Skip to content

Commit 9c0733b

Browse files
authored
Merge branch 'master' into patch-1
2 parents 55be1b7 + 9ebb3c1 commit 9c0733b

26 files changed

+724
-815
lines changed
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [master]
6+
pull_request:
7+
branches: [master]
8+
workflow_dispatch:
9+
10+
jobs:
11+
continuous_integration_build:
12+
continue-on-error: true
13+
strategy:
14+
fail-fast: false
15+
matrix:
16+
ruby: [2.7, 3.0, 3.2, head]
17+
operating-system: [ubuntu-latest]
18+
19+
name: Ruby ${{ matrix.ruby }} on ${{ matrix.operating-system }}
20+
21+
runs-on: ${{ matrix.operating-system }}
22+
23+
steps:
24+
- name: Checkout Code
25+
uses: actions/checkout@v3
26+
27+
- name: Setup Ruby
28+
uses: ruby/setup-ruby@v1
29+
with:
30+
ruby-version: ${{ matrix.ruby }}
31+
bundler-cache: true # runs 'bundle install' and caches installed gems automatically
32+
33+
- name: Run Build
34+
run: bundle exec rake build
35+
36+
- name: Test Gem
37+
run: bundle exec rake unit_tests

.travis.yml

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
language: ruby
22

33
rvm:
4-
- 2.2.9
5-
- 2.3.6
6-
- 2.4.3
7-
- 2.5.0
4+
- 2.2.10
5+
- 2.3.8
6+
- 2.4.10
7+
- 2.5.8
8+
- 2.6.6
9+
- 2.7.1
810

911
script:
1012
- bundle exec rake unit_tests

Gemfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,5 @@ group :development do
1010
gem "yard"
1111
gem "pry"
1212
gem "rake"
13+
gem "bump"
1314
end

README.md

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -454,8 +454,4 @@ FEATURE REQUEST:
454454

455455
If you use this gem for your project and you think it would be nice to have a
456456
particular feature that is presently not implemented, I would love to hear that
457-
and consider working on it. Just open an issue in GitHub as a feature request.
458-
459-
460-
[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/arangamani/jenkins_api_client/trend.png)](https://bitdeli.com/free "Bitdeli Badge")
461-
457+
and consider working on it. Just open an issue in GitHub as a feature request.

Rakefile

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,23 +6,20 @@ require 'yard'
66
require 'bundler/setup'
77
require 'bundler/gem_tasks'
88
require 'rubygems/package_task'
9-
9+
require 'bump/tasks'
1010

1111
require 'rspec/core'
1212
require 'rspec/core/rake_task'
1313
RSpec::Core::RakeTask.new(:unit_tests) do |spec|
14-
spec.pattern = FileList['spec/unit_tests/*_spec.rb']
15-
spec.rspec_opts = ['--color', '--format documentation']
14+
spec.pattern = 'spec/unit_tests/*_spec.rb'
1615
end
1716

1817
RSpec::Core::RakeTask.new(:func_tests) do |spec|
19-
spec.pattern = FileList['spec/func_tests/*_spec.rb']
20-
spec.rspec_opts = ['--color', '--format documentation']
18+
spec.pattern = 'spec/func_tests/*_spec.rb'
2119
end
2220

2321
RSpec::Core::RakeTask.new(:test) do |spec|
24-
spec.pattern = FileList['spec/*/*.rb']
25-
spec.rspec_opts = ['--color', '--format documentation']
22+
spec.pattern = 'spec/*/*.rb'
2623
end
2724

2825
YARD::Config.load_plugin 'thor'
@@ -86,4 +83,4 @@ namespace :doc do
8683
end
8784
end
8885

89-
task :default => [:unit_tests]
86+
task default: :unit_tests

jenkins_api_client.gemspec

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,13 @@ Gem::Specification.new do |s|
66
s.name = "jenkins_api_client"
77
s.version = ::JenkinsApi::Client::VERSION
88

9-
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
10-
s.require_paths = ["lib"]
119
s.authors = ["Kannan Manickam"]
1210
s.description = "\nThis is a simple and easy-to-use Jenkins Api client with features focused on\nautomating Job configuration programaticaly and so forth"
1311
s.email = ["[email protected]"]
1412
s.executables = ['jenkinscli']
1513
s.files = `git ls-files -z`.split("\x0").select { |f| f.match(%r{lib/|bin/|java_deps/|gemspec}) }
16-
s.require_paths = ['lib']
1714
s.homepage = 'https://github.com/arangamani/jenkins_api_client'
18-
s.required_ruby_version = ::Gem::Requirement.new('~> 2.1')
19-
s.rubygems_version = "2.4.5.1"
15+
s.required_ruby_version = '>= 2.7'
2016
s.summary = "Jenkins JSON API Client"
2117
s.licenses = ["MIT"]
2218

@@ -26,5 +22,5 @@ Gem::Specification.new do |s|
2622
s.add_dependency 'mixlib-shellout', '>= 1.1.0'
2723
s.add_dependency 'socksify', '>= 1.7.0'
2824
s.add_dependency 'json', '>= 1.0'
25+
s.add_dependency 'addressable', '~> 2.7'
2926
end
30-

lib/jenkins_api_client/job.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1687,7 +1687,7 @@ def artifact_exists?(job_name, build_number = 0)
16871687
def find_artifacts(job_name, build_number = nil)
16881688
response_json = get_build_details(job_name, build_number)
16891689
artifact_path(build_details: response_json).map do |p|
1690-
URI.escape("#{response_json['url']}artifact/#{p['relativePath']}")
1690+
path_encode("#{response_json['url']}artifact/#{p['relativePath']}")
16911691
end
16921692
end
16931693

lib/jenkins_api_client/urihelper.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
require 'uri'
2+
require 'addressable/uri'
23

34
module JenkinsApi
45
module UriHelper
@@ -11,7 +12,7 @@ def form_encode(string)
1112
# Encode a string for use in the hiearchical part of an URL
1213
#
1314
def path_encode(path)
14-
URI.escape(path.encode(Encoding::UTF_8))
15+
Addressable::URI.escape(path.encode(Encoding::UTF_8))
1516
end
1617
end
1718
end

lib/jenkins_api_client/version.rb

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -22,15 +22,7 @@
2222

2323
module JenkinsApi
2424
class Client
25-
# Major version of the gem
26-
MAJOR = 1
27-
# Minor version of the gem
28-
MINOR = 5
29-
# Tiny version of the gem used for patches
30-
TINY = 3
31-
# Used for pre-releases
32-
PRE = nil
3325
# Version String of Jenkins API Client.
34-
VERSION = [MAJOR, MINOR, TINY, PRE].compact.join('.')
26+
VERSION = "2.0.0"
3527
end
3628
end

spec/func_tests/client_spec.rb

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -32,14 +32,14 @@
3232
client1 = JenkinsApi::Client.new(
3333
YAML.load_file(File.expand_path(@creds_file, __FILE__))
3434
)
35-
client1.class.should == JenkinsApi::Client
35+
expect(client1.class).to eq JenkinsApi::Client
3636
end
3737

3838
it "Should accept a YAML argument when creating a new client" do
3939
client3 = JenkinsApi::Client.new(
4040
YAML.load_file(File.expand_path(@creds_file, __FILE__))
4141
)
42-
client3.class.should == JenkinsApi::Client
42+
expect(client3.class).to eq JenkinsApi::Client
4343
end
4444

4545
it "Should fail if wrong credentials are given" do
@@ -49,58 +49,56 @@
4949
:password => 'hacked',
5050
:log_location => '/dev/null'
5151
)
52-
expect(
53-
lambda { client2.job.list_all }
54-
).to raise_error(JenkinsApi::Exceptions::Unauthorized)
52+
expect{ client2.job.list_all }.to raise_error(JenkinsApi::Exceptions::Unauthorized)
5553
end
5654
end
5755
describe "#get_jenkins_version" do
5856
it "Should the jenkins version" do
59-
@client.get_jenkins_version.class.should == String
57+
expect(@client.get_jenkins_version.class).to eq String
6058
end
6159
end
6260

6361
describe "#get_hudson_version" do
6462
it "Should get the hudson version" do
65-
@client.get_hudson_version.class.should == String
63+
expect(@client.get_hudson_version.class).to eq String
6664
end
6765
end
6866

6967
describe "#exec_script" do
7068
it "Should execute the provided groovy script" do
71-
@client.exec_script('println("hi")').should == "hi\n"
69+
expect(@client.exec_script('println("hi")')).to eq "hi\n"
7270
end
7371
end
7472
end
7573

7674
describe "SubClassAccessorMethods" do
7775
describe "#job" do
7876
it "Should return a job object on call" do
79-
@client.job.class.should == JenkinsApi::Client::Job
77+
expect(@client.job.class).to eq JenkinsApi::Client::Job
8078
end
8179
end
8280

8381
describe "#node" do
8482
it "Should return a node object on call" do
85-
@client.node.class.should == JenkinsApi::Client::Node
83+
expect(@client.node.class).to eq JenkinsApi::Client::Node
8684
end
8785
end
8886

8987
describe "#view" do
9088
it "Should return a view object on call" do
91-
@client.view.class.should == JenkinsApi::Client::View
89+
expect(@client.view.class).to eq JenkinsApi::Client::View
9290
end
9391
end
9492

9593
describe "#system" do
9694
it "Should return a system object on call" do
97-
@client.system.class.should == JenkinsApi::Client::System
95+
expect(@client.system.class).to eq JenkinsApi::Client::System
9896
end
9997
end
10098

10199
describe "#queue" do
102100
it "Should return a build queue object on call" do
103-
@client.queue.class.should == JenkinsApi::Client::BuildQueue
101+
expect(@client.queue.class).to eq JenkinsApi::Client::BuildQueue
104102
end
105103
end
106104
end
@@ -129,7 +127,7 @@
129127
end
130128

131129
it "Should connect without an error" do
132-
expect { client.job.list_all }.not_to raise_error
130+
client.job.list_all
133131
end
134132
end
135133
end

0 commit comments

Comments
 (0)