Class: Gemi::Command
- Inherits:
-
Object
- Object
- Gemi::Command
- Defined in:
- lib/gemi/commands.rb
Instance Method Summary collapse
- #build(ruby) ⇒ Object
-
#initialize(type, gem_names, yamls) ⇒ Command
constructor
A new instance of Command.
Constructor Details
#initialize(type, gem_names, yamls) ⇒ Command
Returns a new instance of Command.
4 5 6 7 8 9 10 11 |
# File 'lib/gemi/commands.rb', line 4 def initialize(type, gem_names, yamls) @type = type @gems = [ gem_names.map{|s| Gem.new(s)}, yamls.map{|path| Gem.from_yaml(YAML.load_file(path))} ].flatten end |
Instance Method Details
#build(ruby) ⇒ Object
13 14 15 16 17 18 19 20 21 22 |
# File 'lib/gemi/commands.rb', line 13 def build(ruby) if @gems.any?{|gem| gem.version or gem.[@type]} @gems.map{|gem| build_command(gem.to_command(@type), ruby) }.join(" ; ") else gem_names = @gems.map(&:name).join(" ") build_command(gem_names, ruby) end end |