Class: Gemi::Command

Inherits:
Object
  • Object
show all
Defined in:
lib/gemi/commands.rb

Instance Method Summary collapse

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.options[@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