jenkins_api_client 0.14.0 → 0.14.1

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG.md CHANGED
@@ -4,6 +4,10 @@ CHANGELOG
4
4
  upcoming
5
5
  --------
6
6
 
7
+ v0.14.1 [18-AUG-2013]
8
+ ----------------------
9
+ * Fixed a bug in Job#create_or_update method. Credit: @bobbrez
10
+
7
11
  v0.14.0 [07-AUG-2013]
8
12
  ----------------------
9
13
  * Fixed a bug where a space was missing in the exec_cli method argument list.
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = "jenkins_api_client"
8
- s.version = "0.14.0"
8
+ s.version = "0.14.1"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Kannan Manickam"]
12
- s.date = "2013-08-08"
12
+ s.date = "2013-08-19"
13
13
  s.description = "\nThis is a simple and easy-to-use Jenkins Api client with features focused on\nautomating Job configuration programaticaly and so forth"
14
14
  s.email = ["arangamani.kannan@gmail.com"]
15
15
  s.executables = ["jenkinscli"]
@@ -55,7 +55,7 @@ module JenkinsApi
55
55
  # @return [String] the HTTP status code from the POST request
56
56
  #
57
57
  def create_or_update(job_name, xml)
58
- if exists?(name)
58
+ if exists?(job_name)
59
59
  update(job_name, xml)
60
60
  else
61
61
  create(job_name, xml)
@@ -27,7 +27,7 @@ module JenkinsApi
27
27
  # Minor version of the gem
28
28
  MINOR = 14
29
29
  # Tiny version of the gem used for patches
30
- TINY = 0
30
+ TINY = 1
31
31
  # Used for pre-releases
32
32
  PRE = nil
33
33
  # Version String of Jenkins API Client.
@@ -37,6 +37,32 @@ describe JenkinsApi::Client::Job do
37
37
  end
38
38
  end
39
39
 
40
+ describe "#create_or_update" do
41
+ it "creates jobs if they do not exist" do
42
+ job_name = 'test_job'
43
+ xml = '<name>somename</name>'
44
+
45
+ mock_job_list_response = { "jobs" => [] } # job response w/ 0 jobs
46
+
47
+ @client.should_receive(:api_get_request).with('').and_return(mock_job_list_response)
48
+ @job.should_receive(:create).with(job_name, xml).and_return(nil)
49
+
50
+ @job.create_or_update(job_name, xml)
51
+ end
52
+
53
+ it "updates existing jobs if they exist" do
54
+ job_name = 'test_job'
55
+ xml = '<name>somename</name>'
56
+
57
+ mock_job_list_response = { "jobs" => [ { "name" => job_name } ] } # job response w/ 1 job
58
+
59
+ @client.should_receive(:api_get_request).with('').and_return(mock_job_list_response)
60
+ @job.should_receive(:update).with(job_name, xml).and_return(nil)
61
+
62
+ @job.create_or_update(job_name, xml)
63
+ end
64
+ end
65
+
40
66
  describe "#create_freestyle" do
41
67
  it "creates a simple freestyle job" do
42
68
  params = {
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jenkins_api_client
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.14.0
4
+ version: 0.14.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-08-08 00:00:00.000000000 Z
12
+ date: 2013-08-19 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: nokogiri
@@ -251,7 +251,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
251
251
  version: '0'
252
252
  segments:
253
253
  - 0
254
- hash: -2522134501944430216
254
+ hash: 2979339971375720651
255
255
  required_rubygems_version: !ruby/object:Gem::Requirement
256
256
  none: false
257
257
  requirements: