Class: Buildmeister::Launcher

Inherits:
Object
  • Object
show all
Defined in:
lib/buildmeister/base.rb

Class Method Summary collapse

Class Method Details

.exit_appObject



52
53
54
# File 'lib/buildmeister/base.rb', line 52

def self.exit_app
  exit
end

.launch(*args) ⇒ Object



6
7
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
# File 'lib/buildmeister/base.rb', line 6

def self.launch(*args)
  @options = {:mode => :verbose, :compare_branch => 'master'}
        
  OptionParser.new do |opts|
    opts.banner = "Usage: buildmeister notify"
    
    opts.on('-q', '--quiet', 'Quiet') do
      @options[:mode] = :quiet
    end
    
    opts.on('-f', '--from-bin BIN_NAME', 'Move From Bin') do |f|
      @options[:move_from] = f
    end
    
    opts.on('-t', '--to-state STATE', 'Move to State') do |t|
      @options[:to_state] = t
    end
    
    opts.on('-p', '--project PROJECT', 'Use Project') do |p|
      @options[:project] = p
    end
    
    opts.on('-b', '--bin-name BIN', 'Summary Bin Name') do |p|
      @options[:bin_name] = p
    end

    opts.on('-c', '--compare-branch BRANCH', 'Compare From Branch') do |c|
      @options[:compare_branch] = c
    end

    opts.on_tail("-h", "--help", "Show this message") do
      puts opts
      exit_app
    end
    
    if args.empty?
      puts opts
      exit_app
    end
  end.parse!(args)
  
  @options[:command] = args.shift      

  Base.new(@options)
end