ci-go-nfo 0.0.2 → 0.0.3

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/.gitignore CHANGED
@@ -15,3 +15,4 @@ spec/reports
15
15
  test/tmp
16
16
  test/version_tmp
17
17
  tmp
18
+ *swp
data/CHANGELOG CHANGED
@@ -1,6 +1,11 @@
1
1
  Ci-Go-Nfo CHANGLEOG
2
2
  ++++++++++++++++++++++++++++++++++++++++++++++++++
3
3
 
4
+ v0.0.2 => v0.0.3
5
+ 6) fixing nil argument case, some code cleanup
6
+
7
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
8
+
4
9
  v0.0.1 => v0.0.2
5
10
  5) get summary of total/passed/failed Go CI pipelines and the names of failed
6
11
 
data/README CHANGED
@@ -14,7 +14,7 @@ easily from console itself, no more browse
14
14
 
15
15
  ## Usage
16
16
 
17
- Ci-Go-Nfo ver.0.0.1
17
+ Ci-Go-Nfo ver.0.0.3
18
18
 
19
19
  to set-up credential config for your go-ci
20
20
  $ ci-go-nfo setup
@@ -3,7 +3,9 @@ $LOAD_PATH.unshift File.dirname(__FILE__) + '/../lib'
3
3
 
4
4
  require 'ci-go-nfo'
5
5
 
6
- if ARGV.size === 1
6
+ if ARGV.size === 0
7
+ Ci::Go::Nfo.builds
8
+ elsif ARGV.size === 1
7
9
  case ARGV[0]
8
10
  when 'help', '-h', '--help', '?'
9
11
  puts <<-HELP
@@ -30,8 +32,6 @@ if ARGV.size === 1
30
32
  Ci::Go::Nfo.builds 'fail'
31
33
  when 'summary'
32
34
  Ci::Go::Nfo.summary
33
- else
34
- Ci::Go::Nfo.builds nil, ARGV[0]
35
35
  end
36
36
 
37
37
  elsif ARGV.size === 2
@@ -14,12 +14,11 @@ module Ci
14
14
  go_all = Ci::Go::Cctray.data_from_xml
15
15
  failed_builds, passed_builds = [], []
16
16
  go_all['names'].each_with_index do |name, idx|
17
- if name.split('::').size == 3
18
- if go_all['lastBuildStatus'][idx] === 'Failure'
19
- failed_builds << name.split('::')[0]
20
- elsif go_all['lastBuildStatus'][idx] === 'Success'
21
- passed_builds << name.split('::')[0]
22
- end
17
+ next unless name.split('::').size == 3
18
+ if go_all['lastBuildStatus'][idx] === 'Failure'
19
+ failed_builds << name.split('::')[0]
20
+ elsif go_all['lastBuildStatus'][idx] === 'Success'
21
+ passed_builds << name.split('::')[0]
23
22
  end
24
23
  end
25
24
  Ci::Go::Print.summary passed_builds.uniq, failed_builds.uniq
@@ -29,19 +28,11 @@ module Ci
29
28
  go = Ci::Go::Cctray.data_from_xml
30
29
  go['names'].each_with_index do |name, idx|
31
30
  next if name.split('::').size < 3
32
- build = {
33
- 'name' => name,
34
- 'last_status' => go['lastBuildStatus'][idx],
35
- 'last_label' => go['lastBuildLabels'][idx],
36
- 'last_time' => go['lastBuildTimes'][idx],
37
- 'weburl' => go['weburls'][idx]
38
- }
31
+ build = build_nfo(go, idx)
39
32
 
40
- if status.nil?
41
- Ci::Go::Print.build_status build
42
- elsif status === 'fail' && build['last_status'] === 'Failure'
43
- Ci::Go::Print.build_status build
44
- elsif status === 'pass' && build['last_status'] === 'Success'
33
+ if status.nil? or
34
+ build['last_status'].match(/#{status}/i) or
35
+ ( status === 'pass' && build['last_status'] === 'Success' )
45
36
  Ci::Go::Print.build_status build
46
37
  end
47
38
  end
@@ -51,15 +42,18 @@ module Ci
51
42
  go = Ci::Go::Cctray.data_from_xml
52
43
  build_name = go['names'].select{|gname| gname.split(/::/)[0] === pipeline}
53
44
  idx = go.index build_name
54
- build = {
55
- 'name' => go['names'][idx],
56
- 'last_status' => go['lastBuildStatus'][idx],
57
- 'last_label' => go['lastBuildLabels'][idx],
58
- 'last_time' => go['lastBuildTimes'][idx],
59
- 'weburl' => go['weburls'][idx]
60
- }
61
45
 
62
- Ci::Go::Print.build_status build
46
+ Ci::Go::Print.build_status build_nfo(go, idx)
47
+ end
48
+
49
+ def self.build_nfo(goXML, index)
50
+ {
51
+ 'name' => goXML['names'][index],
52
+ 'last_status' => goXML['lastBuildStatus'][index],
53
+ 'last_label' => goXML['lastBuildLabels'][index],
54
+ 'last_time' => goXML['lastBuildTimes'][index],
55
+ 'weburl' => goXML['weburls'][index]
56
+ }
63
57
  end
64
58
 
65
59
  end
@@ -1,7 +1,7 @@
1
1
  module Ci
2
2
  module Go
3
3
  module Nfo
4
- VERSION = "0.0.2"
4
+ VERSION = "0.0.3"
5
5
  end
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ci-go-nfo
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-10-28 00:00:00.000000000 Z
12
+ date: 2013-01-22 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: xml-motor