go_api_client 0.4.0 → 0.5.0
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/.init.sh +8 -0
- data/Gemfile.lock +1 -1
- data/go_api_client.gemspec +1 -0
- data/lib/go_api_client.rb +35 -17
- data/lib/go_api_client/atom/feed.rb +11 -1
- data/lib/go_api_client/http_fetcher.rb +97 -42
- data/lib/go_api_client/job.rb +1 -1
- data/lib/go_api_client/logger.rb +8 -0
- data/lib/go_api_client/pipeline.rb +1 -1
- data/lib/go_api_client/stage.rb +1 -1
- data/lib/go_api_client/version.rb +1 -1
- data/test/fixtures/default_pipeline.xml +24 -0
- data/test/fixtures/integration_pipeline.xml +24 -0
- data/test/fixtures/pipelines.xml +5 -0
- data/test/go_api_client/atom/feed_test.rb +14 -0
- data/test/go_api_client/stage_test.rb +21 -0
- metadata +13 -10
data/.init.sh
ADDED
data/Gemfile.lock
CHANGED
data/go_api_client.gemspec
CHANGED
@@ -10,6 +10,7 @@ Gem::Specification.new do |s|
|
|
10
10
|
s.homepage = "https://github.com/ThoughtWorksInc/go-api-client"
|
11
11
|
s.summary = %q{Client to parse Go CI atom feed}
|
12
12
|
s.description = %q{This gem parses atom feed generated by the Go Continuous Integration server and provides an OO representation of the pipelines and stages.}
|
13
|
+
s.license = 'MIT'
|
13
14
|
|
14
15
|
s.rubyforge_project = "go_api_client"
|
15
16
|
|
data/lib/go_api_client.rb
CHANGED
@@ -13,6 +13,7 @@ require 'go_api_client/job'
|
|
13
13
|
require 'go_api_client/artifact'
|
14
14
|
require 'go_api_client/commit'
|
15
15
|
require 'go_api_client/user'
|
16
|
+
require 'go_api_client/logger'
|
16
17
|
|
17
18
|
module GoApiClient
|
18
19
|
|
@@ -45,30 +46,30 @@ module GoApiClient
|
|
45
46
|
# @option options [Boolean] :ssl (false) If connection should be made over ssl.
|
46
47
|
# @option options [String] :username (nil) The username to be used if server or the pipeline requires authorization.
|
47
48
|
# @option options [String] :password (nil) The password to be used if server or the pipeline requires authorization.
|
48
|
-
# @option options [String] :pipeline_name
|
49
|
+
# @option options [String] :pipeline_name The name of the pipeline that should be fetched.
|
49
50
|
# @option options [String] :latest_atom_entry_id (nil) The id of the last atom feed entry
|
50
51
|
def runs(options={})
|
51
|
-
options = ({:ssl => false, :host => 'localhost', :port => 8153, :username => nil, :password => nil, :latest_atom_entry_id => nil
|
52
|
+
options = ({:ssl => false, :host => 'localhost', :port => 8153, :username => nil, :password => nil, :latest_atom_entry_id => nil}).merge(options)
|
52
53
|
|
53
54
|
http_fetcher = GoApiClient::HttpFetcher.new(:username => options[:username], :password => options[:password])
|
54
55
|
|
55
|
-
|
56
|
-
|
56
|
+
pipeline_name = options[:pipeline_name] || "defaultPipeline"
|
57
|
+
feed_url = "#{options[:ssl] ? 'https' : 'http'}://#{options[:host]}:#{options[:port]}/go/api/pipelines/#{pipeline_name}/stages.xml"
|
57
58
|
feed = GoApiClient::Atom::Feed.new(feed_url, options[:latest_atom_entry_id])
|
58
59
|
feed.fetch!(http_fetcher)
|
60
|
+
return construct_last_run(feed, http_fetcher, options[:latest_atom_entry_id])
|
61
|
+
end
|
59
62
|
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
63
|
+
def all_runs(options={})
|
64
|
+
options = ({:ssl => false, :host => 'localhost', :port => 8153, :username => nil, :password => nil}).merge(options)
|
65
|
+
http_fetcher = GoApiClient::HttpFetcher.new(:username => options[:username], :password => options[:password])
|
66
|
+
feed_url = "#{options[:ssl] ? 'https' : 'http'}://#{options[:host]}:#{options[:port]}/go/api/pipelines.xml"
|
67
|
+
feed = GoApiClient::Atom::Feed.new(feed_url, nil)
|
68
|
+
feed = feed.fetch_all!(http_fetcher)
|
69
|
+
feed.inject({}) do |memo, (href, entries)|
|
70
|
+
memo[href] = construct_last_run(entries, http_fetcher, nil)
|
71
|
+
memo
|
67
72
|
end
|
68
|
-
|
69
|
-
pipelines = pipelines.values.sort_by {|p| p.counter}
|
70
|
-
latest_atom_entry_id = stages.empty? ? options[:latest_atom_entry_id] : feed.entries.first.id
|
71
|
-
return LastRun.new(pipelines, latest_atom_entry_id)
|
72
73
|
end
|
73
74
|
|
74
75
|
# Answers if a build is in progress. For the list of supported connection options see {GoApiClient.runs #runs}
|
@@ -78,7 +79,7 @@ module GoApiClient
|
|
78
79
|
options = ({:ssl => false, :port => 8153, :username => nil, :password => nil, :pipeline_name => 'defaultPipeline'}).merge(options)
|
79
80
|
http_fetcher = GoApiClient::HttpFetcher.new(:username => options[:username], :password => options[:password])
|
80
81
|
url = "#{options[:ssl] ? 'https' : 'http'}://#{options[:host]}:#{options[:port]}/go/cctray.xml"
|
81
|
-
doc = Nokogiri::XML(http_fetcher.
|
82
|
+
doc = Nokogiri::XML(http_fetcher.get!(url))
|
82
83
|
doc.css("Project[activity='Building'][name^='#{options[:pipeline_name]} ::']").count > 0
|
83
84
|
end
|
84
85
|
|
@@ -94,7 +95,24 @@ module GoApiClient
|
|
94
95
|
options = ({:ssl => false, :port => 8153, :username => nil, :password => nil, :pipeline_name => 'defaultPipeline'}).merge(options)
|
95
96
|
|
96
97
|
uri = "#{options[:ssl] ? 'https' : 'http'}://#{options[:host]}:#{options[:port]}/go/api/pipelines/#{options[:pipeline_name]}/schedule"
|
97
|
-
GoApiClient::HttpFetcher.new.post(uri)
|
98
|
+
GoApiClient::HttpFetcher.new.post!(uri)
|
99
|
+
end
|
100
|
+
|
101
|
+
private
|
102
|
+
|
103
|
+
def construct_last_run(feed, http_fetcher, last_atom_entry_id)
|
104
|
+
pipelines = {}
|
105
|
+
stages = feed.entries.collect do |entry|
|
106
|
+
Stage.from(entry.stage_href, :authors => entry.authors, :pipeline_cache => pipelines, :http_fetcher => http_fetcher)
|
107
|
+
end
|
108
|
+
|
109
|
+
pipelines.values.each do |p|
|
110
|
+
p.stages = p.stages.sort_by {|s| s.completed_at }
|
111
|
+
end
|
112
|
+
|
113
|
+
pipelines = pipelines.values.sort_by {|p| p.counter}
|
114
|
+
latest_atom_entry_id = stages.empty? ? last_atom_entry_id : feed.entries.first.id
|
115
|
+
return LastRun.new(pipelines, latest_atom_entry_id)
|
98
116
|
end
|
99
117
|
end
|
100
118
|
end
|
@@ -13,7 +13,7 @@ module GoApiClient
|
|
13
13
|
feed_url = @atom_feed_url
|
14
14
|
|
15
15
|
begin
|
16
|
-
doc = Nokogiri::XML(http_fetcher.
|
16
|
+
doc = Nokogiri::XML(http_fetcher.get!(feed_url))
|
17
17
|
feed_page = GoApiClient::Atom::FeedPage.new(doc.root).parse!
|
18
18
|
|
19
19
|
self.entries += if feed_page.contains_entry?(@last_entry_id)
|
@@ -25,6 +25,16 @@ module GoApiClient
|
|
25
25
|
end while feed_page.next_page && !feed_page.contains_entry?(@last_entry_id)
|
26
26
|
self
|
27
27
|
end
|
28
|
+
|
29
|
+
def fetch_all!(http_fetcher = HttpFetcher.new)
|
30
|
+
begin
|
31
|
+
doc = Nokogiri::XML(http_fetcher.get!(@atom_feed_url))
|
32
|
+
doc.css("pipeline").inject({}) do |hash, feed|
|
33
|
+
hash[feed.attr("href")] = GoApiClient::Atom::Feed.new(feed.attr("href")).fetch!
|
34
|
+
hash
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
28
38
|
end
|
29
39
|
end
|
30
40
|
end
|
@@ -4,67 +4,122 @@ require 'net/https'
|
|
4
4
|
module GoApiClient
|
5
5
|
class HttpFetcher
|
6
6
|
|
7
|
+
class HttpError < StandardError
|
8
|
+
attr_reader :http_code
|
9
|
+
def initialize(msg, http_code)
|
10
|
+
super(msg)
|
11
|
+
@http_code = http_code
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
class ConnectionError <StandardError
|
16
|
+
end
|
17
|
+
|
18
|
+
NET_HTTP_EXCEPTIONS = [
|
19
|
+
EOFError,
|
20
|
+
Errno::ECONNABORTED,
|
21
|
+
Errno::ECONNREFUSED,
|
22
|
+
Errno::ECONNRESET,
|
23
|
+
Errno::ECONNRESET, EOFError,
|
24
|
+
Errno::EINVAL,
|
25
|
+
Errno::ETIMEDOUT,
|
26
|
+
Net::HTTPBadResponse,
|
27
|
+
Net::HTTPClientError,
|
28
|
+
Net::HTTPError,
|
29
|
+
Net::HTTPFatalError,
|
30
|
+
Net::HTTPHeaderSyntaxError,
|
31
|
+
Net::HTTPRetriableError,
|
32
|
+
Net::HTTPServerException,
|
33
|
+
Net::ProtocolError,
|
34
|
+
SocketError,
|
35
|
+
Timeout::Error,
|
36
|
+
]
|
37
|
+
|
38
|
+
NET_HTTP_EXCEPTIONS << OpenSSL::SSL::SSLError if defined?(OpenSSL)
|
39
|
+
|
40
|
+
attr_accessor :response
|
41
|
+
|
7
42
|
def initialize(options={})
|
8
43
|
@username = options[:username]
|
9
44
|
@password = options[:password]
|
10
45
|
end
|
11
46
|
|
12
|
-
|
13
|
-
|
47
|
+
%w(get post).each do |meth|
|
48
|
+
class_eval <<-RUBY_EVAL, __FILE__, __LINE__ + 1
|
49
|
+
def #{meth}!(url, options={})
|
50
|
+
response_body = #{meth}(url, options)
|
51
|
+
return response_body
|
52
|
+
if failure?
|
53
|
+
message = "Could not fetch url \#{url}."
|
54
|
+
GoApiClient.logger.error("\#{message} The response returned status \#{status} with body `\#{response_body}'")
|
55
|
+
raise HttpError.new(message, status)
|
56
|
+
end
|
57
|
+
rescue *NET_HTTP_EXCEPTIONS => e
|
58
|
+
message = "Could not connect to url \#{url}."
|
59
|
+
GoApiClient.logger.error("\#{message}. The error was \#{e.message}")
|
60
|
+
GoApiClient.logger.error(e.backtrace.collect {|l| " \#{l}"}.join("\n"))
|
61
|
+
raise ConnectionError.new(e)
|
62
|
+
end
|
63
|
+
RUBY_EVAL
|
64
|
+
end
|
14
65
|
|
15
|
-
|
16
|
-
|
17
|
-
|
66
|
+
def status
|
67
|
+
@response.code.to_i
|
68
|
+
end
|
18
69
|
|
19
|
-
|
70
|
+
def success?
|
71
|
+
(200..299).include?(status)
|
72
|
+
end
|
20
73
|
|
21
|
-
|
22
|
-
|
74
|
+
def failure?
|
75
|
+
!success?
|
76
|
+
end
|
23
77
|
|
24
|
-
|
25
|
-
req = Net::HTTP::Get.new(uri.request_uri)
|
26
|
-
req.basic_auth(username, password) if username || password
|
27
|
-
http.request(req)
|
28
|
-
end
|
78
|
+
private
|
29
79
|
|
30
|
-
case res
|
31
|
-
when Net::HTTPSuccess
|
32
|
-
return res
|
33
|
-
end
|
34
|
-
res.error!
|
35
|
-
end
|
36
80
|
|
37
|
-
|
38
|
-
|
81
|
+
def get(url, options={})
|
82
|
+
uri = URI.parse(url)
|
39
83
|
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
headers = options[:headers] || {}
|
84
|
+
password = options[:password] || uri.password || @password
|
85
|
+
username = options[:username] || uri.user || @username
|
86
|
+
params = options[:params] || {}
|
44
87
|
|
45
|
-
|
46
|
-
http.use_ssl = uri.scheme == 'https'
|
88
|
+
uri.query = URI.encode_www_form(params) if params.any?
|
47
89
|
|
48
|
-
|
90
|
+
http = Net::HTTP.new(uri.host, uri.port)
|
91
|
+
http.use_ssl = uri.scheme == 'https'
|
49
92
|
|
50
|
-
|
51
|
-
|
93
|
+
@response = http.start do |http|
|
94
|
+
req = Net::HTTP::Get.new(uri.request_uri)
|
95
|
+
req.basic_auth(username, password) if username || password
|
96
|
+
http.request(req)
|
97
|
+
end
|
98
|
+
return @response.body
|
52
99
|
end
|
53
100
|
|
54
|
-
|
101
|
+
def post(url, options={})
|
102
|
+
uri = URI.parse(url)
|
55
103
|
|
56
|
-
|
57
|
-
|
104
|
+
password = options[:password] || uri.password || @password
|
105
|
+
username = options[:username] || uri.user || @username
|
106
|
+
params = options[:params] || {}
|
107
|
+
headers = options[:headers] || {}
|
58
108
|
|
59
|
-
|
60
|
-
|
61
|
-
return res
|
62
|
-
end
|
63
|
-
res.error!
|
64
|
-
end
|
109
|
+
http = Net::HTTP.new(uri.host, uri.port)
|
110
|
+
http.use_ssl = uri.scheme == 'https'
|
65
111
|
|
66
|
-
|
67
|
-
|
68
|
-
|
112
|
+
req = Net::HTTP::Post.new(uri.request_uri)
|
113
|
+
|
114
|
+
headers.each do |header_name, value|
|
115
|
+
req[header_name] = value
|
116
|
+
end
|
117
|
+
|
118
|
+
req.basic_auth(username, password) if username || password
|
119
|
+
|
120
|
+
req.set_form_data(params)
|
121
|
+
@response = http.request(req)
|
122
|
+
return @response.body
|
123
|
+
end
|
69
124
|
end
|
70
125
|
end
|
data/lib/go_api_client/job.rb
CHANGED
@@ -25,7 +25,7 @@ module GoApiClient
|
|
25
25
|
class << self
|
26
26
|
def from(url, attributes = {})
|
27
27
|
attributes[:http_fetcher] ||= GoApiClient::HttpFetcher.new
|
28
|
-
doc = Nokogiri::XML(attributes[:http_fetcher].
|
28
|
+
doc = Nokogiri::XML(attributes[:http_fetcher].get!(url))
|
29
29
|
self.new(doc.root, attributes).parse!
|
30
30
|
end
|
31
31
|
end
|
@@ -12,7 +12,7 @@ module GoApiClient
|
|
12
12
|
class << self
|
13
13
|
def from(url, attributes = {})
|
14
14
|
attributes[:http_fetcher] ||= GoApiClient::HttpFetcher.new
|
15
|
-
doc = Nokogiri::XML(attributes[:http_fetcher].
|
15
|
+
doc = Nokogiri::XML(attributes[:http_fetcher].get!(url))
|
16
16
|
self.new(doc.root, attributes).parse!
|
17
17
|
end
|
18
18
|
end
|
data/lib/go_api_client/stage.rb
CHANGED
@@ -13,7 +13,7 @@ module GoApiClient
|
|
13
13
|
class << self
|
14
14
|
def from(url, attributes = {})
|
15
15
|
attributes[:http_fetcher] ||= GoApiClient::HttpFetcher.new
|
16
|
-
doc = Nokogiri::XML(attributes[:http_fetcher].
|
16
|
+
doc = Nokogiri::XML(attributes[:http_fetcher].get!(url))
|
17
17
|
self.new(doc.root, attributes).parse!
|
18
18
|
end
|
19
19
|
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
<feed xmlns="http://www.w3.org/2005/Atom" xmlns:go="http://www.thoughtworks-studios.com/ns/go">
|
2
|
+
<title><![CDATA[defaultPipeline]]></title>
|
3
|
+
<id>http://localhost:8153/go/api/pipelines/defaultPipeline/stages.xml</id>
|
4
|
+
<author>
|
5
|
+
<name>Go</name>
|
6
|
+
</author>
|
7
|
+
<updated>2013-05-23T05:55:18Z</updated>
|
8
|
+
<link rel="self" href="http://localhost:8153/go/api/pipelines/defaultPipeline/stages.xml"/>
|
9
|
+
<entry>
|
10
|
+
<title><![CDATA[defaultPipeline(7) stage FastFeedback(1) Passed]]></title>
|
11
|
+
<updated>2013-05-23T05:55:18Z</updated>
|
12
|
+
<id>http://localhost:8153/go/pipelines/defaultPipeline/7/FastFeedback/1</id>
|
13
|
+
<author>
|
14
|
+
<name><![CDATA[Shishir <shishir.das@gmail.com>]]></name>
|
15
|
+
</author>
|
16
|
+
<link title="FastFeedback Stage Detail" href="http://localhost:8153/go/api/stages/1.xml" rel="alternate" type="application/vnd.go+xml"/>
|
17
|
+
<link title="FastFeedback Stage Detail" href="http://localhost:8153/go/pipelines/defaultPipeline/1/FastFeedback/1" rel="alternate" type="text/html"/>
|
18
|
+
<link title="defaultPipeline Pipeline Detail" href="http://localhost:8153/go/api/pipelines/defaultPipeline/1.xml" rel="http://www.thoughtworks-studios.com/ns/relations/go/pipeline" type="application/vnd.go+xml"/>
|
19
|
+
<link title="defaultPipeline Pipeline Detail" href="http://localhost:8153/go/pipelines/defaultPipeline/1/FastFeedback/1/pipeline" rel="http://www.thoughtworks-studios.com/ns/relations/go/pipeline" type="text/html"/>
|
20
|
+
<category scheme="http://www.thoughtworks-studios.com/ns/categories/go" term="stage" label="Stage"/>
|
21
|
+
<category scheme="http://www.thoughtworks-studios.com/ns/categories/go" term="completed" label="Completed"/>
|
22
|
+
<category scheme="http://www.thoughtworks-studios.com/ns/categories/go" term="passed" label="Passed"/>
|
23
|
+
</entry>
|
24
|
+
</feed>
|
@@ -0,0 +1,24 @@
|
|
1
|
+
<feed xmlns="http://www.w3.org/2005/Atom" xmlns:go="http://www.thoughtworks-studios.com/ns/go">
|
2
|
+
<title><![CDATA[integrationPipeline]]></title>
|
3
|
+
<id>http://localhost:8153/go/api/pipelines/integrationPipeline/stages.xml</id>
|
4
|
+
<author>
|
5
|
+
<name>Go</name>
|
6
|
+
</author>
|
7
|
+
<updated>2013-05-23T05:56:17Z</updated>
|
8
|
+
<link rel="self" href="http://localhost:8153/go/api/pipelines/integrationPipeline/stages.xml"/>
|
9
|
+
<entry>
|
10
|
+
<title><![CDATA[integrationPipeline(7) stage FastFeedback(1) Passed]]></title>
|
11
|
+
<updated>2013-05-23T05:56:17Z</updated>
|
12
|
+
<id>http://localhost:8153/go/pipelines/integrationPipeline/7/FastFeedback/1</id>
|
13
|
+
<author>
|
14
|
+
<name><![CDATA[Shishir <shishir.das@gmail.com>]]></name>
|
15
|
+
</author>
|
16
|
+
<link title="FastFeedback Stage Detail" href="http://localhost:8153/go/api/stages/1.xml" rel="alternate" type="application/vnd.go+xml"/>
|
17
|
+
<link title="FastFeedback Stage Detail" href="http://localhost:8153/go/pipelines/integrationPipeline/1/FastFeedback/1" rel="alternate" type="text/html"/>
|
18
|
+
<link title="integrationPipeline Pipeline Detail" href="http://localhost:8153/go/api/pipelines/integrationPipeline/1.xml" rel="http://www.thoughtworks-studios.com/ns/relations/go/pipeline" type="application/vnd.go+xml"/>
|
19
|
+
<link title="integrationPipeline Pipeline Detail" href="http://localhost:8153/go/pipelines/integrationPipeline/1/FastFeedback/1/pipeline" rel="http://www.thoughtworks-studios.com/ns/relations/go/pipeline" type="text/html"/>
|
20
|
+
<category scheme="http://www.thoughtworks-studios.com/ns/categories/go" term="stage" label="Stage"/>
|
21
|
+
<category scheme="http://www.thoughtworks-studios.com/ns/categories/go" term="completed" label="Completed"/>
|
22
|
+
<category scheme="http://www.thoughtworks-studios.com/ns/categories/go" term="passed" label="Passed"/>
|
23
|
+
</entry>
|
24
|
+
</feed>
|
@@ -0,0 +1,5 @@
|
|
1
|
+
<pipelines>
|
2
|
+
<link rel="self" href="http://localhost:8153/go/api/pipelines.xml"/>
|
3
|
+
<pipeline href="http://localhost:8153/go/api/pipelines/defaultPipeline/stages.xml"/>
|
4
|
+
<pipeline href="http://localhost:8153/go/api/pipelines/integrationPipeline/stages.xml"/>
|
5
|
+
</pipelines>
|
@@ -20,6 +20,20 @@ module GoApiClient
|
|
20
20
|
assert_equal 25*3, feed.entries.count
|
21
21
|
end
|
22
22
|
|
23
|
+
test "should fetch all the pipelines" do
|
24
|
+
stub_request(:get,"https://localhost:8153/go/api/pipelines.xml" ).to_return(:body => file_contents("pipelines.xml"))
|
25
|
+
stub_request(:get,"http://localhost:8153/go/api/pipelines/defaultPipeline/stages.xml" ).to_return(:body => file_contents("default_pipeline.xml"))
|
26
|
+
stub_request(:get,"http://localhost:8153/go/api/pipelines/integrationPipeline/stages.xml" ).to_return(:body => file_contents("integration_pipeline.xml"))
|
27
|
+
|
28
|
+
feeds = GoApiClient::Atom::Feed.new("https://localhost:8153/go/api/pipelines.xml", nil).fetch_all!
|
29
|
+
assert_equal 2, feeds.count
|
30
|
+
assert_equal "http://localhost:8153/go/api/pipelines/defaultPipeline/stages.xml", feeds.keys[0]
|
31
|
+
assert_equal "http://localhost:8153/go/api/pipelines/integrationPipeline/stages.xml", feeds.keys[1]
|
32
|
+
|
33
|
+
assert_equal 1, feeds.values[0].entries.count
|
34
|
+
assert_equal 1, feeds.values[1].entries.count
|
35
|
+
end
|
23
36
|
end
|
37
|
+
|
24
38
|
end
|
25
39
|
end
|
@@ -70,6 +70,27 @@ module GoApiClient
|
|
70
70
|
runs = GoApiClient.runs(:host => "localhost", :port => 8153)
|
71
71
|
|
72
72
|
assert runs.pipelines.empty?
|
73
|
+
|
74
|
+
end
|
75
|
+
|
76
|
+
test "should returns feed data for all pipelines available on the server" do
|
77
|
+
stub_request(:get,"http://localhost:8153/go/api/pipelines.xml" ).to_return(:body => file_contents("pipelines.xml"))
|
78
|
+
|
79
|
+
stub_request(:get,"http://localhost:8153/go/api/pipelines/defaultPipeline/stages.xml" ).to_return(:body => file_contents("default_pipeline.xml"))
|
80
|
+
stub_request(:get, "http://localhost:8153/go/api/pipelines/defaultPipeline/1.xml").to_return(:body => file_contents("pipelines_1.xml"))
|
81
|
+
stub_request(:get, "http://localhost:8153/go/api/stages/1.xml").to_return(:body => file_contents("stages_1.xml"))
|
82
|
+
stub_request(:get, "http://localhost:8153/go/api/jobs/1.xml").to_return(:body => file_contents("jobs_1.xml"))
|
83
|
+
|
84
|
+
|
85
|
+
stub_request(:get,"http://localhost:8153/go/api/pipelines/integrationPipeline/stages.xml" ).to_return(:body => file_contents("integration_pipeline.xml"))
|
86
|
+
stub_request(:get, "http://localhost:8153/go/api/pipelines/integrationPipeline/1.xml").to_return(:body => file_contents("pipelines_1.xml"))
|
87
|
+
stub_request(:get, "http://localhost:8153/go/api/stages/1.xml").to_return(:body => file_contents("stages_1.xml"))
|
88
|
+
stub_request(:get, "http://localhost:8153/go/api/jobs/1.xml").to_return(:body => file_contents("jobs_1.xml"))
|
89
|
+
|
90
|
+
|
91
|
+
|
92
|
+
all_runs = GoApiClient::all_runs({:host => "localhost"})
|
93
|
+
assert_equal all_runs.keys, %w(http://localhost:8153/go/api/pipelines/defaultPipeline/stages.xml http://localhost:8153/go/api/pipelines/integrationPipeline/stages.xml)
|
73
94
|
end
|
74
95
|
end
|
75
96
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: go_api_client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.5.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -11,7 +11,7 @@ authors:
|
|
11
11
|
autorequire:
|
12
12
|
bindir: bin
|
13
13
|
cert_chain: []
|
14
|
-
date: 2013-
|
14
|
+
date: 2013-05-28 00:00:00.000000000 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: webmock
|
@@ -104,6 +104,7 @@ extensions: []
|
|
104
104
|
extra_rdoc_files: []
|
105
105
|
files:
|
106
106
|
- .gitignore
|
107
|
+
- .init.sh
|
107
108
|
- .rvmrc
|
108
109
|
- .yardopts
|
109
110
|
- Gemfile
|
@@ -123,6 +124,7 @@ files:
|
|
123
124
|
- lib/go_api_client/helpers/simple_attribute_support.rb
|
124
125
|
- lib/go_api_client/http_fetcher.rb
|
125
126
|
- lib/go_api_client/job.rb
|
127
|
+
- lib/go_api_client/logger.rb
|
126
128
|
- lib/go_api_client/pipeline.rb
|
127
129
|
- lib/go_api_client/stage.rb
|
128
130
|
- lib/go_api_client/user.rb
|
@@ -139,6 +141,8 @@ files:
|
|
139
141
|
- test/fixtures/building/stages_2.xml
|
140
142
|
- test/fixtures/building/stages_3.xml
|
141
143
|
- test/fixtures/building/stages_4.xml
|
144
|
+
- test/fixtures/default_pipeline.xml
|
145
|
+
- test/fixtures/integration_pipeline.xml
|
142
146
|
- test/fixtures/job_1_console.log.txt
|
143
147
|
- test/fixtures/job_2_console.log.txt
|
144
148
|
- test/fixtures/jobs_1.xml
|
@@ -174,6 +178,7 @@ files:
|
|
174
178
|
- test/fixtures/pagination/stages.xml
|
175
179
|
- test/fixtures/pagination/stages_before_7916973.xml
|
176
180
|
- test/fixtures/pagination/stages_before_7959831.xml
|
181
|
+
- test/fixtures/pipelines.xml
|
177
182
|
- test/fixtures/pipelines_1.xml
|
178
183
|
- test/fixtures/stages.xml
|
179
184
|
- test/fixtures/stages_1.xml
|
@@ -193,7 +198,8 @@ files:
|
|
193
198
|
- test/schedule_test.rb
|
194
199
|
- test/test_helper.rb
|
195
200
|
homepage: https://github.com/ThoughtWorksInc/go-api-client
|
196
|
-
licenses:
|
201
|
+
licenses:
|
202
|
+
- MIT
|
197
203
|
post_install_message:
|
198
204
|
rdoc_options: []
|
199
205
|
require_paths:
|
@@ -204,21 +210,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
204
210
|
- - ! '>='
|
205
211
|
- !ruby/object:Gem::Version
|
206
212
|
version: '0'
|
207
|
-
segments:
|
208
|
-
- 0
|
209
|
-
hash: 4219299069108051820
|
210
213
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
211
214
|
none: false
|
212
215
|
requirements:
|
213
216
|
- - ! '>='
|
214
217
|
- !ruby/object:Gem::Version
|
215
218
|
version: '0'
|
216
|
-
segments:
|
217
|
-
- 0
|
218
|
-
hash: 4219299069108051820
|
219
219
|
requirements: []
|
220
220
|
rubyforge_project: go_api_client
|
221
|
-
rubygems_version: 1.8.
|
221
|
+
rubygems_version: 1.8.23
|
222
222
|
signing_key:
|
223
223
|
specification_version: 3
|
224
224
|
summary: Client to parse Go CI atom feed
|
@@ -235,6 +235,8 @@ test_files:
|
|
235
235
|
- test/fixtures/building/stages_2.xml
|
236
236
|
- test/fixtures/building/stages_3.xml
|
237
237
|
- test/fixtures/building/stages_4.xml
|
238
|
+
- test/fixtures/default_pipeline.xml
|
239
|
+
- test/fixtures/integration_pipeline.xml
|
238
240
|
- test/fixtures/job_1_console.log.txt
|
239
241
|
- test/fixtures/job_2_console.log.txt
|
240
242
|
- test/fixtures/jobs_1.xml
|
@@ -270,6 +272,7 @@ test_files:
|
|
270
272
|
- test/fixtures/pagination/stages.xml
|
271
273
|
- test/fixtures/pagination/stages_before_7916973.xml
|
272
274
|
- test/fixtures/pagination/stages_before_7959831.xml
|
275
|
+
- test/fixtures/pipelines.xml
|
273
276
|
- test/fixtures/pipelines_1.xml
|
274
277
|
- test/fixtures/stages.xml
|
275
278
|
- test/fixtures/stages_1.xml
|