subordinate 0.1.1 → 0.2.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/README.md
CHANGED
@@ -79,6 +79,36 @@ Currently can safe restart, restart, and quiet down
|
|
79
79
|
client.restart
|
80
80
|
```
|
81
81
|
|
82
|
+
### [Build Queue](http://rdoc.info/github/jasontruluck/subordinate/master/Subordinate/Client/Queue)
|
83
|
+
|
84
|
+
Retrieves the current build queue for the Jenkins server
|
85
|
+
|
86
|
+
```ruby
|
87
|
+
client.build_queue
|
88
|
+
```
|
89
|
+
|
90
|
+
### Using Depth query parameter
|
91
|
+
|
92
|
+
For methods that allow you to specify a depth simply pass the depth you want via an option
|
93
|
+
|
94
|
+
```ruby
|
95
|
+
client.job("My-awesome-job", {:depth => 1})
|
96
|
+
```
|
97
|
+
|
98
|
+
The default depth is 0 for all methods.
|
99
|
+
|
100
|
+
### Using Tree query parameters
|
101
|
+
|
102
|
+
`tree` parameters are more efficient than using depth with exclude. They are available ot any methods that except them via options as well
|
103
|
+
|
104
|
+
```ruby
|
105
|
+
client.root({:tree => "jobs[name],views[name,jobs[name]]"})
|
106
|
+
```
|
107
|
+
|
108
|
+
A note from Jenkins: for array-type properties (such as jobs in this example), the name must be given in the original plural, not in the singular as the element would appear in XML (<job>). This will be more natural for e.g. json?tree=jobs[name] anyway: the JSON writer does not do plural-to-singular mangling because arrays are represented explicitly.
|
109
|
+
|
110
|
+
Please see the [docs](https://ci.jenkins-ci.org/api/) for more info on tree parameters
|
111
|
+
|
82
112
|
## Testing
|
83
113
|
|
84
114
|
This gem uses VCR to record requests to the api so you must test using a valid Jenkins server and credentails to test
|
data/lib/subordinate/client.rb
CHANGED
@@ -7,6 +7,7 @@ require "subordinate/client/job"
|
|
7
7
|
require "subordinate/client/system"
|
8
8
|
require "subordinate/client/build"
|
9
9
|
require "subordinate/client/queue"
|
10
|
+
require "subordinate/client/load"
|
10
11
|
|
11
12
|
module Subordinate
|
12
13
|
class Client
|
@@ -43,5 +44,6 @@ module Subordinate
|
|
43
44
|
include Subordinate::Client::System
|
44
45
|
include Subordinate::Client::Build
|
45
46
|
include Subordinate::Client::Queue
|
47
|
+
include Subordinate::Client::Load
|
46
48
|
end
|
47
49
|
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
# Load
|
2
|
+
module Subordinate
|
3
|
+
class Client
|
4
|
+
# Load statistics
|
5
|
+
#
|
6
|
+
# @see https://ci.jenkins-ci.org/job/jenkins_rc_branch/api/
|
7
|
+
module Load
|
8
|
+
# Returns the current load statistics of the Jenkins server
|
9
|
+
#
|
10
|
+
# @see http://jenkins.missioncontrol.io:8080/queue/api/
|
11
|
+
#
|
12
|
+
# @return [Hashie::Mash] load statistics response
|
13
|
+
#
|
14
|
+
# @example Get the current load statistics
|
15
|
+
# Subordinate::Client.load_statistics
|
16
|
+
#
|
17
|
+
# @author Jason Truluck
|
18
|
+
def load_statistics(options = {})
|
19
|
+
get("overallLoad/api/json", options)
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
data/lib/subordinate/version.rb
CHANGED
@@ -0,0 +1,43 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
auth = YAML::load(File.open(File.expand_path("../../../fixtures/authentications.yml", __FILE__)))
|
4
|
+
|
5
|
+
# Queue Spec
|
6
|
+
describe Subordinate::Client do
|
7
|
+
before do
|
8
|
+
Subordinate.reset!
|
9
|
+
Subordinate.configure do |c|
|
10
|
+
c.subdomain = auth["subdomain"]
|
11
|
+
c.domain = auth["domain"]
|
12
|
+
c.port = auth["port"]
|
13
|
+
c.ssl = false
|
14
|
+
end
|
15
|
+
end
|
16
|
+
let(:subordinate) { Subordinate::Client.new(:username => auth["username"], :api_token => auth["token"]) }
|
17
|
+
|
18
|
+
describe "#load_statistics", :vcr do
|
19
|
+
let(:current_response) { subordinate.load_statistics }
|
20
|
+
|
21
|
+
it "returns the load statistics response" do
|
22
|
+
current_response.should_not be_nil
|
23
|
+
end
|
24
|
+
|
25
|
+
context "methods" do
|
26
|
+
it "responds to .busyExecutors" do
|
27
|
+
current_response.should respond_to(:busyExecutors)
|
28
|
+
end
|
29
|
+
|
30
|
+
it "responds to .queueLength" do
|
31
|
+
current_response.should respond_to(:queueLength)
|
32
|
+
end
|
33
|
+
|
34
|
+
it "responds to .totalExecutors" do
|
35
|
+
current_response.should respond_to(:totalExecutors)
|
36
|
+
end
|
37
|
+
|
38
|
+
it "responds to .totalQueueLength" do
|
39
|
+
current_response.should respond_to(:totalQueueLength)
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
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.
|
4
|
+
version: 0.2.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -220,6 +220,7 @@ files:
|
|
220
220
|
- lib/subordinate/client.rb
|
221
221
|
- lib/subordinate/client/build.rb
|
222
222
|
- lib/subordinate/client/job.rb
|
223
|
+
- lib/subordinate/client/load.rb
|
223
224
|
- lib/subordinate/client/queue.rb
|
224
225
|
- lib/subordinate/client/system.rb
|
225
226
|
- lib/subordinate/configuration.rb
|
@@ -230,6 +231,7 @@ files:
|
|
230
231
|
- spec/spec_helper.rb
|
231
232
|
- spec/subordinate/client/build_spec.rb
|
232
233
|
- spec/subordinate/client/job_spec.rb
|
234
|
+
- spec/subordinate/client/load_spec.rb
|
233
235
|
- spec/subordinate/client/queue_spec.rb
|
234
236
|
- spec/subordinate/client/system_spec.rb
|
235
237
|
- spec/subordinate/client_spec.rb
|
@@ -248,7 +250,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
248
250
|
version: '0'
|
249
251
|
segments:
|
250
252
|
- 0
|
251
|
-
hash: -
|
253
|
+
hash: -3274379220519707228
|
252
254
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
253
255
|
none: false
|
254
256
|
requirements:
|
@@ -257,7 +259,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
257
259
|
version: '0'
|
258
260
|
segments:
|
259
261
|
- 0
|
260
|
-
hash: -
|
262
|
+
hash: -3274379220519707228
|
261
263
|
requirements: []
|
262
264
|
rubyforge_project:
|
263
265
|
rubygems_version: 1.8.24
|
@@ -269,6 +271,7 @@ test_files:
|
|
269
271
|
- spec/spec_helper.rb
|
270
272
|
- spec/subordinate/client/build_spec.rb
|
271
273
|
- spec/subordinate/client/job_spec.rb
|
274
|
+
- spec/subordinate/client/load_spec.rb
|
272
275
|
- spec/subordinate/client/queue_spec.rb
|
273
276
|
- spec/subordinate/client/system_spec.rb
|
274
277
|
- spec/subordinate/client_spec.rb
|