puppetlabs_spec_helper 2.16.0 → 3.0.0

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,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 77cf85ee1cb6e0c063fc70b7633745f22e1a74db5dd004addd055b11a3b2d3aa
4
- data.tar.gz: 509b75a40c8e4041dbdd73a2f01bed57f141ebd0c44d695551ed3aa554e67d3f
3
+ metadata.gz: ef65ff61efb2a4ba220a726fd2ac309dc077a37ba9a2a2951430cebdd449b3c3
4
+ data.tar.gz: e079aa402cc3c638d7fb0f9dae179afb884a894ba20334ce781289523177446c
5
5
  SHA512:
6
- metadata.gz: 2c6b745e80ddc0b9d2bad8f902f9155252cf5d8503f8cc1052b3a1f8dc647646701a36145dff46b17bdeaff04e53a32d2927401faf619bfec3ac0fa61212adad
7
- data.tar.gz: 5fb4f21feb106e531d3b5112494fba80e3deab0775d16bcbf559133cccd06259e3ad5e69d9dd055f4024282c299be9b1aceb38d7d7e5be2074a4a808531dbb64
6
+ metadata.gz: 616b63b83dafabafeb3d6ece228f76d94f21ac01266093100fd8fa2c75b14a99c8e2fa5ba3bff1a6e0203a4321486fa2e3133aeb7edc35541d139e31ce1495b3
7
+ data.tar.gz: cb0399bf3984b9bab34d202819493c1829cabf6050f9f2d19ada65a41aaa268e7901e62382c77dfbaf948bff8bd944d42c80d25941a366115fdf79e67e9c5f93
data/.rubocop.yml CHANGED
@@ -2,7 +2,7 @@ require: rubocop-rspec
2
2
  inherit_from: .rubocop_todo.yml
3
3
 
4
4
  AllCops:
5
- TargetRubyVersion: 2.1
5
+ TargetRubyVersion: 2.4
6
6
  # let dependabot find the rough spots for us
7
7
  NewCops: enable
8
8
  Exclude:
@@ -16,10 +16,6 @@ AllCops:
16
16
  - package-testing/vendor/**/*
17
17
  - package-testing/vendor/**/.*
18
18
 
19
- Layout/HeredocIndentation:
20
- Description: The `squiggly` style would be preferable, but is only available from ruby 2.3. We'll enable this when we can.
21
- Enabled: False
22
-
23
19
  # Metrics, excludes complexity and sizing metrics for now, as ruby's defaults are very strict
24
20
  Metrics/AbcSize:
25
21
  Enabled: False
@@ -36,7 +32,7 @@ Metrics/ClassLength:
36
32
  Metrics/CyclomaticComplexity:
37
33
  Enabled: False
38
34
 
39
- Layout/LineLength:
35
+ Metrics/LineLength:
40
36
  Description: People have wide screens, use them.
41
37
  Max: 200
42
38
 
@@ -147,10 +143,6 @@ Style/SymbolArray:
147
143
  Layout/EndOfLine:
148
144
  EnforcedStyle: lf
149
145
 
150
- RSpec/FactoryBot/CreateList:
151
- Description: produces lots of errors (not violations) with out code
152
- Enabled: false
153
-
154
146
  Style/AccessModifierDeclarations:
155
147
  EnforcedStyle: inline
156
148
 
data/.rubocop_todo.yml CHANGED
@@ -1,28 +1,19 @@
1
1
  # This configuration was generated by
2
2
  # `rubocop --auto-gen-config`
3
- # on 2020-11-16 16:15:06 +0000 using RuboCop version 0.57.2.
3
+ # on 2021-02-09 10:30:38 +0000 using RuboCop version 0.57.2.
4
4
  # The point is for the user to remove these configuration records
5
5
  # one by one as the offenses are removed from the code base.
6
6
  # Note that changes in the inspected code, or installation of new
7
7
  # versions of RuboCop, may require this file to be generated again.
8
8
 
9
- # Offense count: 2
9
+ # Offense count: 1
10
10
  # Cop supports --auto-correct.
11
11
  # Configuration parameters: EnforcedStyleAlignWith, AutoCorrect, Severity.
12
12
  # SupportedStylesAlignWith: keyword, variable, start_of_line
13
13
  Layout/EndAlignment:
14
14
  Exclude:
15
- - 'lib/puppetlabs_spec_helper/rake_tasks.rb'
16
15
  - 'spec/watchr.rb'
17
16
 
18
- # Offense count: 1
19
- # Cop supports --auto-correct.
20
- # Configuration parameters: EnforcedStyle.
21
- # SupportedStyles: auto_detection, squiggly, active_support, powerpack, unindent
22
- Layout/IndentHeredoc:
23
- Exclude:
24
- - 'lib/puppetlabs_spec_helper/rake_tasks.rb'
25
-
26
17
  # Offense count: 4
27
18
  # Configuration parameters: AllowSafeAssignment.
28
19
  Lint/AssignmentInCondition:
@@ -38,10 +29,9 @@ Lint/HandleExceptions:
38
29
  - 'lib/puppetlabs_spec_helper/puppetlabs_spec/files.rb'
39
30
  - 'lib/puppetlabs_spec_helper/rake_tasks.rb'
40
31
 
41
- # Offense count: 2
32
+ # Offense count: 1
42
33
  Lint/UselessAssignment:
43
34
  Exclude:
44
- - 'lib/puppetlabs_spec_helper/puppet_spec_helper.rb'
45
35
  - 'lib/puppetlabs_spec_helper/puppetlabs_spec/puppet_internals.rb'
46
36
 
47
37
  # Offense count: 2
data/.travis.yml CHANGED
@@ -4,30 +4,20 @@ language: ruby
4
4
  cache: bundler
5
5
  before_install: bundle -v
6
6
  script: bundle exec rake
7
- matrix:
7
+ jobs:
8
8
  fast_finish: true
9
9
  include:
10
10
  - rvm: '2.7'
11
- env: PUPPET_GEM_VERSION='https://github.com/puppetlabs/puppet.git#main' # TODO: change to 7 once it becomes available
11
+ env: PUPPET_GEM_VERSION='https://github.com/puppetlabs/puppet.git#main'
12
+ - rvm: '2.7'
13
+ env: PUPPET_GEM_VERSION='~> 7.0' COVERAGE=yes
12
14
  - rvm: '2.6'
13
15
  env: PUPPET_GEM_VERSION='~> 6.0' COVERAGE=yes
14
16
  - rvm: '2.5'
15
17
  env: PUPPET_GEM_VERSION='~> 6.0' COVERAGE=yes
16
18
  - rvm: '2.4'
17
19
  env: PUPPET_GEM_VERSION='~> 6.0' COVERAGE=yes
18
- - rvm: '2.3'
19
- env: PUPPET_GEM_VERSION='~> 6.0'
20
20
  - rvm: '2.4'
21
21
  env: PUPPET_GEM_VERSION='~> 5.0' COVERAGE=yes
22
- - rvm: '2.3'
23
- env: PUPPET_GEM_VERSION='~> 5.0'
24
- - rvm: '2.1'
25
- env: PUPPET_GEM_VERSION='~> 5.0'
26
- - rvm: '2.4'
27
- env: PUPPET_GEM_VERSION='~> 4.0' COVERAGE=yes
28
- - rvm: '2.3'
29
- env: PUPPET_GEM_VERSION='~> 4.0'
30
- - rvm: '2.1'
31
- env: PUPPET_GEM_VERSION='~> 4.0'
32
22
  notifications:
33
23
  email: false
data/CHANGELOG.md CHANGED
@@ -3,6 +3,16 @@
3
3
  All significant changes to this repo will be summarized in this file.
4
4
 
5
5
 
6
+ ## [v3.0.0](https://github.com/puppetlabs/puppetlabs_spec_helper/tree/v3.0.0) (2021-02-10)
7
+
8
+ [Full Changelog](https://github.com/puppetlabs/puppetlabs_spec_helper/compare/v2.16.0...v3.0.0)
9
+
10
+ **Implemented enhancements:**
11
+
12
+ - dropping rubies before 2.4 [\#332](https://github.com/puppetlabs/puppetlabs_spec_helper/pull/332) ([DavidS](https://github.com/DavidS))
13
+ - Remove i18n/gettext task [\#331](https://github.com/puppetlabs/puppetlabs_spec_helper/pull/331) ([DavidS](https://github.com/DavidS))
14
+ - Restructure PuppetLint rake tasks so they can be configurable [\#330](https://github.com/puppetlabs/puppetlabs_spec_helper/pull/330) ([nmaludy](https://github.com/nmaludy))
15
+
6
16
  ## [v2.16.0](https://github.com/puppetlabs/puppetlabs_spec_helper/tree/v2.16.0) (2021-01-18)
7
17
 
8
18
  [Full Changelog](https://github.com/puppetlabs/puppetlabs_spec_helper/compare/v2.15.0...v2.16.0)
@@ -15,6 +25,7 @@ All significant changes to this repo will be summarized in this file.
15
25
 
16
26
  **Merged pull requests:**
17
27
 
28
+ - Release prep for v2.16.0 [\#329](https://github.com/puppetlabs/puppetlabs_spec_helper/pull/329) ([DavidS](https://github.com/DavidS))
18
29
  - Update pathspec requirement from ~\> 0.2.1 to \>= 0.2.1, \< 1.1.0 [\#328](https://github.com/puppetlabs/puppetlabs_spec_helper/pull/328) ([dependabot-preview[bot]](https://github.com/apps/dependabot-preview))
19
30
  - Update rubocop requirement from = 0.49 to 0.57.2; prepare for future move to 1.3.1 [\#322](https://github.com/puppetlabs/puppetlabs_spec_helper/pull/322) ([dependabot-preview[bot]](https://github.com/apps/dependabot-preview))
20
31
 
data/Gemfile CHANGED
@@ -22,10 +22,9 @@ gemspec
22
22
  def infer_puppet_version
23
23
  # Infer the Puppet Gem version based on the Ruby Version
24
24
  ruby_ver = Gem::Version.new(RUBY_VERSION.dup)
25
+ return '~> 7.0' if ruby_ver >= Gem::Version.new('2.7.0')
25
26
  return '~> 6.0' if ruby_ver >= Gem::Version.new('2.5.0')
26
- return '~> 5.0' if ruby_ver >= Gem::Version.new('2.4.0')
27
-
28
- '~> 4.0'
27
+ '~> 5.0'
29
28
  end
30
29
 
31
30
  group :development do
@@ -40,10 +39,4 @@ group :development do
40
39
  end
41
40
  end
42
41
 
43
- # pin some gems for older ruby versions
44
- gem 'fakefs', '<= 0.13.3' if Gem::Version.new(RUBY_VERSION.dup) < Gem::Version.new('2.4.0')
45
- gem 'json_pure', '<=2.0.1' if Gem::Version.new(RUBY_VERSION.dup) < Gem::Version.new('2.0.0')
46
- gem 'puppet-syntax', '<= 3' if Gem::Version.new(RUBY_VERSION.dup) < Gem::Version.new('2.4.0')
47
- gem 'rack', '~> 1' if Gem::Version.new(RUBY_VERSION.dup) < Gem::Version.new('2.2.0')
48
-
49
42
  # vim:filetype=ruby
@@ -47,7 +47,7 @@ require 'puppetlabs_spec_helper/puppetlabs_spec/files'
47
47
  # to compatibility mode for older versions of puppet.
48
48
  begin
49
49
  require 'puppet/test/test_helper'
50
- rescue LoadError => e
50
+ rescue LoadError
51
51
  end
52
52
 
53
53
  # This is just a utility class to allow us to isolate the various version-specific
@@ -12,7 +12,7 @@ module PuppetlabsSpec
12
12
  def scope(parts = {})
13
13
  RSpec.deprecate('scope', replacement: 'rspec-puppet 2.2.0 provides a scope property')
14
14
 
15
- if Puppet.version =~ %r{^2\.[67]}
15
+ if %r{^2\.[67]}.match?(Puppet.version)
16
16
  # loadall should only be necessary prior to 3.x
17
17
  # Please note, loadall needs to happen first when creating a scope, otherwise
18
18
  # you might receive undefined method `function_*' errors
@@ -23,7 +23,7 @@ module PuppetlabsSpec
23
23
  scope_parent = parts[:parent] || scope_compiler.topscope
24
24
  scope_resource = parts[:resource] || resource(type: :node, title: scope_compiler.node.name)
25
25
 
26
- scope = if Puppet.version =~ %r{^2\.[67]}
26
+ scope = if %r{^2\.[67]}.match?(Puppet.version)
27
27
  Puppet::Parser::Scope.new(compiler: scope_compiler)
28
28
  else
29
29
  Puppet::Parser::Scope.new(scope_compiler)
@@ -149,7 +149,7 @@ namespace :build do
149
149
  require 'pdk/util'
150
150
  require 'pdk/module/build'
151
151
 
152
- path = PDK::Module::Build.invoke(:force => true, :'target-dir' => File.join(Dir.pwd, 'pkg'))
152
+ path = PDK::Module::Build.invoke(force: true, 'target-dir': File.join(Dir.pwd, 'pkg'))
153
153
  puts "Module built: #{path}"
154
154
  rescue LoadError
155
155
  _ = `pdk --version`
@@ -172,52 +172,34 @@ require 'puppet-lint/tasks/puppet-lint'
172
172
  # Must clear as it will not override the existing puppet-lint rake task since we require to import for
173
173
  # the PuppetLint::RakeTask
174
174
  Rake::Task[:lint].clear
175
- # Relative is not able to be set within the context of PuppetLint::RakeTask
175
+ # Utilize PuppetLint global configuration so that these settings can be tweaked by
176
+ # spec_helper.rb in an individual module
176
177
  PuppetLint.configuration.relative = true
177
- PuppetLint::RakeTask.new(:lint) do |config|
178
- config.fail_on_warnings = true
179
- config.disable_checks = %w[
180
- 80chars
181
- 140chars
182
- class_inherits_from_params_class
183
- class_parameter_defaults
184
- disable_autoloader_layout
185
- documentation
186
- single_quote_string_with_variables
187
- ]
188
- config.ignore_paths = [
189
- '.vendor/**/*.pp',
190
- 'bundle/**/*.pp',
191
- 'pkg/**/*.pp',
192
- 'spec/**/*.pp',
193
- 'tests/**/*.pp',
194
- 'types/**/*.pp',
195
- 'vendor/**/*.pp',
196
- ]
178
+ PuppetLint.configuration.ignore_paths ||= []
179
+ PuppetLint.configuration.ignore_paths << '.vendor/**/*.pp'
180
+ PuppetLint.configuration.ignore_paths << 'bundle/**/*.pp'
181
+ PuppetLint.configuration.ignore_paths << 'pkg/**/*.pp'
182
+ PuppetLint.configuration.ignore_paths << 'spec/**/*.pp'
183
+ PuppetLint.configuration.ignore_paths << 'tests/**/*.pp'
184
+ PuppetLint.configuration.ignore_paths << 'types/**/*.pp'
185
+ PuppetLint.configuration.ignore_paths << 'vendor/**/*.pp'
186
+ puppet_lint_disable_checks = %w[
187
+ 80chars
188
+ 140chars
189
+ class_inherits_from_params_class
190
+ class_parameter_defaults
191
+ disable_autoloader_layout
192
+ documentation
193
+ single_quote_string_with_variables
194
+ ]
195
+ puppet_lint_disable_checks.each do |check|
196
+ PuppetLint.configuration.send("disable_#{check}")
197
197
  end
198
+ PuppetLint::RakeTask.new(:lint)
198
199
 
199
200
  desc 'Run puppet-lint and fix issues automatically'
200
201
  PuppetLint::RakeTask.new(:lint_fix) do |config|
201
- config.fail_on_warnings = true
202
202
  config.fix = true
203
- config.disable_checks = %w[
204
- 80chars
205
- 140chars
206
- class_inherits_from_params_class
207
- class_parameter_defaults
208
- disable_autoloader_layout
209
- documentation
210
- single_quote_string_with_variables
211
- ]
212
- config.ignore_paths = [
213
- '.vendor/**/*.pp',
214
- 'bundle/**/*.pp',
215
- 'pkg/**/*.pp',
216
- 'spec/**/*.pp',
217
- 'tests/**/*.pp',
218
- 'types/**/*.pp',
219
- 'vendor/**/*.pp',
220
- ]
221
203
  end
222
204
 
223
205
  require 'puppet-syntax/tasks/puppet-syntax'
@@ -279,7 +261,7 @@ task :compute_dev_version do
279
261
  # If the branch is a release branch we append an 'r' into the new_version,
280
262
  # this is due to the release branch buildID conflicting with master branch when trying to push to the staging forge.
281
263
  # More info can be found at https://tickets.puppetlabs.com/browse/FM-6170
282
- new_version = if build = ENV['BUILD_NUMBER'] || ENV['TRAVIS_BUILD_NUMBER']
264
+ new_version = if build = (ENV['BUILD_NUMBER'] || ENV['TRAVIS_BUILD_NUMBER'])
283
265
  if branch.eql? 'release'
284
266
  '%s-%s%04d-%s' % [version, 'r', build, sha] # legacy support code # rubocop:disable Style/FormatStringToken
285
267
  else
@@ -363,29 +345,6 @@ rescue LoadError
363
345
  end
364
346
  end
365
347
 
366
- module_dir = Dir.pwd
367
- locales_dir = File.absolute_path('locales', module_dir)
368
- # if the task is allowed to run when the module does not have a locales directory,
369
- # the task is run in the puppet gem instead and creates a POT there.
370
- puts 'gettext-setup tasks will only be loaded if the locales/ directory is present' if Rake.verbose == true
371
- if File.exist? locales_dir
372
- begin
373
- spec = Gem::Specification.find_by_name 'gettext-setup'
374
- load "#{spec.gem_dir}/lib/tasks/gettext.rake"
375
- # Initialization requires a valid locales directory
376
- GettextSetup.initialize(locales_dir)
377
- namespace :module do
378
- desc 'Runs all tasks to build a modules POT file for internationalization'
379
- task :pot_gen do
380
- Rake::Task['gettext:pot'].invoke
381
- Rake::Task['gettext:metadata_pot'].invoke("#{module_dir}/metadata.json")
382
- end
383
- end
384
- rescue Gem::LoadError
385
- puts 'No gettext-setup gem found, skipping GettextSetup config initialization' if Rake.verbose == true
386
- end
387
- end
388
-
389
348
  def create_gch_task(changelog_user = nil, changelog_project = nil, changelog_since_tag = nil, changelog_tag_pattern = 'v%s')
390
349
  if Bundler.rubygems.find_name('github_changelog_generator').any?
391
350
  # needed a place to hide these methods
@@ -451,18 +410,18 @@ def create_gch_task(changelog_user = nil, changelog_project = nil, changelog_sin
451
410
  else
452
411
  desc 'Generate a Changelog from GitHub'
453
412
  task :changelog do
454
- raise <<MESSAGE
455
- The changelog tasks depends on unreleased features of the github_changelog_generator gem.
456
- Please manually add it to your .sync.yml for now, and run `pdk update`:
457
- ---
458
- Gemfile:
459
- optional:
460
- ':development':
461
- - gem: 'github_changelog_generator'
462
- git: 'https://github.com/skywinder/github-changelog-generator'
463
- ref: '20ee04ba1234e9e83eb2ffb5056e23d641c7a018'
464
- condition: "Gem::Version.new(RUBY_VERSION.dup) >= Gem::Version.new('2.2.2')"
465
- MESSAGE
413
+ raise <<~MESSAGE
414
+ The changelog tasks depends on unreleased features of the github_changelog_generator gem.
415
+ Please manually add it to your .sync.yml for now, and run `pdk update`:
416
+ ---
417
+ Gemfile:
418
+ optional:
419
+ ':development':
420
+ - gem: 'github_changelog_generator'
421
+ git: 'https://github.com/skywinder/github-changelog-generator'
422
+ ref: '20ee04ba1234e9e83eb2ffb5056e23d641c7a018'
423
+ condition: "Gem::Version.new(RUBY_VERSION.dup) >= Gem::Version.new('2.2.2')"
424
+ MESSAGE
466
425
  end
467
426
  end
468
427
  end
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module PuppetlabsSpecHelper
4
- VERSION = '2.16.0'.freeze
4
+ VERSION = '3.0.0'
5
5
 
6
6
  # compat for pre-1.2.0 users; deprecated
7
7
  module Version
@@ -28,7 +28,6 @@ Gem::Specification.new do |spec|
28
28
 
29
29
  spec.add_development_dependency 'bundler'
30
30
  spec.add_development_dependency 'fakefs', ['>= 0.13.3', '< 2']
31
- spec.add_development_dependency 'gettext-setup', '~> 0.29'
32
31
  spec.add_development_dependency 'pry'
33
32
  spec.add_development_dependency 'puppet'
34
33
  spec.add_development_dependency 'rake', ['>= 10.0', '< 14']
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: puppetlabs_spec_helper
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.16.0
4
+ version: 3.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Puppet, Inc.
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: exe
11
11
  cert_chain: []
12
- date: 2021-01-18 00:00:00.000000000 Z
12
+ date: 2021-02-10 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: mocha
@@ -127,20 +127,6 @@ dependencies:
127
127
  - - "<"
128
128
  - !ruby/object:Gem::Version
129
129
  version: '2'
130
- - !ruby/object:Gem::Dependency
131
- name: gettext-setup
132
- requirement: !ruby/object:Gem::Requirement
133
- requirements:
134
- - - "~>"
135
- - !ruby/object:Gem::Version
136
- version: '0.29'
137
- type: :development
138
- prerelease: false
139
- version_requirements: !ruby/object:Gem::Requirement
140
- requirements:
141
- - - "~>"
142
- - !ruby/object:Gem::Version
143
- version: '0.29'
144
130
  - !ruby/object:Gem::Dependency
145
131
  name: pry
146
132
  requirement: !ruby/object:Gem::Requirement