Module: MPM::Utility
- Defined in:
- lib/mpm.rb
Overview
MODULE->UTILITY ——————————
Class Method Summary collapse
- .get_os ⇒ Object
- .get_pm_executable ⇒ Object
-
.glob_in_pwd(*path_suffixes) ⇒ Object
——————————————– FILE-LOADING ——————————- ——————————————–.
- .instance_eval_from_glob_in_pwd(instance, *path_suffixes) ⇒ Object
- .load_from_glob_in_pwd(*path_suffixes) ⇒ Object
Class Method Details
.get_os ⇒ Object
71 72 73 |
# File 'lib/mpm.rb', line 71 def self.get_os() OS.to_sym end |
.get_pm_executable ⇒ Object
75 76 77 78 79 80 81 82 83 84 |
# File 'lib/mpm.rb', line 75 def self.get_pm_executable() case get_os when :linux # FIX: Detect distro... "apt-get" when :osx, :macos # FIX: Ensure brew, etc. "brew" end end |
.glob_in_pwd(*path_suffixes) ⇒ Object
FILE-LOADING ——————————-
89 90 91 |
# File 'lib/mpm.rb', line 89 def self.glob_in_pwd(*path_suffixes) Dir.glob(File.(File.join(File.dirname(__FILE__), *path_suffixes))) end |
.instance_eval_from_glob_in_pwd(instance, *path_suffixes) ⇒ Object
99 100 101 102 103 |
# File 'lib/mpm.rb', line 99 def self.instance_eval_from_glob_in_pwd(instance, *path_suffixes) glob_in_pwd(*path_suffixes).each do |file| instance.instance_eval File.read(file) end end |
.load_from_glob_in_pwd(*path_suffixes) ⇒ Object
93 94 95 96 97 |
# File 'lib/mpm.rb', line 93 def self.load_from_glob_in_pwd(*path_suffixes) glob_in_pwd(*path_suffixes).each do |file| load file end end |