diff options
-rw-r--r-- | .gitignore | 1 | ||||
-rw-r--r-- | .gitlab-ci.yml | 75 | ||||
-rw-r--r-- | .pdkignore | 1 | ||||
-rw-r--r-- | .rubocop.yml | 13 | ||||
-rw-r--r-- | .travis.yml | 16 | ||||
-rw-r--r-- | Gemfile | 1 | ||||
-rw-r--r-- | Rakefile | 3 | ||||
-rw-r--r-- | appveyor.yml | 17 | ||||
-rw-r--r-- | metadata.json | 4 | ||||
-rw-r--r-- | spec/spec_helper.rb | 10 | ||||
-rw-r--r-- | spec/unit/provider/augeas/augeas_spec.rb | 16 |
11 files changed, 69 insertions, 88 deletions
@@ -1,3 +1,4 @@ +.git/ .*.sw[op] .metadata .yardoc diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 35e4209..d651650 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,70 +1,41 @@ --- stages: - - test_2.4.1 - - test_2.1.9 + - syntax + - unit + +cache: + paths: + - vendor/bundle before_script: - bundle -v - rm Gemfile.lock || true - gem update --system - - gem update bundler - gem --version - bundle -v - - bundle install --without system_tests - -rubocop-2.4.1: - stage: test_2.4.1 - image: ruby:2.4.1 - script: - - bundle exec rake rubocop - -syntax-2.4.1: - stage: test_2.4.1 - image: ruby:2.4.1 - script: - - bundle exec rake syntax lint + - bundle install --without system_tests --path vendor/bundle --jobs $(nproc) -metadata-2.4.1: - stage: test_2.4.1 - image: ruby:2.4.1 - script: - - bundle exec rake metadata_lint - -rspec-puppet-2.4.1: - stage: test_2.4.1 - image: ruby:2.4.1 - variables: - PUPPET_GEM_VERSION: ~> 4.0 - CHECK: spec - script: - - bundle update - - bundle exec rake $CHECK - -rubocop-2.1.9: - stage: test_2.1.9 +parallel_spec-Ruby 2.1.9-Puppet ~> 4.0: + stage: syntax image: ruby:2.1.9 script: - - bundle exec rake rubocop + - bundle exec rake parallel_spec + variables: + PUPPET_GEM_VERSION: '~> 4.0' -syntax-2.1.9: - stage: test_2.1.9 - image: ruby:2.1.9 +syntax lint metadata_lint check:symlinks check:git_ignore check:dot_underscore check:test_file rubocop-Ruby 2.4.4-Puppet ~> 5.5: + stage: syntax + image: ruby:2.4.4 script: - - bundle exec rake syntax lint + - bundle exec rake syntax lint metadata_lint check:symlinks check:git_ignore check:dot_underscore check:test_file rubocop + variables: + PUPPET_GEM_VERSION: '~> 5.5' -metadata-2.1.9: - stage: test_2.1.9 - image: ruby:2.1.9 +parallel_spec-Ruby 2.4.4-Puppet ~> 5.5: + stage: syntax + image: ruby:2.4.4 script: - - bundle exec rake metadata_lint - -rspec-puppet-2.1.9: - stage: test_2.1.9 - image: ruby:2.1.9 + - bundle exec rake parallel_spec variables: - PUPPET_GEM_VERSION: ~> 4.0 - CHECK: spec - script: - - bundle update - - bundle exec rake $CHECK + PUPPET_GEM_VERSION: '~> 5.5' @@ -1,3 +1,4 @@ +.git/ .*.sw[op] .metadata .yardoc diff --git a/.rubocop.yml b/.rubocop.yml index f97abb8..8586548 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -8,11 +8,14 @@ AllCops: Exclude: - bin/* - ".vendor/**/*" - - Gemfile - - Rakefile + - "**/Gemfile" + - "**/Rakefile" - pkg/**/* - spec/fixtures/**/* - vendor/**/* + - "**/Puppetfile" + - "**/Vagrantfile" + - "**/Guardfile" Metrics/LineLength: Description: People have wide screens, use them. Max: 200 @@ -84,6 +87,12 @@ Style/VariableName: Enabled: false RSpec/MessageSpies: EnforcedStyle: receive +Style/Documentation: + Exclude: + - lib/puppet/parser/functions/**/* + - spec/**/* +Style/WordArray: + EnforcedStyle: brackets Style/CollectionMethods: Enabled: true Style/MethodCalledOnDoEndBlock: diff --git a/.travis.yml b/.travis.yml index 0f10309..81f77dd 100644 --- a/.travis.yml +++ b/.travis.yml @@ -7,7 +7,6 @@ before_install: - bundle -v - rm -f Gemfile.lock - gem update --system - - gem update bundler - gem --version - bundle -v script: @@ -16,22 +15,17 @@ bundler_args: --without system_tests rvm: - 2.4.1 env: - - PUPPET_GEM_VERSION="~> 5.0" CHECK=spec + global: + - BEAKER_PUPPET_COLLECTION=puppet5 PUPPET_GEM_VERSION="~> 5.0" matrix: fast_finish: true include: - - env: CHECK=rubocop + env: CHECK="syntax lint metadata_lint check:symlinks check:git_ignore check:dot_underscore check:test_file rubocop" - - env: CHECK="syntax lint" + env: CHECK=parallel_spec - - env: CHECK=metadata_lint - - - env: CHECK=release_checks - - - env: CHECK=spec - - - env: PUPPET_GEM_VERSION="~> 4.0" CHECK=spec + env: PUPPET_GEM_VERSION="~> 4.0" CHECK=parallel_spec rvm: 2.1.9 branches: only: @@ -33,7 +33,6 @@ group :development do gem "puppet-module-posix-dev-r#{minor_version}", require: false, platforms: [:ruby] gem "puppet-module-win-default-r#{minor_version}", require: false, platforms: [:mswin, :mingw, :x64_mingw] gem "puppet-module-win-dev-r#{minor_version}", require: false, platforms: [:mswin, :mingw, :x64_mingw] - gem "puppet-blacksmith", '~> 3.4', require: false, platforms: [:ruby] end group :system_tests do gem "puppet-module-posix-system-r#{minor_version}", require: false, platforms: [:ruby] @@ -2,4 +2,5 @@ require 'puppetlabs_spec_helper/rake_tasks' require 'puppet-syntax/tasks/puppet-syntax' require 'puppet_blacksmith/rake_tasks' if Bundler.rubygems.find_name('puppet-blacksmith').any? -PuppetLint.configuration.send('relative') +PuppetLint.configuration.send('disable_relative') + diff --git a/appveyor.yml b/appveyor.yml index 5fd5e89..4a5b227 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -1,3 +1,4 @@ +--- version: 1.1.x.{build} skip_commits: message: /^\(?doc\)?.*/ @@ -12,29 +13,23 @@ environment: matrix: - RUBY_VERSION: 24-x64 - CHECK: syntax lint - - - RUBY_VERSION: 24-x64 - CHECK: metadata_lint - - - RUBY_VERSION: 24-x64 - CHECK: rubocop + CHECK: syntax lint metadata_lint check:symlinks check:git_ignore check:dot_underscore check:test_file rubocop - PUPPET_GEM_VERSION: ~> 4.0 RUBY_VERSION: 21 - CHECK: spec + CHECK: parallel_spec - PUPPET_GEM_VERSION: ~> 4.0 RUBY_VERSION: 21-x64 - CHECK: spec + CHECK: parallel_spec - PUPPET_GEM_VERSION: ~> 5.0 RUBY_VERSION: 24 - CHECK: spec + CHECK: parallel_spec - PUPPET_GEM_VERSION: ~> 5.0 RUBY_VERSION: 24-x64 - CHECK: spec + CHECK: parallel_spec matrix: fast_finish: true install: diff --git a/metadata.json b/metadata.json index 38b347c..0d59433 100644 --- a/metadata.json +++ b/metadata.json @@ -60,7 +60,7 @@ "version_requirement": ">= 4.7.0 < 6.0.0" } ], - "pdk-version": "1.5.0", + "pdk-version": "1.6.0", "template-url": "file:///opt/puppetlabs/pdk/share/cache/pdk-templates.git", - "template-ref": "1.5.0-0-gd1b3eca" + "template-ref": "1.6.0-0-gf5564c0" } diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 2d5f003..e69d11d 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -1,3 +1,4 @@ + require 'puppetlabs_spec_helper/module_spec_helper' require 'rspec-puppet-facts' @@ -33,3 +34,12 @@ RSpec.configure do |c| Puppet.settings[:strict] = :warning end end + +def ensure_module_defined(module_name) + module_name.split('::').reduce(Object) do |last_module, next_module| + last_module.const_set(next_module, Module.new) unless last_module.const_defined?(next_module) + last_module.const_get(next_module) + end +end + +# 'spec_overrides' from sync.yml will appear below this line diff --git a/spec/unit/provider/augeas/augeas_spec.rb b/spec/unit/provider/augeas/augeas_spec.rb index 46bf161..6166140 100644 --- a/spec/unit/provider/augeas/augeas_spec.rb +++ b/spec/unit/provider/augeas/augeas_spec.rb @@ -230,7 +230,7 @@ describe Puppet::Type.type(:augeas).provider(:augeas) do end describe 'values filters' do - let(:augeas) { stub('augeas', match: %w[set of values]) } + let(:augeas) { stub('augeas', match: ['set', 'of', 'values']) } before(:each) do augeas.stubs(:get).returns('set').then.returns('of').then.returns('values') @@ -280,7 +280,7 @@ describe Puppet::Type.type(:augeas).provider(:augeas) do end describe 'match filters' do - let(:augeas) { stub('augeas', match: %w[set of values]) } + let(:augeas) { stub('augeas', match: ['set', 'of', 'values']) } before(:each) do augeas.stubs('close') @@ -351,7 +351,7 @@ describe Puppet::Type.type(:augeas).provider(:augeas) do end it 'handles no filters' do - augeas.stubs('match').returns(%w[set of values]) + augeas.stubs('match').returns(['set', 'of', 'values']) expect(provider.need_to_run?).to eq(true) end @@ -424,13 +424,13 @@ describe Puppet::Type.type(:augeas).provider(:augeas) do it 'returns true when a match filter matches' do resource[:onlyif] = 'match path size == 3' - augeas.stubs('match').returns(%w[set of values]) + augeas.stubs('match').returns(['set', 'of', 'values']) expect(provider.need_to_run?).to eq(true) end it 'returns false when a match filter does not match' do resource[:onlyif] = 'match path size == 2' - augeas.stubs('match').returns(%w[set of values]) + augeas.stubs('match').returns(['set', 'of', 'values']) expect(provider.need_to_run?).to eq(false) end @@ -438,21 +438,21 @@ describe Puppet::Type.type(:augeas).provider(:augeas) do it 'setting force should not change the above logic' do resource[:force] = true resource[:onlyif] = 'match path size == 2' - augeas.stubs('match').returns(%w[set of values]) + augeas.stubs('match').returns(['set', 'of', 'values']) expect(provider.need_to_run?).to eq(false) end # Ticket 5211 testing it 'returns true when a size != the provided value' do resource[:onlyif] = 'match path size != 17' - augeas.stubs('match').returns(%w[set of values]) + augeas.stubs('match').returns(['set', 'of', 'values']) expect(provider.need_to_run?).to eq(true) end # Ticket 5211 testing it 'returns false when a size does equal the provided value' do resource[:onlyif] = 'match path size != 3' - augeas.stubs('match').returns(%w[set of values]) + augeas.stubs('match').returns(['set', 'of', 'values']) expect(provider.need_to_run?).to eq(false) end |