buildlights 0.0.3 → 0.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/Gemfile +3 -7
- data/Gemfile.lock +22 -0
- data/Rakefile +1 -37
- data/bin/buildlights +0 -0
- data/buildlights.gemspec +18 -63
- data/lib/buildlights.rb +5 -37
- data/lib/{ccnet.rb → buildlights/ccnet.rb} +2 -2
- data/lib/buildlights/cli.rb +35 -0
- data/lib/{hudson.rb → buildlights/hudson.rb} +1 -1
- data/lib/{lights.rb → buildlights/lights.rb} +4 -4
- data/lib/buildlights/version.rb +5 -0
- data/spec/lib/hudson_spec.rb +9 -3
- metadata +31 -45
- data/VERSION +0 -1
data/Gemfile
CHANGED
data/Gemfile.lock
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
buildlights (0.0.3)
|
5
|
+
hpricot (~> 0.8)
|
6
|
+
simple-rss (~> 1.2)
|
7
|
+
|
8
|
+
GEM
|
9
|
+
remote: http://rubygems.org/
|
10
|
+
specs:
|
11
|
+
hpricot (0.8.4)
|
12
|
+
rake (0.9.0)
|
13
|
+
rspec (1.3.2)
|
14
|
+
simple-rss (1.2.3)
|
15
|
+
|
16
|
+
PLATFORMS
|
17
|
+
ruby
|
18
|
+
|
19
|
+
DEPENDENCIES
|
20
|
+
buildlights!
|
21
|
+
rake
|
22
|
+
rspec (~> 1.3)
|
data/Rakefile
CHANGED
@@ -1,47 +1,11 @@
|
|
1
|
-
require '
|
1
|
+
require 'bundler'
|
2
2
|
require 'rake'
|
3
3
|
|
4
|
-
begin
|
5
|
-
require 'jeweler'
|
6
|
-
Jeweler::Tasks.new do |gem|
|
7
|
-
gem.name = "buildlights"
|
8
|
-
gem.executables = "buildlights"
|
9
|
-
gem.summary = %Q{build monitor that will trigger lights via x10}
|
10
|
-
gem.email = "darrinholst@gmail.com"
|
11
|
-
gem.homepage = "http://github.com/darrinholst/buildlights"
|
12
|
-
gem.authors = ["Darrin Holst"]
|
13
|
-
gem.rubyforge_project = "buildlights"
|
14
|
-
gem.add_development_dependency "rspec", ">= 1.2.9"
|
15
|
-
gem.add_dependency "simple-rss", ">= 1.2"
|
16
|
-
gem.add_dependency "hpricot", ">= 0.8.1"
|
17
|
-
end
|
18
|
-
|
19
|
-
Jeweler::GemcutterTasks.new
|
20
|
-
rescue LoadError
|
21
|
-
puts "Jeweler (or a dependency) not available. Install it with: sudo gem install jeweler"
|
22
|
-
end
|
23
|
-
|
24
4
|
require 'spec/rake/spectask'
|
25
5
|
Spec::Rake::SpecTask.new(:spec) do |spec|
|
26
6
|
spec.libs << 'lib' << 'spec'
|
27
7
|
spec.spec_files = FileList['spec/**/*_spec.rb']
|
28
8
|
end
|
29
9
|
|
30
|
-
Spec::Rake::SpecTask.new(:rcov) do |spec|
|
31
|
-
spec.libs << 'lib' << 'spec'
|
32
|
-
spec.pattern = 'spec/**/*_spec.rb'
|
33
|
-
spec.rcov = true
|
34
|
-
end
|
35
|
-
|
36
10
|
task :default => :spec
|
37
11
|
|
38
|
-
require 'rake/rdoctask'
|
39
|
-
Rake::RDocTask.new do |rdoc|
|
40
|
-
version = File.exist?('VERSION') ? File.read('VERSION') : ""
|
41
|
-
|
42
|
-
rdoc.rdoc_dir = 'rdoc'
|
43
|
-
rdoc.title = "foo #{version}"
|
44
|
-
rdoc.rdoc_files.include('README*')
|
45
|
-
rdoc.rdoc_files.include('lib/**/*.rb')
|
46
|
-
end
|
47
|
-
|
data/bin/buildlights
CHANGED
File without changes
|
data/buildlights.gemspec
CHANGED
@@ -1,71 +1,26 @@
|
|
1
|
-
# Generated by jeweler
|
2
|
-
# DO NOT EDIT THIS FILE DIRECTLY
|
3
|
-
# Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
|
4
1
|
# -*- encoding: utf-8 -*-
|
2
|
+
$:.push File.expand_path("../lib", __FILE__)
|
3
|
+
require 'buildlights/version'
|
5
4
|
|
6
5
|
Gem::Specification.new do |s|
|
7
|
-
s.name
|
8
|
-
s.version
|
6
|
+
s.name = "buildlights"
|
7
|
+
s.version = BuildLights::VERSION
|
8
|
+
s.platform = Gem::Platform::RUBY
|
9
|
+
s.authors = ["Darrin Holst"]
|
10
|
+
s.email = ["darrinholst@gmail.com"]
|
11
|
+
s.homepage = "http://github.com/darrinholst/buildlights"
|
12
|
+
s.summary = "build monitor that will trigger lights via x10"
|
13
|
+
s.description = "build monitor that will trigger lights via x10"
|
9
14
|
|
10
|
-
s.
|
11
|
-
s.authors = ["Darrin Holst"]
|
12
|
-
s.date = %q{2010-04-16}
|
13
|
-
s.default_executable = %q{buildlights}
|
14
|
-
s.email = %q{darrinholst@gmail.com}
|
15
|
-
s.executables = ["buildlights"]
|
16
|
-
s.extra_rdoc_files = [
|
17
|
-
"LICENSE",
|
18
|
-
"README.rdoc"
|
19
|
-
]
|
20
|
-
s.files = [
|
21
|
-
".document",
|
22
|
-
".gitignore",
|
23
|
-
"Gemfile",
|
24
|
-
"LICENSE",
|
25
|
-
"README.rdoc",
|
26
|
-
"Rakefile",
|
27
|
-
"VERSION",
|
28
|
-
"bin/buildlights",
|
29
|
-
"buildlights.gemspec",
|
30
|
-
"lib/buildlights.rb",
|
31
|
-
"lib/ccnet.rb",
|
32
|
-
"lib/hudson.rb",
|
33
|
-
"lib/lights.rb",
|
34
|
-
"spec/lib/ccnet_spec.rb",
|
35
|
-
"spec/lib/hudson_spec.rb",
|
36
|
-
"spec/lib/lights_spec.rb",
|
37
|
-
"spec/spec_helper.rb"
|
38
|
-
]
|
39
|
-
s.homepage = %q{http://github.com/darrinholst/buildlights}
|
40
|
-
s.rdoc_options = ["--charset=UTF-8"]
|
41
|
-
s.require_paths = ["lib"]
|
42
|
-
s.rubyforge_project = %q{buildlights}
|
43
|
-
s.rubygems_version = %q{1.3.6}
|
44
|
-
s.summary = %q{build monitor that will trigger lights via x10}
|
45
|
-
s.test_files = [
|
46
|
-
"spec/lib/ccnet_spec.rb",
|
47
|
-
"spec/lib/hudson_spec.rb",
|
48
|
-
"spec/lib/lights_spec.rb",
|
49
|
-
"spec/spec_helper.rb"
|
50
|
-
]
|
15
|
+
s.rubyforge_project = "buildlights"
|
51
16
|
|
52
|
-
|
53
|
-
|
54
|
-
|
17
|
+
s.files = `git ls-files`.split("\n")
|
18
|
+
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
19
|
+
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
20
|
+
s.require_paths = ["lib"]
|
55
21
|
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
s.add_runtime_dependency(%q<hpricot>, [">= 0.8.1"])
|
60
|
-
else
|
61
|
-
s.add_dependency(%q<rspec>, [">= 1.2.9"])
|
62
|
-
s.add_dependency(%q<simple-rss>, [">= 1.2"])
|
63
|
-
s.add_dependency(%q<hpricot>, [">= 0.8.1"])
|
64
|
-
end
|
65
|
-
else
|
66
|
-
s.add_dependency(%q<rspec>, [">= 1.2.9"])
|
67
|
-
s.add_dependency(%q<simple-rss>, [">= 1.2"])
|
68
|
-
s.add_dependency(%q<hpricot>, [">= 0.8.1"])
|
69
|
-
end
|
22
|
+
s.add_dependency "hpricot", "~> 0.8"
|
23
|
+
s.add_dependency "simple-rss", "~> 1.2"
|
24
|
+
s.add_development_dependency "rspec", "~> 1.3"
|
70
25
|
end
|
71
26
|
|
data/lib/buildlights.rb
CHANGED
@@ -1,38 +1,6 @@
|
|
1
|
-
require '
|
2
|
-
require 'ccnet'
|
3
|
-
require 'hudson'
|
4
|
-
require 'lights'
|
1
|
+
require 'buildlights/version'
|
2
|
+
require 'buildlights/ccnet'
|
3
|
+
require 'buildlights/hudson'
|
4
|
+
require 'buildlights/lights'
|
5
|
+
require 'buildlights/cli'
|
5
6
|
|
6
|
-
module BuildLights
|
7
|
-
extend self
|
8
|
-
|
9
|
-
def cli(args)
|
10
|
-
urls = []
|
11
|
-
|
12
|
-
OptionParser.new do |opts|
|
13
|
-
opts.banner = "Usage: buildlights [options]"
|
14
|
-
|
15
|
-
opts.on("-v", "--[no-]verbose", "Run verbosely") do |v|
|
16
|
-
$verbose = true
|
17
|
-
end
|
18
|
-
|
19
|
-
opts.on("--hudson [URL]", "Hudson url") do |url|
|
20
|
-
urls << [Hudson, url]
|
21
|
-
end
|
22
|
-
|
23
|
-
opts.on("--ccnet [URL]", "CruiseControl.net url") do |url|
|
24
|
-
urls << [CcNet, url]
|
25
|
-
end
|
26
|
-
end.parse!
|
27
|
-
|
28
|
-
raise "must supply at least one url to check" if urls.empty?
|
29
|
-
|
30
|
-
failed_jobs = []
|
31
|
-
|
32
|
-
urls.each do |url|
|
33
|
-
failed_jobs << url.first.new(url.last).failed_jobs
|
34
|
-
end
|
35
|
-
|
36
|
-
Lights.new.send(failed_jobs.flatten.empty? ? :success : :failed)
|
37
|
-
end
|
38
|
-
end
|
@@ -7,7 +7,7 @@ module BuildLights
|
|
7
7
|
puts "CruiseControl.net url: #{uri}" if $verbose
|
8
8
|
@doc = parser.parse(uri)
|
9
9
|
end
|
10
|
-
|
10
|
+
|
11
11
|
def failed_jobs
|
12
12
|
@doc.search(:Project).map do |project|
|
13
13
|
name = project[:name]
|
@@ -18,7 +18,7 @@ module BuildLights
|
|
18
18
|
end.compact
|
19
19
|
end
|
20
20
|
end
|
21
|
-
|
21
|
+
|
22
22
|
class XmlParser
|
23
23
|
def self.parse(uri)
|
24
24
|
Hpricot::XML(open(uri))
|
@@ -0,0 +1,35 @@
|
|
1
|
+
require 'optparse'
|
2
|
+
|
3
|
+
module BuildLights
|
4
|
+
extend self
|
5
|
+
|
6
|
+
def cli(args)
|
7
|
+
urls = []
|
8
|
+
|
9
|
+
OptionParser.new do |opts|
|
10
|
+
opts.banner = "Usage: buildlights [options]"
|
11
|
+
|
12
|
+
opts.on("-v", "--[no-]verbose", "Run verbosely") do |v|
|
13
|
+
$verbose = true
|
14
|
+
end
|
15
|
+
|
16
|
+
opts.on("--hudson [URL]", "Hudson url") do |url|
|
17
|
+
urls << [Hudson, url]
|
18
|
+
end
|
19
|
+
|
20
|
+
opts.on("--ccnet [URL]", "CruiseControl.net url") do |url|
|
21
|
+
urls << [CcNet, url]
|
22
|
+
end
|
23
|
+
end.parse!
|
24
|
+
|
25
|
+
raise "must supply at least one url to check" if urls.empty?
|
26
|
+
|
27
|
+
failed_jobs = []
|
28
|
+
|
29
|
+
urls.each do |url|
|
30
|
+
failed_jobs << url.first.new(url.last).failed_jobs
|
31
|
+
end
|
32
|
+
|
33
|
+
Lights.new.send(failed_jobs.flatten.empty? ? :success : :failed)
|
34
|
+
end
|
35
|
+
end
|
@@ -6,18 +6,18 @@ module BuildLights
|
|
6
6
|
def initialize(implementation = BottleRocket)
|
7
7
|
@implementation = implementation
|
8
8
|
end
|
9
|
-
|
9
|
+
|
10
10
|
def success
|
11
11
|
@implementation.turn_on GREEN
|
12
12
|
@implementation.turn_off RED
|
13
13
|
end
|
14
|
-
|
14
|
+
|
15
15
|
def failed
|
16
16
|
@implementation.turn_on RED
|
17
17
|
@implementation.turn_off GREEN
|
18
18
|
end
|
19
19
|
end
|
20
|
-
|
20
|
+
|
21
21
|
class BottleRocket
|
22
22
|
def self.turn_on(unit, house='A')
|
23
23
|
send('on', unit, house)
|
@@ -35,5 +35,5 @@ module BuildLights
|
|
35
35
|
system cmd
|
36
36
|
raise "bottlerocket command failed with status code #{$?.exitstatus}" if $?.exitstatus > 0
|
37
37
|
end
|
38
|
-
end
|
38
|
+
end
|
39
39
|
end
|
data/spec/lib/hudson_spec.rb
CHANGED
@@ -6,23 +6,29 @@ describe BuildLights::Hudson do
|
|
6
6
|
scanner = BuildLights::Hudson.new(URI, parser)
|
7
7
|
scanner.failed_jobs.should == []
|
8
8
|
end
|
9
|
-
|
9
|
+
|
10
10
|
it "should return all failed jobs" do
|
11
11
|
parser = feed_parser_for(URI, "job 1 #1 (FAILED)", "job 2 #1 (FAILED)", "job 3 #1 (SUCCESS)")
|
12
12
|
scanner = BuildLights::Hudson.new(URI, parser)
|
13
13
|
scanner.failed_jobs.should == ["job 1", "job 2"]
|
14
14
|
end
|
15
|
-
|
15
|
+
|
16
16
|
it "should return just the latest failed jobs" do
|
17
17
|
parser = feed_parser_for(URI, "job 1 #1 (FAILED)", "job 2 #2 (SUCCESS)", "job 2 #1 (FAILED)")
|
18
18
|
scanner = BuildLights::Hudson.new(URI, parser)
|
19
19
|
scanner.failed_jobs.should == ["job 1"]
|
20
20
|
end
|
21
21
|
|
22
|
+
it "should handle other failure messages" do
|
23
|
+
parser = feed_parser_for(URI, "job 1 #1 (broken)", "job 2 #1 (brokern since foo)", "job 3 #1 (1 test failing)")
|
24
|
+
scanner = BuildLights::Hudson.new(URI, parser)
|
25
|
+
scanner.failed_jobs.should == ["job 1", "job 2", "job 3"]
|
26
|
+
end
|
27
|
+
|
22
28
|
def feed_parser_for(uri, *titles)
|
23
29
|
entries = stub(:entries => titles.map {|t| stub(:title => t)})
|
24
30
|
parser = mock
|
25
31
|
parser.should_receive(:parse).with(uri).and_return(entries)
|
26
32
|
parser
|
27
33
|
end
|
28
|
-
end
|
34
|
+
end
|
metadata
CHANGED
@@ -1,12 +1,8 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: buildlights
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
prerelease:
|
5
|
-
|
6
|
-
- 0
|
7
|
-
- 0
|
8
|
-
- 3
|
9
|
-
version: 0.0.3
|
4
|
+
prerelease:
|
5
|
+
version: 0.0.4
|
10
6
|
platform: ruby
|
11
7
|
authors:
|
12
8
|
- Darrin Holst
|
@@ -14,104 +10,94 @@ autorequire:
|
|
14
10
|
bindir: bin
|
15
11
|
cert_chain: []
|
16
12
|
|
17
|
-
date:
|
18
|
-
default_executable: buildlights
|
13
|
+
date: 2011-07-08 00:00:00 Z
|
19
14
|
dependencies:
|
20
15
|
- !ruby/object:Gem::Dependency
|
21
|
-
name:
|
16
|
+
name: hpricot
|
22
17
|
prerelease: false
|
23
18
|
requirement: &id001 !ruby/object:Gem::Requirement
|
19
|
+
none: false
|
24
20
|
requirements:
|
25
|
-
- -
|
21
|
+
- - ~>
|
26
22
|
- !ruby/object:Gem::Version
|
27
|
-
|
28
|
-
|
29
|
-
- 2
|
30
|
-
- 9
|
31
|
-
version: 1.2.9
|
32
|
-
type: :development
|
23
|
+
version: "0.8"
|
24
|
+
type: :runtime
|
33
25
|
version_requirements: *id001
|
34
26
|
- !ruby/object:Gem::Dependency
|
35
27
|
name: simple-rss
|
36
28
|
prerelease: false
|
37
29
|
requirement: &id002 !ruby/object:Gem::Requirement
|
30
|
+
none: false
|
38
31
|
requirements:
|
39
|
-
- -
|
32
|
+
- - ~>
|
40
33
|
- !ruby/object:Gem::Version
|
41
|
-
segments:
|
42
|
-
- 1
|
43
|
-
- 2
|
44
34
|
version: "1.2"
|
45
35
|
type: :runtime
|
46
36
|
version_requirements: *id002
|
47
37
|
- !ruby/object:Gem::Dependency
|
48
|
-
name:
|
38
|
+
name: rspec
|
49
39
|
prerelease: false
|
50
40
|
requirement: &id003 !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
51
42
|
requirements:
|
52
|
-
- -
|
43
|
+
- - ~>
|
53
44
|
- !ruby/object:Gem::Version
|
54
|
-
|
55
|
-
|
56
|
-
- 8
|
57
|
-
- 1
|
58
|
-
version: 0.8.1
|
59
|
-
type: :runtime
|
45
|
+
version: "1.3"
|
46
|
+
type: :development
|
60
47
|
version_requirements: *id003
|
61
|
-
description:
|
62
|
-
email:
|
48
|
+
description: build monitor that will trigger lights via x10
|
49
|
+
email:
|
50
|
+
- darrinholst@gmail.com
|
63
51
|
executables:
|
64
52
|
- buildlights
|
65
53
|
extensions: []
|
66
54
|
|
67
|
-
extra_rdoc_files:
|
68
|
-
|
69
|
-
- README.rdoc
|
55
|
+
extra_rdoc_files: []
|
56
|
+
|
70
57
|
files:
|
71
58
|
- .document
|
72
59
|
- .gitignore
|
73
60
|
- Gemfile
|
61
|
+
- Gemfile.lock
|
74
62
|
- LICENSE
|
75
63
|
- README.rdoc
|
76
64
|
- Rakefile
|
77
|
-
- VERSION
|
78
65
|
- bin/buildlights
|
79
66
|
- buildlights.gemspec
|
80
67
|
- lib/buildlights.rb
|
81
|
-
- lib/ccnet.rb
|
82
|
-
- lib/
|
83
|
-
- lib/
|
68
|
+
- lib/buildlights/ccnet.rb
|
69
|
+
- lib/buildlights/cli.rb
|
70
|
+
- lib/buildlights/hudson.rb
|
71
|
+
- lib/buildlights/lights.rb
|
72
|
+
- lib/buildlights/version.rb
|
84
73
|
- spec/lib/ccnet_spec.rb
|
85
74
|
- spec/lib/hudson_spec.rb
|
86
75
|
- spec/lib/lights_spec.rb
|
87
76
|
- spec/spec_helper.rb
|
88
|
-
has_rdoc: true
|
89
77
|
homepage: http://github.com/darrinholst/buildlights
|
90
78
|
licenses: []
|
91
79
|
|
92
80
|
post_install_message:
|
93
|
-
rdoc_options:
|
94
|
-
|
81
|
+
rdoc_options: []
|
82
|
+
|
95
83
|
require_paths:
|
96
84
|
- lib
|
97
85
|
required_ruby_version: !ruby/object:Gem::Requirement
|
86
|
+
none: false
|
98
87
|
requirements:
|
99
88
|
- - ">="
|
100
89
|
- !ruby/object:Gem::Version
|
101
|
-
segments:
|
102
|
-
- 0
|
103
90
|
version: "0"
|
104
91
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
92
|
+
none: false
|
105
93
|
requirements:
|
106
94
|
- - ">="
|
107
95
|
- !ruby/object:Gem::Version
|
108
|
-
segments:
|
109
|
-
- 0
|
110
96
|
version: "0"
|
111
97
|
requirements: []
|
112
98
|
|
113
99
|
rubyforge_project: buildlights
|
114
|
-
rubygems_version: 1.
|
100
|
+
rubygems_version: 1.8.4
|
115
101
|
signing_key:
|
116
102
|
specification_version: 3
|
117
103
|
summary: build monitor that will trigger lights via x10
|
data/VERSION
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
0.0.3
|