Module: MPM::Utility

Defined in:
lib/mpm.rb

Overview


MODULE->UTILITY ——————————


Class Method Summary collapse

Class Method Details

.get_osObject



71
72
73
# File 'lib/mpm.rb', line 71

def self.get_os()
  OS.to_sym
end

.get_pm_executableObject



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.expand_path(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