cruisestatus 1.0.0 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/README.rdoc +17 -5
- data/VERSION +1 -1
- data/bin/cruisestatus +2 -3
- data/cruisestatus.gemspec +61 -0
- data/lib/cruisestatus.rb +44 -0
- data/spec/{cruise_status_spec.rb → cruisestatus_spec.rb} +0 -0
- data/spec/spec_helper.rb +1 -1
- metadata +5 -4
- data/lib/cruise_status.rb +0 -25
data/README.rdoc
CHANGED
@@ -1,6 +1,17 @@
|
|
1
|
-
=
|
1
|
+
= Cruise Status
|
2
2
|
|
3
|
-
|
3
|
+
CruiseStatus allows your Ruby scripts to check the status of your project's
|
4
|
+
build. Use this to abort check-ins when the build has failed, for example.
|
5
|
+
|
6
|
+
== Example:
|
7
|
+
|
8
|
+
require "cruisestatus"
|
9
|
+
|
10
|
+
if CruiseStatus.new( 'http://my.cruise.com/projects.rss' ).pass?
|
11
|
+
puts "Build passed!"
|
12
|
+
else
|
13
|
+
abort "Build failed…Boo!"
|
14
|
+
end
|
4
15
|
|
5
16
|
== Note on Patches/Pull Requests
|
6
17
|
|
@@ -9,9 +20,10 @@ Description goes here.
|
|
9
20
|
* Add tests for it. This is important so I don't break it in a
|
10
21
|
future version unintentionally.
|
11
22
|
* Commit, do not mess with rakefile, version, or history.
|
12
|
-
(if you want to have your own version, that is fine but bump version in a
|
13
|
-
|
23
|
+
(if you want to have your own version, that is fine but bump version in a
|
24
|
+
commit by itself I can ignore when I pull)
|
25
|
+
* Send me a pull request.
|
14
26
|
|
15
27
|
== Copyright
|
16
28
|
|
17
|
-
Copyright (c) 2010 Toby. See LICENSE for details.
|
29
|
+
Copyright (c) 2010 Toby Tripp. See LICENSE for details.
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.
|
1
|
+
1.1.0
|
data/bin/cruisestatus
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
#!/usr/bin/env ruby -wKU
|
2
2
|
$LOAD_PATH.unshift File.join(File.dirname(__FILE__), '..', 'lib')
|
3
|
-
require "
|
3
|
+
require "cruisestatus"
|
4
4
|
|
5
5
|
unless ARGV.size == 1
|
6
6
|
$stderr.puts <<-EOS
|
@@ -18,8 +18,7 @@ end
|
|
18
18
|
status = CruiseStatus.new ARGV.first
|
19
19
|
|
20
20
|
unless status.pass?
|
21
|
-
|
22
|
-
exit 1
|
21
|
+
abort "FAIL: #{status.failures.join( ', ' )}"
|
23
22
|
else
|
24
23
|
puts "OK"
|
25
24
|
exit 0
|
@@ -0,0 +1,61 @@
|
|
1
|
+
# Generated by jeweler
|
2
|
+
# DO NOT EDIT THIS FILE DIRECTLY
|
3
|
+
# Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
|
4
|
+
# -*- encoding: utf-8 -*-
|
5
|
+
|
6
|
+
Gem::Specification.new do |s|
|
7
|
+
s.name = %q{cruisestatus}
|
8
|
+
s.version = "1.1.0"
|
9
|
+
|
10
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
|
+
s.authors = ["Toby Tripp"]
|
12
|
+
s.date = %q{2010-01-23}
|
13
|
+
s.default_executable = %q{cruisestatus}
|
14
|
+
s.description = %q{Allows scripts and applications to check the status of your project's build.}
|
15
|
+
s.email = %q{toby.tripp+git@gmail.com}
|
16
|
+
s.executables = ["cruisestatus"]
|
17
|
+
s.extra_rdoc_files = [
|
18
|
+
"LICENSE",
|
19
|
+
"README.rdoc"
|
20
|
+
]
|
21
|
+
s.files = [
|
22
|
+
".document",
|
23
|
+
".gitignore",
|
24
|
+
"LICENSE",
|
25
|
+
"README.rdoc",
|
26
|
+
"Rakefile",
|
27
|
+
"VERSION",
|
28
|
+
"bin/cruisestatus",
|
29
|
+
"cruisestatus.gemspec",
|
30
|
+
"lib/cruisestatus.rb",
|
31
|
+
"spec/cruisestatus_spec.rb",
|
32
|
+
"spec/spec.opts",
|
33
|
+
"spec/spec_helper.rb"
|
34
|
+
]
|
35
|
+
s.homepage = %q{http://github.com/tobytripp/cruisestatus}
|
36
|
+
s.rdoc_options = ["--charset=UTF-8"]
|
37
|
+
s.require_paths = ["lib"]
|
38
|
+
s.rubygems_version = %q{1.3.5}
|
39
|
+
s.summary = %q{Check the build status on a cruise.rb server}
|
40
|
+
s.test_files = [
|
41
|
+
"spec/cruisestatus_spec.rb",
|
42
|
+
"spec/spec_helper.rb"
|
43
|
+
]
|
44
|
+
|
45
|
+
if s.respond_to? :specification_version then
|
46
|
+
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
47
|
+
s.specification_version = 3
|
48
|
+
|
49
|
+
if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
|
50
|
+
s.add_development_dependency(%q<rspec>, [">= 1.2.9"])
|
51
|
+
s.add_development_dependency(%q<rr>, [">= 0.10.5"])
|
52
|
+
else
|
53
|
+
s.add_dependency(%q<rspec>, [">= 1.2.9"])
|
54
|
+
s.add_dependency(%q<rr>, [">= 0.10.5"])
|
55
|
+
end
|
56
|
+
else
|
57
|
+
s.add_dependency(%q<rspec>, [">= 1.2.9"])
|
58
|
+
s.add_dependency(%q<rr>, [">= 0.10.5"])
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
data/lib/cruisestatus.rb
ADDED
@@ -0,0 +1,44 @@
|
|
1
|
+
require 'rexml/document'
|
2
|
+
require "open-uri"
|
3
|
+
|
4
|
+
# Checks the status of one or more project builds on a cruisecontrol.rb
|
5
|
+
# server.
|
6
|
+
#
|
7
|
+
# == Example:
|
8
|
+
#
|
9
|
+
# if CruiseStatus.new( 'http://my.cruise.com/projects.rss' ).pass?
|
10
|
+
# puts "Build passed!"
|
11
|
+
# else
|
12
|
+
# puts "Build failed…Boo!"
|
13
|
+
# end
|
14
|
+
#
|
15
|
+
class CruiseStatus
|
16
|
+
|
17
|
+
# feed_url:: URL pointing to a cruise.rb RSS feed.
|
18
|
+
# Example: http://my.cruise.com/projects.rss
|
19
|
+
# or: http://my.cruise.com/projects/myproject.rss
|
20
|
+
#
|
21
|
+
def initialize( feed_url )
|
22
|
+
project_feed = Kernel.open( feed_url ).read
|
23
|
+
@doc = REXML::Document.new project_feed
|
24
|
+
rescue Exception => e
|
25
|
+
@failures = [e.message]
|
26
|
+
@doc = REXML::Document.new ""
|
27
|
+
end
|
28
|
+
|
29
|
+
# True if all builds described by the feed are passing.
|
30
|
+
#
|
31
|
+
def pass?
|
32
|
+
failures.empty?
|
33
|
+
end
|
34
|
+
|
35
|
+
# A list of failing builds. Empty if all builds passed.
|
36
|
+
#
|
37
|
+
def failures
|
38
|
+
@failures ||= REXML::XPath.match( @doc, "//item/title" ).select { |element|
|
39
|
+
element.text =~ /failed$/
|
40
|
+
}.map do |element|
|
41
|
+
element.text.gsub( /(.*) build (.+) failed$/, '\1' )
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
File without changes
|
data/spec/spec_helper.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cruisestatus
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Toby Tripp
|
@@ -49,8 +49,9 @@ files:
|
|
49
49
|
- Rakefile
|
50
50
|
- VERSION
|
51
51
|
- bin/cruisestatus
|
52
|
-
-
|
53
|
-
-
|
52
|
+
- cruisestatus.gemspec
|
53
|
+
- lib/cruisestatus.rb
|
54
|
+
- spec/cruisestatus_spec.rb
|
54
55
|
- spec/spec.opts
|
55
56
|
- spec/spec_helper.rb
|
56
57
|
has_rdoc: true
|
@@ -82,5 +83,5 @@ signing_key:
|
|
82
83
|
specification_version: 3
|
83
84
|
summary: Check the build status on a cruise.rb server
|
84
85
|
test_files:
|
85
|
-
- spec/
|
86
|
+
- spec/cruisestatus_spec.rb
|
86
87
|
- spec/spec_helper.rb
|
data/lib/cruise_status.rb
DELETED
@@ -1,25 +0,0 @@
|
|
1
|
-
require 'rexml/document'
|
2
|
-
require "open-uri"
|
3
|
-
|
4
|
-
class CruiseStatus
|
5
|
-
|
6
|
-
def initialize( feed_url )
|
7
|
-
project_feed = Kernel.open( feed_url ).read
|
8
|
-
@doc = REXML::Document.new project_feed
|
9
|
-
rescue Exception => e
|
10
|
-
@failures = [e.message]
|
11
|
-
@doc = REXML::Document.new ""
|
12
|
-
end
|
13
|
-
|
14
|
-
def pass?
|
15
|
-
failures.empty?
|
16
|
-
end
|
17
|
-
|
18
|
-
def failures
|
19
|
-
@failures ||= REXML::XPath.match( @doc, "//item/title" ).select { |element|
|
20
|
-
element.text =~ /failed$/
|
21
|
-
}.map do |element|
|
22
|
-
element.text.gsub( /(.*) build (.+) failed$/, '\1' )
|
23
|
-
end
|
24
|
-
end
|
25
|
-
end
|