libcruisecontrol 0.1.1

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.
@@ -0,0 +1,30 @@
1
+ require 'active_support'
2
+ require 'project_proxy'
3
+
4
+ class CruiseControlServer
5
+ attr_reader :projects
6
+
7
+ def initialize(host, port = 80)
8
+ @host, @port = host, port
9
+ @projects = []
10
+ refresh
11
+ end
12
+
13
+ # Retrieve the projects' newest status from the server
14
+ def refresh
15
+ @projects.replace parse_projects_from_xml(Net::HTTP.get @host, '/dashboard/rss.xml', @port)
16
+ end
17
+
18
+ # Returns true if all projects from this server passes
19
+ def pass?
20
+ projects.all? {|p| p.pass?}
21
+ end
22
+
23
+ private
24
+
25
+ def parse_projects_from_xml(xml)
26
+ @projects = Hash.from_xml(xml)['rss']['channel']['item']
27
+ @projects = [@projects] unless @projects.class == Array
28
+ @projects.map!{|p| ProjectProxy.new p}
29
+ end
30
+ end
@@ -0,0 +1 @@
1
+ require 'cruise_control_server'
@@ -0,0 +1,12 @@
1
+ require 'delegate'
2
+
3
+ class ProjectProxy < DelegateClass(Hash)
4
+ def initialize(hash = {})
5
+ super(hash)
6
+ end
7
+
8
+ # Returns true if the current build of this project was successfull
9
+ def pass?
10
+ self['description'] == 'Build passed'
11
+ end
12
+ end
metadata ADDED
@@ -0,0 +1,69 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: libcruisecontrol
3
+ version: !ruby/object:Gem::Version
4
+ hash: 25
5
+ prerelease: false
6
+ segments:
7
+ - 0
8
+ - 1
9
+ - 1
10
+ version: 0.1.1
11
+ platform: ruby
12
+ authors:
13
+ - Jonas Alves
14
+ autorequire:
15
+ bindir: bin
16
+ cert_chain: []
17
+
18
+ date: 2010-06-27 00:00:00 -03:00
19
+ default_executable:
20
+ dependencies: []
21
+
22
+ description: libcruisecontrol is a library to interact with Cruise Control continuous integration tool
23
+ email: jonasfa@gmail.com
24
+ executables: []
25
+
26
+ extensions: []
27
+
28
+ extra_rdoc_files: []
29
+
30
+ files:
31
+ - lib/libcruisecontrol.rb
32
+ - lib/cruise_control_server.rb
33
+ - lib/project_proxy.rb
34
+ has_rdoc: true
35
+ homepage: http://github.com/jonasfa/libcruisecontrol
36
+ licenses: []
37
+
38
+ post_install_message:
39
+ rdoc_options: []
40
+
41
+ require_paths:
42
+ - lib
43
+ required_ruby_version: !ruby/object:Gem::Requirement
44
+ none: false
45
+ requirements:
46
+ - - ">="
47
+ - !ruby/object:Gem::Version
48
+ hash: 3
49
+ segments:
50
+ - 0
51
+ version: "0"
52
+ required_rubygems_version: !ruby/object:Gem::Requirement
53
+ none: false
54
+ requirements:
55
+ - - ">="
56
+ - !ruby/object:Gem::Version
57
+ hash: 3
58
+ segments:
59
+ - 0
60
+ version: "0"
61
+ requirements: []
62
+
63
+ rubyforge_project:
64
+ rubygems_version: 1.3.7
65
+ signing_key:
66
+ specification_version: 3
67
+ summary: Interact with Cruise Control
68
+ test_files: []
69
+