Skip to content

Commit 9f9d224

Browse files
committed
add view to show bamboo success and fail plan's
1 parent 8ffb517 commit 9f9d224

File tree

2 files changed

+104
-0
lines changed

2 files changed

+104
-0
lines changed

lib/bamboo/bamboo_fail_ticker.rb

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
require 'yaml'
2+
require_relative '../http/fetcher'
3+
require_relative 'bamboo_projects'
4+
require_relative 'bamboo_results'
5+
require_relative 'bamboo_result'
6+
require 'colorize'
7+
8+
class BambooTicker
9+
10+
def tick
11+
#load properties
12+
dir = File.dirname(__FILE__)
13+
props = YAML::load(File.open(File.join(dir,"bamboo.properties")))
14+
15+
#fetch content
16+
f = Fetcher.new
17+
18+
19+
resultsAsJson = f.fetch(props['bamboo.host'] + BambooResults.urlThatDescribeMe) { |httpAuth|
20+
httpAuth.auth(props['bamboo.user'], props['bamboo.password'])
21+
}
22+
results = BambooResults.new(resultsAsJson)
23+
24+
projectsAsJson = f.fetch(props['bamboo.host'] + BambooProjects.urlThatDescribeMe) { |httpAuth|
25+
httpAuth.auth(props['bamboo.user'], props['bamboo.password'])
26+
}
27+
b = BambooProjects.new(projectsAsJson)
28+
29+
b.projects.each { |project|
30+
puts project.key
31+
puts '---------------------'
32+
project.plans.each { |plan|
33+
34+
unless results.result(project.key, plan.key).nil?
35+
unless results.result(project.key, plan.key).isSuccessful
36+
print plan.key.colorize(:red)
37+
if plan.isBuilding
38+
print '*'.colorize(:cyan)
39+
end
40+
print ' '
41+
end
42+
end
43+
44+
}
45+
puts ''
46+
puts ''
47+
}
48+
end
49+
50+
end
51+
52+
BambooTicker.new.tick

lib/bamboo/bamboo_success_ticker.rb

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
require 'yaml'
2+
require_relative '../http/fetcher'
3+
require_relative 'bamboo_projects'
4+
require_relative 'bamboo_results'
5+
require_relative 'bamboo_result'
6+
require 'colorize'
7+
8+
class BambooTicker
9+
10+
def tick
11+
#load properties
12+
dir = File.dirname(__FILE__)
13+
props = YAML::load(File.open(File.join(dir,"bamboo.properties")))
14+
15+
#fetch content
16+
f = Fetcher.new
17+
18+
19+
resultsAsJson = f.fetch(props['bamboo.host'] + BambooResults.urlThatDescribeMe) { |httpAuth|
20+
httpAuth.auth(props['bamboo.user'], props['bamboo.password'])
21+
}
22+
results = BambooResults.new(resultsAsJson)
23+
24+
projectsAsJson = f.fetch(props['bamboo.host'] + BambooProjects.urlThatDescribeMe) { |httpAuth|
25+
httpAuth.auth(props['bamboo.user'], props['bamboo.password'])
26+
}
27+
b = BambooProjects.new(projectsAsJson)
28+
29+
b.projects.each { |project|
30+
puts project.key
31+
puts '---------------------'
32+
project.plans.each { |plan|
33+
34+
unless results.result(project.key, plan.key).nil?
35+
if(results.result(project.key, plan.key).isSuccessful)
36+
print plan.key.colorize(:green)
37+
if plan.isBuilding
38+
print '*'.colorize(:cyan)
39+
end
40+
print ' '
41+
end
42+
end
43+
44+
}
45+
puts ''
46+
puts ''
47+
}
48+
end
49+
50+
end
51+
52+
BambooTicker.new.tick

0 commit comments

Comments
 (0)