jenkins_pipeline_builder 1.6.0 → 1.10.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (56) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +22 -3
  3. data/.rubocop_todo.yml +0 -6
  4. data/.travis.yml +0 -1
  5. data/Dockerfile +30 -0
  6. data/README.md +1 -0
  7. data/jenkins_pipeline_builder.gemspec +5 -8
  8. data/lib/jenkins_pipeline_builder.rb +2 -2
  9. data/lib/jenkins_pipeline_builder/cli/describe.rb +0 -2
  10. data/lib/jenkins_pipeline_builder/cli/helper.rb +3 -2
  11. data/lib/jenkins_pipeline_builder/cli/list.rb +2 -1
  12. data/lib/jenkins_pipeline_builder/cli/pipeline.rb +5 -4
  13. data/lib/jenkins_pipeline_builder/compiler.rb +15 -2
  14. data/lib/jenkins_pipeline_builder/extension_set.rb +5 -1
  15. data/lib/jenkins_pipeline_builder/extensions.rb +6 -2
  16. data/lib/jenkins_pipeline_builder/extensions/build_steps.rb +1 -1
  17. data/lib/jenkins_pipeline_builder/extensions/helpers/job_attributes/parameters_helper.rb +2 -2
  18. data/lib/jenkins_pipeline_builder/extensions/helpers/publishers/cobertura_report_helper.rb +1 -0
  19. data/lib/jenkins_pipeline_builder/extensions/job_attributes.rb +24 -0
  20. data/lib/jenkins_pipeline_builder/extensions/publishers.rb +26 -1
  21. data/lib/jenkins_pipeline_builder/extensions/wrappers.rb +2 -1
  22. data/lib/jenkins_pipeline_builder/generator.rb +7 -2
  23. data/lib/jenkins_pipeline_builder/job.rb +3 -0
  24. data/lib/jenkins_pipeline_builder/job_collection.rb +5 -3
  25. data/lib/jenkins_pipeline_builder/module_registry.rb +4 -0
  26. data/lib/jenkins_pipeline_builder/promotion.rb +1 -0
  27. data/lib/jenkins_pipeline_builder/pull_request_generator.rb +12 -11
  28. data/lib/jenkins_pipeline_builder/remote_dependencies.rb +2 -2
  29. data/lib/jenkins_pipeline_builder/utils.rb +12 -7
  30. data/lib/jenkins_pipeline_builder/version.rb +1 -1
  31. data/lib/jenkins_pipeline_builder/view.rb +3 -1
  32. data/spec/lib/jenkins_pipeline_builder/cli/helper_spec.rb +1 -1
  33. data/spec/lib/jenkins_pipeline_builder/compiler_spec.rb +1 -1
  34. data/spec/lib/jenkins_pipeline_builder/extension_dsl_spec.rb +1 -1
  35. data/spec/lib/jenkins_pipeline_builder/extension_set_spec.rb +3 -3
  36. data/spec/lib/jenkins_pipeline_builder/extensions/build_steps_spec.rb +1 -1
  37. data/spec/lib/jenkins_pipeline_builder/extensions/builders_spec.rb +6 -6
  38. data/spec/lib/jenkins_pipeline_builder/extensions/job_attributes_spec.rb +1 -1
  39. data/spec/lib/jenkins_pipeline_builder/extensions/promotion_conditions_spec.rb +1 -1
  40. data/spec/lib/jenkins_pipeline_builder/extensions/publishers_spec.rb +28 -11
  41. data/spec/lib/jenkins_pipeline_builder/extensions/registered_spec.rb +3 -1
  42. data/spec/lib/jenkins_pipeline_builder/extensions/triggers_spec.rb +1 -1
  43. data/spec/lib/jenkins_pipeline_builder/extensions/wrappers_spec.rb +1 -1
  44. data/spec/lib/jenkins_pipeline_builder/extensions_spec.rb +1 -1
  45. data/spec/lib/jenkins_pipeline_builder/fixtures/generator_tests/pullrequest_pipeline/project.yaml +1 -0
  46. data/spec/lib/jenkins_pipeline_builder/generator_spec.rb +90 -36
  47. data/spec/lib/jenkins_pipeline_builder/job_collection_spec.rb +2 -2
  48. data/spec/lib/jenkins_pipeline_builder/job_spec.rb +1 -1
  49. data/spec/lib/jenkins_pipeline_builder/module_registry_spec.rb +1 -1
  50. data/spec/lib/jenkins_pipeline_builder/promotion_spec.rb +1 -1
  51. data/spec/lib/jenkins_pipeline_builder/pull_request_generator_spec.rb +16 -16
  52. data/spec/lib/jenkins_pipeline_builder/spec_helper.rb +1 -1
  53. data/spec/lib/jenkins_pipeline_builder/utils_spec.rb +1 -1
  54. data/spec/lib/jenkins_pipeline_builder/view_spec.rb +2 -2
  55. data/spec/requests/pipeline_spec.rb +1 -1
  56. metadata +20 -20
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e4d433fdb4421e7ff066fd49444c45abe2d2b29df62228b95b9d0933b0dce7f6
4
- data.tar.gz: 2586bd749811dd2848490e146b926e42c7332526282c53ff43c5f706ad49a8fc
3
+ metadata.gz: 13ad923ce7eec2fe757816e9885e1d4128268aaecd27bc6f87e4154159f16dc2
4
+ data.tar.gz: ab8cea9c820c7ae1007689ddcd01d207e15702cefc33495c38dda717ea22ed14
5
5
  SHA512:
6
- metadata.gz: 0969f829a1b73b76c1954ea323352f66d346b90b307705016d28d8b1a74987580f4baaea75dc2ba8f5c59b4e7c41039307c2a4b96019cc0a30c8ab51db861940
7
- data.tar.gz: 6a02902dc545bdd9e2086503818b0cf9095edbe0964a290140bbe1bd718bb3c0748de2763d5b290f7af05927efafa9299418d1145e843fe1f81f78c9cb5f3302
6
+ metadata.gz: fa3a1eaafe161c5a24897e3301951ffc80def639ed5f67dd6f832122906c2ace7925f8db2d1d68fffcec78fabbd4b7f2b19731b126ef3dd41e838efa7031f728
7
+ data.tar.gz: b5371cf6bb0a81c55f7f8b12107a73971f4b7564ad97e01760529fc19ea2ac910f283d6c5df6d5727b70a22f1378492e9949e0e4595ebc514cdfb048478e442b
@@ -1,5 +1,5 @@
1
1
  AllCops:
2
- TargetRubyVersion: 2.1.5
2
+ TargetRubyVersion: 2.3.3
3
3
 
4
4
  inherit_from: .rubocop_todo.yml
5
5
 
@@ -15,7 +15,7 @@ Metrics/ClassLength:
15
15
  #######
16
16
  # Finalized settings
17
17
 
18
- Metrics/LineLength:
18
+ Layout/LineLength:
19
19
  Max: 120
20
20
  Exclude:
21
21
  - 'spec/lib/jenkins_pipeline_builder/compiler_spec.rb'
@@ -32,7 +32,7 @@ Style/Next:
32
32
  - 'lib/jenkins_pipeline_builder/extensions/**/*'
33
33
 
34
34
  # Configuration parameters: EnforcedStyle, SupportedStyles.
35
- Style/VariableName:
35
+ Naming/VariableName:
36
36
  Exclude:
37
37
  - 'lib/jenkins_pipeline_builder/extensions/**/*'
38
38
 
@@ -41,3 +41,22 @@ Style/SymbolProc:
41
41
 
42
42
  Style/FrozenStringLiteralComment:
43
43
  Enabled: false
44
+
45
+ Style/SafeNavigation:
46
+ Enabled: false
47
+
48
+ Lint/RaiseException:
49
+ Enabled: true
50
+
51
+ Lint/StructNewOverride:
52
+ Enabled: true
53
+
54
+ Style/HashEachMethods:
55
+ Enabled: true
56
+
57
+ Style/HashTransformKeys:
58
+ Enabled: true
59
+
60
+ Style/HashTransformValues:
61
+ Enabled: true
62
+
@@ -24,12 +24,6 @@ Metrics/BlockLength:
24
24
  # Offense count: 5
25
25
  # Cop supports --auto-correct.
26
26
  # Configuration parameters: AutoCorrect.
27
- Performance/HashEachMethods:
28
- Exclude:
29
- - 'lib/jenkins_pipeline_builder/cli/list.rb'
30
- - 'lib/jenkins_pipeline_builder/compiler.rb'
31
- - 'lib/jenkins_pipeline_builder/extensions.rb'
32
- - 'lib/jenkins_pipeline_builder/utils.rb'
33
27
 
34
28
  # Offense count: 1
35
29
  # Configuration parameters: MinBodyLength.
@@ -1,6 +1,5 @@
1
1
  language: ruby
2
2
  rvm:
3
- - 2.1.5
4
3
  - 2.3.3
5
4
  before_install:
6
5
  - gem install bundler
@@ -0,0 +1,30 @@
1
+ FROM centos:centos7
2
+
3
+ ENV RUBY_DIR /ruby
4
+ ENV RUBY_VERSION 2.3.3
5
+ ENV RUBY_INSTALL $RUBY_DIR/$RUBY_VERSION
6
+ ENV BUNDLER_VERSION 1.13.3
7
+
8
+ RUN yum update -y && \
9
+ yum install -y make gcc-c++ which wget tar git mysql-devel \
10
+ gcc patch readline-devel zlib-devel \
11
+ libyaml-devel libffi-devel openssl-devel \
12
+ gdbm-devel ncurses-devel libxml-devel bzip2 libxml2-devel
13
+
14
+ RUN cd /usr/src && \
15
+ git clone https://github.com/rbenv/ruby-build.git && \
16
+ ./ruby-build/install.sh && \
17
+ mkdir -p $RUBY_INSTALL && \
18
+ /usr/local/bin/ruby-build $RUBY_VERSION $RUBY_INSTALL && \
19
+ $RUBY_INSTALL/bin/gem install bundler -v $BUNDLER_VERSION && \
20
+ rm -rf /usr/src/ruby-build
21
+
22
+ ENV PATH $RUBY_INSTALL/bin:$PATH
23
+
24
+ WORKDIR /src
25
+
26
+ RUN gem install jenkins_pipeline_builder
27
+
28
+ RUN mkdir -p /srv
29
+ WORKDIR /srv
30
+ ENTRYPOINT ["/bin/bash", "-l" ]
data/README.md CHANGED
@@ -247,6 +247,7 @@ A number of the DSL options rely on Jenkins plugins, including:
247
247
  * ansicolor - "AnsiColor"
248
248
  * (view) type: 'categorizedView' - "categorized-view"
249
249
  * hipchat - "HipChat Plugin"
250
+ * google_chat - "google-chat-notification-plugin"
250
251
  * inject_env_vars - "Environment Injector Plugin"
251
252
  * priority - "Priority Sorter plugin"
252
253
  * downstream - "Parameterized Trigger plugin"
@@ -1,5 +1,4 @@
1
-
2
- lib = File.expand_path('../lib', __FILE__)
1
+ lib = File.expand_path('lib', __dir__)
3
2
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
3
  require 'jenkins_pipeline_builder/version'
5
4
 
@@ -19,8 +18,6 @@ automating Job & Pipeline creation from the YAML files checked-in with your appl
19
18
  spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
20
19
  spec.require_paths = ['lib']
21
20
 
22
- ENV['NOKOGIRI_USE_SYSTEM_LIBRARIES'] = 'true'
23
-
24
21
  spec.add_dependency 'activesupport', '~> 4.2.6'
25
22
  spec.add_dependency 'jenkins_api_client', '~> 1.0.0'
26
23
  spec.add_dependency 'minitar'
@@ -29,8 +26,8 @@ automating Job & Pipeline creation from the YAML files checked-in with your appl
29
26
  spec.add_dependency 'thor', '>= 0.18.0'
30
27
 
31
28
  spec.add_development_dependency 'bump'
32
- spec.add_development_dependency 'byebug'
33
- spec.add_development_dependency 'equivalent-xml'
29
+ spec.add_development_dependency 'byebug', '= 11.0.1' # last version with compatibility with ruby 2.3.x
30
+ spec.add_development_dependency 'equivalent-xml', '= 0.6.0' # last version with compatibility with ruby 2.3.x
34
31
  spec.add_development_dependency 'gem-release'
35
32
  spec.add_development_dependency 'json'
36
33
  spec.add_development_dependency 'kwalify'
@@ -38,8 +35,8 @@ automating Job & Pipeline creation from the YAML files checked-in with your appl
38
35
  spec.add_development_dependency 'rake'
39
36
  spec.add_development_dependency 'rspec', '~> 3.0'
40
37
  spec.add_development_dependency 'rspec_junit_formatter'
41
- spec.add_development_dependency 'rubocop'
42
- spec.add_development_dependency 'simplecov'
38
+ spec.add_development_dependency 'rubocop', '= 0.81' # last version with compatibility with ruby 2.3.x
39
+ spec.add_development_dependency 'simplecov', '= 0.17.1' # last version with compatibility with ruby 2.3.x
43
40
  spec.add_development_dependency 'simplecov-rcov'
44
41
  spec.add_development_dependency 'webmock', '~> 1.0'
45
42
  spec.add_development_dependency 'yard'
@@ -41,7 +41,7 @@ module JenkinsPipelineBuilder
41
41
  attr_reader :client, :credentials, :debug, :file_mode
42
42
  attr_writer :logger
43
43
  def generator
44
- @_generator ||= Generator.new
44
+ @generator ||= Generator.new
45
45
  end
46
46
 
47
47
  def file_mode!
@@ -83,7 +83,7 @@ require 'jenkins_pipeline_builder/extensions'
83
83
  require 'jenkins_pipeline_builder/extension_dsl'
84
84
  require 'jenkins_pipeline_builder/extension_set'
85
85
  require 'jenkins_pipeline_builder/extensions/helpers/extension_helper'
86
- Dir[File.join(File.dirname(__FILE__), 'jenkins_pipeline_builder/extensions/helpers/**/*.rb')].each do |file|
86
+ Dir[File.join(File.dirname(__FILE__), 'jenkins_pipeline_builder/extensions/helpers/**/*.rb')].sort.each do |file|
87
87
  require file
88
88
  end
89
89
 
@@ -26,7 +26,6 @@ module JenkinsPipelineBuilder
26
26
  entries << :job_attributes
27
27
  entries.try(:each) do |entry|
28
28
  klass_name = entry.to_s.classify
29
- # rubocop:disable Style/AccessModifierIndentation
30
29
  klass = Class.new(Thor) do
31
30
  extensions = if entry == :job_attributes
32
31
  JenkinsPipelineBuilder.registry.registry[:job].select { |_, x| x.is_a? ExtensionSet }
@@ -49,7 +48,6 @@ module JenkinsPipelineBuilder
49
48
  puts "#{ext.name}: #{ext.description}"
50
49
  end
51
50
  end
52
- # rubocop:enable Style/AccessModifierIndentation
53
51
  Module.const_set(klass_name, klass)
54
52
  end
55
53
 
@@ -80,6 +80,7 @@ module JenkinsPipelineBuilder
80
80
  def self.process_creds_file(file)
81
81
  return load File.expand_path(file) if file.end_with? 'rb'
82
82
  return self.jenkins_api_creds = JSON.parse(IO.read(File.expand_path(file))) if file.end_with? 'json'
83
+
83
84
  self.jenkins_api_creds = YAML.load_file(File.expand_path(file))
84
85
  end
85
86
 
@@ -97,14 +98,13 @@ module JenkinsPipelineBuilder
97
98
  end
98
99
  end
99
100
 
100
- private_class_method
101
-
102
101
  def self.find_default_file
103
102
  default_file_name = "#{ENV['HOME']}/.jenkins_api_client/login"
104
103
 
105
104
  found_suffix = nil
106
105
  DEFAULT_FILE_FORMATS.each do |suffix|
107
106
  next unless File.exist?("#{default_file_name}.#{suffix}")
107
+
108
108
  if !found_suffix
109
109
  found_suffix = suffix
110
110
  else
@@ -118,6 +118,7 @@ module JenkinsPipelineBuilder
118
118
  def self.logger
119
119
  JenkinsPipelineBuilder.logger
120
120
  end
121
+ private_class_method :find_default_file, :logger
121
122
  end
122
123
  end
123
124
  end
@@ -23,7 +23,7 @@
23
23
  module JenkinsPipelineBuilder
24
24
  module CLI
25
25
  class List < Thor
26
- JenkinsPipelineBuilder.registry.entries.keys.each do |entry|
26
+ JenkinsPipelineBuilder.registry.entries.each_key do |entry|
27
27
  desc entry, "List all #{entry}"
28
28
  define_method(entry) do
29
29
  entries = JenkinsPipelineBuilder.registry.registry[:job][entry]
@@ -39,6 +39,7 @@ module JenkinsPipelineBuilder
39
39
  entries = JenkinsPipelineBuilder.registry.registry[:job]
40
40
  entries.each do |name, set|
41
41
  next unless set.is_a? ExtensionSet
42
+
42
43
  ext = set.extensions.first
43
44
  display_module(name, ext)
44
45
  end
@@ -31,7 +31,7 @@ module JenkinsPipelineBuilder
31
31
  Helper.setup(parent_options).dump(job_name)
32
32
  end
33
33
 
34
- desc 'bootstrap Path', 'Generates pipeline from folder or a file'
34
+ desc 'bootstrap Path [ProjectName]', 'Generates pipeline from folder or a file'
35
35
  def bootstrap(path, project_name = nil)
36
36
  failed = Helper.setup(parent_options).bootstrap(path, project_name)
37
37
  exit(0) if failed.empty? # weird ordering, but rubocop decrees
@@ -39,12 +39,13 @@ module JenkinsPipelineBuilder
39
39
  exit(1)
40
40
  end
41
41
 
42
- desc 'pull_request Path', 'Generates jenkins jobs based on a git pull request.'
42
+ option :base_branch_only, type: :boolean
43
+ desc 'pull_request Path [ProjectName] [--base_branch_only]', 'Generates jenkins jobs based on a git pull request.'
43
44
  def pull_request(path, project_name = nil)
44
- Helper.setup(parent_options).pull_request(path, project_name)
45
+ Helper.setup(parent_options).pull_request(path, project_name, options[:base_branch_only])
45
46
  end
46
47
 
47
- desc 'file Path', 'Does the same thing as bootstrap but doesn\'t actually create jobs on the server'
48
+ desc 'file Path [ProjectName]', 'Does the same thing as bootstrap but doesn\'t actually create jobs on the server'
48
49
  def file(path, project_name = nil)
49
50
  Helper.setup(parent_options).file(path, project_name)
50
51
  end
@@ -33,11 +33,14 @@ module JenkinsPipelineBuilder
33
33
  item = item_bag[:value]
34
34
  bag = {}
35
35
  return unless item.is_a?(Hash)
36
- item.keys.each do |k|
36
+
37
+ item.each_key do |k|
37
38
  val = item[k]
38
39
  next unless val.is_a? String
40
+
39
41
  new_value = resolve_value(val, settings_bag)
40
42
  return nil if new_value.nil?
43
+
41
44
  bag[k] = new_value
42
45
  end
43
46
  my_settings_bag = settings_bag.clone
@@ -48,7 +51,7 @@ module JenkinsPipelineBuilder
48
51
  new_item = compile(item, settings)
49
52
  [true, new_item]
50
53
  rescue StandardError => e
51
- return [false, [e.message]]
54
+ [false, [e.message]]
52
55
  end
53
56
 
54
57
  def compile(item, settings = {})
@@ -67,10 +70,12 @@ module JenkinsPipelineBuilder
67
70
 
68
71
  def handle_enable(item, settings)
69
72
  return item unless item.is_a? Hash
73
+
70
74
  if enable_block_present? item
71
75
  enabled_switch = resolve_value(item[:enabled], settings)
72
76
  return {} if enabled_switch == 'false'
73
77
  raise "Invalid value for #{item[:enabled]}: #{enabled_switch}" if enabled_switch != 'true'
78
+
74
79
  if item[:parameters].is_a? Hash
75
80
  item = item.merge item[:parameters]
76
81
  item.delete :parameters
@@ -105,8 +110,10 @@ module JenkinsPipelineBuilder
105
110
 
106
111
  def compile_array_item(item, settings, array)
107
112
  raise "Found a nil value when processing following array:\n #{array.inspect}" if item.nil?
113
+
108
114
  payload = compile(item, settings)
109
115
  raise "Failed to resolve:\n===>item #{item}\n\n===>of list: #{array.inspect}" if payload.nil?
116
+
110
117
  payload
111
118
  end
112
119
 
@@ -114,8 +121,10 @@ module JenkinsPipelineBuilder
114
121
  if value.nil?
115
122
  raise "key: #{key} has a nil value, this is often a yaml syntax error. Skipping children and siblings"
116
123
  end
124
+
117
125
  payload = compile(value, settings)
118
126
  raise "Failed to resolve:\n===>key: #{key}\n\n===>value: #{value} payload" if payload.nil?
127
+
119
128
  payload
120
129
  end
121
130
 
@@ -135,6 +144,7 @@ module JenkinsPipelineBuilder
135
144
  pull_job = value.to_s.match(/{{pull@(.*)}}/)
136
145
  if pull_job
137
146
  return pull_job[1] unless settings[:pull_request_number]
147
+
138
148
  value = pull_job[1]
139
149
  end
140
150
 
@@ -151,16 +161,19 @@ module JenkinsPipelineBuilder
151
161
  vars.select! do |var|
152
162
  var_val = settings[var]
153
163
  raise "Could not find defined substitution variable: #{var}" if var_val.nil?
164
+
154
165
  value_s.gsub!("{{#{var}}}", var_val.to_s)
155
166
  var_val.nil?
156
167
  end
157
168
  return nil if vars.count != 0
169
+
158
170
  value_s
159
171
  end
160
172
 
161
173
  def correct_job_names!(value)
162
174
  vars = value.scan(/{{job@(.*)}}/).flatten
163
175
  return unless vars.count > 0
176
+
164
177
  vars.select! do |var|
165
178
  var_val = job_collection[var.to_s]
166
179
  value.gsub!("{{job@#{var}}}", var_val[:value][:name]) unless var_val.nil?
@@ -12,6 +12,7 @@ module JenkinsPipelineBuilder
12
12
  SET_METHODS.each do |method_name|
13
13
  define_method method_name do |value = nil|
14
14
  return settings[method_name] if value.nil?
15
+
15
16
  settings[method_name] = value
16
17
  end
17
18
  end
@@ -35,7 +36,6 @@ module JenkinsPipelineBuilder
35
36
  end
36
37
 
37
38
  def installed_version=(version)
38
- version = version.match(/\d+\.\d+(\.\d+)?/)
39
39
  @version = Gem::Version.new version
40
40
  end
41
41
 
@@ -53,9 +53,11 @@ module JenkinsPipelineBuilder
53
53
 
54
54
  def installed_version
55
55
  return @version if @version
56
+
56
57
  reg = JenkinsPipelineBuilder.registry
57
58
  version = reg.versions[settings[:plugin_id]]
58
59
  raise "Plugin #{settings[:name]} is not installed (plugin_id: #{settings[:plugin_id]})" if version.nil?
60
+
59
61
  self.installed_version = version
60
62
  @version
61
63
  end
@@ -103,6 +105,7 @@ module JenkinsPipelineBuilder
103
105
  end
104
106
  unless block
105
107
  raise "no block found for version #{version}" unless blocks.key version
108
+
106
109
  return blocks[version][:block]
107
110
  end
108
111
  store_xml version, block, path
@@ -122,6 +125,7 @@ module JenkinsPipelineBuilder
122
125
  end
123
126
 
124
127
  return instance_variable_get(method_name) unless block
128
+
125
129
  blocks[version] = {} unless blocks[version]
126
130
  blocks[version][method_name] = block
127
131
  end
@@ -37,9 +37,10 @@ module JenkinsPipelineBuilder
37
37
  parameters: []
38
38
  }.freeze
39
39
 
40
- EXT_METHODS.keys.each do |method_name|
40
+ EXT_METHODS.each_key do |method_name|
41
41
  define_method method_name do |value = nil|
42
42
  return instance_variable_get("@#{method_name}") if value.nil?
43
+
43
44
  instance_variable_set("@#{method_name}", value)
44
45
  end
45
46
  end
@@ -59,6 +60,7 @@ module JenkinsPipelineBuilder
59
60
  def execute(value, n_xml)
60
61
  errors = check_parameters value
61
62
  raise ArgumentError, errors.join("\n") if errors.any?
63
+
62
64
  unless path
63
65
  raise ArgumentError, %(Extension #{name} has no valid path
64
66
  Check ModuleRegistry#entries and the definition of the extension
@@ -76,9 +78,11 @@ module JenkinsPipelineBuilder
76
78
  def check_parameters(value)
77
79
  return [] if parameters && parameters.empty?
78
80
  return [] unless value.is_a? Hash
81
+
79
82
  errors = []
80
83
  value.each_key do |key|
81
84
  next if parameters && parameters.include?(key)
85
+
82
86
  errors << "Extension #{name} does not support parameter #{key}"
83
87
  end
84
88
  errors
@@ -86,7 +90,7 @@ module JenkinsPipelineBuilder
86
90
 
87
91
  def errors
88
92
  errors = {}
89
- EXT_METHODS.keys.each do |name|
93
+ EXT_METHODS.each_key do |name|
90
94
  errors[name] = 'Must be set' if send(name).nil?
91
95
  end
92
96
  errors
@@ -54,7 +54,7 @@ build_step do
54
54
  end
55
55
  end
56
56
  else
57
- configs(class: 'empty-list'){}
57
+ configs(class: 'empty-list') {}
58
58
  end
59
59
 
60
60
  projects state[:name]
@@ -1,5 +1,5 @@
1
1
  class ParametersHelper < ExtensionHelper
2
- # rubocop:disable CyclomaticComplexity
2
+ # rubocop:disable Metrics/CyclomaticComplexity
3
3
  def param_type(param)
4
4
  case param[:type]
5
5
  when 'string'
@@ -18,5 +18,5 @@ class ParametersHelper < ExtensionHelper
18
18
  'hudson.model.StringParameterDefinition'
19
19
  end
20
20
  end
21
- # rubocop:enable CyclomaticComplexity
21
+ # rubocop:enable Metrics/CyclomaticComplexity
22
22
  end