Module: BuildLights

Extended by:
BuildLights
Included in:
BuildLights
Defined in:
lib/ccnet.rb,
lib/hudson.rb,
lib/lights.rb,
lib/buildlights.rb

Defined Under Namespace

Classes: BottleRocket, CcNet, FeedParser, Hudson, Lights, XmlParser

Instance Method Summary collapse

Instance Method Details

#cli(args) ⇒ Object



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
# File 'lib/buildlights.rb', line 9

def cli(args)
  urls = []
  
  OptionParser.new do |opts|
    opts.banner = "Usage: buildlights [options]"

    opts.on("-v", "--[no-]verbose", "Run verbosely") do |v|
      $verbose = true
    end

    opts.on("--hudson [URL]", "Hudson url") do |url|
      urls << [Hudson, url]
    end

    opts.on("--ccnet [URL]", "CruiseControl.net url") do |url|
      urls << [CcNet, url]
    end
  end.parse!
  
  raise "must supply at least one url to check" if urls.empty?
  
  failed_jobs = []
  
  urls.each do |url|
    failed_jobs << url.first.new(url.last).failed_jobs
  end
  
  Lights.new.send(failed_jobs.flatten.empty? ? :success : :failed)
end