jenkins_pipeline_builder 0.9.9 → 0.9.10

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
- NmQ5M2UxZWU2NDhkN2IzNTM4ZjhiYWEwNmIyODg5MTc3NGZlMzU2Ng==
4
+ NTIyNGIzNTAxYzhmM2YzMTZhNTdlOGFiOGI1MjA3NTk4ZmJjZGUzMA==
5
5
  data.tar.gz: !binary |-
6
- MzRkOWU1OTQ5MjU5NzY2OTE1NDBkNzZkNjcwOTIzYTMxODU2MWI3Nw==
6
+ ZDBmOWJhYzBkN2M5NWJhYWFmM2Y5YTdjMjRjOTc4OGQ0MTZiNjljMA==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- MDk4OGZiNWFjZDAwNjczZDQyZmRhNDE5NzFmZTZlNjc3MzdjZDJkZTU1N2Zk
10
- YTZhOWFkZTRhMjI5ZjNlZDQyM2ZkNDVmMjA1Yjc3ODc0N2ZmMGZmNmU4NWJm
11
- Yzc0YTMxYTcyZjBiYTE3MGZhODlmMWRmMDU5ZDBkYWRlMjVlOGM=
9
+ YzFhNzRiZDc1YTZlYzdlNzYwNWMxYjgyN2Q2YWZhZGMzYmZjZjg0ZTBhNjE0
10
+ ZmIxYTk0MzM2N2JmNjM1MjhlY2U3MzIyNWQwOGVjZjlhNjg0ZTQzOWRjYzAx
11
+ NjQ1MDRjODBjNzdhZjM1ZjU1NzAyYmZkZjZhZWRjY2E5N2FlMGM=
12
12
  data.tar.gz: !binary |-
13
- NTMyZWJiNWJhZTVjNTQzZWUzZmY5MWY0ZTBjYTQxYmFmZTg1ZDdmOTA0N2Nh
14
- M2JkZmUwN2FmYjcxZTBkMzJhZWMwZjY4M2Y3ODUxYjYwYTQzNGQwODEwMDU0
15
- ZWIyYjY0NTk0N2VmYmVhNDNkNjQ0MTQ3NWFjMDI0OTVmNjMxODE=
13
+ NjViM2M4MTNiMDQxYmI1OWI2MGExNTRkNzE5NWM2N2UwZWU0NGJmZTc2MmUw
14
+ MzA0NTc5ZjcwMjlkZWU1YWU4M2FmM2VlNmNhYTk2Y2Q3NmQ2ODViMmUwNWU4
15
+ YmYyNGEzYjYwZDEyOGJjNzY1Zjc4M2Q4OTk1N2QyYzUyZjE5N2U=
@@ -41,6 +41,11 @@ module JenkinsPipelineBuilder
41
41
  def pull_request(path, project_name = nil)
42
42
  Helper.setup(parent_options).pull_request(path, project_name)
43
43
  end
44
+
45
+ desc 'file Path', 'Does the same thing as bootstrap but doesn\'t actually create jobs on the server'
46
+ def file(path, project_name = nil)
47
+ Helper.setup(parent_options).file(path, project_name)
48
+ end
44
49
  end
45
50
  end
46
51
  end
@@ -106,6 +106,12 @@ module JenkinsPipelineBuilder
106
106
  !failed
107
107
  end
108
108
 
109
+ def file(path, project_name)
110
+ logger.info "Generating files from path #{path}"
111
+ @file_mode = true
112
+ bootstrap(path, project_name)
113
+ end
114
+
109
115
  def dump(job_name)
110
116
  @logger.info "Debug #{@debug}"
111
117
  @logger.info "Dumping #{job_name} into #{job_name}.xml"
@@ -149,7 +155,7 @@ module JenkinsPipelineBuilder
149
155
  job = @job_collection[job.to_s]
150
156
  pull_job = job if job[:value][:job_type] == 'pull_request_generator'
151
157
  end
152
- fail 'No Pull Request Found for Project' unless pull_job
158
+ fail 'No Pull Request Job Found for Project' unless pull_job
153
159
  pull_job
154
160
  end
155
161
 
@@ -481,9 +487,9 @@ module JenkinsPipelineBuilder
481
487
 
482
488
  def create_or_update(job, xml)
483
489
  job_name = job[:name]
484
- if @debug
490
+ if @debug || @file_mode
485
491
  logger.info "Will create job #{job}"
486
- logger.info "#{xml}"
492
+ logger.info "#{xml}" if @debug
487
493
  FileUtils.mkdir_p(out_dir) unless File.exist?(out_dir)
488
494
  File.open("#{out_dir}/#{job_name}.xml", 'w') { |f| f.write xml }
489
495
  return
@@ -21,5 +21,5 @@
21
21
  #
22
22
 
23
23
  module JenkinsPipelineBuilder
24
- VERSION = '0.9.9'
24
+ VERSION = '0.9.10'
25
25
  end
@@ -214,4 +214,19 @@ describe JenkinsPipelineBuilder::Generator do
214
214
  File.delete("#{job_name}.xml")
215
215
  end
216
216
  end
217
+
218
+ describe '#file_mode' do
219
+ before :each do
220
+ allow(JenkinsPipelineBuilder.client).to receive(:plugin).and_return double(
221
+ list_installed: { 'description' => '20.0', 'git' => '20.0' })
222
+ end
223
+ it 'generates xml and saves to disk without sending jobs to the server' do
224
+ job_name = 'TemplatePipeline'
225
+ path = File.expand_path('../fixtures/generator_tests/template_pipeline', __FILE__)
226
+ errors = @generator.file(path, job_name)
227
+ expect(errors).to be_empty
228
+ expect(File.exist?("out/xml/#{job_name}-10.xml")).to be true
229
+ expect(File.exist?("out/xml/#{job_name}-11.xml")).to be true
230
+ end
231
+ end
217
232
  end
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.9.9
4
+ version: 0.9.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - Igor Moochnick
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2014-11-24 00:00:00.000000000 Z
12
+ date: 2014-12-02 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: nokogiri