Skip to content

Commit 623c260

Browse files
committed
convert to pdk and refresh rspec unit tests
1 parent 80c1e70 commit 623c260

26 files changed

+852
-254
lines changed

.gitattributes

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
*.rb eol=lf
2+
*.erb eol=lf
3+
*.pp eol=lf
4+
*.sh eol=lf
5+
*.epp eol=lf

.gitignore

+27-5
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,27 @@
1-
.*.sw?
2-
pkg
3-
.rspec_system/
4-
spec/fixtures
5-
Gemfile.lock
1+
.git/
2+
.*.sw[op]
3+
.metadata
4+
.yardoc
5+
.yardwarns
6+
*.iml
7+
/.bundle/
8+
/.idea/
9+
/.vagrant/
10+
/coverage/
11+
/bin/
12+
/doc/
13+
/Gemfile.local
14+
/Gemfile.lock
15+
/junit/
16+
/log/
17+
/pkg/
18+
/spec/fixtures/manifests/
19+
/spec/fixtures/modules/
20+
/tmp/
21+
/vendor/
22+
/convert_report.txt
23+
/update_report.txt
24+
.DS_Store
25+
.project
26+
.envrc
27+
/inventory.yaml

.gitlab-ci.yml

+44
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
---
2+
stages:
3+
- syntax
4+
- unit
5+
6+
cache:
7+
paths:
8+
- vendor/bundle
9+
10+
before_script:
11+
- bundle -v
12+
- rm Gemfile.lock || true
13+
- "# Update system gems if requested. This is useful to temporarily workaround troubles in the test runner"
14+
- "# Set `rubygems_version` in the .sync.yml to set a value"
15+
- "# Ignore exit code of SIGPIPE'd yes to not fail with shell's pipefail set"
16+
- '[ -z "$RUBYGEMS_VERSION" ] || (yes || true) | gem update --system $RUBYGEMS_VERSION'
17+
- gem --version
18+
- bundle -v
19+
- bundle install --without system_tests --path vendor/bundle --jobs $(nproc)
20+
21+
syntax lint metadata_lint check:symlinks check:git_ignore check:dot_underscore check:test_file rubocop-Ruby 2.5.3-Puppet ~> 6:
22+
stage: syntax
23+
image: ruby:2.5.3
24+
script:
25+
- bundle exec rake syntax lint metadata_lint check:symlinks check:git_ignore check:dot_underscore check:test_file rubocop
26+
variables:
27+
PUPPET_GEM_VERSION: '~> 6'
28+
29+
parallel_spec-Ruby 2.5.3-Puppet ~> 6:
30+
stage: unit
31+
image: ruby:2.5.3
32+
script:
33+
- bundle exec rake parallel_spec
34+
variables:
35+
PUPPET_GEM_VERSION: '~> 6'
36+
37+
parallel_spec-Ruby 2.4.5-Puppet ~> 5:
38+
stage: unit
39+
image: ruby:2.4.5
40+
script:
41+
- bundle exec rake parallel_spec
42+
variables:
43+
PUPPET_GEM_VERSION: '~> 5'
44+

.pdkignore

+42
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
.git/
2+
.*.sw[op]
3+
.metadata
4+
.yardoc
5+
.yardwarns
6+
*.iml
7+
/.bundle/
8+
/.idea/
9+
/.vagrant/
10+
/coverage/
11+
/bin/
12+
/doc/
13+
/Gemfile.local
14+
/Gemfile.lock
15+
/junit/
16+
/log/
17+
/pkg/
18+
/spec/fixtures/manifests/
19+
/spec/fixtures/modules/
20+
/tmp/
21+
/vendor/
22+
/convert_report.txt
23+
/update_report.txt
24+
.DS_Store
25+
.project
26+
.envrc
27+
/inventory.yaml
28+
/appveyor.yml
29+
/.fixtures.yml
30+
/Gemfile
31+
/.gitattributes
32+
/.gitignore
33+
/.gitlab-ci.yml
34+
/.pdkignore
35+
/Rakefile
36+
/rakelib/
37+
/.rspec
38+
/.rubocop.yml
39+
/.travis.yml
40+
/.yardopts
41+
/spec/
42+
/.vscode/

.puppet-lint.rc

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
--relative

.rspec

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
--format documentation
21
--color
2+
--format documentation

.rubocop.yml

+133
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,133 @@
1+
---
2+
require:
3+
- rubocop-rspec
4+
- rubocop-i18n
5+
AllCops:
6+
DisplayCopNames: true
7+
TargetRubyVersion: '2.1'
8+
Include:
9+
- "./**/*.rb"
10+
Exclude:
11+
- bin/*
12+
- ".vendor/**/*"
13+
- "**/Gemfile"
14+
- "**/Rakefile"
15+
- pkg/**/*
16+
- spec/fixtures/**/*
17+
- vendor/**/*
18+
- "**/Puppetfile"
19+
- "**/Vagrantfile"
20+
- "**/Guardfile"
21+
Metrics/LineLength:
22+
Description: People have wide screens, use them.
23+
Max: 200
24+
GetText:
25+
Enabled: false
26+
GetText/DecorateString:
27+
Description: We don't want to decorate test output.
28+
Exclude:
29+
- spec/**/*
30+
Enabled: false
31+
RSpec/BeforeAfterAll:
32+
Description: Beware of using after(:all) as it may cause state to leak between tests.
33+
A necessary evil in acceptance testing.
34+
Exclude:
35+
- spec/acceptance/**/*.rb
36+
RSpec/HookArgument:
37+
Description: Prefer explicit :each argument, matching existing module's style
38+
EnforcedStyle: each
39+
Style/BlockDelimiters:
40+
Description: Prefer braces for chaining. Mostly an aesthetical choice. Better to
41+
be consistent then.
42+
EnforcedStyle: braces_for_chaining
43+
Style/ClassAndModuleChildren:
44+
Description: Compact style reduces the required amount of indentation.
45+
EnforcedStyle: compact
46+
Style/EmptyElse:
47+
Description: Enforce against empty else clauses, but allow `nil` for clarity.
48+
EnforcedStyle: empty
49+
Style/FormatString:
50+
Description: Following the main puppet project's style, prefer the % format format.
51+
EnforcedStyle: percent
52+
Style/FormatStringToken:
53+
Description: Following the main puppet project's style, prefer the simpler template
54+
tokens over annotated ones.
55+
EnforcedStyle: template
56+
Style/Lambda:
57+
Description: Prefer the keyword for easier discoverability.
58+
EnforcedStyle: literal
59+
Style/RegexpLiteral:
60+
Description: Community preference. See https://github.com/voxpupuli/modulesync_config/issues/168
61+
EnforcedStyle: percent_r
62+
Style/TernaryParentheses:
63+
Description: Checks for use of parentheses around ternary conditions. Enforce parentheses
64+
on complex expressions for better readability, but seriously consider breaking
65+
it up.
66+
EnforcedStyle: require_parentheses_when_complex
67+
Style/TrailingCommaInArguments:
68+
Description: Prefer always trailing comma on multiline argument lists. This makes
69+
diffs, and re-ordering nicer.
70+
EnforcedStyleForMultiline: comma
71+
Style/TrailingCommaInLiteral:
72+
Description: Prefer always trailing comma on multiline literals. This makes diffs,
73+
and re-ordering nicer.
74+
EnforcedStyleForMultiline: comma
75+
Style/SymbolArray:
76+
Description: Using percent style obscures symbolic intent of array's contents.
77+
EnforcedStyle: brackets
78+
RSpec/MessageSpies:
79+
EnforcedStyle: receive
80+
Style/Documentation:
81+
Exclude:
82+
- lib/puppet/parser/functions/**/*
83+
- spec/**/*
84+
Style/WordArray:
85+
EnforcedStyle: brackets
86+
Style/CollectionMethods:
87+
Enabled: true
88+
Style/MethodCalledOnDoEndBlock:
89+
Enabled: true
90+
Style/StringMethods:
91+
Enabled: true
92+
GetText/DecorateFunctionMessage:
93+
Enabled: false
94+
GetText/DecorateStringFormattingUsingInterpolation:
95+
Enabled: false
96+
GetText/DecorateStringFormattingUsingPercent:
97+
Enabled: false
98+
Layout/EndOfLine:
99+
Enabled: false
100+
Layout/IndentHeredoc:
101+
Enabled: false
102+
Metrics/AbcSize:
103+
Enabled: false
104+
Metrics/BlockLength:
105+
Enabled: false
106+
Metrics/ClassLength:
107+
Enabled: false
108+
Metrics/CyclomaticComplexity:
109+
Enabled: false
110+
Metrics/MethodLength:
111+
Enabled: false
112+
Metrics/ModuleLength:
113+
Enabled: false
114+
Metrics/ParameterLists:
115+
Enabled: false
116+
Metrics/PerceivedComplexity:
117+
Enabled: false
118+
RSpec/DescribeClass:
119+
Enabled: false
120+
RSpec/ExampleLength:
121+
Enabled: false
122+
RSpec/MessageExpectation:
123+
Enabled: false
124+
RSpec/MultipleExpectations:
125+
Enabled: false
126+
RSpec/NestedGroups:
127+
Enabled: false
128+
Style/AsciiComments:
129+
Enabled: false
130+
Style/IfUnlessModifier:
131+
Enabled: false
132+
Style/SymbolProc:
133+
Enabled: false

.travis.yml

+42-24
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,48 @@
11
---
2+
dist: xenial
23
language: ruby
34
cache: bundler
4-
sudo: false
5-
bundler_args: --without development
6-
before_install: rm Gemfile.lock || true
7-
script: bundle exec rake test
5+
before_install:
6+
- bundle -v
7+
- rm -f Gemfile.lock
8+
- "# Update system gems if requested. This is useful to temporarily workaround troubles in the test runner"
9+
- "# See https://github.com/puppetlabs/pdk-templates/commit/705154d5c437796b821691b707156e1b056d244f for an example of how this was used"
10+
- "# Ignore exit code of SIGPIPE'd yes to not fail with shell's pipefail set"
11+
- '[ -z "$RUBYGEMS_VERSION" ] || (yes || true) | gem update --system $RUBYGEMS_VERSION'
12+
- gem --version
13+
- bundle -v
14+
script:
15+
- 'bundle exec rake $CHECK'
16+
bundler_args: --without system_tests
17+
rvm:
18+
- 2.5.3
19+
stages:
20+
- static
21+
- spec
22+
- acceptance
23+
-
24+
if: tag =~ ^v\d
25+
name: deploy
826
matrix:
927
fast_finish: true
1028
include:
11-
- rvm: 2.0.0
12-
env: PUPPET_VERSION="~> 3.0" FUTURE_PARSER="yes"
13-
- rvm: 2.0.0
14-
env: PUPPET_VERSION="~> 3.3.0"
15-
- rvm: 2.0.0
16-
env: PUPPET_VERSION="~> 3.7"
17-
- rvm: 2.1.0
18-
env: PUPPET_VERSION="~> 3" FUTURE_PARSER="yes"
19-
- rvm: 2.1.8
20-
env: PUPPET_VERSION="~> 4.0"
21-
- rvm: 2.1.8
22-
env: PUPPET_VERSION="~> 4"
23-
- rvm: 2.2.4
24-
env: PUPPET_VERSION="~> 4.0"
25-
- rvm: 2.2.4
26-
env: PUPPET_VERSION="~> 4"
27-
- rvm: 2.3.0
28-
env: PUPPET_VERSION="~> 4.0"
29-
- rvm: 2.3.0
30-
env: PUPPET_VERSION="~> 4"
29+
-
30+
env: CHECK="check:symlinks check:git_ignore check:dot_underscore check:test_file rubocop syntax lint metadata_lint"
31+
stage: static
32+
-
33+
env: PUPPET_GEM_VERSION="~> 5.0" CHECK=parallel_spec
34+
rvm: 2.4.5
35+
stage: spec
36+
-
37+
env: PUPPET_GEM_VERSION="~> 6.0" CHECK=parallel_spec
38+
rvm: 2.5.3
39+
stage: spec
40+
-
41+
env: DEPLOY_TO_FORGE=yes
42+
stage: deploy
43+
branches:
44+
only:
45+
- master
46+
- /^v\d/
47+
notifications:
48+
email: false

.vscode/extensions.json

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"recommendations": [
3+
"jpogran.puppet-vscode",
4+
"rebornix.Ruby"
5+
]
6+
}

.yardopts

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
--markup markdown

CHANGELOG.md

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# Changelog
2+
3+
All notable changes to this project will be documented in this file.
4+
5+
## Release 2.1.0
6+
7+
**Features**
8+
9+
**Bugfixes**
10+
11+
**Known Issues**

0 commit comments

Comments
 (0)