ci-go-nfo 0.0.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.
- data/.gitignore +17 -0
- data/Gemfile +4 -0
- data/LICENSE +22 -0
- data/README.md +27 -0
- data/Rakefile +2 -0
- data/bin/ci-go-nfo +32 -0
- data/ci-go-nfo.gemspec +22 -0
- data/lib/ci-go-nfo.rb +35 -0
- data/lib/ci-go-nfo/cctray.rb +25 -0
- data/lib/ci-go-nfo/go_info.rb +77 -0
- data/lib/ci-go-nfo/version.rb +7 -0
- data/lib/ci-go-nfo/www.rb +19 -0
- data/resource/config.store +1 -0
- metadata +94 -0
data/.gitignore
ADDED
data/Gemfile
ADDED
data/LICENSE
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2012 AbhishekKr
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,27 @@
|
|
1
|
+
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
2
|
+
+ //^^ =||= //^^^ //^\\ |\\ || ||^^ //^\\ +
|
3
|
+
+ || || [] || ==; || || [] ||\\|| ||== || || +
|
4
|
+
+ \\++ =||= \\++// \\+// || \\| || \\+// +
|
5
|
+
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
6
|
+
# Ci::Go::Nfo
|
7
|
+
|
8
|
+
Just a utility to get Focussed INFO about your Go CI Pipeline
|
9
|
+
easily from console itself, no more browse
|
10
|
+
|
11
|
+
## Installation
|
12
|
+
$ gem install ci-go-nfo
|
13
|
+
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
14
|
+
|
15
|
+
## Usage
|
16
|
+
|
17
|
+
TODO: Write usage instructions here
|
18
|
+
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
19
|
+
|
20
|
+
## Contributing
|
21
|
+
|
22
|
+
1. Fork it git@github.com:abhishekkr/ci-go-nfo.git
|
23
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
24
|
+
3. Commit your changes (`git commit -am 'Added some feature'`)
|
25
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
26
|
+
5. Create new Pull Request
|
27
|
+
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
data/Rakefile
ADDED
data/bin/ci-go-nfo
ADDED
@@ -0,0 +1,32 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
$LOAD_PATH.unshift File.dirname(__FILE__) + '/../lib'
|
3
|
+
|
4
|
+
require 'ci-go-nfo'
|
5
|
+
|
6
|
+
case ARGV[0]
|
7
|
+
when 'help', '-h', '--help', '?'
|
8
|
+
puts <<-HELP
|
9
|
+
\e[1m\e[31mCi-Go-Nfo ver.#{Ci::Go::Nfo::VERSION}\e[0m
|
10
|
+
to set-up credential config for your go-ci\e[33m
|
11
|
+
$ ci-go-nfo setup\e[0m
|
12
|
+
to set-up credential config for your go-ci\e[33m
|
13
|
+
$ ci-go-nfo setup\e[0m
|
14
|
+
to show go-ci info of all runs\e[33m
|
15
|
+
$ ci-go-nfo\e[0m
|
16
|
+
to show go-ci info of failed runs\e[33m
|
17
|
+
$ ci-go-nfo fail\e[0m
|
18
|
+
to show go-ci info of passed runs\e[33m
|
19
|
+
$ ci-go-nfo pass\e[0m
|
20
|
+
\e[32m_____
|
21
|
+
\e[33m.....more to come
|
22
|
+
\e[0m
|
23
|
+
HELP
|
24
|
+
when 'setup'
|
25
|
+
Ci::Go::Access.persist_config
|
26
|
+
when 'pass'
|
27
|
+
Ci::Go::Nfo.cli 'pass'
|
28
|
+
when 'fail'
|
29
|
+
Ci::Go::Nfo.cli 'fail'
|
30
|
+
else
|
31
|
+
Ci::Go::Nfo.cli
|
32
|
+
end
|
data/ci-go-nfo.gemspec
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
$:.push File.expand_path('../lib', __FILE__)
|
3
|
+
require 'ci-go-nfo/version'
|
4
|
+
|
5
|
+
Gem::Specification.new do |gem|
|
6
|
+
gem.name = "ci-go-nfo"
|
7
|
+
gem.authors = ["AbhishekKr"]
|
8
|
+
gem.email = ["abhikumar163@gmail.com"]
|
9
|
+
gem.description = %q{A console utility to get information from your ThoughtWorks' Go Continuous Integration Server. Run '$ ci-go-nfo setup' to configure your access from console utility.}
|
10
|
+
gem.summary = %q{a console utility to get information from your ThoughtWorks' Go Continuous Integration Server}
|
11
|
+
gem.homepage = "https://github.com/abhishekkr/ci-go-nfo"
|
12
|
+
|
13
|
+
gem.files = `git ls-files`.split($\)
|
14
|
+
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
|
15
|
+
gem.require_paths = ["lib"]
|
16
|
+
gem.version = Ci::Go::Nfo::VERSION
|
17
|
+
|
18
|
+
gem.executables = %w( ci-go-nfo )
|
19
|
+
|
20
|
+
gem.add_runtime_dependency 'xml-motor', '>= 0.1.6'
|
21
|
+
gem.add_development_dependency 'xml-motor', '>= 0.1.6'
|
22
|
+
end
|
data/lib/ci-go-nfo.rb
ADDED
@@ -0,0 +1,35 @@
|
|
1
|
+
## ci-go-nfo : your console mate for ThoughtWorks' Go CI
|
2
|
+
|
3
|
+
ci_libs = File.join(File.dirname(File.expand_path __FILE__), 'ci-go-nfo', '*.rb')
|
4
|
+
Dir.glob(ci_libs).each do |lib|
|
5
|
+
require lib
|
6
|
+
end
|
7
|
+
require 'xml-motor'
|
8
|
+
|
9
|
+
module Ci
|
10
|
+
module Go
|
11
|
+
module Nfo
|
12
|
+
|
13
|
+
def self.cli(filter = nil)
|
14
|
+
go = Ci::Go::Cctray.data_from_xml
|
15
|
+
go['names'].each_with_index do |name, idx|
|
16
|
+
next if name.split('::').size < 3
|
17
|
+
status = <<-STATUS
|
18
|
+
\e[1m\e[31m#{name.gsub('::', '->')}
|
19
|
+
\e[32m#{go['lastBuildStatus'][idx]} \e[0m for run#\e[32m#{go['lastBuildLabels'][idx]} \e[33mat #{go['lastBuildTimes'][idx]}
|
20
|
+
\e[0mdetails at \e[36m#{go['weburls'][idx]}
|
21
|
+
|
22
|
+
STATUS
|
23
|
+
if filter.nil?
|
24
|
+
puts status
|
25
|
+
elsif filter === 'fail' && go['lastBuildStatus'][idx]==='Failure'
|
26
|
+
puts status
|
27
|
+
elsif filter === 'pass' && go['lastBuildStatus'][idx]==='Success'
|
28
|
+
puts status
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
## cctray.rb
|
2
|
+
|
3
|
+
require 'xml-motor'
|
4
|
+
|
5
|
+
module Ci
|
6
|
+
module Go
|
7
|
+
module Cctray
|
8
|
+
|
9
|
+
def self.data_from_xml
|
10
|
+
cctray = Ci::WWW.http
|
11
|
+
splitd = XMLMotor.splitter cctray.body
|
12
|
+
tags = XMLMotor.indexify splitd
|
13
|
+
go_nfo = {}
|
14
|
+
|
15
|
+
go_nfo['names'] = XMLMotor.xmlattrib 'name', splitd, tags, 'Project'
|
16
|
+
go_nfo['lastBuildStatus'] = XMLMotor.xmlattrib 'lastBuildStatus', splitd, tags, 'Project'
|
17
|
+
go_nfo['lastBuildLabels'] = XMLMotor.xmlattrib 'lastBuildLabel', splitd, tags, 'Project'
|
18
|
+
go_nfo['lastBuildTimes'] = XMLMotor.xmlattrib 'lastBuildTime', splitd, tags, 'Project'
|
19
|
+
go_nfo['weburls'] = XMLMotor.xmlattrib 'webUrl', splitd, tags, 'Project'
|
20
|
+
go_nfo
|
21
|
+
end
|
22
|
+
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1,77 @@
|
|
1
|
+
## go_info.rb
|
2
|
+
|
3
|
+
require 'yaml'
|
4
|
+
|
5
|
+
module Ci
|
6
|
+
module Go
|
7
|
+
module Access
|
8
|
+
|
9
|
+
def self.config_from(new_file = nil)
|
10
|
+
gem = File.join File.expand_path(File.dirname __FILE__), '..', '..'
|
11
|
+
gem_res = File.join gem, 'resource', 'config.store'
|
12
|
+
if new_file.nil?
|
13
|
+
from_file = File.open(gem_res, 'r'){|fyl| fyl.read}
|
14
|
+
return from_file.chop.gsub(/^~/,File.expand_path('~'))
|
15
|
+
end
|
16
|
+
new_file = new_file.chop.gsub(/^~/,File.expand_path('~'))
|
17
|
+
File.open(gem_res, 'w'){|fyl| fyl.puts new_file}
|
18
|
+
new_file
|
19
|
+
end
|
20
|
+
|
21
|
+
def self.config
|
22
|
+
conf_fyl = config_from
|
23
|
+
if File.exists? conf_fyl
|
24
|
+
defaults = YAML.load_file conf_fyl
|
25
|
+
else
|
26
|
+
defaults = persist_config
|
27
|
+
end
|
28
|
+
defaults = persist_config unless defaults
|
29
|
+
baseurl = defaults['baseurl']
|
30
|
+
unless defaults['creds'].nil?
|
31
|
+
user = defaults['creds']['user']
|
32
|
+
password = defaults['creds']['pass']
|
33
|
+
end
|
34
|
+
if baseurl.nil?
|
35
|
+
return persist_config_from
|
36
|
+
else
|
37
|
+
return {'user' => user, 'password' => password, 'baseurl' => baseurl}
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
def self.persist_config
|
42
|
+
inputs = setup_access
|
43
|
+
config_hash = {
|
44
|
+
'baseurl' => inputs['baseurl'],
|
45
|
+
'creds' => {
|
46
|
+
'user' => inputs['user'],
|
47
|
+
'pass' => inputs['password']
|
48
|
+
}
|
49
|
+
}
|
50
|
+
config_from inputs['config_from'] unless inputs['config_from'].empty?
|
51
|
+
File.open(config_from, 'w+') do |conf|
|
52
|
+
conf.write( config_hash.to_yaml )
|
53
|
+
end
|
54
|
+
|
55
|
+
{
|
56
|
+
'baseurl' => inputs['baseurl'],
|
57
|
+
'user' => inputs['user'],
|
58
|
+
'pass' => inputs['password']
|
59
|
+
}
|
60
|
+
end
|
61
|
+
|
62
|
+
def self.setup_access
|
63
|
+
ARGV.clear
|
64
|
+
print "\nStore sensitive Go Configs in file {current file: #{config_from}}: "
|
65
|
+
conf_file = gets.strip
|
66
|
+
print "\nEnter Base URL of Go Server {like http://<ip>:8153}: "
|
67
|
+
baseurl = gets.strip
|
68
|
+
puts "\nThis is better to be ReadOnly account details..."
|
69
|
+
print "\nEnter Log-in UserName: "
|
70
|
+
user = gets.strip
|
71
|
+
print "\nPassword: "
|
72
|
+
password = gets.strip
|
73
|
+
{'config_from' => conf_file, 'user' => user, 'password' => password, 'baseurl' => baseurl}
|
74
|
+
end
|
75
|
+
end
|
76
|
+
end
|
77
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
## www.rb
|
2
|
+
|
3
|
+
require 'net/http'
|
4
|
+
require 'uri'
|
5
|
+
|
6
|
+
module Ci
|
7
|
+
module WWW
|
8
|
+
|
9
|
+
def self.http
|
10
|
+
config = Ci::Go::Access.config
|
11
|
+
url = URI.parse("#{config['baseurl']}/go/cctray.xml")
|
12
|
+
req = Net::HTTP::Get.new(url.path)
|
13
|
+
req.basic_auth(config['user'], config['password']) unless config['user'].nil?
|
14
|
+
Net::HTTP.start(url.host, url.port) {|http|
|
15
|
+
http.request(req)
|
16
|
+
}
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1 @@
|
|
1
|
+
~/.go.abril
|
metadata
ADDED
@@ -0,0 +1,94 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: ci-go-nfo
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- AbhishekKr
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2012-09-19 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: xml-motor
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ! '>='
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: 0.1.6
|
22
|
+
type: :runtime
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ! '>='
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: 0.1.6
|
30
|
+
- !ruby/object:Gem::Dependency
|
31
|
+
name: xml-motor
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
33
|
+
none: false
|
34
|
+
requirements:
|
35
|
+
- - ! '>='
|
36
|
+
- !ruby/object:Gem::Version
|
37
|
+
version: 0.1.6
|
38
|
+
type: :development
|
39
|
+
prerelease: false
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ! '>='
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: 0.1.6
|
46
|
+
description: A console utility to get information from your ThoughtWorks' Go Continuous
|
47
|
+
Integration Server. Run '$ ci-go-nfo setup' to configure your access from console
|
48
|
+
utility.
|
49
|
+
email:
|
50
|
+
- abhikumar163@gmail.com
|
51
|
+
executables:
|
52
|
+
- ci-go-nfo
|
53
|
+
extensions: []
|
54
|
+
extra_rdoc_files: []
|
55
|
+
files:
|
56
|
+
- .gitignore
|
57
|
+
- Gemfile
|
58
|
+
- LICENSE
|
59
|
+
- README.md
|
60
|
+
- Rakefile
|
61
|
+
- bin/ci-go-nfo
|
62
|
+
- ci-go-nfo.gemspec
|
63
|
+
- lib/ci-go-nfo.rb
|
64
|
+
- lib/ci-go-nfo/cctray.rb
|
65
|
+
- lib/ci-go-nfo/go_info.rb
|
66
|
+
- lib/ci-go-nfo/version.rb
|
67
|
+
- lib/ci-go-nfo/www.rb
|
68
|
+
- resource/config.store
|
69
|
+
homepage: https://github.com/abhishekkr/ci-go-nfo
|
70
|
+
licenses: []
|
71
|
+
post_install_message:
|
72
|
+
rdoc_options: []
|
73
|
+
require_paths:
|
74
|
+
- lib
|
75
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
76
|
+
none: false
|
77
|
+
requirements:
|
78
|
+
- - ! '>='
|
79
|
+
- !ruby/object:Gem::Version
|
80
|
+
version: '0'
|
81
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
82
|
+
none: false
|
83
|
+
requirements:
|
84
|
+
- - ! '>='
|
85
|
+
- !ruby/object:Gem::Version
|
86
|
+
version: '0'
|
87
|
+
requirements: []
|
88
|
+
rubyforge_project:
|
89
|
+
rubygems_version: 1.8.24
|
90
|
+
signing_key:
|
91
|
+
specification_version: 3
|
92
|
+
summary: a console utility to get information from your ThoughtWorks' Go Continuous
|
93
|
+
Integration Server
|
94
|
+
test_files: []
|