jenkins_api_client 1.0.0.beta.5 → 1.0.0.beta.6

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -1,9 +1,15 @@
1
1
  Jenkins API Client
2
2
  ==================
3
- [![Gem Version](https://badge.fury.io/rb/jenkins_api_client.png)](http://rubygems.org/gems/jenkins_api_client)
4
- [![Build Status](https://travis-ci.org/arangamani/jenkins_api_client.png?branch=master)](https://travis-ci.org/arangamani/jenkins_api_client)
5
- [![Dependency Status](https://gemnasium.com/arangamani/jenkins_api_client.png)](https://gemnasium.com/arangamani/jenkins_api_client)
6
- [![Code Climate](https://codeclimate.com/github/arangamani/jenkins_api_client.png)](https://codeclimate.com/github/arangamani/jenkins_api_client)
3
+
4
+ [![Gem Version](http://img.shields.io/gem/v/jenkins_api_client.svg)][gem]
5
+ [![Build Status](http://img.shields.io/travis/arangamani/jenkins_api_client.svg)][travis]
6
+ [![Dependency Status](http://img.shields.io/gemnasium/arangamani/jenkins_api_client.svg)][gemnasium]
7
+ [![Code Climate](http://img.shields.io/codeclimate/github/arangamani/jenkins_api_client.svg)][codeclimate]
8
+
9
+ [gem]: https://rubygems.org/gems/jenkins_api_client
10
+ [travis]: http://travis-ci.org/arangamani/jenkins_api_client
11
+ [gemnasium]: https://gemnasium.com/arangamani/jenkins_api_client
12
+ [codeclimate]: https://codeclimate.com/github/arangamani/jenkins_api_client
7
13
 
8
14
  Copyright © 2012-2013, Kannan Manickam [![endorse](http://api.coderwall.com/arangamani/endorsecount.png)](http://coderwall.com/arangamani)
9
15
 
data/Vagrantfile CHANGED
@@ -6,7 +6,7 @@ Vagrant.configure("2") do |config|
6
6
  # options are documented and commented below. For a complete reference,
7
7
  # please see the online documentation at vagrantup.com.
8
8
 
9
- config.vm.hostname = "jenkins"
9
+ config.vm.hostname = "jenkins-api-client"
10
10
 
11
11
  # Every Vagrant virtual environment requires a box to build off of.
12
12
  config.vm.box = "opscode-ubuntu-12.04"
@@ -19,7 +19,7 @@ Vagrant.configure("2") do |config|
19
19
  # via the IP. Host-only networks can talk to the host machine as well as
20
20
  # any other machines on the same network, but cannot be accessed (through this
21
21
  # network interface) by any external networks.
22
- config.vm.network :private_network, ip: "33.33.33.100"
22
+ config.vm.network :private_network, ip: "33.33.33.10"
23
23
 
24
24
  # Create a public network, which generally matched to bridged network.
25
25
  # Bridged networks make the machine appear as another physical device on
@@ -78,6 +78,6 @@ Vagrant.configure("2") do |config|
78
78
  " sudo gem1.9.1 install bundler;" +
79
79
  " bundle install;" +
80
80
  " travis/setup.sh;" +
81
- " bundle exec rake unit_tests;"
82
- #" bundle exec rake func_tests"
81
+ " bundle exec rake unit_tests;" +
82
+ " bundle exec rake func_tests"
83
83
  end
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = "jenkins_api_client"
8
- s.version = "1.0.0.beta.4"
8
+ s.version = "1.0.0.beta.6"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new("> 1.3.1") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Kannan Manickam"]
12
- s.date = "2014-02-18"
12
+ s.date = "2014-04-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"]
@@ -47,6 +47,7 @@ Gem::Specification.new do |s|
47
47
  "lib/jenkins_api_client/version.rb",
48
48
  "lib/jenkins_api_client/view.rb",
49
49
  "scripts/login_with_irb.rb",
50
+ "scripts/login_with_pry.rb",
50
51
  "spec/func_tests/client_spec.rb",
51
52
  "spec/func_tests/job_spec.rb",
52
53
  "spec/func_tests/node_spec.rb.pending",
@@ -99,6 +100,7 @@ Gem::Specification.new do |s|
99
100
  s.add_development_dependency(%q<simplecov>, [">= 0"])
100
101
  s.add_development_dependency(%q<yard-thor>, [">= 0"])
101
102
  s.add_development_dependency(%q<yard>, [">= 0"])
103
+ s.add_development_dependency(%q<pry>, [">= 0"])
102
104
  else
103
105
  s.add_dependency(%q<nokogiri>, ["~> 1.6.0"])
104
106
  s.add_dependency(%q<thor>, [">= 0.16.0"])
@@ -111,6 +113,7 @@ Gem::Specification.new do |s|
111
113
  s.add_dependency(%q<simplecov>, [">= 0"])
112
114
  s.add_dependency(%q<yard-thor>, [">= 0"])
113
115
  s.add_dependency(%q<yard>, [">= 0"])
116
+ s.add_dependency(%q<pry>, [">= 0"])
114
117
  end
115
118
  else
116
119
  s.add_dependency(%q<nokogiri>, ["~> 1.6.0"])
@@ -124,6 +127,7 @@ Gem::Specification.new do |s|
124
127
  s.add_dependency(%q<simplecov>, [">= 0"])
125
128
  s.add_dependency(%q<yard-thor>, [">= 0"])
126
129
  s.add_dependency(%q<yard>, [">= 0"])
130
+ s.add_dependency(%q<pry>, [">= 0"])
127
131
  end
128
132
  end
129
133
 
@@ -35,7 +35,7 @@ require 'logger'
35
35
  #
36
36
  module JenkinsApi
37
37
  # This is the client class that acts as the bridge between the subclasses and
38
- # Jnekins. This class contains methods that performs GET and POST requests
38
+ # Jenkins. This class contains methods that performs GET and POST requests
39
39
  # for various operations.
40
40
  #
41
41
  class Client
@@ -44,6 +44,8 @@ module JenkinsApi
44
44
  DEFAULT_SERVER_PORT = 8080
45
45
  # Default timeout in seconds to be used while performing operations
46
46
  DEFAULT_TIMEOUT = 120
47
+ DEFAULT_HTTP_OPEN_TIMEOUT = 10
48
+ DEFAULT_HTTP_READ_TIMEOUT = 120
47
49
  # Parameters that are permitted as options while initializing the client
48
50
  VALID_PARAMS = [
49
51
  "server_url",
@@ -58,6 +60,8 @@ module JenkinsApi
58
60
  "log_location",
59
61
  "log_level",
60
62
  "timeout",
63
+ "http_open_timeout",
64
+ "http_read_timeout",
61
65
  "ssl",
62
66
  "follow_redirects",
63
67
  "identity_file",
@@ -101,7 +105,7 @@ module JenkinsApi
101
105
  end
102
106
  end if args.is_a? Hash
103
107
 
104
- # Server IP or Server URL must be specifiec
108
+ # Server IP or Server URL must be specific
105
109
  unless @server_ip || @server_url
106
110
  raise ArgumentError, "Server IP or Server URL is required to connect" +
107
111
  " to Jenkins"
@@ -135,6 +139,8 @@ module JenkinsApi
135
139
  @jenkins_path.gsub!(/\/$/,"") # remove trailing slash if there is one
136
140
  @server_port = DEFAULT_SERVER_PORT unless @server_port
137
141
  @timeout = DEFAULT_TIMEOUT unless @timeout
142
+ @http_open_timeout = DEFAULT_HTTP_OPEN_TIMEOUT unless @http_open_timeout
143
+ @http_read_timeout = DEFAULT_HTTP_READ_TIMEOUT unless @http_read_timeout
138
144
  @ssl ||= false
139
145
 
140
146
  # Setting log options
@@ -238,7 +244,9 @@ module JenkinsApi
238
244
  " @crumbs_enabled=#{@crumbs_enabled.inspect}," +
239
245
  " @follow_redirects=#{@follow_redirects.inspect}," +
240
246
  " @jenkins_path=#{@jenkins_path.inspect}," +
241
- " @timeout=#{@timeout.inspect}>"
247
+ " @timeout=#{@timeout.inspect}>," +
248
+ " @http_open_timeout=#{@http_open_timeout.inspect}>," +
249
+ " @http_read_timeout=#{@http_read_timeout.inspect}>"
242
250
  end
243
251
 
244
252
  # Connects to the Jenkins server, sends the specified request and returns
@@ -264,6 +272,9 @@ module JenkinsApi
264
272
  http.verify_mode = OpenSSL::SSL::VERIFY_NONE
265
273
  end
266
274
 
275
+ http.open_timeout = @http_open_timeout
276
+ http.read_timeout = @http_read_timeout
277
+
267
278
  response = http.request(request)
268
279
  case response
269
280
  when Net::HTTPRedirection then
@@ -489,7 +489,7 @@ module JenkinsApi
489
489
  to_job_name = "copy_of_#{from_job_name}" if to_job_name.nil?
490
490
  @logger.info "Copying job '#{from_job_name}' to '#{to_job_name}'"
491
491
  @client.api_post_request(
492
- "/createItem?name=#{to_job_name}&mode=copy&from=#{from_job_name}"
492
+ "/createItem?name=#{path_encode to_job_name}&mode=copy&from=#{path_encode from_job_name}"
493
493
  )
494
494
  end
495
495
 
@@ -963,7 +963,7 @@ module JenkinsApi
963
963
  #
964
964
  def enable(job_name)
965
965
  @logger.info "Enabling job '#{job_name}'"
966
- @client.api_post_request("/job/#{job_name}/enable")
966
+ @client.api_post_request("/job/#{path_encode job_name}/enable")
967
967
  end
968
968
 
969
969
  # Disable a job given the name of the job
@@ -29,7 +29,7 @@ module JenkinsApi
29
29
  # Tiny version of the gem used for patches
30
30
  TINY = 0
31
31
  # Used for pre-releases
32
- PRE = 'beta.5'
32
+ PRE = 'beta.6'
33
33
  # Version String of Jenkins API Client.
34
34
  VERSION = [MAJOR, MINOR, TINY, PRE].compact.join('.')
35
35
  end
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: 1.0.0.beta.5
4
+ version: 1.0.0.beta.6
5
5
  prerelease: 6
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: 2014-03-14 00:00:00.000000000 Z
12
+ date: 2014-04-19 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: nokogiri