subordinate 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/subordinate/client/build.rb +3 -3
- data/lib/subordinate/client.rb +0 -1
- data/lib/subordinate/configuration.rb +1 -3
- data/lib/subordinate/version.rb +1 -1
- data/spec/subordinate/client/build_spec.rb +23 -2
- data/spec/subordinate/client/job_spec.rb +1 -1
- data/spec/subordinate/client/queue_spec.rb +1 -1
- data/spec/subordinate/client/system_spec.rb +1 -1
- data/spec/subordinate/client_spec.rb +47 -1
- metadata +3 -3
@@ -72,12 +72,12 @@ module Subordinate
|
|
72
72
|
# @author Jason Truluck
|
73
73
|
def console_output_for_build(job, build_number, start_offset = 0, pre = false, options = {})
|
74
74
|
options.merge!(
|
75
|
-
:start => start_offset
|
75
|
+
:start => start_offset.to_i # Convert to Integer in case of nil
|
76
76
|
)
|
77
77
|
if pre
|
78
|
-
get("job/#{job}/#{build_number}/logText/
|
78
|
+
get("job/#{job}/#{build_number}/logText/progressiveHtml", options)
|
79
79
|
else
|
80
|
-
get("job/#{job}/#{build_number}/logText/
|
80
|
+
get("job/#{job}/#{build_number}/logText/progressiveText", options)
|
81
81
|
end
|
82
82
|
end
|
83
83
|
end
|
data/lib/subordinate/client.rb
CHANGED
@@ -32,7 +32,6 @@ module Subordinate
|
|
32
32
|
endpoint = ssl ? "https://" : "http://"
|
33
33
|
endpoint << "#{self.username}:#{self.api_token}@" if self.authenticated?
|
34
34
|
endpoint << "#{self.subdomain}.#{self.domain}:#{self.port}"
|
35
|
-
endpoint << "?depth=#{self.depth}" if !depth.nil?
|
36
35
|
self.api_endpoint = endpoint
|
37
36
|
end
|
38
37
|
|
@@ -8,8 +8,7 @@ module Subordinate
|
|
8
8
|
:domain,
|
9
9
|
:subdomain,
|
10
10
|
:port,
|
11
|
-
:ssl
|
12
|
-
:depth
|
11
|
+
:ssl
|
13
12
|
]
|
14
13
|
|
15
14
|
attr_accessor(*VALID_OPTIONS_KEYS)
|
@@ -29,7 +28,6 @@ module Subordinate
|
|
29
28
|
self.subdomain = nil
|
30
29
|
self.port = nil
|
31
30
|
self.ssl = true
|
32
|
-
self.depth = nil
|
33
31
|
end
|
34
32
|
end
|
35
33
|
end
|
data/lib/subordinate/version.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
require "spec_helper"
|
2
2
|
|
3
|
-
auth =
|
3
|
+
auth = YAML::load(File.open(File.expand_path("../../../fixtures/authentications.yml", __FILE__)))
|
4
4
|
|
5
5
|
# Client Spec
|
6
6
|
describe Subordinate::Client do
|
@@ -112,7 +112,28 @@ describe Subordinate::Client do
|
|
112
112
|
|
113
113
|
describe "#console_output_for_build", :vcr do
|
114
114
|
it "returns the console output for a complete build" do
|
115
|
-
subordinate.console_output_for_build(auth["job"], 1)
|
115
|
+
response = subordinate.console_output_for_build(auth["job"], 1)
|
116
|
+
response.should_not be_nil
|
117
|
+
response.should_not include("javax.servlet.ServletException:")
|
118
|
+
end
|
119
|
+
|
120
|
+
it "returns pre-formatted output" do
|
121
|
+
response = subordinate.console_output_for_build(auth["job"], 1, nil, true)
|
122
|
+
response.should_not be_nil
|
123
|
+
response.should_not include("javax.servlet.ServletException:")
|
124
|
+
end
|
125
|
+
|
126
|
+
context "byte size arguement" do
|
127
|
+
it "returns data at byte 2000" do
|
128
|
+
subordinate.console_output_for_build(auth["job"], 1, 2000).should_not be_nil
|
129
|
+
end
|
130
|
+
|
131
|
+
it "when passed an offset of 2000 it is offset by 2000 bytes" do
|
132
|
+
output1 = subordinate.console_output_for_build(auth["job"], 1, 2000)
|
133
|
+
output2 = subordinate.console_output_for_build(auth["job"], 1, 0)
|
134
|
+
|
135
|
+
output1.bytesize.should < output2.bytesize
|
136
|
+
end
|
116
137
|
end
|
117
138
|
end
|
118
139
|
end
|
@@ -1,6 +1,6 @@
|
|
1
1
|
require "spec_helper"
|
2
2
|
|
3
|
-
auth =
|
3
|
+
auth = YAML::load(File.open(File.expand_path("../../../fixtures/authentications.yml", __FILE__)))
|
4
4
|
|
5
5
|
# Client Spec
|
6
6
|
describe Subordinate::Client do
|
@@ -1,6 +1,6 @@
|
|
1
1
|
require "spec_helper"
|
2
2
|
|
3
|
-
auth =
|
3
|
+
auth = YAML::load(File.open(File.expand_path("../../../fixtures/authentications.yml", __FILE__)))
|
4
4
|
|
5
5
|
# Queue Spec
|
6
6
|
describe Subordinate::Client do
|
@@ -1,6 +1,6 @@
|
|
1
1
|
require "spec_helper"
|
2
2
|
|
3
|
-
auth =
|
3
|
+
auth = YAML::load(File.open(File.expand_path("../../../fixtures/authentications.yml", __FILE__)))
|
4
4
|
|
5
5
|
# Client Spec
|
6
6
|
describe Subordinate::Client do
|
@@ -1,6 +1,6 @@
|
|
1
1
|
require "spec_helper"
|
2
2
|
|
3
|
-
auth =
|
3
|
+
auth = YAML::load(File.open(File.expand_path("../../fixtures/authentications.yml", __FILE__)))
|
4
4
|
|
5
5
|
# Client Spec
|
6
6
|
describe Subordinate::Client do
|
@@ -19,10 +19,56 @@ describe Subordinate::Client do
|
|
19
19
|
Subordinate::Client.new.class.should == Subordinate::Client
|
20
20
|
end
|
21
21
|
|
22
|
+
it "is aliased within itself" do
|
23
|
+
Subordinate.new.class.should == Subordinate::Client
|
24
|
+
end
|
25
|
+
|
22
26
|
it "works with basic username and api token", :vcr do
|
23
27
|
Subordinate::Client.new(:username => auth["username"], :api_token => auth["token"]).root
|
24
28
|
.should_not
|
25
29
|
raise_exception
|
26
30
|
end
|
31
|
+
|
32
|
+
it "can be configured to use a new domain via options" do
|
33
|
+
domain = "woofound.com"
|
34
|
+
client = Subordinate::Client.new(:api_key => ENV["API_KEY"], :domain => domain )
|
35
|
+
client.domain.should == domain
|
36
|
+
end
|
37
|
+
|
38
|
+
it "can be configured to use a new subdomain via options" do
|
39
|
+
subdomain = "awesome"
|
40
|
+
client = Subordinate::Client.new(:api_key => ENV["API_KEY"], :subdomain => subdomain )
|
41
|
+
client.subdomain.should == subdomain
|
42
|
+
end
|
43
|
+
|
44
|
+
it "can be configured to use a new port via options" do
|
45
|
+
port = 2000
|
46
|
+
client = Subordinate::Client.new(:api_key => ENV["API_KEY"], :port => port )
|
47
|
+
client.port.should == port
|
48
|
+
end
|
49
|
+
|
50
|
+
it "can be configured to use a different ssl option via options" do
|
51
|
+
ssl = false
|
52
|
+
client = Subordinate::Client.new(:api_key => ENV["API_KEY"], :ssl => ssl )
|
53
|
+
client.ssl.should == ssl
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
57
|
+
describe "#respond_to?" do
|
58
|
+
it "returns true if the method exists" do
|
59
|
+
Subordinate.respond_to?(:build_queue).should == true
|
60
|
+
end
|
61
|
+
|
62
|
+
it "returns false if the method does not exists" do
|
63
|
+
Subordinate.respond_to?(:missing_method).should == false
|
64
|
+
end
|
65
|
+
|
66
|
+
it "can check private methods if the 'include_private' flag is true" do
|
67
|
+
Subordinate.respond_to?(:request, true).should == true
|
68
|
+
end
|
69
|
+
|
70
|
+
it "can not check private methods if the 'include_private' flag is false" do
|
71
|
+
Subordinate.respond_to?(:request, false).should == false
|
72
|
+
end
|
27
73
|
end
|
28
74
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: subordinate
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -248,7 +248,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
248
248
|
version: '0'
|
249
249
|
segments:
|
250
250
|
- 0
|
251
|
-
hash: -
|
251
|
+
hash: -1032835890192964007
|
252
252
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
253
253
|
none: false
|
254
254
|
requirements:
|
@@ -257,7 +257,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
257
257
|
version: '0'
|
258
258
|
segments:
|
259
259
|
- 0
|
260
|
-
hash: -
|
260
|
+
hash: -1032835890192964007
|
261
261
|
requirements: []
|
262
262
|
rubyforge_project:
|
263
263
|
rubygems_version: 1.8.24
|