From e3a2118acec0483213e386071d5ca4511435719e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Steffen=20=E2=80=9Csaz=E2=80=9D=20Zieger?= Date: Fri, 21 Feb 2025 11:31:46 +0100 Subject: [PATCH] Update from modulesync_config --- .editorconfig | 15 + .github/ISSUE_TEMPLATE.md | 26 ++ .github/PULL_REQUEST_TEMPLATE.md | 20 + .github/labeler.yml | 6 + .github/release.yml | 42 +++ .github/workflows/ci.yml | 22 ++ .github/workflows/labeler.yml | 18 + .github/workflows/prepare_release.yml | 23 ++ .github/workflows/release.yml | 23 ++ .gitignore | 35 +- .msync.yml | 5 + .overcommit.yml | 67 ++++ .pmtignore | 39 ++ .puppet-lint.rc | 6 + .rspec | 2 - .rubocop.yml | 515 +------------------------- .travis.yml | 44 --- Gemfile | 64 +--- Rakefile | 69 ++-- spec/spec.opts | 6 - spec/spec_helper.rb | 35 +- 21 files changed, 411 insertions(+), 671 deletions(-) create mode 100644 .editorconfig create mode 100644 .github/ISSUE_TEMPLATE.md create mode 100644 .github/PULL_REQUEST_TEMPLATE.md create mode 100644 .github/labeler.yml create mode 100644 .github/release.yml create mode 100644 .github/workflows/ci.yml create mode 100644 .github/workflows/labeler.yml create mode 100644 .github/workflows/prepare_release.yml create mode 100644 .github/workflows/release.yml create mode 100644 .msync.yml create mode 100644 .overcommit.yml create mode 100644 .pmtignore create mode 100644 .puppet-lint.rc delete mode 100644 .rspec delete mode 100644 .travis.yml delete mode 100644 spec/spec.opts diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 00000000..ecb10a80 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,15 @@ +# editorconfig.org + +# Managed by modulesync - DO NOT EDIT +# https://voxpupuli.org/docs/updating-files-managed-with-modulesync/ + +root = true + +[*] +charset = utf-8 +end_of_line = lf +indent_size = 2 +tab_width = 2 +indent_style = space +insert_final_newline = true +trim_trailing_whitespace = true diff --git a/.github/ISSUE_TEMPLATE.md b/.github/ISSUE_TEMPLATE.md new file mode 100644 index 00000000..593e7aa8 --- /dev/null +++ b/.github/ISSUE_TEMPLATE.md @@ -0,0 +1,26 @@ + + +## Affected Puppet, Ruby, OS and module versions/distributions + +- Puppet: +- Ruby: +- Distribution: +- Module version: + +## How to reproduce (e.g Puppet code you use) + +## What are you seeing + +## What behaviour did you expect instead + +## Output log + +## Any additional information you'd like to impart diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md new file mode 100644 index 00000000..342807bc --- /dev/null +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -0,0 +1,20 @@ + +#### Pull Request (PR) description + + +#### This Pull Request (PR) fixes the following issues + diff --git a/.github/labeler.yml b/.github/labeler.yml new file mode 100644 index 00000000..f2d08d6b --- /dev/null +++ b/.github/labeler.yml @@ -0,0 +1,6 @@ +--- +# Managed by modulesync - DO NOT EDIT +# https://voxpupuli.org/docs/updating-files-managed-with-modulesync/ + +skip-changelog: + - head-branch: ['^release-*', 'release'] diff --git a/.github/release.yml b/.github/release.yml new file mode 100644 index 00000000..f5b5d7a9 --- /dev/null +++ b/.github/release.yml @@ -0,0 +1,42 @@ +--- +# Managed by modulesync - DO NOT EDIT +# https://voxpupuli.org/docs/updating-files-managed-with-modulesync/ + +# https://docs.github.com/en/repositories/releasing-projects-on-github/automatically-generated-release-notes + +changelog: + exclude: + labels: + - duplicate + - invalid + - modulesync + - question + - skip-changelog + - wont-fix + - wontfix + + categories: + - title: Breaking Changes 🛠 + labels: + - backwards-incompatible + + - title: New Features 🎉 + labels: + - enhancement + + - title: Bug Fixes 🐛 + labels: + - bug + + - title: Documentation Updates 📚 + labels: + - documentation + - docs + + - title: Dependency Updates ⬆️ + labels: + - dependencies + + - title: Other Changes + labels: + - "*" diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 00000000..b298dbf4 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,22 @@ +--- +# Managed by modulesync - DO NOT EDIT +# https://voxpupuli.org/docs/updating-files-managed-with-modulesync/ + +name: CI + +# yamllint disable-line rule:truthy +on: + pull_request: {} + push: + branches: + - main + - master + +concurrency: + group: ${{ github.ref_name }} + cancel-in-progress: true + +jobs: + puppet: + name: Puppet + uses: voxpupuli/gha-puppet/.github/workflows/basic.yml@v3 diff --git a/.github/workflows/labeler.yml b/.github/workflows/labeler.yml new file mode 100644 index 00000000..73be88dc --- /dev/null +++ b/.github/workflows/labeler.yml @@ -0,0 +1,18 @@ +--- +# Managed by modulesync - DO NOT EDIT +# https://voxpupuli.org/docs/updating-files-managed-with-modulesync/ + +name: "Pull Request Labeler" + +# yamllint disable-line rule:truthy +on: + pull_request_target: {} + +jobs: + labeler: + permissions: + contents: read + pull-requests: write + runs-on: ubuntu-latest + steps: + - uses: actions/labeler@v5 diff --git a/.github/workflows/prepare_release.yml b/.github/workflows/prepare_release.yml new file mode 100644 index 00000000..6d3b05f3 --- /dev/null +++ b/.github/workflows/prepare_release.yml @@ -0,0 +1,23 @@ +--- +# Managed by modulesync - DO NOT EDIT +# https://voxpupuli.org/docs/updating-files-managed-with-modulesync/ + +name: 'Prepare Release' + +on: + workflow_dispatch: + inputs: + version: + description: 'Module version to be released. Must be a valid semver string without leading v. (1.2.3)' + required: false + +jobs: + release_prep: + uses: 'voxpupuli/gha-puppet/.github/workflows/prepare_release.yml@v3' + with: + version: ${{ github.event.inputs.version }} + allowed_owner: 'saz' + secrets: + # Configure secrets here: + # https://docs.github.com/en/actions/security-guides/encrypted-secrets + github_pat: '${{ secrets.PCCI_PAT_RELEASE_PREP }}' diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 00000000..b6079081 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,23 @@ +--- +# Managed by modulesync - DO NOT EDIT +# https://voxpupuli.org/docs/updating-files-managed-with-modulesync/ + +name: Release + +# yamllint disable-line rule:truthy +on: + push: + tags: + - '*' + +jobs: + release: + name: Release + uses: voxpupuli/gha-puppet/.github/workflows/release.yml@v3 + with: + allowed_owner: 'saz' + secrets: + # Configure secrets here: + # https://docs.github.com/en/actions/security-guides/encrypted-secrets + username: ${{ secrets.PUPPET_FORGE_USERNAME }} + api_key: ${{ secrets.PUPPET_FORGE_API_KEY }} diff --git a/.gitignore b/.gitignore index 87958e64..adea1b01 100644 --- a/.gitignore +++ b/.gitignore @@ -1,10 +1,25 @@ -pkg/ -*.swp -*.swo -.forge-releng -/spec/fixtures -.DS_Store -.bundle -.gemfile.lock -Gemfile.lock -vendor/ +# Managed by modulesync - DO NOT EDIT +# https://voxpupuli.org/docs/updating-files-managed-with-modulesync/ + +/pkg/ +/Gemfile.lock +/Gemfile.local +/vendor/ +/.vendor/ +/spec/fixtures/manifests/ +/spec/fixtures/modules/ +/.vagrant/ +/.bundle/ +/.ruby-version +/coverage/ +/log/ +/.idea/ +/.dependencies/ +/.librarian/ +/Puppetfile.lock +*.iml +.*.sw? +/.yardoc/ +/Guardfile +bolt-debug.log +.rerun.json diff --git a/.msync.yml b/.msync.yml new file mode 100644 index 00000000..36e892e9 --- /dev/null +++ b/.msync.yml @@ -0,0 +1,5 @@ +--- +# Managed by modulesync - DO NOT EDIT +# https://voxpupuli.org/docs/updating-files-managed-with-modulesync/ + +modulesync_config_version: '9.4.0' diff --git a/.overcommit.yml b/.overcommit.yml new file mode 100644 index 00000000..4ed994cc --- /dev/null +++ b/.overcommit.yml @@ -0,0 +1,67 @@ +# Managed by modulesync - DO NOT EDIT +# https://voxpupuli.org/docs/updating-files-managed-with-modulesync/ +# +# Hooks are only enabled if you take action. +# +# To enable the hooks run: +# +# ``` +# bundle exec overcommit --install +# # ensure .overcommit.yml does not harm to you and then +# bundle exec overcommit --sign +# ``` +# +# (it will manage the .git/hooks directory): +# +# Examples howto skip a test for a commit or push: +# +# ``` +# SKIP=RuboCop git commit +# SKIP=PuppetLint git commit +# SKIP=RakeTask git push +# ``` +# +# Don't invoke overcommit at all: +# +# ``` +# OVERCOMMIT_DISABLE=1 git commit +# ``` +# +# Read more about overcommit: https://github.com/brigade/overcommit +# +# To manage this config yourself in your module add +# +# ``` +# .overcommit.yml: +# unmanaged: true +# ``` +# +# to your modules .sync.yml config +--- +PreCommit: + RuboCop: + enabled: true + description: 'Runs rubocop on modified files only' + command: ['bundle', 'exec', 'rubocop'] + RakeTarget: + enabled: true + description: 'Runs lint on modified files only' + targets: + - 'lint' + command: ['bundle', 'exec', 'rake'] + YamlSyntax: + enabled: true + JsonSyntax: + enabled: true + TrailingWhitespace: + enabled: true + +PrePush: + RakeTarget: + enabled: true + description: 'Run rake targets' + targets: + - 'validate' + - 'test' + - 'rubocop' + command: ['bundle', 'exec', 'rake'] diff --git a/.pmtignore b/.pmtignore new file mode 100644 index 00000000..a9d37aa0 --- /dev/null +++ b/.pmtignore @@ -0,0 +1,39 @@ +# Managed by modulesync - DO NOT EDIT +# https://voxpupuli.org/docs/updating-files-managed-with-modulesync/ + +/docs/ +/pkg/ +/Gemfile +/Gemfile.lock +/Gemfile.local +/vendor/ +/.vendor/ +/spec/ +/Rakefile +/.vagrant/ +/.bundle/ +/.ruby-version +/coverage/ +/log/ +/.idea/ +/.dependencies/ +/.github/ +/.librarian/ +/Puppetfile.lock +/Puppetfile +*.iml +/.editorconfig +/.fixtures.yml +/.gitignore +/.msync.yml +/.overcommit.yml +/.pmtignore +/.rspec +/.rspec_parallel +/.rubocop.yml +/.sync.yml +.*.sw? +/.yardoc/ +/.yardopts +/Dockerfile +/HISTORY.md diff --git a/.puppet-lint.rc b/.puppet-lint.rc new file mode 100644 index 00000000..05d28a26 --- /dev/null +++ b/.puppet-lint.rc @@ -0,0 +1,6 @@ +# Managed by modulesync - DO NOT EDIT +# https://voxpupuli.org/docs/updating-files-managed-with-modulesync/ + +--fail-on-warnings +--no-parameter_documentation-check +--no-parameter_types-check diff --git a/.rspec b/.rspec deleted file mode 100644 index 16f9cdb0..00000000 --- a/.rspec +++ /dev/null @@ -1,2 +0,0 @@ ---color ---format documentation diff --git a/.rubocop.yml b/.rubocop.yml index 2bf7f640..53ac1898 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -1,511 +1,6 @@ -require: rubocop-rspec -AllCops: - TargetRubyVersion: 1.9 - Include: - - ./**/*.rb - Exclude: - - vendor/**/* - - .vendor/**/* - - pkg/**/* - - spec/fixtures/**/* -Lint/ConditionPosition: - Enabled: true +--- +# Managed by modulesync - DO NOT EDIT +# https://voxpupuli.org/docs/updating-files-managed-with-modulesync/ -Lint/ElseLayout: - Enabled: true - -Lint/UnreachableCode: - Enabled: true - -Lint/UselessComparison: - Enabled: true - -Lint/EnsureReturn: - Enabled: true - -Lint/HandleExceptions: - Enabled: true - -Lint/LiteralInCondition: - Enabled: true - -Lint/ShadowingOuterLocalVariable: - Enabled: true - -Lint/LiteralInInterpolation: - Enabled: true - -Style/HashSyntax: - Enabled: true - -Style/RedundantReturn: - Enabled: true - -Lint/AmbiguousOperator: - Enabled: true - -Lint/AssignmentInCondition: - Enabled: true - -Style/SpaceBeforeComment: - Enabled: true - -Style/AndOr: - Enabled: true - -Style/RedundantSelf: - Enabled: true - -# Method length is not necessarily an indicator of code quality -Metrics/MethodLength: - Enabled: false - -# Module length is not necessarily an indicator of code quality -Metrics/ModuleLength: - Enabled: false - -Metrics/BlockLength: - Enabled: false - -Style/WhileUntilModifier: - Enabled: true - -Lint/AmbiguousRegexpLiteral: - Enabled: true - -Security/Eval: - Enabled: true - -Lint/BlockAlignment: - Enabled: true - -Lint/DefEndAlignment: - Enabled: true - -Lint/EndAlignment: - Enabled: true - -Lint/DeprecatedClassMethods: - Enabled: true - -Lint/Loop: - Enabled: true - -Lint/ParenthesesAsGroupedExpression: - Enabled: true - -Lint/RescueException: - Enabled: true - -Lint/StringConversionInInterpolation: - Enabled: true - -Lint/UnusedBlockArgument: - Enabled: true - -Lint/UnusedMethodArgument: - Enabled: true - -Lint/UselessAccessModifier: - Enabled: true - -Lint/UselessAssignment: - Enabled: true - -Lint/Void: - Enabled: true - -Style/AccessModifierIndentation: - Enabled: true - -Style/AccessorMethodName: - Enabled: true - -Style/Alias: - Enabled: true - -Style/AlignArray: - Enabled: true - -Style/AlignHash: - Enabled: true - -Style/AlignParameters: - Enabled: true - -Metrics/BlockNesting: - Enabled: true - -Style/AsciiComments: - Enabled: true - -Style/Attr: - Enabled: true - -Style/BracesAroundHashParameters: - Enabled: true - -Style/CaseEquality: - Enabled: true - -Style/CaseIndentation: - Enabled: true - -Style/CharacterLiteral: - Enabled: true - -Style/ClassAndModuleCamelCase: - Enabled: true - -Style/ClassAndModuleChildren: - Enabled: false - -Style/ClassCheck: - Enabled: true - -# Class length is not necessarily an indicator of code quality -Metrics/ClassLength: - Enabled: false - -Style/ClassMethods: - Enabled: true - -Style/ClassVars: - Enabled: true - -Style/WhenThen: - Enabled: true - -Style/WordArray: - Enabled: true - -Style/UnneededPercentQ: - Enabled: true - -Style/Tab: - Enabled: true - -Style/SpaceBeforeSemicolon: - Enabled: true - -Style/TrailingBlankLines: - Enabled: true - -Style/SpaceInsideBlockBraces: - Enabled: true - -Style/SpaceInsideBrackets: - Enabled: true - -Style/SpaceInsideHashLiteralBraces: - Enabled: true - -Style/SpaceInsideParens: - Enabled: true - -Style/LeadingCommentSpace: - Enabled: true - -Style/SpaceBeforeFirstArg: - Enabled: true - -Style/SpaceAfterColon: - Enabled: true - -Style/SpaceAfterComma: - Enabled: true - -Style/SpaceAfterMethodName: - Enabled: true - -Style/SpaceAfterNot: - Enabled: true - -Style/SpaceAfterSemicolon: - Enabled: true - -Style/SpaceAroundEqualsInParameterDefault: - Enabled: true - -Style/SpaceAroundOperators: - Enabled: true - -Style/SpaceBeforeBlockBraces: - Enabled: true - -Style/SpaceBeforeComma: - Enabled: true - -Style/CollectionMethods: - Enabled: true - -Style/CommentIndentation: - Enabled: true - -Style/ColonMethodCall: - Enabled: true - -Style/CommentAnnotation: - Enabled: true - -# 'Complexity' is very relative -Metrics/CyclomaticComplexity: - Enabled: false - -Style/ConstantName: - Enabled: true - -Style/Documentation: - Enabled: false - -Style/DefWithParentheses: - Enabled: true - -Style/PreferredHashMethods: - Enabled: true - -Style/DotPosition: - EnforcedStyle: trailing - -Style/DoubleNegation: - Enabled: true - -Style/EachWithObject: - Enabled: true - -Style/EmptyLineBetweenDefs: - Enabled: true - -Style/IndentArray: - Enabled: true - -Style/IndentHash: - Enabled: true - -Style/IndentationConsistency: - Enabled: true - -Style/IndentationWidth: - Enabled: true - -Style/EmptyLines: - Enabled: true - -Style/EmptyLinesAroundAccessModifier: - Enabled: true - -Style/EmptyLiteral: - Enabled: true - -# Configuration parameters: AllowURI, URISchemes. -Metrics/LineLength: - Enabled: false - -Style/MethodCallWithoutArgsParentheses: - Enabled: true - -Style/MethodDefParentheses: - Enabled: true - -Style/LineEndConcatenation: - Enabled: true - -Style/TrailingWhitespace: - Enabled: true - -Style/StringLiterals: - Enabled: true - -Style/TrailingCommaInArguments: - Enabled: true - -Style/TrailingCommaInLiteral: - Enabled: true - -Style/GlobalVars: - Enabled: true - -Style/GuardClause: - Enabled: true - -Style/IfUnlessModifier: - Enabled: true - -Style/MultilineIfThen: - Enabled: true - -Style/NegatedIf: - Enabled: true - -Style/NegatedWhile: - Enabled: true - -Style/Next: - Enabled: true - -Style/SingleLineBlockParams: - Enabled: true - -Style/SingleLineMethods: - Enabled: true - -Style/SpecialGlobalVars: - Enabled: true - -Style/TrivialAccessors: - Enabled: true - -Style/UnlessElse: - Enabled: true - -Style/VariableInterpolation: - Enabled: true - -Style/VariableName: - Enabled: true - -Style/WhileUntilDo: - Enabled: true - -Style/EvenOdd: - Enabled: true - -Style/FileName: - Enabled: true - -Style/For: - Enabled: true - -Style/Lambda: - Enabled: true - -Style/MethodName: - Enabled: true - -Style/MultilineTernaryOperator: - Enabled: true - -Style/NestedTernaryOperator: - Enabled: true - -Style/NilComparison: - Enabled: true - -Style/FormatString: - Enabled: true - -Style/MultilineBlockChain: - Enabled: true - -Style/Semicolon: - Enabled: true - -Style/SignalException: - Enabled: true - -Style/NonNilCheck: - Enabled: true - -Style/Not: - Enabled: true - -Style/NumericLiterals: - Enabled: true - -Style/OneLineConditional: - Enabled: true - -Style/OpMethod: - Enabled: true - -Style/ParenthesesAroundCondition: - Enabled: true - -Style/PercentLiteralDelimiters: - Enabled: true - -Style/PerlBackrefs: - Enabled: true - -Style/PredicateName: - Enabled: true - -Style/RedundantException: - Enabled: true - -Style/SelfAssignment: - Enabled: true - -Style/Proc: - Enabled: true - -Style/RaiseArgs: - Enabled: true - -Style/RedundantBegin: - Enabled: true - -Style/RescueModifier: - Enabled: true - -# based on https://github.com/voxpupuli/modulesync_config/issues/168 -Style/RegexpLiteral: - EnforcedStyle: percent_r - Enabled: true - -Lint/UnderscorePrefixedVariableName: - Enabled: true - -Metrics/ParameterLists: - Enabled: false - -Lint/RequireParentheses: - Enabled: true - -Style/SpaceBeforeFirstArg: - Enabled: true - -Style/ModuleFunction: - Enabled: true - -Lint/Debugger: - Enabled: true - -Style/IfWithSemicolon: - Enabled: true - -Style/Encoding: - Enabled: true - -Style/BlockDelimiters: - Enabled: true - -Style/MultilineBlockLayout: - Enabled: true - -# 'Complexity' is very relative -Metrics/AbcSize: - Enabled: False - -# 'Complexity' is very relative -Metrics/PerceivedComplexity: - Enabled: False - -Lint/UselessAssignment: - Enabled: true - -Style/ClosingParenthesisIndentation: - Enabled: false - -# RSpec - -# We don't use rspec in this way -RSpec/DescribeClass: - Enabled: False - -# Example length is not necessarily an indicator of code quality -RSpec/ExampleLength: - Enabled: False - -RSpec/NestedGroups: - Enabled: False +inherit_gem: + voxpupuli-test: rubocop.yml diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 0f0819cc..00000000 --- a/.travis.yml +++ /dev/null @@ -1,44 +0,0 @@ -sudo: false -language: ruby -cache: bundler -bundler_args: --without system_tests development -before_install: -- bundle -v -- rm Gemfile.lock || true -- gem update --system -- gem update bundler -- gem --version -- bundle -v -script: -- bundle exec rake $CHECK -matrix: - fast_finish: true - include: - - rvm: 1.9.3 - env: PUPPET_VERSION="~> 3.0" STRICT_VARIABLES="yes" CHECK=test - - rvm: 1.9.3 - env: PUPPET_VERSION="~> 3.0" STRICT_VARIABLES="yes" FUTURE_PARSER="yes" CHECK=test - - rvm: 2.1 - env: PUPPET_VERSION="~> 3.0" STRICT_VARIABLES="yes" CHECK=test - - rvm: 2.1 - env: PUPPET_VERSION="~> 4.0" STRICT_VARIABLES="yes" CHECK=test - - rvm: 2.2 - env: PUPPET_VERSION="~> 4.0" STRICT_VARIABLES="yes" CHECK=test - - rvm: 2.3.1 - env: PUPPET_VERSION="~> 4.0" STRICT_VARIABLES="yes" CHECK=build - - rvm: 2.3.1 - env: PUPPET_VERSION="~> 4.0" STRICT_VARIABLES="yes" CHECK=rubocop - - rvm: 2.3.1 - env: PUPPET_VERSION="~> 4.0" STRICT_VARIABLES="yes" CHECK=test FORGEDEPLOY=true -notifications: - email: false -deploy: - provider: puppetforge - user: saz - password: - secure: CDaPVIFvrP2qTlblGxDOvQWZ73swvhG+fU2jl9qEBjMCyKwz1obTGacOrUaj0CGSeim93k0V0FvpFirYtIsXt1B64WLZj/HNBPHHonsUZnb4ZVP1bYRtjkpPyhAes5JPbV+pXSiCMEzR9RwdP6BOpIYNgD953c2cW+bv4OGKvi4= - on: - tags: true - all_branches: true - rvm: 2.3.1 - condition: "$FORGEDEPLOY = true" diff --git a/Gemfile b/Gemfile index df09f9b2..2ac98f89 100644 --- a/Gemfile +++ b/Gemfile @@ -1,62 +1,32 @@ -source ENV['GEM_SOURCE'] || 'https://rubygems.org' +# Managed by modulesync - DO NOT EDIT +# https://voxpupuli.org/docs/updating-files-managed-with-modulesync/ -def location_for(place, fake_version = nil) - if place =~ /^(git[:@][^#]*)#(.*)/ - [fake_version, { git: $1, branch: $2, require: false }].compact - elsif place =~ /^file:\/\/(.*)/ - ['>= 0', { path: File.expand_path($1), require: false }] - else - [place, { require: false }] - end -end +source ENV['GEM_SOURCE'] || 'https://rubygems.org' group :test do - gem 'puppetlabs_spec_helper', require: false - gem 'rspec-puppet', require: false, git: 'https://github.com/rodjek/rspec-puppet.git' - gem 'rspec-puppet-facts', require: false - gem 'rspec-puppet-utils', require: false - gem 'puppet-lint-absolute_classname-check', require: false - gem 'puppet-lint-leading_zero-check', require: false - gem 'puppet-lint-trailing_comma-check', require: false - gem 'puppet-lint-version_comparison-check', require: false - gem 'puppet-lint-classes_and_types_beginning_with_digits-check', require: false - gem 'puppet-lint-unquoted_string-check', require: false - gem 'puppet-lint-variable_contains_upcase', require: false - gem 'metadata-json-lint', require: false - gem 'puppet-blacksmith', require: false - gem 'voxpupuli-release', require: false, git: 'https://github.com/voxpupuli/voxpupuli-release-gem.git' - gem 'rubocop-rspec', '~> 1.5', require: false if RUBY_VERSION >= '2.2.0' - gem 'json_pure', '<= 2.0.1', require: false if RUBY_VERSION < '2.0.0' - gem 'rspec-its', require: false + gem 'voxpupuli-test', '~> 9.0', :require => false + gem 'coveralls', :require => false + gem 'simplecov-console', :require => false + gem 'puppet_metadata', '~> 4.0', :require => false end group :development do - gem 'travis', require: false - gem 'travis-lint', require: false - gem 'guard-rake', require: false + gem 'guard-rake', :require => false + gem 'overcommit', '>= 0.39.1', :require => false end group :system_tests do - if (beaker_version = ENV['BEAKER_VERSION']) - gem 'beaker', *location_for(beaker_version) - end - if (beaker_rspec_version = ENV['BEAKER_RSPEC_VERSION']) - gem 'beaker-rspec', *location_for(beaker_rspec_version) - else - gem 'beaker-rspec', require: false - end - gem 'beaker-puppet_install_helper', require: false + gem 'voxpupuli-acceptance', '~> 3.0', :require => false end - - -if (facterversion = ENV['FACTER_GEM_VERSION']) - gem 'facter', facterversion.to_s, require: false, groups: [:test] -else - gem 'facter', require: false, groups: [:test] +group :release do + gem 'voxpupuli-release', '~> 3.0', :require => false end -ENV['PUPPET_VERSION'].nil? ? puppetversion = '~> 4.0' : puppetversion = ENV['PUPPET_VERSION'].to_s -gem 'puppet', puppetversion, require: false, groups: [:test] +gem 'rake', :require => false +gem 'facter', ENV['FACTER_GEM_VERSION'], :require => false, :groups => [:test] + +puppetversion = ENV['PUPPET_GEM_VERSION'] || [">= 7.24", "< 9"] +gem 'puppet', puppetversion, :require => false, :groups => [:test] # vim: syntax=ruby diff --git a/Rakefile b/Rakefile index 3bd6547a..9597d8e3 100644 --- a/Rakefile +++ b/Rakefile @@ -1,43 +1,44 @@ -require 'puppetlabs_spec_helper/rake_tasks' -require 'puppet_blacksmith/rake_tasks' -require 'voxpupuli/release/rake_tasks' +# Managed by modulesync - DO NOT EDIT +# https://voxpupuli.org/docs/updating-files-managed-with-modulesync/ -if RUBY_VERSION >= '2.2.0' - require 'rubocop/rake_task' - - RuboCop::RakeTask.new(:rubocop) do |task| - # These make the rubocop experience maybe slightly less terrible - task.options = ['-D', '-S', '-E'] +# Attempt to load voxpupuli-test (which pulls in puppetlabs_spec_helper), +# otherwise attempt to load it directly. +begin + require 'voxpupuli/test/rake' +rescue LoadError + begin + require 'puppetlabs_spec_helper/rake_tasks' + rescue LoadError end end -PuppetLint.configuration.log_format = '%{path}:%{linenumber}:%{check}:%{KIND}:%{message}' -PuppetLint.configuration.fail_on_warnings = true -PuppetLint.configuration.send('relative') -PuppetLint.configuration.send('disable_140chars') -PuppetLint.configuration.send('disable_class_inherits_from_params_class') -PuppetLint.configuration.send('disable_documentation') -PuppetLint.configuration.send('disable_single_quote_string_with_variables') +# load optional tasks for acceptance +# only available if gem group releases is installed +begin + require 'voxpupuli/acceptance/rake' +rescue LoadError +end -exclude_paths = %w( - pkg/**/* - vendor/**/* - .vendor/**/* - spec/**/* -) -PuppetLint.configuration.ignore_paths = exclude_paths -PuppetSyntax.exclude_paths = exclude_paths +# load optional tasks for releases +# only available if gem group releases is installed +begin + require 'voxpupuli/release/rake_tasks' +rescue LoadError + # voxpupuli-release not present +else + GCGConfig.user = 'saz' + GCGConfig.project = 'puppet-rsyslog' +end -desc 'Run acceptance tests' -RSpec::Core::RakeTask.new(:acceptance) do |t| - t.pattern = 'spec/acceptance' +desc "Run main 'test' task and report merged results to coveralls" +task test_with_coveralls: [:test] do + if Dir.exist?(File.expand_path('../lib', __FILE__)) + require 'coveralls/rake/task' + Coveralls::RakeTask.new + Rake::Task['coveralls:push'].invoke + else + puts 'Skipping reporting to coveralls. Module has no lib dir' + end end -desc 'Run tests metadata_lint, lint, syntax, spec' -task test: [ - :metadata_lint, - :lint, - :syntax, - :spec, -] # vim: syntax=ruby diff --git a/spec/spec.opts b/spec/spec.opts deleted file mode 100644 index 91cd6427..00000000 --- a/spec/spec.opts +++ /dev/null @@ -1,6 +0,0 @@ ---format -s ---colour ---loadby -mtime ---backtrace diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 53301dbf..58c9b66a 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -1,25 +1,24 @@ -require 'rspec' -require 'puppet' -require 'rspec-puppet' -require 'mocha' +# frozen_string_literal: true -PROJECT_ROOT = File.expand_path('..', File.dirname(__FILE__)) -$LOAD_PATH.unshift(File.join(PROJECT_ROOT, 'lib')) +# Managed by modulesync - DO NOT EDIT +# https://voxpupuli.org/docs/updating-files-managed-with-modulesync/ -fixture_path = File.expand_path(File.join('spec', 'fixtures'), PROJECT_ROOT) +# puppetlabs_spec_helper will set up coverage if the env variable is set. +# We want to do this if lib exists and it hasn't been explicitly set. +ENV['COVERAGE'] ||= 'yes' if Dir.exist?(File.expand_path('../lib', __dir__)) -RSpec.configure do |config| - config.mock_with :mocha +require 'voxpupuli/test/spec_helper' - # --- - # Configuration for puppet-rspec - - config.module_path = File.join(fixture_path, 'modules') - config.manifest_dir = File.join(fixture_path, 'manifests') - config.environmentpath = File.expand_path(File.join(Dir.pwd, 'spec')) +RSpec.configure do |c| + c.facterdb_string_keys = false end -# --- -# Add the fixture module libdirs to the modulepath +add_mocked_facts! -$LOAD_PATH.concat(Dir.glob(File.join(fixture_path, 'modules', '*', 'lib'))) +if File.exist?(File.join(__dir__, 'default_module_facts.yml')) + facts = YAML.safe_load(File.read(File.join(__dir__, 'default_module_facts.yml'))) + facts&.each do |name, value| + add_custom_fact name.to_sym, value + end +end +Dir['./spec/support/spec/**/*.rb'].sort.each { |f| require f }