jenkins-remote-api 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +5 -0
- data/.rvmrc +1 -0
- data/Gemfile +4 -0
- data/README.md +51 -0
- data/Rakefile +2 -0
- data/bin/jenkins +6 -0
- data/features/jenkins.feature +57 -0
- data/features/step_definitions/aruba_steps.rb +18 -0
- data/features/support/env.rb +3 -0
- data/jenkins-remote-api.gemspec +31 -0
- data/lib/jenkins-remote-api.rb +1 -0
- data/lib/jenkins-remote-api/ci/helper/xml_helper.rb +22 -0
- data/lib/jenkins-remote-api/ci/jenkins.rb +92 -0
- data/lib/jenkins-remote-api/ci/job.rb +10 -0
- data/lib/jenkins-remote-api/cli.rb +45 -0
- data/lib/jenkins-remote-api/version.rb +7 -0
- data/spec/jenkins_spec.rb +141 -0
- data/spec/spec_helper.rb +2 -0
- metadata +181 -0
data/.rvmrc
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
rvm --create use ruby-1.9.2@jenkins-remote-api
|
data/Gemfile
ADDED
data/README.md
ADDED
@@ -0,0 +1,51 @@
|
|
1
|
+
Jenkins Remote API
|
2
|
+
=============
|
3
|
+
|
4
|
+
A gem aims at help you consume [remote-access-api](https://wiki.jenkins-ci.org/display/JENKINS/Remote+access+API) offered by [Jenkins](http://jenkins-ci.org/).
|
5
|
+
|
6
|
+
Why
|
7
|
+
-------
|
8
|
+
|
9
|
+
The Jenkins exposes three kinds of api(xml/json/python) to outside users. And we might ask why we need to consume
|
10
|
+
those data?
|
11
|
+
|
12
|
+
Well, for a large team(over 6~8 people), how to visualize the ci process status is very important. In opposite to
|
13
|
+
the way that you manually go to Jenkins website and see the build status(positive), what if we can utilize Kanban methodology.That is to have a screen to show current ci status(passive but with knowledge radiation). Red means failure; Green means good/success;Blue means building in process.Maybe in further, we can buy [The Hudson Bear Lamps](https://wiki.jenkins-ci.org/pages/viewpage.action?pageId=20250625) to show build status.
|
14
|
+
|
15
|
+
But the prerequisite is that you need to consume the raw data offered by Jenkins api. So this gem will wrap around
|
16
|
+
the raw api from Jenkins, let you make best of it to do thing better.
|
17
|
+
|
18
|
+
The following markups are supported. The dependencies listed are required if
|
19
|
+
you wish to run the library.
|
20
|
+
|
21
|
+
|
22
|
+
Installation
|
23
|
+
-----------
|
24
|
+
|
25
|
+
gem install jenkins-remote-api
|
26
|
+
|
27
|
+
How to use
|
28
|
+
------------
|
29
|
+
|
30
|
+
###Commands from terminal
|
31
|
+
Yes, this gem use [CLI(using Aruba)](https://github.com/cucumber/aruba) to add command line interface so that you can fire it up directly in terminal(cool).
|
32
|
+
If you just want to play around with it, you probably don't even need to go to crazy "IRB" console^_^.
|
33
|
+
|
34
|
+
* `jenkins -h` -- It will come up with help message.
|
35
|
+
* `jenkins list_all_job_names --ci_address http://ci.jruby.org/view/Ruboto/` -- It will list all jobs'name on Jenkins.
|
36
|
+
* `jenkins jobs_description --ci_address http://ci.jruby.org/view/Ruboto/` -- It will list all jobs description(name,url,status) on Jenkins.
|
37
|
+
* `jenkins current_status --job_name ruboto-core --ci_address http://ci.jruby.org/view/Ruboto/` -- It will list current building status of job you identified on Jenkins.
|
38
|
+
|
39
|
+
####Usage in irb console
|
40
|
+
require 'rubygems'
|
41
|
+
require 'jenkins-remote-api'
|
42
|
+
jenkins = Ci::Jenkins.new("http://ci.jruby.org/view/Ruboto/")
|
43
|
+
jenkins.list_all_job_names
|
44
|
+
jenkins.jobs_description
|
45
|
+
jenkins.current_status_on_job "ruboto-core"
|
46
|
+
job = jenkins.job_named "ruboto-core"
|
47
|
+
|
48
|
+
Contribute
|
49
|
+
------------
|
50
|
+
|
51
|
+
Want to contribute? Email to: clarkhtse@gmail.com
|
data/Rakefile
ADDED
data/bin/jenkins
ADDED
@@ -0,0 +1,57 @@
|
|
1
|
+
Feature: Jenkins
|
2
|
+
In order to consume jenkins api
|
3
|
+
As a CLI
|
4
|
+
I want to be as objective as possible
|
5
|
+
|
6
|
+
Scenario: Get ci address when you set it
|
7
|
+
When I run `jenkins ci_address_to http://deadlock.netbeans.org/hudson`
|
8
|
+
Then the output should contain "http://deadlock.netbeans.org/hudson/"
|
9
|
+
|
10
|
+
Scenario: Get list all job names for specific jenkins ci
|
11
|
+
When I run `jenkins list_all_job_names --ci_address http://ci.jruby.org/view/Ruboto/`
|
12
|
+
Then the output should exactly equal to following without caring about space:
|
13
|
+
"""
|
14
|
+
+-------------------------------+
|
15
|
+
| Job Name |
|
16
|
+
+-------------------------------+
|
17
|
+
| ruboto-core |
|
18
|
+
| ruboto-core_jruby_master |
|
19
|
+
| ruboto-core_pads |
|
20
|
+
| ruboto-core_pads_jruby_master |
|
21
|
+
+-------------------------------+
|
22
|
+
"""
|
23
|
+
|
24
|
+
Scenario: Get all jobs descriptions for specific ci
|
25
|
+
When I run `jenkins jobs_description --ci_address http://ci.jruby.org/view/Ruboto/`
|
26
|
+
Then the output should exactly equal to following without caring about space:
|
27
|
+
"""
|
28
|
+
+-------------------------------+------------+--------------------------------------------------------+
|
29
|
+
| Job Name | Job Status | Job URL |
|
30
|
+
+-------------------------------+------------+--------------------------------------------------------+
|
31
|
+
| ruboto-core | building | http://ci.jruby.org/job/ruboto-core/ |
|
32
|
+
| ruboto-core_jruby_master | failure | http://ci.jruby.org/job/ruboto-core_jruby_master/ |
|
33
|
+
| ruboto-core_pads | building | http://ci.jruby.org/job/ruboto-core_pads/ |
|
34
|
+
| ruboto-core_pads_jruby_master | failure | http://ci.jruby.org/job/ruboto-core_pads_jruby_master/ |
|
35
|
+
+-------------------------------+------------+--------------------------------------------------------+
|
36
|
+
"""
|
37
|
+
|
38
|
+
Scenario: Prompt error info when ci address for list all job names has no job infos
|
39
|
+
When I run `jenkins list_all_job_names --ci_address http://www.google.com/`
|
40
|
+
Then the output should contain "Error in grabbing xml of http://www.google.com/api/xml.Pls refer to response code:404."
|
41
|
+
|
42
|
+
Scenario: Prompt error info when ci address for list all job names return xml that is illegal
|
43
|
+
When I run `jenkins list_all_job_names --ci_address http://www.baidu.com/`
|
44
|
+
Then the output should contain "Error parsing xml from http://www.baidu.com/api/xml due to format."
|
45
|
+
|
46
|
+
Scenario: Get current build status for job for specific ci
|
47
|
+
When I run `jenkins current_status --job_name ruboto-core --ci_address http://ci.jruby.org/view/Ruboto/`
|
48
|
+
Then the output should exactly equal to following without caring about space:
|
49
|
+
"""
|
50
|
+
+-------------+----------+
|
51
|
+
| Job Name | Status |
|
52
|
+
+-------------+----------+
|
53
|
+
| ruboto-core | building |
|
54
|
+
+-------------+----------+
|
55
|
+
"""
|
56
|
+
|
57
|
+
|
@@ -0,0 +1,18 @@
|
|
1
|
+
#we have defined some customized steps using aruba
|
2
|
+
Then /^I should see job names "([^\"]*)"$/ do | job_names |
|
3
|
+
unescape(all_output).split.join(", ").should == unescape(job_names)
|
4
|
+
end
|
5
|
+
|
6
|
+
#http://www.themodestrubyist.com/2010/04/22/aruba---cucumber-goodness-for-the-command-line/
|
7
|
+
Then /^I should see "([^\"]*)"$/ do |partial_output|
|
8
|
+
unescape(all_output).should =~ unescape(partial_output)
|
9
|
+
end
|
10
|
+
|
11
|
+
|
12
|
+
#exact match,after remove space and line just for awesome_print
|
13
|
+
#http://www.themodestrubyist.com/2010/04/22/aruba---cucumber-goodness-for-the-command-line/
|
14
|
+
Then /^the output should exactly equal to following without caring about space:$/ do |partial_output|
|
15
|
+
all_output.to_s.split.join('').should == partial_output.split.join('')
|
16
|
+
end
|
17
|
+
|
18
|
+
|
@@ -0,0 +1,31 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
$:.push File.expand_path("../lib", __FILE__)
|
3
|
+
require "jenkins-remote-api/version"
|
4
|
+
|
5
|
+
Gem::Specification.new do |s|
|
6
|
+
s.name = "jenkins-remote-api"
|
7
|
+
s.version = Jenkins::Remote::Api::VERSION
|
8
|
+
s.platform = Gem::Platform::RUBY
|
9
|
+
s.authors = ["Tuo Huang"]
|
10
|
+
s.email = ["clarkhtse@gmail.com"]
|
11
|
+
s.homepage = ""
|
12
|
+
s.summary = %q{This gem is to aim at helping people consume the api from Jenkins.}
|
13
|
+
s.description = %q{It retrieves the api/xml from Jenkins Ci. Then it will parse it to
|
14
|
+
get build status. e.g how many jobs are there and what status are those jobs.
|
15
|
+
}
|
16
|
+
|
17
|
+
s.rubyforge_project = "jenkins-remote-api"
|
18
|
+
|
19
|
+
s.files = `git ls-files`.split("\n")
|
20
|
+
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
21
|
+
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
22
|
+
s.require_paths = ["lib"]
|
23
|
+
s.add_development_dependency 'rspec', '~> 2.6'
|
24
|
+
s.add_development_dependency 'cucumber'
|
25
|
+
s.add_development_dependency 'aruba'
|
26
|
+
s.add_dependency 'terminal-table'
|
27
|
+
s.add_dependency 'thor'
|
28
|
+
s.add_dependency 'mechanize', '~>2.0.1'
|
29
|
+
s.add_dependency 'libxml-ruby','~>2.2.2'
|
30
|
+
|
31
|
+
end
|
@@ -0,0 +1 @@
|
|
1
|
+
Dir[File.dirname(__FILE__) + '/jenkins-remote-api/ci/*.rb'].each {|file| require file }
|
@@ -0,0 +1,22 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'mechanize'
|
3
|
+
module Ci
|
4
|
+
module XmlHelper
|
5
|
+
private
|
6
|
+
def retrieve_xml_from(url)
|
7
|
+
xml = nil
|
8
|
+
begin
|
9
|
+
Mechanize.new.get(url) do |page|
|
10
|
+
xml = page.body
|
11
|
+
end
|
12
|
+
rescue Mechanize::ResponseCodeError => e
|
13
|
+
raise "Error in grabbing xml of #{url}.Pls refer to response code:#{e.response_code}."
|
14
|
+
end
|
15
|
+
xml
|
16
|
+
end
|
17
|
+
|
18
|
+
def url_with_appended_xml url
|
19
|
+
url + "api/xml"
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,92 @@
|
|
1
|
+
require 'libxml'
|
2
|
+
require "#{File.dirname(__FILE__)}/helper/xml_helper.rb"
|
3
|
+
require "#{File.dirname(__FILE__)}/job.rb"
|
4
|
+
module Ci
|
5
|
+
class Jenkins
|
6
|
+
include LibXML
|
7
|
+
include XmlHelper
|
8
|
+
|
9
|
+
COLOR_STATUS_MAPPING = {
|
10
|
+
'blue' => 'success',
|
11
|
+
'red' => 'failure',
|
12
|
+
'blue_anime' => 'building-from-failure',
|
13
|
+
'red_anime' => 'building',
|
14
|
+
'disabled' => 'disabled',
|
15
|
+
'aborted' => 'aborted',
|
16
|
+
'yellow' => 'unstable', #rare
|
17
|
+
}
|
18
|
+
|
19
|
+
attr_accessor :ci_address
|
20
|
+
|
21
|
+
def initialize url
|
22
|
+
@ci_address = url
|
23
|
+
end
|
24
|
+
|
25
|
+
def ci_address
|
26
|
+
unless @ci_address.end_with?("/")
|
27
|
+
@ci_address += "/"
|
28
|
+
end
|
29
|
+
@ci_address
|
30
|
+
end
|
31
|
+
|
32
|
+
def list_all_job_names
|
33
|
+
jobs_summary.collect{ |job_summary| job_summary[:description][:name]}
|
34
|
+
end
|
35
|
+
|
36
|
+
def job_named job_name
|
37
|
+
get_job_summary_on(job_name)[:job]
|
38
|
+
end
|
39
|
+
|
40
|
+
def jobs
|
41
|
+
jobs_summary.collect{ |job_info| job_info[:job]}
|
42
|
+
end
|
43
|
+
|
44
|
+
def jobs_description
|
45
|
+
jobs_summary.collect{ |job_info| job_info[:description]}
|
46
|
+
end
|
47
|
+
|
48
|
+
def current_status_on_job job_name
|
49
|
+
get_job_summary_on(job_name)[:description][:status]
|
50
|
+
end
|
51
|
+
|
52
|
+
private
|
53
|
+
def jobs_summary
|
54
|
+
@jobs_summary ||= cached_xml_doc_of_jobs.find('//job').collect {|job_doc|
|
55
|
+
name = job_doc.find_first('name').content.strip
|
56
|
+
url = job_doc.find_first('url').content.strip
|
57
|
+
color = job_doc.find_first('color').content.strip
|
58
|
+
{
|
59
|
+
:description => {:name => name, :status => get_status_to(color), :url => url },
|
60
|
+
:job => Ci::Job.new(url)
|
61
|
+
}
|
62
|
+
}
|
63
|
+
@jobs_summary
|
64
|
+
end
|
65
|
+
|
66
|
+
def cached_xml_doc_of_jobs
|
67
|
+
return @jobs_highlevel_xml unless @jobs_highlevel_xml.nil?
|
68
|
+
xml = retrieve_xml_from(xml_url_on_ci)
|
69
|
+
parser = LibXML::XML::Parser.string(xml)
|
70
|
+
begin
|
71
|
+
@jobs_highlevel_xml = parser.parse
|
72
|
+
rescue LibXML::XML::Error => e
|
73
|
+
raise "Error parsing xml from #{xml_url_on_ci} due to format."
|
74
|
+
end
|
75
|
+
end
|
76
|
+
|
77
|
+
def xml_url_on_ci
|
78
|
+
url_with_appended_xml(ci_address)
|
79
|
+
end
|
80
|
+
|
81
|
+
def get_status_to color
|
82
|
+
raise "This color '#{color}' and its corresponding status hasn't been added to library, pls contact author." unless COLOR_STATUS_MAPPING.has_key?(color)
|
83
|
+
COLOR_STATUS_MAPPING[color]
|
84
|
+
end
|
85
|
+
|
86
|
+
def get_job_summary_on job_name
|
87
|
+
targeting_job_summary = jobs_summary.detect{|job_summary| job_summary[:description][:name] == job_name}
|
88
|
+
raise "The job with name 'some job' doesn't exist in job list of #{xml_url_on_ci}.Using jenkins.list_all_job_names to see list." if targeting_job_summary.nil?
|
89
|
+
targeting_job_summary
|
90
|
+
end
|
91
|
+
end
|
92
|
+
end
|
@@ -0,0 +1,45 @@
|
|
1
|
+
require 'thor'
|
2
|
+
require 'terminal-table/import'
|
3
|
+
require "#{File.dirname(__FILE__)}/ci/jenkins.rb"
|
4
|
+
|
5
|
+
module Jenkins
|
6
|
+
class CLI < Thor
|
7
|
+
|
8
|
+
desc "ci_address_to", "Initialize a new jenkins instance"
|
9
|
+
def ci_address_to url
|
10
|
+
jenkins = Ci::Jenkins.new url
|
11
|
+
puts jenkins.ci_address
|
12
|
+
end
|
13
|
+
|
14
|
+
desc "list_all_job_names", "List all job's name for jenkins ci"
|
15
|
+
method_option :ci_address, :aliases => '-ci_addr'
|
16
|
+
def list_all_job_names
|
17
|
+
jenkins = Ci::Jenkins.new options[:ci_address]
|
18
|
+
puts table(['Job Name'], *(jenkins.list_all_job_names.collect{|name| [name]}))
|
19
|
+
end
|
20
|
+
|
21
|
+
desc "jobs_description", "List all jobs' description for jenkins ci"
|
22
|
+
method_option :ci_address, :aliases => '-ci_addr'
|
23
|
+
def jobs_description
|
24
|
+
jenkins = Ci::Jenkins.new options[:ci_address]
|
25
|
+
job_description_table = table do |t|
|
26
|
+
t.headings = 'Job Name', 'Job Status', 'Job URL'
|
27
|
+
jenkins.jobs_description.each do |job_desc|
|
28
|
+
t << job_desc.values
|
29
|
+
end
|
30
|
+
end
|
31
|
+
puts job_description_table
|
32
|
+
end
|
33
|
+
|
34
|
+
desc "current_status", "Get current status of specific job on jenkins options -ci_addr , -job_name "
|
35
|
+
method_option :ci_address, :aliases => '-ci_addr'
|
36
|
+
method_option :job_name, :aliases => '-job_name'
|
37
|
+
def current_status
|
38
|
+
jenkins = Ci::Jenkins.new options[:ci_address]
|
39
|
+
status = jenkins.current_status_on_job options[:job_name]
|
40
|
+
puts table(['Job Name', 'Status'], *([[options[:job_name], status]]))
|
41
|
+
end
|
42
|
+
|
43
|
+
|
44
|
+
end
|
45
|
+
end
|
@@ -0,0 +1,141 @@
|
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
|
2
|
+
|
3
|
+
describe Ci::Jenkins do
|
4
|
+
|
5
|
+
let(:ci_url) { "http://deadlock.netbeans.org/hudson/" }
|
6
|
+
let(:jenkins) { Ci::Jenkins.new(ci_url) }
|
7
|
+
|
8
|
+
it "should set initialize jenkins instance with ci address" do
|
9
|
+
jenkins.ci_address.should == ci_url
|
10
|
+
end
|
11
|
+
|
12
|
+
it "should set initialize jenkins instance with ci address" do
|
13
|
+
jenkins_without_end_slash = Ci::Jenkins.new("helloworld.com")
|
14
|
+
jenkins_without_end_slash.ci_address.should == "helloworld.com/"
|
15
|
+
end
|
16
|
+
|
17
|
+
|
18
|
+
it "should get all job's names for specific ci" do
|
19
|
+
mechanize = mock("Mechanize")
|
20
|
+
Mechanize.stub(:new).and_return(mechanize)
|
21
|
+
result = mock("some xml ouput")
|
22
|
+
result.stub(:body).and_return(legal_xml_source)
|
23
|
+
mechanize.should_receive(:get).with(ci_url + "api/xml").and_yield(result)
|
24
|
+
jenkins.list_all_job_names.should == ["analytics-server", "apitest"]
|
25
|
+
end
|
26
|
+
|
27
|
+
it "should prompt network problem info when mechanize can't get right response" do
|
28
|
+
mechanize = mock("Mechanize")
|
29
|
+
Mechanize.stub(:new).and_return(mechanize)
|
30
|
+
error_page = mock("some error page")
|
31
|
+
error_page.stub(:code).and_return(404)
|
32
|
+
mechanize.stub(:get).and_raise(Mechanize::ResponseCodeError.new(error_page))
|
33
|
+
expect {
|
34
|
+
jenkins.list_all_job_names
|
35
|
+
}.to raise_exception("Error in grabbing xml of http://deadlock.netbeans.org/hudson/api/xml.Pls refer to response code:404.")
|
36
|
+
end
|
37
|
+
|
38
|
+
it "should raise error when xml is illegal" do
|
39
|
+
mechanize = mock("Mechanize")
|
40
|
+
Mechanize.stub(:new).and_return(mechanize)
|
41
|
+
result = mock("some xml ouput")
|
42
|
+
xml = <<EOF
|
43
|
+
<html>helloworld
|
44
|
+
some test
|
45
|
+
EOF
|
46
|
+
result.stub(:body).and_return(xml)
|
47
|
+
mechanize.should_receive(:get).with(ci_url + "api/xml").and_yield(result)
|
48
|
+
expect {
|
49
|
+
jenkins.list_all_job_names
|
50
|
+
}.to raise_exception(
|
51
|
+
"Error parsing xml from http://deadlock.netbeans.org/hudson/api/xml due to format.")
|
52
|
+
end
|
53
|
+
|
54
|
+
it "should return empty array when page doesn't have job info" do
|
55
|
+
mechanize = mock("Mechanize")
|
56
|
+
Mechanize.stub(:new).and_return(mechanize)
|
57
|
+
result = mock("some xml ouput")
|
58
|
+
xml = <<EOF
|
59
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
60
|
+
<hudson>
|
61
|
+
<assignedLabel/>
|
62
|
+
<mode>NORMAL</mode>
|
63
|
+
</hudson>
|
64
|
+
EOF
|
65
|
+
result.stub(:body).and_return(xml)
|
66
|
+
mechanize.should_receive(:get).with(ci_url + "api/xml").and_yield(result)
|
67
|
+
jenkins.list_all_job_names.should == []
|
68
|
+
end
|
69
|
+
|
70
|
+
describe "for legal xml source" do
|
71
|
+
|
72
|
+
before(:each) do
|
73
|
+
mechanize = mock("Mechanize")
|
74
|
+
Mechanize.stub(:new).and_return(mechanize)
|
75
|
+
result = mock("some xml ouput")
|
76
|
+
result.stub(:body).and_return(legal_xml_source)
|
77
|
+
mechanize.should_receive(:get).with(ci_url + "api/xml").and_yield(result)
|
78
|
+
end
|
79
|
+
|
80
|
+
context "#job_named" do
|
81
|
+
it "should get corresponding job for name" do
|
82
|
+
Ci::Job.should_receive(:new).with("http://deadlock.netbeans.org/hudson/job/analytics-server/")
|
83
|
+
jenkins.job_named("analytics-server")
|
84
|
+
end
|
85
|
+
|
86
|
+
it "should throw error info when job with name doesn't exist" do
|
87
|
+
expect {
|
88
|
+
jenkins.job_named("some job")
|
89
|
+
}.to raise_exception("The job with name 'some job' doesn't exist in job list of #{ci_url}api/xml.Using jenkins.list_all_job_names to see list.")
|
90
|
+
end
|
91
|
+
end
|
92
|
+
|
93
|
+
context "#list_all_jobs_info" do
|
94
|
+
it "should get list_all_jobs_info" do
|
95
|
+
jenkins.jobs_description.should == [
|
96
|
+
{
|
97
|
+
:name => "analytics-server",
|
98
|
+
:status => "disabled",
|
99
|
+
:url => "http://deadlock.netbeans.org/hudson/job/analytics-server/",
|
100
|
+
},
|
101
|
+
{
|
102
|
+
:name => "apitest",
|
103
|
+
:status => "success",
|
104
|
+
:url => "http://deadlock.netbeans.org/hudson/job/apitest/",
|
105
|
+
}]
|
106
|
+
end
|
107
|
+
end
|
108
|
+
|
109
|
+
it "should get current status of job on ci" do
|
110
|
+
jenkins.current_status_on_job("apitest").should == "success"
|
111
|
+
end
|
112
|
+
|
113
|
+
end
|
114
|
+
|
115
|
+
|
116
|
+
|
117
|
+
|
118
|
+
def legal_xml_source
|
119
|
+
xml = <<EOF
|
120
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
121
|
+
<hudson>
|
122
|
+
<assignedLabel/>
|
123
|
+
<mode>NORMAL</mode>
|
124
|
+
<nodeDescription>the master Hudson node</nodeDescription>
|
125
|
+
<job>
|
126
|
+
<name>analytics-server</name>
|
127
|
+
<url>
|
128
|
+
http://deadlock.netbeans.org/hudson/job/analytics-server/
|
129
|
+
</url>
|
130
|
+
<color>disabled</color>
|
131
|
+
</job>
|
132
|
+
<job>
|
133
|
+
<name>apitest</name>
|
134
|
+
<url>http://deadlock.netbeans.org/hudson/job/apitest/</url>
|
135
|
+
<color>blue</color>
|
136
|
+
</job>
|
137
|
+
</hudson>
|
138
|
+
EOF
|
139
|
+
xml
|
140
|
+
end
|
141
|
+
end
|
data/spec/spec_helper.rb
ADDED
metadata
ADDED
@@ -0,0 +1,181 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: jenkins-remote-api
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
prerelease: false
|
5
|
+
segments:
|
6
|
+
- 0
|
7
|
+
- 0
|
8
|
+
- 1
|
9
|
+
version: 0.0.1
|
10
|
+
platform: ruby
|
11
|
+
authors:
|
12
|
+
- Tuo Huang
|
13
|
+
autorequire:
|
14
|
+
bindir: bin
|
15
|
+
cert_chain: []
|
16
|
+
|
17
|
+
date: 2011-09-03 00:00:00 +08:00
|
18
|
+
default_executable:
|
19
|
+
dependencies:
|
20
|
+
- !ruby/object:Gem::Dependency
|
21
|
+
name: rspec
|
22
|
+
prerelease: false
|
23
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
24
|
+
none: false
|
25
|
+
requirements:
|
26
|
+
- - ~>
|
27
|
+
- !ruby/object:Gem::Version
|
28
|
+
segments:
|
29
|
+
- 2
|
30
|
+
- 6
|
31
|
+
version: "2.6"
|
32
|
+
type: :development
|
33
|
+
version_requirements: *id001
|
34
|
+
- !ruby/object:Gem::Dependency
|
35
|
+
name: cucumber
|
36
|
+
prerelease: false
|
37
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
38
|
+
none: false
|
39
|
+
requirements:
|
40
|
+
- - ">="
|
41
|
+
- !ruby/object:Gem::Version
|
42
|
+
segments:
|
43
|
+
- 0
|
44
|
+
version: "0"
|
45
|
+
type: :development
|
46
|
+
version_requirements: *id002
|
47
|
+
- !ruby/object:Gem::Dependency
|
48
|
+
name: aruba
|
49
|
+
prerelease: false
|
50
|
+
requirement: &id003 !ruby/object:Gem::Requirement
|
51
|
+
none: false
|
52
|
+
requirements:
|
53
|
+
- - ">="
|
54
|
+
- !ruby/object:Gem::Version
|
55
|
+
segments:
|
56
|
+
- 0
|
57
|
+
version: "0"
|
58
|
+
type: :development
|
59
|
+
version_requirements: *id003
|
60
|
+
- !ruby/object:Gem::Dependency
|
61
|
+
name: terminal-table
|
62
|
+
prerelease: false
|
63
|
+
requirement: &id004 !ruby/object:Gem::Requirement
|
64
|
+
none: false
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
segments:
|
69
|
+
- 0
|
70
|
+
version: "0"
|
71
|
+
type: :runtime
|
72
|
+
version_requirements: *id004
|
73
|
+
- !ruby/object:Gem::Dependency
|
74
|
+
name: thor
|
75
|
+
prerelease: false
|
76
|
+
requirement: &id005 !ruby/object:Gem::Requirement
|
77
|
+
none: false
|
78
|
+
requirements:
|
79
|
+
- - ">="
|
80
|
+
- !ruby/object:Gem::Version
|
81
|
+
segments:
|
82
|
+
- 0
|
83
|
+
version: "0"
|
84
|
+
type: :runtime
|
85
|
+
version_requirements: *id005
|
86
|
+
- !ruby/object:Gem::Dependency
|
87
|
+
name: mechanize
|
88
|
+
prerelease: false
|
89
|
+
requirement: &id006 !ruby/object:Gem::Requirement
|
90
|
+
none: false
|
91
|
+
requirements:
|
92
|
+
- - ~>
|
93
|
+
- !ruby/object:Gem::Version
|
94
|
+
segments:
|
95
|
+
- 2
|
96
|
+
- 0
|
97
|
+
- 1
|
98
|
+
version: 2.0.1
|
99
|
+
type: :runtime
|
100
|
+
version_requirements: *id006
|
101
|
+
- !ruby/object:Gem::Dependency
|
102
|
+
name: libxml-ruby
|
103
|
+
prerelease: false
|
104
|
+
requirement: &id007 !ruby/object:Gem::Requirement
|
105
|
+
none: false
|
106
|
+
requirements:
|
107
|
+
- - ~>
|
108
|
+
- !ruby/object:Gem::Version
|
109
|
+
segments:
|
110
|
+
- 2
|
111
|
+
- 2
|
112
|
+
- 2
|
113
|
+
version: 2.2.2
|
114
|
+
type: :runtime
|
115
|
+
version_requirements: *id007
|
116
|
+
description: "It retrieves the api/xml from Jenkins Ci. Then it will parse it to \n get build status. e.g how many jobs are there and what status are those jobs.\n "
|
117
|
+
email:
|
118
|
+
- clarkhtse@gmail.com
|
119
|
+
executables:
|
120
|
+
- jenkins
|
121
|
+
extensions: []
|
122
|
+
|
123
|
+
extra_rdoc_files: []
|
124
|
+
|
125
|
+
files:
|
126
|
+
- .gitignore
|
127
|
+
- .rvmrc
|
128
|
+
- Gemfile
|
129
|
+
- README.md
|
130
|
+
- Rakefile
|
131
|
+
- bin/jenkins
|
132
|
+
- features/jenkins.feature
|
133
|
+
- features/step_definitions/aruba_steps.rb
|
134
|
+
- features/support/env.rb
|
135
|
+
- jenkins-remote-api.gemspec
|
136
|
+
- lib/jenkins-remote-api.rb
|
137
|
+
- lib/jenkins-remote-api/ci/helper/xml_helper.rb
|
138
|
+
- lib/jenkins-remote-api/ci/jenkins.rb
|
139
|
+
- lib/jenkins-remote-api/ci/job.rb
|
140
|
+
- lib/jenkins-remote-api/cli.rb
|
141
|
+
- lib/jenkins-remote-api/version.rb
|
142
|
+
- spec/jenkins_spec.rb
|
143
|
+
- spec/spec_helper.rb
|
144
|
+
has_rdoc: true
|
145
|
+
homepage: ""
|
146
|
+
licenses: []
|
147
|
+
|
148
|
+
post_install_message:
|
149
|
+
rdoc_options: []
|
150
|
+
|
151
|
+
require_paths:
|
152
|
+
- lib
|
153
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
154
|
+
none: false
|
155
|
+
requirements:
|
156
|
+
- - ">="
|
157
|
+
- !ruby/object:Gem::Version
|
158
|
+
segments:
|
159
|
+
- 0
|
160
|
+
version: "0"
|
161
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
162
|
+
none: false
|
163
|
+
requirements:
|
164
|
+
- - ">="
|
165
|
+
- !ruby/object:Gem::Version
|
166
|
+
segments:
|
167
|
+
- 0
|
168
|
+
version: "0"
|
169
|
+
requirements: []
|
170
|
+
|
171
|
+
rubyforge_project: jenkins-remote-api
|
172
|
+
rubygems_version: 1.3.7
|
173
|
+
signing_key:
|
174
|
+
specification_version: 3
|
175
|
+
summary: This gem is to aim at helping people consume the api from Jenkins.
|
176
|
+
test_files:
|
177
|
+
- features/jenkins.feature
|
178
|
+
- features/step_definitions/aruba_steps.rb
|
179
|
+
- features/support/env.rb
|
180
|
+
- spec/jenkins_spec.rb
|
181
|
+
- spec/spec_helper.rb
|