Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions .fixtures.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# This file can be used to install module dependencies for unit testing
# See https://github.com/puppetlabs/puppetlabs_spec_helper#using-fixtures for details
---
fixtures:
symlinks:
hash2stuff: "#{source_dir}"
forge_modules:
stdlib: "puppetlabs/stdlib"
5 changes: 5 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
*.rb eol=lf
*.erb eol=lf
*.pp eol=lf
*.sh eol=lf
*.epp eol=lf
35 changes: 27 additions & 8 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,8 +1,27 @@
pkg/
spec/fixtures/
.rspec_system/
.vagrant/
.bundle/
vendor/
Gemfile.lock
log/
.git/
.*.sw[op]
.metadata
.yardoc
.yardwarns
*.iml
/.bundle/
/.idea/
/.vagrant/
/coverage/
/bin/
/doc/
/Gemfile.local
/Gemfile.lock
/junit/
/log/
/pkg/
/spec/fixtures/manifests/
/spec/fixtures/modules/
/tmp/
/vendor/
/convert_report.txt
/update_report.txt
.DS_Store
.project
.envrc
/inventory.yaml
44 changes: 44 additions & 0 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
---
stages:
- syntax
- unit

cache:
paths:
- vendor/bundle

before_script:
- bundle -v
- rm Gemfile.lock || true
- "# Update system gems if requested. This is useful to temporarily workaround troubles in the test runner"
- "# Set `rubygems_version` in the .sync.yml to set a value"
- "# Ignore exit code of SIGPIPE'd yes to not fail with shell's pipefail set"
- '[ -z "$RUBYGEMS_VERSION" ] || (yes || true) | gem update --system $RUBYGEMS_VERSION'
- gem --version
- bundle -v
- bundle install --without system_tests --path vendor/bundle --jobs $(nproc)

syntax lint metadata_lint check:symlinks check:git_ignore check:dot_underscore check:test_file rubocop-Ruby 2.5.7-Puppet ~> 6:
stage: syntax
image: ruby:2.5.7
script:
- bundle exec rake syntax lint metadata_lint check:symlinks check:git_ignore check:dot_underscore check:test_file rubocop
variables:
PUPPET_GEM_VERSION: '~> 6'

parallel_spec-Ruby 2.5.7-Puppet ~> 6:
stage: unit
image: ruby:2.5.7
script:
- bundle exec rake parallel_spec
variables:
PUPPET_GEM_VERSION: '~> 6'

parallel_spec-Ruby 2.4.5-Puppet ~> 5:
stage: unit
image: ruby:2.4.5
script:
- bundle exec rake parallel_spec
variables:
PUPPET_GEM_VERSION: '~> 5'

42 changes: 42 additions & 0 deletions .pdkignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
.git/
.*.sw[op]
.metadata
.yardoc
.yardwarns
*.iml
/.bundle/
/.idea/
/.vagrant/
/coverage/
/bin/
/doc/
/Gemfile.local
/Gemfile.lock
/junit/
/log/
/pkg/
/spec/fixtures/manifests/
/spec/fixtures/modules/
/tmp/
/vendor/
/convert_report.txt
/update_report.txt
.DS_Store
.project
.envrc
/inventory.yaml
/appveyor.yml
/.fixtures.yml
/Gemfile
/.gitattributes
/.gitignore
/.gitlab-ci.yml
/.pdkignore
/Rakefile
/rakelib/
/.rspec
/.rubocop.yml
/.travis.yml
/.yardopts
/spec/
/.vscode/
1 change: 1 addition & 0 deletions .puppet-lint.rc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
--relative
2 changes: 2 additions & 0 deletions .rspec
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
--color
--format documentation
137 changes: 137 additions & 0 deletions .rubocop.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,137 @@
---
require:
- rubocop-rspec
- rubocop-i18n
AllCops:
DisplayCopNames: true
TargetRubyVersion: '2.1'
Include:
- "./**/*.rb"
Exclude:
- bin/*
- ".vendor/**/*"
- "**/Gemfile"
- "**/Rakefile"
- pkg/**/*
- spec/fixtures/**/*
- vendor/**/*
- "**/Puppetfile"
- "**/Vagrantfile"
- "**/Guardfile"
Metrics/LineLength:
Description: People have wide screens, use them.
Max: 200
GetText:
Enabled: false
GetText/DecorateString:
Description: We don't want to decorate test output.
Exclude:
- spec/**/*
Enabled: false
RSpec/BeforeAfterAll:
Description: Beware of using after(:all) as it may cause state to leak between tests.
A necessary evil in acceptance testing.
Exclude:
- spec/acceptance/**/*.rb
RSpec/HookArgument:
Description: Prefer explicit :each argument, matching existing module's style
EnforcedStyle: each
Style/BlockDelimiters:
Description: Prefer braces for chaining. Mostly an aesthetical choice. Better to
be consistent then.
EnforcedStyle: braces_for_chaining
Style/BracesAroundHashParameters:
Description: Braces are required by Ruby 2.7. Cop removed from RuboCop v0.80.0.
See https://github.com/rubocop-hq/rubocop/pull/7643
Enabled: true
Style/ClassAndModuleChildren:
Description: Compact style reduces the required amount of indentation.
EnforcedStyle: compact
Style/EmptyElse:
Description: Enforce against empty else clauses, but allow `nil` for clarity.
EnforcedStyle: empty
Style/FormatString:
Description: Following the main puppet project's style, prefer the % format format.
EnforcedStyle: percent
Style/FormatStringToken:
Description: Following the main puppet project's style, prefer the simpler template
tokens over annotated ones.
EnforcedStyle: template
Style/Lambda:
Description: Prefer the keyword for easier discoverability.
EnforcedStyle: literal
Style/RegexpLiteral:
Description: Community preference. See https://github.com/voxpupuli/modulesync_config/issues/168
EnforcedStyle: percent_r
Style/TernaryParentheses:
Description: Checks for use of parentheses around ternary conditions. Enforce parentheses
on complex expressions for better readability, but seriously consider breaking
it up.
EnforcedStyle: require_parentheses_when_complex
Style/TrailingCommaInArguments:
Description: Prefer always trailing comma on multiline argument lists. This makes
diffs, and re-ordering nicer.
EnforcedStyleForMultiline: comma
Style/TrailingCommaInLiteral:
Description: Prefer always trailing comma on multiline literals. This makes diffs,
and re-ordering nicer.
EnforcedStyleForMultiline: comma
Style/SymbolArray:
Description: Using percent style obscures symbolic intent of array's contents.
EnforcedStyle: brackets
RSpec/MessageSpies:
EnforcedStyle: receive
Style/Documentation:
Exclude:
- lib/puppet/parser/functions/**/*
- spec/**/*
Style/WordArray:
EnforcedStyle: brackets
Style/CollectionMethods:
Enabled: true
Style/MethodCalledOnDoEndBlock:
Enabled: true
Style/StringMethods:
Enabled: true
GetText/DecorateFunctionMessage:
Enabled: false
GetText/DecorateStringFormattingUsingInterpolation:
Enabled: false
GetText/DecorateStringFormattingUsingPercent:
Enabled: false
Layout/EndOfLine:
Enabled: false
Layout/IndentHeredoc:
Enabled: false
Metrics/AbcSize:
Enabled: false
Metrics/BlockLength:
Enabled: false
Metrics/ClassLength:
Enabled: false
Metrics/CyclomaticComplexity:
Enabled: false
Metrics/MethodLength:
Enabled: false
Metrics/ModuleLength:
Enabled: false
Metrics/ParameterLists:
Enabled: false
Metrics/PerceivedComplexity:
Enabled: false
RSpec/DescribeClass:
Enabled: false
RSpec/ExampleLength:
Enabled: false
RSpec/MessageExpectation:
Enabled: false
RSpec/MultipleExpectations:
Enabled: false
RSpec/NestedGroups:
Enabled: false
Style/AsciiComments:
Enabled: false
Style/IfUnlessModifier:
Enabled: false
Style/SymbolProc:
Enabled: false
81 changes: 44 additions & 37 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,42 +1,49 @@
---
os: linux
dist: xenial
language: ruby
bundler_args: --without development system_tests
before_install: rm Gemfile.lock || true
matrix:
cache: bundler
before_install:
- bundle -v
- rm -f Gemfile.lock
- "# Update system gems if requested. This is useful to temporarily workaround troubles in the test runner"
- "# See https://github.com/puppetlabs/pdk-templates/commit/705154d5c437796b821691b707156e1b056d244f for an example of how this was used"
- "# Ignore exit code of SIGPIPE'd yes to not fail with shell's pipefail set"
- '[ -z "$RUBYGEMS_VERSION" ] || (yes || true) | gem update --system $RUBYGEMS_VERSION'
- gem --version
- bundle -v
script:
- 'bundle exec rake $CHECK'
bundler_args: --without system_tests
rvm:
- 2.5.7
stages:
- static
- spec
- acceptance
-
if: tag =~ ^v\d
name: deploy
jobs:
fast_finish: true
include:
# these versions of ruby were somewhat supported up to puppet 4.8, then
# deprecated in puppet 4.9. we'll keep testing them for now...
#
# https://docs.puppet.com/puppet/4.9/release_notes.html#ruby-20-series
# https://docs.puppet.com/puppet/4.8/system_requirements.html#ruby
- rvm: 2.0.0
env: PUPPET_GEM_VERSION="~> 4.8.0" STRICT_VARIABLES=yes
- rvm: 2.2.0
env: PUPPET_GEM_VERSION="~> 4.8.0" STRICT_VARIABLES=yes
- rvm: 2.3.0
env: PUPPET_GEM_VERSION="~> 4.8.0" STRICT_VARIABLES=yes

# always test the latest versions of puppet in the 3.x, 4.x, 5.x, 6.x lines
- rvm: 2.1.0
env: PUPPET_GEM_VERSION="~> 3.0" STRICT_VARIABLES=yes
- rvm: 2.1.0
env: PUPPET_GEM_VERSION="~> 4.0" STRICT_VARIABLES=yes DEPLOY_TO_FORGE=yes
- rvm: 2.4.0
env: PUPPET_GEM_VERSION="~> 5.0" STRICT_VARIABLES=yes
- rvm: 2.5.0
env: PUPPET_GEM_VERSION="~> 6.0" STRICT_VARIABLES=yes

script: "bundle exec rake validate && bundle exec rake lint && bundle exec rake spec SPEC_OPTS='--format documentation'"
-
env: CHECK="check:symlinks check:git_ignore check:dot_underscore check:test_file rubocop syntax lint metadata_lint"
stage: static
-
env: PUPPET_GEM_VERSION="~> 5.0" CHECK=parallel_spec
rvm: 2.4.5
stage: spec
-
env: PUPPET_GEM_VERSION="~> 6.0" CHECK=parallel_spec
rvm: 2.5.7
stage: spec
-
env: DEPLOY_TO_FORGE=yes
stage: deploy
branches:
only:
- master
- /^v\d/
notifications:
email: false
deploy:
provider: puppetforge
user: mmckinst
password:
secure: U95IYVdpILpz3VavlT3YoTcsBe20YkG70AfXtHL526HYcBlpnmsZljsQw1arX0jfiliKhIwsl2FJhG73IBaJ5udy5tlhGmttpJJcga9SMGUIntYz+AEyvPKzClu8Cf7zWop0Rt/lv/51bSr/ICYE2R0yoasL3ScuSqKQRqf9VUULnbIghHJ6dmPQtHQRtJVaHNTWQgb6PXDOnqsjoF5B/yqTafeB+nj/v/9NOXDfcaGpaGmkiVqkZkhtjn1RjFHf5ftrIoMrdPVV3u6cFaNrTEhpFk3EpGLbvqsSyQ3e/5TINi/ni2RpW949/jZCp+AXu7Wi9eoLG72KUNMZUY5PHegu1GKq0bDV5U79sPamDdkAT2YXa+LvNkCZPLmssGe18QYFD/YQiR+ZUIRhvmno3GCXVfqdogi+AbCqVnPJk4gqKbgO9ggHKik9Px/yoS+Ic6JDTOlf535BYYlqpS6R17xTe4BIud1/XZvb6ditt6+D+A9CyosoKVg4AzdPt/zZ3sFzYzMvRAM1TRbHLtePOVztpJ/Y4F/nnMN6CLcC9SEPgCtBgqvjw/VMIs5961/wPHq5TCXngI7XcnMhYYQltgsJXi6gRlw/grgB34Q0Iy9FYSC/i6ek/LrD5xeNQIJRIXndieCBlFlLTjAMqml5LA+6+I4MUOIqmNbsmEeGWvo=
on:
tags: true
# all_branches is required to use tags
all_branches: true
# Only publish the build marked with "DEPLOY_TO_FORGE"
condition: "$DEPLOY_TO_FORGE = yes"
6 changes: 6 additions & 0 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"recommendations": [
"puppet.puppet-vscode",
"rebornix.Ruby"
]
}
1 change: 1 addition & 0 deletions .yardopts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
--markup markdown
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
## 1.3.0 (2021-02-28) - Updates contributed by southalc
- Converted to PDK, linted, validated
- Add support for Puppet 7
- Refactored legacy 3.x functions to 4.x API
- Updated unit tests as needed for changes
- Documentation using puppet strings
- Added defined types to complement the respective functions for use from hiera
- Support all releases of puppet supported operating system

## 1.2.1 (2019-06-25)
- Document overlaps with stdlib
- Test on puppet 6
Expand Down
Loading