jenkins_api_client 1.2.0 → 1.3.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ae6ba9e0eccf49a825c6adc02e7d6d3a6200ac9d
4
- data.tar.gz: eeb2d4cfb1d2858e157c74aa6b146ba572bf7246
3
+ metadata.gz: 58d034d4ed3f397f82ac0db50f4bdd3f955e162c
4
+ data.tar.gz: 96e93335ff4401d5077def1902fe7211c054351b
5
5
  SHA512:
6
- metadata.gz: 7e6088e2b7231336b556fca98788f58be9abb0d68a739ecc73789adf22f23532519cd7f08b7b4e7ed9d5f5a96db24de9ef3f303752e14784aae91e9a129d9acc
7
- data.tar.gz: 148deba58cb95bb445af9b232613c740648590def0e96cfdb4bc5c7cb6687a68e17682cf8c3f9408e5ae086ecec5bb69240017547c0872a71a5376e071b77aa8
6
+ metadata.gz: 7c286e0b68b5db499f97e2fac0545678127303d796c6bd29be9afabab715a23c6d4219b97b3b5e07427cfe818703a3bbe6dbf1e66caa3b56fd1a2e985fdd869c
7
+ data.tar.gz: 81ef02baf6791a223e5ba72337d4ecfd040d332c51660d1137628df691affac6b011851e04bd4f07b45a535281a36c4dad152650518f90bc0c77f2de5d7ad127
data/CHANGELOG.md CHANGED
@@ -4,6 +4,11 @@ CHANGELOG
4
4
  upcoming
5
5
  --------
6
6
 
7
+ v1.3.0 [03-JAN-2015]
8
+ ----------------------
9
+ * [#159][] Add ability to configure git tool for a job. Credit: [@hubert][]
10
+ * [#163][] Improve performance by using the `tree` parameter. Credit: [@stjohnjohnson][]
11
+
7
12
  v1.2.0 [12-NOV-2014]
8
13
  ----------------------
9
14
  * [#156][] Added workspace cleanup plugin. Credit [@hubert][]
@@ -294,6 +299,8 @@ v0.0.1 [15-OCT-2012]
294
299
  [#156]: https://github.com/arangamani/jenkins_api_client/issues/156
295
300
  [#157]: https://github.com/arangamani/jenkins_api_client/issues/157
296
301
  [#158]: https://github.com/arangamani/jenkins_api_client/issues/158
302
+ [#159]: https://github.com/arangamani/jenkins_api_client/issues/159
303
+ [#163]: https://github.com/arangamani/jenkins_api_client/issues/163
297
304
  [@Loa]: https://github.com/Loa
298
305
  [@Niarfe]: https://github.com/Niarfe
299
306
  [@bobbrez]: https://github.com/bobbrez
@@ -319,6 +326,7 @@ v0.0.1 [15-OCT-2012]
319
326
  [@rubytester]: https://github.com/rubytester
320
327
  [@scotje]: https://github.com/scotje
321
328
  [@spikegrobstein]: https://github.com/spikegrobstein
329
+ [@stjohnjohnson]: https://github.com/stjohnjohnson
322
330
  [@sunaot]: https://github.com/sunaot
323
331
  [@tjhanley]: https://github.com/tjhanley
324
332
  [@woodbusy]: https://github.com/woodbusy
@@ -2,16 +2,16 @@
2
2
  # DO NOT EDIT THIS FILE DIRECTLY
3
3
  # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
4
  # -*- encoding: utf-8 -*-
5
- # stub: jenkins_api_client 1.2.0 ruby lib
5
+ # stub: jenkins_api_client 1.3.0 ruby lib
6
6
 
7
7
  Gem::Specification.new do |s|
8
8
  s.name = "jenkins_api_client"
9
- s.version = "1.2.0"
9
+ s.version = "1.3.0"
10
10
 
11
11
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
12
12
  s.require_paths = ["lib"]
13
13
  s.authors = ["Kannan Manickam"]
14
- s.date = "2014-11-13"
14
+ s.date = "2015-01-03"
15
15
  s.description = "\nThis is a simple and easy-to-use Jenkins Api client with features focused on\nautomating Job configuration programaticaly and so forth"
16
16
  s.email = ["arangamani.kannan@gmail.com"]
17
17
  s.executables = ["jenkinscli"]
@@ -489,7 +489,7 @@ module JenkinsApi
489
489
  # @return [Boolean] whether Jenkins uses crumbs or not
490
490
  #
491
491
  def use_crumbs?
492
- response = api_get_request("")
492
+ response = api_get_request("", "tree=useCrumbs")
493
493
  response["useCrumbs"]
494
494
  end
495
495
 
@@ -498,7 +498,7 @@ module JenkinsApi
498
498
  # @return [Boolean] whether Jenkins uses security or not
499
499
  #
500
500
  def use_security?
501
- response = api_get_request("")
501
+ response = api_get_request("", "tree=useSecurity")
502
502
  response["useSecurity"]
503
503
  end
504
504
 
@@ -141,6 +141,8 @@ module JenkinsApi
141
141
  # the remote url for the selected scm provider
142
142
  # @option params [String] :scm_credentials_id
143
143
  # the id of the credentials to use for authenticating with scm. Only for "git"
144
+ # @option params [String] :scm_git_tool
145
+ # the git executable. Defaults to "Default"; only for "git"
144
146
  # @option params [String] :scm_module
145
147
  # the module to download. Only for use with "cvs" scm provider
146
148
  # @option params [String] :scm_branch (master)
@@ -1619,7 +1621,7 @@ module JenkinsApi
1619
1621
  xml.useShallowClone "false"
1620
1622
  xml.buildChooser(:class =>
1621
1623
  "hudson.plugins.git.util.DefaultBuildChooser")
1622
- xml.gitTool "Default"
1624
+ xml.gitTool params.fetch(:scm_git_tool) { "Default" }
1623
1625
  xml.submoduleCfg(:class => "list")
1624
1626
  xml.relativeTargetDir
1625
1627
  xml.reference
@@ -25,7 +25,7 @@ module JenkinsApi
25
25
  # Major version of the gem
26
26
  MAJOR = 1
27
27
  # Minor version of the gem
28
- MINOR = 2
28
+ MINOR = 3
29
29
  # Tiny version of the gem used for patches
30
30
  TINY = 0
31
31
  # Used for pre-releases
@@ -184,7 +184,7 @@ module JenkinsApi
184
184
  def list(filter = "", ignorecase = true)
185
185
  @logger.info "Obtaining views based on filter '#{filter}'"
186
186
  view_names = []
187
- response_json = @client.api_get_request("")
187
+ response_json = @client.api_get_request("", "tree=views[name]")
188
188
  response_json["views"].each { |view|
189
189
  if ignorecase
190
190
  view_names << view["name"] if view["name"] =~ /#{filter}/i
@@ -319,6 +319,46 @@ describe JenkinsApi::Client do
319
319
  @client.compare_versions("1.0.10", "1.0.2").should eql(1)
320
320
  end
321
321
  end
322
+
323
+ describe "#use_crumbs?" do
324
+ it "returns true if the server has useCrumbs on" do
325
+ expect(@client).to receive(:api_get_request).with("", "tree=useCrumbs") {
326
+ {
327
+ "useCrumbs" => true
328
+ }
329
+ }
330
+ @client.use_crumbs?.should == true
331
+ end
332
+
333
+ it "returns false if the server has useCrumbs off" do
334
+ expect(@client).to receive(:api_get_request).with("", "tree=useCrumbs") {
335
+ {
336
+ "useCrumbs" => false
337
+ }
338
+ }
339
+ @client.use_crumbs?.should == false
340
+ end
341
+ end
342
+
343
+ describe "#use_security?" do
344
+ it "returns true if the server has useSecurity on" do
345
+ expect(@client).to receive(:api_get_request).with("", "tree=useSecurity") {
346
+ {
347
+ "useSecurity" => true
348
+ }
349
+ }
350
+ @client.use_security?.should == true
351
+ end
352
+
353
+ it "returns false if the server has useSecurity off" do
354
+ expect(@client).to receive(:api_get_request).with("", "tree=useSecurity") {
355
+ {
356
+ "useSecurity" => false
357
+ }
358
+ }
359
+ @client.use_security?.should == false
360
+ end
361
+ end
322
362
  end
323
363
  end
324
364
 
@@ -618,7 +618,12 @@ describe JenkinsApi::Client::Job do
618
618
 
619
619
  describe '#scm_git' do
620
620
  before do
621
- @job.send(:scm_git, {scm_url: 'http://foo.bar', scm_credentials_id: 'foobar', scm_branch: 'master'}, xml_builder=Nokogiri::XML::Builder.new(:encoding => 'UTF-8'))
621
+ @job.send(:scm_git, {
622
+ scm_url: 'http://foo.bar',
623
+ scm_credentials_id: 'foobar',
624
+ scm_branch: 'master',
625
+ scm_git_tool: 'Git_NoPath',
626
+ }, xml_builder=Nokogiri::XML::Builder.new(:encoding => 'UTF-8'))
622
627
  @xml_config = Nokogiri::XML(xml_builder.to_xml)
623
628
  end
624
629
 
@@ -633,6 +638,10 @@ describe JenkinsApi::Client::Job do
633
638
  it 'adds branch to scm branches' do
634
639
  expect(@xml_config.at_css('scm branches name').content).to eql('master')
635
640
  end
641
+
642
+ it 'adds gitTool to scm tag' do
643
+ expect(@xml_config.at_css('scm gitTool').content).to eql('Git_NoPath')
644
+ end
636
645
  end
637
646
  end
638
647
 
@@ -23,7 +23,7 @@ describe JenkinsApi::Client::View do
23
23
 
24
24
  describe "InstanceMethods" do
25
25
  describe "#initialize" do
26
- it "initializes by receiving an instane of client object" do
26
+ it "initializes by receiving an instance of client object" do
27
27
  mock_logger = Logger.new "/dev/null"
28
28
  @client.should_receive(:logger).and_return(mock_logger)
29
29
  expect(
@@ -48,21 +48,21 @@ describe JenkinsApi::Client::View do
48
48
 
49
49
  describe "#list" do
50
50
  it "lists all views" do
51
- @client.should_receive(:api_get_request).with("").and_return(@sample_views_json)
51
+ @client.should_receive(:api_get_request).with("", "tree=views[name]").and_return(@sample_views_json)
52
52
  response = @view.list
53
53
  response.class.should == Array
54
54
  response.size.should == 2
55
55
  end
56
56
 
57
57
  it "lists views matching specific filter" do
58
- @client.should_receive(:api_get_request).with("").and_return(@sample_views_json)
58
+ @client.should_receive(:api_get_request).with("", "tree=views[name]").and_return(@sample_views_json)
59
59
  response = @view.list("test_view2")
60
60
  response.class.should == Array
61
61
  response.size.should == 1
62
62
  end
63
63
 
64
64
  it "lists views matching specific filter and matches case" do
65
- @client.should_receive(:api_get_request).with("").and_return(@sample_views_json)
65
+ @client.should_receive(:api_get_request).with("", "tree=views[name]").and_return(@sample_views_json)
66
66
  response = @view.list("TEST_VIEW", false)
67
67
  response.class.should == Array
68
68
  response.size.should == 0
@@ -71,19 +71,19 @@ describe JenkinsApi::Client::View do
71
71
 
72
72
  describe "#exists?" do
73
73
  it "returns true a view that exists" do
74
- @client.should_receive(:api_get_request).with("").and_return(@sample_views_json)
74
+ @client.should_receive(:api_get_request).with("", "tree=views[name]").and_return(@sample_views_json)
75
75
  @view.exists?("test_view2").should == true
76
76
  end
77
77
 
78
78
  it "returns false for non-existent view" do
79
- @client.should_receive(:api_get_request).with("").and_return(@sample_views_json)
79
+ @client.should_receive(:api_get_request).with("", "tree=views[name]").and_return(@sample_views_json)
80
80
  @view.exists?("i_am_not_there").should == false
81
81
  end
82
82
  end
83
83
 
84
84
  describe "#list_jobs" do
85
85
  it "lists all jobs in the given view" do
86
- @client.should_receive(:api_get_request).with("").and_return(@sample_views_json)
86
+ @client.should_receive(:api_get_request).with("", "tree=views[name]").and_return(@sample_views_json)
87
87
  @client.should_receive(:api_get_request).with("/view/test_view").and_return(@sample_view_json)
88
88
  response = @view.list_jobs("test_view")
89
89
  response.class.should == Array
@@ -91,7 +91,7 @@ describe JenkinsApi::Client::View do
91
91
  end
92
92
 
93
93
  it "raises an error if called on a non-existent view" do
94
- @client.should_receive(:api_get_request).with("").and_return(@sample_views_json)
94
+ @client.should_receive(:api_get_request).with("", "tree=views[name]").and_return(@sample_views_json)
95
95
  expect(
96
96
  lambda { @view.list_jobs("i_am_not_there") }
97
97
  ).to raise_error
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jenkins_api_client
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.0
4
+ version: 1.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kannan Manickam
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-11-13 00:00:00.000000000 Z
11
+ date: 2015-01-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: nokogiri