File tree Expand file tree Collapse file tree 2 files changed +104
-0
lines changed Expand file tree Collapse file tree 2 files changed +104
-0
lines changed Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
You can’t perform that action at this time.
0 commit comments