Module: GemHelper::Loader
- Defined in:
- lib/gem_helper/loader.rb
Instance Attribute Summary collapse
-
#root_path ⇒ Object
Returns the value of attribute root_path.
Class Method Summary collapse
- .config(file_path) ⇒ Object
- .configure(definition) ⇒ Object
- .load(file_path = 'geminstaller.yml') ⇒ Object
Instance Attribute Details
#root_path ⇒ Object
Returns the value of attribute root_path.
5 6 7 |
# File 'lib/gem_helper/loader.rb', line 5 def root_path @root_path end |
Class Method Details
.config(file_path) ⇒ Object
7 8 9 |
# File 'lib/gem_helper/loader.rb', line 7 def self.config(file_path) YAML.load_file(File.join(self.root_path, 'config', file_path)) end |
.configure(definition) ⇒ Object
22 23 24 25 |
# File 'lib/gem_helper/loader.rb', line 22 def self.configure(definition) gem definition['name'], definition['version'] require definition['lib'] if definition['lib'] end |
.load(file_path = 'geminstaller.yml') ⇒ Object
11 12 13 14 15 16 17 18 19 20 |
# File 'lib/gem_helper/loader.rb', line 11 def self.load(file_path='geminstaller.yml') gems = [] self.config(file_path)["gems"].each do |definition| if definition['lib'] != false && definition['version'] self.configure definition gems << "#{definition['name']} [#{definition['version'] || "> 0.0"}]" end end p "Loaded: #{gems.join(', ')}" end |