Skip to content

Commit 5172313

Browse files
Sebastien VarretteSebastien Varrette
Sebastien Varrette
authored and
Sebastien Varrette
committed
bootstrap pdk
Signed-off-by: Sebastien Varrette <[email protected]>
1 parent 23329ad commit 5172313

23 files changed

+343
-119
lines changed

.fixtures.yml

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# This file can be used to install module dependencies for unit testing
2+
# See https://github.com/puppetlabs/puppetlabs_spec_helper#using-fixtures for details
3+
---
4+
fixtures:
5+
forge_modules:
6+
# stdlib: "puppetlabs/stdlib"

.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

+26-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,29 @@
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
124
.DS_Store
25+
.project
26+
.envrc
27+
/inventory.yaml
228
.vagrant
3-
/.bundle/*
429
.falkor*
5-
/pkg/*

.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.7-Puppet ~> 6:
22+
stage: syntax
23+
image: ruby:2.5.7
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.7-Puppet ~> 6:
30+
stage: unit
31+
image: ruby:2.5.7
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-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
--no-only_variable_string-check
1+
--relative

.rspec

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

.rubocop.yml

+67-31
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,51 @@
11
---
2-
#require: rubocop-rspec
2+
require:
3+
- rubocop-rspec
4+
- rubocop-i18n
35
AllCops:
6+
DisplayCopNames: true
47
TargetRubyVersion: '2.2'
58
Include:
69
- "./**/*.rb"
710
Exclude:
811
- bin/*
912
- ".vendor/**/*"
10-
- Gemfile
11-
- Vagrantfile
12-
- Rakefile
13+
- "**/Gemfile"
14+
- "**/Rakefile"
1315
- pkg/**/*
1416
- spec/fixtures/**/*
1517
- vendor/**/*
18+
- "**/Puppetfile"
19+
- "**/Vagrantfile"
20+
- "**/Guardfile"
1621
Metrics/LineLength:
1722
Description: People have wide screens, use them.
1823
Max: 200
19-
# RSpec/BeforeAfterAll:
20-
# Description: Beware of using after(:all) as it may cause state to leak between tests.
21-
# A necessary evil in acceptance testing.
22-
# Exclude:
23-
# - spec/acceptance/**/*.rb
24-
# RSpec/HookArgument:
25-
# Description: Prefer explicit :each argument, matching existing module's style
26-
# EnforcedStyle: each
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
2739
Style/BlockDelimiters:
2840
Description: Prefer braces for chaining. Mostly an aesthetical choice. Better to
2941
be consistent then.
3042
EnforcedStyle: braces_for_chaining
43+
Style/BracesAroundHashParameters:
44+
Description: Braces are required by Ruby 2.7. Cop removed from RuboCop v0.80.0.
45+
See https://github.com/rubocop-hq/rubocop/pull/7643
46+
Enabled: true
3147
Style/ClassAndModuleChildren:
32-
Description: Compact style reduces the required amount ofindentation.
48+
Description: Compact style reduces the required amount of indentation.
3349
EnforcedStyle: compact
3450
Style/EmptyElse:
3551
Description: Enforce against empty else clauses, but allow `nil` for clarity.
@@ -46,7 +62,7 @@ Style/Lambda:
4662
EnforcedStyle: literal
4763
Style/RegexpLiteral:
4864
Description: Community preference. See https://github.com/voxpupuli/modulesync_config/issues/168
49-
EnforcedStyle: slashes
65+
EnforcedStyle: percent_r
5066
Style/TernaryParentheses:
5167
Description: Checks for use of parentheses around ternary conditions. Enforce parentheses
5268
on complex expressions for better readability, but seriously consider breaking
@@ -56,19 +72,39 @@ Style/TrailingCommaInArguments:
5672
Description: Prefer always trailing comma on multiline argument lists. This makes
5773
diffs, and re-ordering nicer.
5874
EnforcedStyleForMultiline: comma
59-
TrailingCommaInArrayLiteral:
75+
Style/TrailingCommaInLiteral:
6076
Description: Prefer always trailing comma on multiline literals. This makes diffs,
6177
and re-ordering nicer.
6278
EnforcedStyleForMultiline: comma
6379
Style/SymbolArray:
6480
Description: Using percent style obscures symbolic intent of array's contents.
6581
EnforcedStyle: brackets
82+
RSpec/MessageSpies:
83+
EnforcedStyle: receive
84+
Style/Documentation:
85+
Exclude:
86+
- lib/puppet/parser/functions/**/*
87+
- spec/**/*
88+
Style/HashSyntax:
89+
Enabled: false
90+
Style/WordArray:
91+
EnforcedStyle: brackets
6692
Style/CollectionMethods:
6793
Enabled: true
6894
Style/MethodCalledOnDoEndBlock:
6995
Enabled: true
7096
Style/StringMethods:
7197
Enabled: true
98+
GetText/DecorateFunctionMessage:
99+
Enabled: false
100+
GetText/DecorateStringFormattingUsingInterpolation:
101+
Enabled: false
102+
GetText/DecorateStringFormattingUsingPercent:
103+
Enabled: false
104+
Layout/EndOfLine:
105+
Enabled: false
106+
Layout/IndentHeredoc:
107+
Enabled: false
72108
Metrics/AbcSize:
73109
Enabled: false
74110
Metrics/BlockLength:
@@ -85,19 +121,19 @@ Metrics/ParameterLists:
85121
Enabled: false
86122
Metrics/PerceivedComplexity:
87123
Enabled: false
88-
# RSpec/DescribeClass:
89-
# Enabled: false
90-
# RSpec/ExampleLength:
91-
# Enabled: false
92-
# RSpec/MessageExpectation:
93-
# Enabled: false
94-
# RSpec/MultipleExpectations:
95-
# Enabled: false
96-
# RSpec/NestedGroups:
97-
# Enabled: false
98-
# Style/AsciiComments:
99-
# Enabled: false
100-
# Style/IfUnlessModifier:
101-
# Enabled: false
102-
# Style/SymbolProc:
103-
# Enabled: false
124+
RSpec/DescribeClass:
125+
Enabled: false
126+
RSpec/ExampleLength:
127+
Enabled: false
128+
RSpec/MessageExpectation:
129+
Enabled: false
130+
RSpec/MultipleExpectations:
131+
Enabled: false
132+
RSpec/NestedGroups:
133+
Enabled: false
134+
Style/AsciiComments:
135+
Enabled: false
136+
Style/IfUnlessModifier:
137+
Enabled: false
138+
Style/SymbolProc:
139+
Enabled: false

.travis.yml

+41-23
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,49 @@
11
---
2-
sudo: false
2+
os: linux
3+
dist: xenial
34
language: ruby
45
cache: bundler
5-
os:
6-
- linux
7-
script:
8-
- "bundle exec rake lint"
9-
- "bundle exec rake rubocop"
10-
# - "bundle exec rake validate"
116
before_install:
12-
- gem update bundler
13-
addons:
14-
hosts:
15-
- travis.dev
16-
matrix:
7+
- bundle -v
8+
- rm -f Gemfile.lock
9+
- "# Update system gems if requested. This is useful to temporarily workaround troubles in the test runner"
10+
- "# See https://github.com/puppetlabs/pdk-templates/commit/705154d5c437796b821691b707156e1b056d244f for an example of how this was used"
11+
- "# Ignore exit code of SIGPIPE'd yes to not fail with shell's pipefail set"
12+
- '[ -z "$RUBYGEMS_VERSION" ] || (yes || true) | gem update --system $RUBYGEMS_VERSION'
13+
- gem --version
14+
- bundle -v
15+
script:
16+
- 'bundle exec rake $CHECK'
17+
bundler_args: --without system_tests
18+
rvm:
19+
- 2.6.5
20+
stages:
21+
- static
22+
- spec
23+
- acceptance
24+
-
25+
if: tag =~ ^v\d
26+
name: deploy
27+
jobs:
1728
fast_finish: true
1829
include:
19-
- rvm: 2.6
20-
env: PUPPET_GEM_VERSION="~> 4.4.0"
21-
# - rvm: 2.1.9
22-
# env: PUPPET_GEM_VERSION="~> 4.10.0"
23-
30+
-
31+
env: CHECK="check:symlinks check:git_ignore check:dot_underscore check:test_file rubocop syntax lint metadata_lint"
32+
stage: static
33+
-
34+
env: PUPPET_GEM_VERSION="~> 5.0" CHECK=parallel_spec
35+
rvm: 2.4.5
36+
stage: spec
37+
-
38+
env: PUPPET_GEM_VERSION="~> 6.0" CHECK=parallel_spec
39+
rvm: 2.5.7
40+
stage: spec
41+
-
42+
env: DEPLOY_TO_FORGE=yes
43+
stage: deploy
44+
branches:
45+
only:
46+
- master
47+
- /^v\d/
2448
notifications:
2549
email: false
26-
# notifications:
27-
# email:
28-
# on_success: never
29-
# slack:
30-
# rooms:
31-
# secure: S5njaNpzoz3cgjHhGktwE+1Y0BbhADN224OqJoO3RuS1p4hcpvj+YrAfBQGAAm1bH4bPj5e+vJskAELH8GRCgGUHdKJurBM0KHbfSHOM+6wc8iemlyUu9j6x8j17n5BDgKzHgf/WyiQN9GvF8rLWCCdRdlCuaUkLujKQpQk4Wgc=

.vscode/extensions.json

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

.yardopts

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

0 commit comments

Comments
 (0)