jenkins_pipeline_builder 0.10.3 → 0.10.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- YjVmMTJkOWM4Y2Q3ZTc2N2FmMDU0MjU2NDk3YTJmNmZiYzIzMWE0Mw==
4
+ NjNhNjgyYWNjMzcxNTMyYTdhOWVjODdmMWE0NzViZDBhNzllYTkxMg==
5
5
  data.tar.gz: !binary |-
6
- MzBhZjUyNjgwM2JmN2FhYmEwYjM1NGQ4ZDVkYTVkYzhjMDlhNWQwZQ==
6
+ MDQ0Y2MzNjU0NzZmMzYxOGNkYTNjNmUzNjJmMGU5YWYyZTQ0ZmEwNw==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- NmM2YThhNjUxMjlkOTJhODY5YjdjYmQ1Y2IzN2VjMTFmNzNhNzJkZDEyMjFh
10
- YmE4NDQzN2QyN2M4MDY1MmM0MDg2ZGVjMTRkYTRkMzI4YWE0MDM1YTRkNzlm
11
- Zjg4MzlkN2IxZTAwMzE0MjgzYTQwMTEzZmI5OTViOTRiZGU0MWU=
9
+ MWIwMGRlMzAxNTFhNGI4YzhmNzFiZmE4MmJhZDE1NTNhYmU1ZjM0MDU3ZGU4
10
+ YzA2NmI5NDBkNzdjYjQ2MjI5MzdkNWE5ZGY3NDU0MzkyZDA4N2RlODY3YTdj
11
+ N2I4Y2NlN2E2MzNiZWE5NWI1Y2EzZWU2YmZlODUyZmU3ZTA2ZDk=
12
12
  data.tar.gz: !binary |-
13
- M2FmNjEyMTk4ZjUwMTA3MzZiYWFhNTAwN2RlY2I3OTBiNWY4N2Q2ODRkMDdk
14
- NGFmZjlhMDBjNDA5MmJlZDJjMTliNDcxNTNhNDY0N2UwYjRmMGRjNjFkNDNi
15
- NmJmMzA3ZTY3MWNhMzA1Yjg5MzM0MDAzNmNlYWMyODdkMzlhOTY=
13
+ MDFhZWE3OGFiNTNlODNjNzlhMjlmYzE4OGZlN2M5ZDJkNmZjMmQyOTlkNDVh
14
+ Mjk2ZWEyMDFjZGJmMGE1ZDViMzFkZmQ4ZWM4NGE3NzlhNTExMmI5ZTQ1Yjhk
15
+ MGJjMDhiOGM0NjU1OGNjNjU1NjM0YzVmNDkxMWQ2MDY2NzgzOTY=
@@ -61,6 +61,9 @@ module JenkinsPipelineBuilder
61
61
  end
62
62
 
63
63
  def self.compile(item, settings = {}, job_collection = {})
64
+ success, item = handle_enable(item, settings, job_collection)
65
+ return false, item unless success
66
+
64
67
  case item
65
68
  when String
66
69
  return compile_string item, settings, job_collection
@@ -104,6 +107,7 @@ module JenkinsPipelineBuilder
104
107
  end
105
108
 
106
109
  def self.handle_enable(item, settings, job_collection)
110
+ return true, item unless item.is_a? Hash
107
111
  if item.key?(:enabled) && item.key?(:parameters) && item.length == 2
108
112
  enabled_switch = resolve_value(item[:enabled], settings, job_collection)
109
113
  return [true, {}] if enabled_switch == 'false'
@@ -122,12 +126,12 @@ module JenkinsPipelineBuilder
122
126
  end
123
127
 
124
128
  def self.compile_hash(item, settings, job_collection)
125
- errors = {}
126
- result = {}
127
-
128
129
  success, item = handle_enable(item, settings, job_collection)
129
130
  return false, item unless success
130
131
 
132
+ errors = {}
133
+ result = {}
134
+
131
135
  item.each do |key, value|
132
136
  if value.nil?
133
137
  errors[key] = "key: #{key} has a nil value, this is often a yaml syntax error. Skipping children and siblings"
@@ -21,5 +21,5 @@
21
21
  #
22
22
 
23
23
  module JenkinsPipelineBuilder
24
- VERSION = '0.10.3'
24
+ VERSION = '0.10.4'
25
25
  end
@@ -27,14 +27,26 @@ describe JenkinsPipelineBuilder::Compiler do
27
27
  end
28
28
 
29
29
  describe '#compile' do
30
- it 'compile a job with a name change' do
30
+ it 'compiles a job with a name change' do
31
31
  result = compiler.compile(job2, settings_bag, job_collection)
32
32
  expect(result[1]).to eq(job2_compiled)
33
33
  end
34
- it 'compile a job with a downstream name change' do
34
+
35
+ it 'compiles a job with a downstream name change' do
35
36
  result = compiler.compile(job0, settings_bag, job_collection)
36
37
  expect(result[1]).to eq(job0_compiled)
37
38
  end
39
+
40
+ it 'compiles an enabled job with a string parameter' do
41
+ my_job = { name: '{{name}}-00',
42
+ triggers: [{ periodic_build: { enabled: true, parameters: '{{var}}' } }] }
43
+ compiled_job = { name: 'name-00',
44
+ triggers: [{ periodic_build: 'this_is_a_var' }] }
45
+ settings_bag = { var: 'this_is_a_var', name: 'name' }
46
+
47
+ result = compiler.compile(my_job, settings_bag, job_collection)
48
+ expect(result[1]).to eq(compiled_job)
49
+ end
38
50
  end
39
51
 
40
52
  describe '#enable_blocks' do
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.10.3
4
+ version: 0.10.4
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: 2015-01-30 00:00:00.000000000 Z
12
+ date: 2015-02-03 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: nokogiri