Class: GemInstaller::Config
- Inherits:
-
Object
- Object
- GemInstaller::Config
- Defined in:
- lib/geminstaller/config.rb
Instance Method Summary collapse
- #gems ⇒ Object
-
#initialize(yaml) ⇒ Config
constructor
A new instance of Config.
Constructor Details
#initialize(yaml) ⇒ Config
Returns a new instance of Config.
3 4 5 6 |
# File 'lib/geminstaller/config.rb', line 3 def initialize(yaml) @yaml = yaml @default_install_options_string = nil end |
Instance Method Details
#gems ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 |
# File 'lib/geminstaller/config.rb', line 8 def gems parse_defaults gem_defs = @yaml["gems"] gems = [] gem_defs.each do |gem_def| name = gem_def['name'] version = gem_def['version'].to_s platform = gem_def['platform'].to_s # get install_options for specific gem, if specified = gem_def['install_options'].to_s # if no install_options were specified for specific gem, and default install_options were specified... if .empty? && !@default_install_options_string.nil? && !@default_install_options_string.empty? then # then use the default install_options = @default_install_options_string end = [] # if there was an install options string specified, default or gem-specific, parse it to an array = .split(" ") unless .empty? check_for_upgrade = gem_def['check_for_upgrade'] if check_for_upgrade.nil? && defined? @default_check_for_upgrade then check_for_upgrade = @default_check_for_upgrade end fix_dependencies = gem_def['fix_dependencies'] if fix_dependencies.nil? && defined? @default_fix_dependencies then fix_dependencies = @default_fix_dependencies end no_autogem = gem_def['no_autogem'] if no_autogem.nil? && defined? @default_no_autogem then no_autogem = @default_no_autogem end gem = GemInstaller::RubyGem.new( name, :version => version, :platform => platform, :install_options => , :check_for_upgrade => check_for_upgrade, :no_autogem => no_autogem, :fix_dependencies => fix_dependencies) gems << gem end return gems end |