Class: ErpDevSvcs::Commands::PushGems

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

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initializePushGems

Returns a new instance of PushGems.



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
56
57
58
59
60
# File 'lib/erp_dev_svcs/commands/push_gems.rb', line 12

def initialize
  options = {}

  optparse = OptionParser.new do|opts|
    opts.banner = "Usage: compass_ae-dev push_gems [options]"

    options[:verbose] = false
    opts.on('-v', '--verbose', 'Output more information') do
      options[:verbose] = true
    end

    options[:ruby_gems] = false
    opts.on('-r', '--ruby_gems', 'push to ruby gems') do
      options[:ruby_gems] = true
    end

    options[:geminabox] = true
    opts.on('-b', '--geminabox', 'push to geminabox') do
      options[:geminabox] = true
      options[:ruby_gems] = false
    end

    opts.on("-g", "--gems [GEMLIST]", Array,
           "List of engines to operate on;"\
           "defaults to all") {|engines| options[:engines] = engines}

    opts.on_tail("-h", "--help", "Show this message") do
      puts opts
      exit
    end
  end

  optparse.parse!

  ErpDevSvcs::Commands::Helper.exec_in_engines(options[:gems]) do |engine_name|
    gem_file = Dir.glob("*.gem")[0]

    if options[:ruby_gems]
      result = %x[gem push #{gem_file}]
      puts result if options[:verbose]
    end

    if options[:geminabox]
      result = %x[gem inabox #{gem_file}]
      puts result if options[:verbose]
    end
  end

end

Class Method Details

.executeObject



8
9
10
# File 'lib/erp_dev_svcs/commands/push_gems.rb', line 8

def self.execute
  new()
end