Class: ErpDevSvcs::Commands::SetupDevEnv

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

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeSetupDevEnv

Returns a new instance of SetupDevEnv.



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
# File 'lib/erp_dev_svcs/commands/setup_dev_env.rb', line 12

def initialize
  options = {:engines => nil,
             :create_gemfiles => false,
             :bundle => false}

  opt_parser = OptionParser.new do |opt|
    opt.banner = "Usage: compass_ae-dev test [OPTIONS]"

    opt.on("-g", "--gems [GEMLIST]", Array,
           "List of engines to operate on;"\
           "defaults to all") {|engines| options[:engines] = engines}
    opt.on("-c", "--create-gemfiles", nil,
           "Create Gemfiles in engines from Gemfile") do |x|
             options[:create_gemfiles] = true
           end
    opt.on("-b", "--bundle-engines", nil,
           "Run 'bundle install' in engines") {|x| options[:bundle] = true}
    opt.on_tail("-h", "--help", "Show this message") do
      puts opt
      exit
    end
  end

  opt_parser.parse!

  if options[:create_gemfiles] == false && options[:bundle] == false
    puts opt_parser
    exit
  end

  ErpDevSvcs::Commands::Helper.exec_in_engines(options[:engines]) do |engine_name|
    puts "\nOperating on engine #{engine_name}... \n"
    puts %x[cp Gemfile Gemfile] if options[:create_gemfiles] == true
    puts %x[bundle update] if options[:bundle] == true
    #result = %x[cp Gemfile Gemfile]
    #puts result
  end
end

Class Method Details

.executeObject



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

def self.execute
  new()
end