Skip to content

Commit f9c1cd1

Browse files
authored
Merge pull request #19 from puppetlabs-operations/pdkconvert
PDK convert
2 parents 8a820dc + 042a9b2 commit f9c1cd1

File tree

14 files changed

+606
-1
lines changed

14 files changed

+606
-1
lines changed

.gitignore

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
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

.gitlab-ci.yml

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
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+
- gem update --system
14+
- gem --version
15+
- bundle -v
16+
- bundle install --without system_tests --path vendor/bundle --jobs $(nproc)
17+
18+
parallel_spec-Ruby 2.1.9-Puppet ~> 4.0:
19+
stage: unit
20+
image: ruby:2.1.9
21+
script:
22+
- bundle exec rake parallel_spec
23+
variables:
24+
PUPPET_GEM_VERSION: '~> 4.0'
25+
26+
syntax lint metadata_lint check:symlinks check:git_ignore check:dot_underscore check:test_file rubocop-Ruby 2.4.4-Puppet ~> 5.5:
27+
stage: syntax
28+
image: ruby:2.4.4
29+
script:
30+
- bundle exec rake syntax lint metadata_lint check:symlinks check:git_ignore check:dot_underscore check:test_file rubocop
31+
variables:
32+
PUPPET_GEM_VERSION: '~> 5.5'
33+
34+
parallel_spec-Ruby 2.4.4-Puppet ~> 5.5:
35+
stage: unit
36+
image: ruby:2.4.4
37+
script:
38+
- bundle exec rake parallel_spec
39+
variables:
40+
PUPPET_GEM_VERSION: '~> 5.5'
41+

.pdkignore

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
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

.rspec

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
--color
2+
--format documentation

.rubocop.yml

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

.travis.yml

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
---
2+
sudo: false
3+
dist: trusty
4+
language: ruby
5+
cache: bundler
6+
before_install:
7+
- bundle -v
8+
- rm -f Gemfile.lock
9+
- gem update --system
10+
- gem --version
11+
- bundle -v
12+
script:
13+
- 'bundle exec rake $CHECK'
14+
bundler_args: --without system_tests
15+
rvm:
16+
- 2.5.0
17+
env:
18+
global:
19+
- BEAKER_PUPPET_COLLECTION=puppet6 PUPPET_GEM_VERSION="~> 6.0"
20+
matrix:
21+
fast_finish: true
22+
include:
23+
-
24+
env: CHECK="syntax lint metadata_lint check:symlinks check:git_ignore check:dot_underscore check:test_file rubocop"
25+
-
26+
env: CHECK=parallel_spec
27+
-
28+
env: PUPPET_GEM_VERSION="~> 5.0" CHECK=parallel_spec
29+
rvm: 2.4.4
30+
-
31+
env: PUPPET_GEM_VERSION="~> 4.0" CHECK=parallel_spec
32+
rvm: 2.1.9
33+
branches:
34+
only:
35+
- master
36+
- /^v\d/
37+
notifications:
38+
email: false
39+
deploy:
40+
provider: puppetforge
41+
user: puppet
42+
password:
43+
secure: ""
44+
on:
45+
tags: true
46+
all_branches: true
47+
condition: "$DEPLOY_TO_FORGE = yes"

.yardopts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
--markup markdown

Gemfile

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
source ENV['GEM_SOURCE'] || 'https://rubygems.org'
2+
3+
def location_for(place_or_version, fake_version = nil)
4+
git_url_regex = %r{\A(?<url>(https?|git)[:@][^#]*)(#(?<branch>.*))?}
5+
file_url_regex = %r{\Afile:\/\/(?<path>.*)}
6+
7+
if place_or_version && (git_url = place_or_version.match(git_url_regex))
8+
[fake_version, { git: git_url[:url], branch: git_url[:branch], require: false }].compact
9+
elsif place_or_version && (file_url = place_or_version.match(file_url_regex))
10+
['>= 0', { path: File.expand_path(file_url[:path]), require: false }]
11+
else
12+
[place_or_version, { require: false }]
13+
end
14+
end
15+
16+
ruby_version_segments = Gem::Version.new(RUBY_VERSION.dup).segments
17+
minor_version = ruby_version_segments[0..1].join('.')
18+
19+
group :development do
20+
gem "fast_gettext", '1.1.0', require: false if Gem::Version.new(RUBY_VERSION.dup) < Gem::Version.new('2.1.0')
21+
gem "fast_gettext", require: false if Gem::Version.new(RUBY_VERSION.dup) >= Gem::Version.new('2.1.0')
22+
gem "json_pure", '<= 2.0.1', require: false if Gem::Version.new(RUBY_VERSION.dup) < Gem::Version.new('2.0.0')
23+
gem "json", '= 1.8.1', require: false if Gem::Version.new(RUBY_VERSION.dup) == Gem::Version.new('2.1.9')
24+
gem "json", '<= 2.0.4', require: false if Gem::Version.new(RUBY_VERSION.dup) == Gem::Version.new('2.4.4')
25+
gem "puppet-module-posix-default-r#{minor_version}", require: false, platforms: [:ruby]
26+
gem "puppet-module-posix-dev-r#{minor_version}", require: false, platforms: [:ruby]
27+
gem "puppet-module-win-default-r#{minor_version}", require: false, platforms: [:mswin, :mingw, :x64_mingw]
28+
gem "puppet-module-win-dev-r#{minor_version}", require: false, platforms: [:mswin, :mingw, :x64_mingw]
29+
end
30+
31+
puppet_version = ENV['PUPPET_GEM_VERSION']
32+
facter_version = ENV['FACTER_GEM_VERSION']
33+
hiera_version = ENV['HIERA_GEM_VERSION']
34+
35+
gems = {}
36+
37+
gems['puppet'] = location_for(puppet_version)
38+
39+
# If facter or hiera versions have been specified via the environment
40+
# variables
41+
42+
gems['facter'] = location_for(facter_version) if facter_version
43+
gems['hiera'] = location_for(hiera_version) if hiera_version
44+
45+
if Gem.win_platform? && puppet_version =~ %r{^(file:///|git://)}
46+
# If we're using a Puppet gem on Windows which handles its own win32-xxx gem
47+
# dependencies (>= 3.5.0), set the maximum versions (see PUP-6445).
48+
gems['win32-dir'] = ['<= 0.4.9', require: false]
49+
gems['win32-eventlog'] = ['<= 0.6.5', require: false]
50+
gems['win32-process'] = ['<= 0.7.5', require: false]
51+
gems['win32-security'] = ['<= 0.2.5', require: false]
52+
gems['win32-service'] = ['0.8.8', require: false]
53+
end
54+
55+
gems.each do |gem_name, gem_params|
56+
gem gem_name, *gem_params
57+
end
58+
59+
# Evaluate Gemfile.local and ~/.gemfile if they exist
60+
extra_gemfiles = [
61+
"#{__FILE__}.local",
62+
File.join(Dir.home, '.gemfile'),
63+
]
64+
65+
extra_gemfiles.each do |gemfile|
66+
if File.file?(gemfile) && File.readable?(gemfile)
67+
eval(File.read(gemfile), binding)
68+
end
69+
end
70+
# vim: syntax=ruby

0 commit comments

Comments
 (0)