jenkins_pipeline_builder 0.15.0 → 0.15.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- MjAwOGQ5NDM1MmMyYTkzNjExNzViMWYyMzRlMzFiYTYwMTc0ZTU3MA==
4
+ MjE1OTAzNTU1MTFkMDYwZjJiZjVlZWM3ZTY0NWJlNjZlMzBkNDU1Nw==
5
5
  data.tar.gz: !binary |-
6
- MzlmOGIxNmRhYWFiYjYyMDUxNmIzNzZjOGFhZTIxNmUxNmE2NjhmMA==
6
+ YjVkZjVkZjA4ZWI3ODdhNzliNTU3YmE0NTM4YjVkODI4NjlkZTUxNQ==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- YzMwNWQzZjliNGFkZTY5ZjY5NzgzMzY1MTdmZThjZjI5MjhkNDAwNzVhNzE3
10
- YTI2ZGY5ZWVhNWRhMDliOWVmNGE1NGIwNDdhYjEwNTdiNjM5MGVmYzExOTY5
11
- YmU1NmJmZGYxZjlhMTJmZWRlNTU2OWY0ZGQ1MWVjOWY5YjI1OTE=
9
+ MWJhN2EyZDg3OTNiNTBhZWJlMDY4OTljYzM3MjBjMjQ5M2UwMDNkNDQ0YzI3
10
+ YWRhZWI0M2M1YjkyN2JkODE1NGVjYTdkZDdjNDNhM2JjMTQxYmNiZDc1NmE5
11
+ MjQ2ZDNjOGRlNDdkNzkzZjcyNTYxYmU0NWVjMmE3NmMyMTJkMTk=
12
12
  data.tar.gz: !binary |-
13
- ZGMwNjliZDJiNWQ4YWJlZTlmOWQxZjVlMTQxNjQwOTgwYjc5YTUyMDA2NWU1
14
- NDdlZDgzMjg5YmJhY2U1NTY2NWM3YWI1NzhhZmU5OGQ1Y2M3ZTBjOTQ1NjU0
15
- MmY5N2E5Zjc5NzNjMTExYmIwYjNkOWM4NDcwZGIzOTU2NGFlNjE=
13
+ YjFlYTQ5OTVkY2ViMTY0MmI1NDk1Mzc1OWRiMTIyZTJlZTc2YTRkYmYyZThi
14
+ MWNjODlmMzM4YTFiNGZmMWFjNWE5YWI3YzMxNGY5Zjg3MmFiMWIxMmM4YmQ0
15
+ NDZiMTY5NGI3YmRmMzAxMWVkYmE3YWUxYzliNGI1ZTYyY2Y4NTM=
@@ -38,7 +38,7 @@ module JenkinsPipelineBuilder
38
38
  attr_accessor :jenkins_api_creds
39
39
  end
40
40
 
41
- DEFAULT_FILE_FORMATS = %w(rb json yaml).freeze
41
+ DEFAULT_FILE_FORMATS = %w(rb json yml yaml).freeze
42
42
 
43
43
  # Sets up the credentials and initializes the Jenkins Pipeline Builder
44
44
  #
@@ -21,5 +21,5 @@
21
21
  #
22
22
 
23
23
  module JenkinsPipelineBuilder
24
- VERSION = '0.15.0'.freeze
24
+ VERSION = '0.15.1'.freeze
25
25
  end
@@ -1,9 +1,10 @@
1
1
  require File.expand_path('../../spec_helper', __FILE__)
2
2
 
3
3
  describe JenkinsPipelineBuilder::CLI::Helper do
4
+ file_suffixes = JenkinsPipelineBuilder::CLI::Helper::DEFAULT_FILE_FORMATS
5
+
4
6
  context '#setup' do
5
7
  let(:creds_file_base) { 'spec/lib/jenkins_pipeline_builder/fixtures/sample_creds' }
6
-
7
8
  context 'username and password given' do
8
9
  let(:options) do
9
10
  {
@@ -110,65 +111,44 @@ describe JenkinsPipelineBuilder::CLI::Helper do
110
111
  allow(ENV).to receive(:[]).with('HOME').and_return '/foo'
111
112
  end
112
113
 
113
- it 'checks for all 3 supported formats in order' do
114
+ it 'checks for all 4 supported formats in order' do
114
115
  expect(File).to receive(:exist?).with("#{default_creds_base}.rb")
115
116
  expect(File).to receive(:exist?).with("#{default_creds_base}.json")
116
117
  expect(File).to receive(:exist?).with("#{default_creds_base}.yaml")
118
+ expect(File).to receive(:exist?).with("#{default_creds_base}.yml")
117
119
  expect { described_class.setup({}) }.to raise_error(SystemExit, 'exit')
118
120
  end
119
121
 
120
- it 'loads the default ruby file' do
121
- expect(File).to receive(:exist?).with("#{default_creds_base}.rb").and_return true
122
- expect(File).to receive(:exist?).with("#{default_creds_base}.json").and_return false
123
- expect(File).to receive(:exist?).with("#{default_creds_base}.yaml").and_return false
124
- expect(File).to receive(:expand_path).with("#{default_creds_base}.rb").and_return "#{creds_file_base}.rb"
125
- described_class.setup({})
126
- end
127
-
128
- it 'loads the default json file' do
129
- expect(File).to receive(:exist?).with("#{default_creds_base}.rb").and_return false
130
- expect(File).to receive(:exist?).with("#{default_creds_base}.json").and_return true
131
- expect(File).to receive(:exist?).with("#{default_creds_base}.yaml").and_return false
132
- expect(File).to receive(:expand_path).with("#{default_creds_base}.json").and_return "#{creds_file_base}.json"
133
- expect(JSON).to receive(:parse).and_call_original
134
- described_class.setup({})
135
- end
136
-
137
- it 'loads the default yaml file' do
138
- expect(File).to receive(:exist?).with("#{default_creds_base}.rb").and_return false
139
- expect(File).to receive(:exist?).with("#{default_creds_base}.json").and_return false
140
- expect(File).to receive(:exist?).with("#{default_creds_base}.yaml").and_return true
141
- expect(File).to receive(:expand_path).with("#{default_creds_base}.yaml").and_return "#{creds_file_base}.yaml"
142
- expect(YAML).to receive(:load_file).and_call_original
143
- described_class.setup({})
144
- end
145
-
146
- it 'warns if both ruby and yaml' do
147
- used_suffix = 'rb'
148
- found_suffix = 'yaml'
149
- expect(File).to receive(:exist?).with("#{default_creds_base}.rb").and_return true
150
- expect(File).to receive(:exist?).with("#{default_creds_base}.json").and_return false
151
- expect(File).to receive(:exist?).with("#{default_creds_base}.yaml").and_return true
152
- expect(JenkinsPipelineBuilder.logger).to receive(:warn)
153
- .with(/'#{default_creds_base}\.#{used_suffix}' but '#{default_creds_base}\.#{found_suffix}' found\./)
154
- .and_return true
155
- expect(File).to receive(:expand_path)
156
- .with("#{default_creds_base}.#{used_suffix}").and_return "#{creds_file_base}.#{used_suffix}"
157
- described_class.setup({})
158
- end
159
-
160
- it 'warns if both ruby and json' do
161
- used_suffix = 'rb'
162
- found_suffix = 'json'
163
- expect(File).to receive(:exist?).with("#{default_creds_base}.rb").and_return true
164
- expect(File).to receive(:exist?).with("#{default_creds_base}.json").and_return true
165
- expect(File).to receive(:exist?).with("#{default_creds_base}.yaml").and_return false
166
- expect(JenkinsPipelineBuilder.logger).to receive(:warn)
167
- .with(/'#{default_creds_base}\.#{used_suffix}' but '#{default_creds_base}\.#{found_suffix}' found\./)
168
- .and_return true
169
- expect(File).to receive(:expand_path)
170
- .with("#{default_creds_base}.#{used_suffix}").and_return "#{creds_file_base}.#{used_suffix}"
171
- described_class.setup({})
122
+ file_suffixes.each do |suffix|
123
+ it "loads a default file ending in .#{suffix}" do
124
+ file_suffixes.each do |ending|
125
+ expect(File).to receive(:exist?).with("#{default_creds_base}.#{ending}")
126
+ .and_return ending == suffix
127
+ end
128
+ expect(File).to receive(:expand_path).with("#{default_creds_base}.#{suffix}")
129
+ .and_return "#{creds_file_base}.#{suffix}"
130
+
131
+ described_class.setup({})
132
+ end
133
+ end
134
+
135
+ # file_suffixes.combination(2).to_a
136
+ # returns something like:
137
+ # [["rb", "json"], ["rb", "yml"], ["rb", "yaml"], ["json", "yml"], ["json", "yaml"], ["yml", "yaml"]]
138
+ file_suffixes.combination(2).each do |used_suffix, found_suffix|
139
+ it "warns if both #{used_suffix} and #{found_suffix} exists" do
140
+ # Stub the existence of the used and extraneous 'found' files
141
+ file_suffixes.each do |suffix|
142
+ expect(File).to receive(:exist?).with("#{default_creds_base}.#{suffix}")
143
+ .and_return suffix == used_suffix || suffix == found_suffix
144
+ end
145
+ expect(JenkinsPipelineBuilder.logger).to receive(:warn)
146
+ .with(/'#{default_creds_base}\.#{used_suffix}' but '#{default_creds_base}\.#{found_suffix}' found\./)
147
+ .and_return true
148
+ expect(File).to receive(:expand_path)
149
+ .with("#{default_creds_base}.#{used_suffix}").and_return "#{creds_file_base}.#{used_suffix}"
150
+ described_class.setup({})
151
+ end
172
152
  end
173
153
  end
174
154
  end
@@ -0,0 +1,4 @@
1
+ server_url: https://localhost.localdomain
2
+ server_port: 8080
3
+ username: username
4
+ password: password
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jenkins_pipeline_builder
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.15.0
4
+ version: 0.15.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Igor Moochnick
@@ -429,6 +429,7 @@ files:
429
429
  - spec/lib/jenkins_pipeline_builder/fixtures/sample_creds.json
430
430
  - spec/lib/jenkins_pipeline_builder/fixtures/sample_creds.rb
431
431
  - spec/lib/jenkins_pipeline_builder/fixtures/sample_creds.yaml
432
+ - spec/lib/jenkins_pipeline_builder/fixtures/sample_creds.yml
432
433
  - spec/lib/jenkins_pipeline_builder/fixtures/view_test/duplicate_view.yaml
433
434
  - spec/lib/jenkins_pipeline_builder/fixtures/view_test/parent_view.yaml
434
435
  - spec/lib/jenkins_pipeline_builder/fixtures/view_test/regular_view.yaml
@@ -516,6 +517,7 @@ test_files:
516
517
  - spec/lib/jenkins_pipeline_builder/fixtures/sample_creds.json
517
518
  - spec/lib/jenkins_pipeline_builder/fixtures/sample_creds.rb
518
519
  - spec/lib/jenkins_pipeline_builder/fixtures/sample_creds.yaml
520
+ - spec/lib/jenkins_pipeline_builder/fixtures/sample_creds.yml
519
521
  - spec/lib/jenkins_pipeline_builder/fixtures/view_test/duplicate_view.yaml
520
522
  - spec/lib/jenkins_pipeline_builder/fixtures/view_test/parent_view.yaml
521
523
  - spec/lib/jenkins_pipeline_builder/fixtures/view_test/regular_view.yaml