Switch to PDK module layout

This commit is contained in:
2019-05-09 23:39:55 +01:00
parent 0291282ee2
commit 998f1716f3
17 changed files with 699 additions and 94 deletions

View File

@@ -1,3 +0,0 @@
---
BUNDLE_PATH: "vendor/bundle"
BUNDLE_DISABLE_SHARED_GEMS: "true"

5
.gitattributes vendored Normal file
View File

@@ -0,0 +1,5 @@
*.rb eol=lf
*.erb eol=lf
*.pp eol=lf
*.sh eol=lf
*.epp eol=lf

29
.gitignore vendored
View File

@@ -1,2 +1,27 @@
# blacksmith output directory .git/
pkg .*.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

41
.gitlab-ci.yml Normal file
View File

@@ -0,0 +1,41 @@
---
stages:
- syntax
- unit
cache:
paths:
- vendor/bundle
before_script:
- bundle -v
- rm Gemfile.lock || 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.3-Puppet ~> 6:
stage: syntax
image: ruby:2.5.3
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.3-Puppet ~> 6:
stage: unit
image: ruby:2.5.3
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
.pdkignore Normal file
View File

@@ -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
.puppet-lint.rc Normal file
View File

@@ -0,0 +1 @@
--relative

2
.rspec Normal file
View File

@@ -0,0 +1,2 @@
--color
--format documentation

122
.rubocop.yml Normal file
View File

@@ -0,0 +1,122 @@
---
require: rubocop-rspec
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/DecorateString:
Description: We don't want to decorate test output.
Exclude:
- spec/*
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/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
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

54
.travis.yml Normal file
View File

@@ -0,0 +1,54 @@
---
dist: trusty
language: ruby
cache: bundler
before_install:
- bundle -v
- rm -f Gemfile.lock
- gem update --system $RUBYGEMS_VERSION
- gem --version
- bundle -v
script:
- 'bundle exec rake $CHECK'
bundler_args: --without system_tests
rvm:
- 2.5.3
stages:
- static
- spec
- acceptance
-
if: tag =~ ^v\d
name: deploy
matrix:
fast_finish: true
include:
-
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.3
stage: spec
-
env: DEPLOY_TO_FORGE=yes
stage: deploy
branches:
only:
- master
- /^v\d/
notifications:
email: false
deploy:
provider: puppetforge
user: puppet
password:
secure: ""
on:
tags: true
all_branches: true
condition: "$DEPLOY_TO_FORGE = yes"

1
.yardopts Normal file
View File

@@ -0,0 +1 @@
--markup markdown

82
Gemfile
View File

@@ -1,19 +1,71 @@
source ENV['GEM_SOURCE'] || 'https://rubygems.org' source ENV['GEM_SOURCE'] || 'https://rubygems.org'
puppetversion = ENV.key?('PUPPET_VERSION') ? ENV['PUPPET_VERSION'] : ['>= 3.3'] def location_for(place_or_version, fake_version = nil)
gem 'metadata-json-lint' git_url_regex = %r{\A(?<url>(https?|git)[:@][^#]*)(#(?<branch>.*))?}
gem 'puppet', puppetversion file_url_regex = %r{\Afile:\/\/(?<path>.*)}
gem 'puppetlabs_spec_helper', '>= 1.0.0'
gem 'puppet-lint', '>= 1.0.0'
gem 'facter', '>= 1.7.0'
gem 'rspec-puppet'
gem 'puppet-blacksmith'
# rspec must be v2 for ruby 1.8.7 if place_or_version && (git_url = place_or_version.match(git_url_regex))
if RUBY_VERSION >= '1.8.7' && RUBY_VERSION < '1.9' [fake_version, { git: git_url[:url], branch: git_url[:branch], require: false }].compact
gem 'rspec', '~> 2.0' elsif place_or_version && (file_url = place_or_version.match(file_url_regex))
gem 'rake', '~> 10.0' ['>= 0', { path: File.expand_path(file_url[:path]), require: false }]
else else
# rubocop requires ruby >= 1.9 [place_or_version, { require: false }]
gem 'rubocop' end
end end
ruby_version_segments = Gem::Version.new(RUBY_VERSION.dup).segments
minor_version = ruby_version_segments[0..1].join('.')
group :development do
gem "fast_gettext", '1.1.0', require: false if Gem::Version.new(RUBY_VERSION.dup) < Gem::Version.new('2.1.0')
gem "fast_gettext", require: false if Gem::Version.new(RUBY_VERSION.dup) >= Gem::Version.new('2.1.0')
gem "json_pure", '<= 2.0.1', require: false if Gem::Version.new(RUBY_VERSION.dup) < Gem::Version.new('2.0.0')
gem "json", '= 1.8.1', require: false if Gem::Version.new(RUBY_VERSION.dup) == Gem::Version.new('2.1.9')
gem "json", '= 2.0.4', require: false if Gem::Requirement.create('~> 2.4.2').satisfied_by?(Gem::Version.new(RUBY_VERSION.dup))
gem "json", '= 2.1.0', require: false if Gem::Requirement.create(['>= 2.5.0', '< 2.7.0']).satisfied_by?(Gem::Version.new(RUBY_VERSION.dup))
gem "puppet-module-posix-default-r#{minor_version}", require: false, platforms: [:ruby]
gem "puppet-module-posix-dev-r#{minor_version}", require: false, platforms: [:ruby]
gem "puppet-module-win-default-r#{minor_version}", require: false, platforms: [:mswin, :mingw, :x64_mingw]
gem "puppet-module-win-dev-r#{minor_version}", require: false, platforms: [:mswin, :mingw, :x64_mingw]
end
puppet_version = ENV['PUPPET_GEM_VERSION']
facter_version = ENV['FACTER_GEM_VERSION']
hiera_version = ENV['HIERA_GEM_VERSION']
gems = {}
gems['puppet'] = location_for(puppet_version)
# If facter or hiera versions have been specified via the environment
# variables
gems['facter'] = location_for(facter_version) if facter_version
gems['hiera'] = location_for(hiera_version) if hiera_version
if Gem.win_platform? && puppet_version =~ %r{^(file:///|git://)}
# If we're using a Puppet gem on Windows which handles its own win32-xxx gem
# dependencies (>= 3.5.0), set the maximum versions (see PUP-6445).
gems['win32-dir'] = ['<= 0.4.9', require: false]
gems['win32-eventlog'] = ['<= 0.6.5', require: false]
gems['win32-process'] = ['<= 0.7.5', require: false]
gems['win32-security'] = ['<= 0.2.5', require: false]
gems['win32-service'] = ['0.8.8', require: false]
end
gems.each do |gem_name, gem_params|
gem gem_name, *gem_params
end
# Evaluate Gemfile.local and ~/.gemfile if they exist
extra_gemfiles = [
"#{__FILE__}.local",
File.join(Dir.home, '.gemfile'),
]
extra_gemfiles.each do |gemfile|
if File.file?(gemfile) && File.readable?(gemfile)
eval(File.read(gemfile), binding)
end
end
# vim: syntax=ruby

View File

@@ -1,36 +1,75 @@
GEM GEM
remote: https://rubygems.org/ remote: https://rubygems.org/
specs: specs:
addressable (2.6.0)
public_suffix (>= 2.0.2, < 4.0)
ansi (1.5.0)
ast (2.4.0) ast (2.4.0)
diff-lcs (1.2.5) codecov (0.1.14)
json
simplecov
url
coderay (1.1.2)
diff-lcs (1.3)
docile (1.3.1)
domain_name (0.5.20180417) domain_name (0.5.20180417)
unf (>= 0.0.5, < 1.0.0) unf (>= 0.0.5, < 1.0.0)
facter (2.5.1) facter (2.5.1)
facterdb (0.6.0)
facter
jgrep
fast_gettext (1.1.2) fast_gettext (1.1.2)
hiera (3.4.5) gettext (3.2.9)
locale (>= 2.0.5)
text (>= 1.3.0)
gettext-setup (0.30)
fast_gettext (~> 1.1.0)
gettext (>= 3.0.2)
locale
hiera (3.5.0)
hirb (0.7.3)
hocon (1.2.5) hocon (1.2.5)
http-cookie (1.0.3) http-cookie (1.0.3)
domain_name (~> 0.5) domain_name (~> 0.5)
httpclient (2.8.3) httpclient (2.8.3)
jaro_winkler (1.5.1) jgrep (1.5.0)
json (2.0.2) json (2.1.0)
json-schema (2.8.1)
addressable (>= 2.4)
locale (2.1.2) locale (2.1.2)
metaclass (0.0.4) mcollective-client (2.12.4)
metadata-json-lint (0.0.11)
json json
stomp
systemu
metaclass (0.0.4)
metadata-json-lint (2.2.0)
json-schema (~> 2.8)
spdx-licenses (~> 1.0) spdx-licenses (~> 1.0)
method_source (0.8.2)
mime-types (3.2.2) mime-types (3.2.2)
mime-types-data (~> 3.2015) mime-types-data (~> 3.2015)
mime-types-data (3.2018.0812) mime-types-data (3.2019.0331)
mocha (1.2.0) mocha (1.1.0)
metaclass (~> 0.0.1) metaclass (~> 0.0.1)
multi_json (1.13.1) multi_json (1.13.1)
net-scp (2.0.0)
net-ssh (>= 2.6.5, < 6.0.0)
net-ssh (5.2.0)
net-telnet (0.1.1)
netrc (0.11.0) netrc (0.11.0)
parallel (1.12.1) parallel (1.17.0)
parallel_tests (2.14.2)
parallel
parser (2.5.1.2) parser (2.5.1.2)
ast (~> 2.4.0) ast (~> 2.4.0)
pathspec (0.2.1)
powerpack (0.1.2) powerpack (0.1.2)
puppet (6.0.2) pry (0.10.4)
coderay (~> 1.1.0)
method_source (~> 0.8.1)
slop (~> 3.4)
public_suffix (3.0.3)
puppet (6.4.0)
facter (> 2.0.1, < 4) facter (> 2.0.1, < 4)
fast_gettext (~> 1.1.2) fast_gettext (~> 1.1.2)
hiera (>= 3.2.1, < 4) hiera (>= 3.2.1, < 4)
@@ -41,65 +80,129 @@ GEM
semantic_puppet (~> 1.0) semantic_puppet (~> 1.0)
puppet-blacksmith (4.1.2) puppet-blacksmith (4.1.2)
rest-client (~> 2.0) rest-client (~> 2.0)
puppet-lint (2.0.2) puppet-lint (2.3.6)
puppet-resource_api (1.6.0) puppet-module-posix-default-r2.5 (0.3.14)
puppet-module-posix-dev-r2.5 (0.3.14)
codecov (~> 0.1.10)
gettext-setup (~> 0.26)
metadata-json-lint (>= 2.0.2, < 3.0.0)
mocha (>= 1.0.0, < 1.2.0)
parallel_tests (>= 2.14.1, < 2.14.3)
parser (~> 2.5.1.2)
pry (~> 0.10.4)
puppet-blacksmith (>= 3.4.0)
puppet-lint (>= 2.3.0, < 3.0.0)
puppet-strings (~> 2.0)
puppet-syntax (>= 2.4.1, < 3.0.0)
puppet_pot_generator (~> 1.0)
puppetlabs_spec_helper (>= 2.9.0, < 3.0.0)
rainbow (~> 2.0)
rspec-puppet (>= 2.3.2, < 3.0.0)
rspec-puppet-facts (~> 1.8)
rspec_junit_formatter (~> 0.2)
rubocop (~> 0.49.0)
rubocop-i18n (~> 1.2.0)
rubocop-rspec (~> 1.16.0)
simplecov (>= 0.14.1, < 1.0.0)
simplecov-console (~> 0.4.2)
specinfra (= 2.76.7)
puppet-resource_api (1.8.1)
hocon (>= 1.0) hocon (>= 1.0)
puppet-syntax (2.1.0) puppet-strings (2.1.0)
rgen
yard (~> 0.9.5)
puppet-syntax (2.4.3)
rake rake
puppetlabs_spec_helper (1.2.2) puppet_pot_generator (1.0.1)
puppet
puppetlabs_spec_helper (2.14.1)
mocha (~> 1.0) mocha (~> 1.0)
pathspec (~> 0.2.1)
puppet-lint (~> 2.0) puppet-lint (~> 2.0)
puppet-syntax (~> 2.0) puppet-syntax (~> 2.0)
rspec-puppet (~> 2.0) rspec-puppet (~> 2.0)
rainbow (3.0.0) rainbow (2.2.2)
rake (11.3.0) rake
rake (12.3.2)
rest-client (2.0.2) rest-client (2.0.2)
http-cookie (>= 1.0.2, < 2.0) http-cookie (>= 1.0.2, < 2.0)
mime-types (>= 1.16, < 4.0) mime-types (>= 1.16, < 4.0)
netrc (~> 0.8) netrc (~> 0.8)
rspec (3.5.0) rgen (0.8.2)
rspec-core (~> 3.5.0) rspec (3.8.0)
rspec-expectations (~> 3.5.0) rspec-core (~> 3.8.0)
rspec-mocks (~> 3.5.0) rspec-expectations (~> 3.8.0)
rspec-core (3.5.4) rspec-mocks (~> 3.8.0)
rspec-support (~> 3.5.0) rspec-core (3.8.0)
rspec-expectations (3.5.0) rspec-support (~> 3.8.0)
rspec-expectations (3.8.2)
diff-lcs (>= 1.2.0, < 2.0) diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.5.0) rspec-support (~> 3.8.0)
rspec-mocks (3.5.0) rspec-mocks (3.8.0)
diff-lcs (>= 1.2.0, < 2.0) diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.5.0) rspec-support (~> 3.8.0)
rspec-puppet (2.4.0) rspec-puppet (2.7.3)
rspec rspec
rspec-support (3.5.0) rspec-puppet-facts (1.9.2)
rubocop (0.59.2) facter
jaro_winkler (~> 1.5.1) facterdb (>= 0.5.0)
json
mcollective-client
puppet
rspec-support (3.8.0)
rspec_junit_formatter (0.4.1)
rspec-core (>= 2, < 4, != 2.12.0)
rubocop (0.49.1)
parallel (~> 1.10) parallel (~> 1.10)
parser (>= 2.5, != 2.5.1.1) parser (>= 2.3.3.1, < 3.0)
powerpack (~> 0.1) powerpack (~> 0.1)
rainbow (>= 2.2.2, < 4.0) rainbow (>= 1.99.1, < 3.0)
ruby-progressbar (~> 1.7) ruby-progressbar (~> 1.7)
unicode-display_width (~> 1.0, >= 1.0.1) unicode-display_width (~> 1.0, >= 1.0.1)
rubocop-i18n (1.2.0)
rubocop (~> 0.49.0)
rubocop-rspec (1.16.0)
rubocop (>= 0.49.0)
ruby-progressbar (1.10.0) ruby-progressbar (1.10.0)
semantic_puppet (1.0.2) semantic_puppet (1.0.2)
spdx-licenses (1.1.0) sfl (2.3)
simplecov (0.16.1)
docile (~> 1.1)
json (>= 1.8, < 3)
simplecov-html (~> 0.10.0)
simplecov-console (0.4.2)
ansi
hirb
simplecov
simplecov-html (0.10.2)
slop (3.6.0)
spdx-licenses (1.2.0)
specinfra (2.76.7)
net-scp
net-ssh (>= 2.7)
net-telnet (= 0.1.1)
sfl
stomp (1.4.8)
systemu (2.6.5)
text (1.3.1)
unf (0.1.4) unf (0.1.4)
unf_ext unf_ext
unf_ext (0.0.7.5) unf_ext (0.0.7.5)
unicode-display_width (1.4.0) unicode-display_width (1.5.0)
url (0.3.2)
yard (0.9.19)
PLATFORMS PLATFORMS
ruby ruby
DEPENDENCIES DEPENDENCIES
facter (>= 1.7.0) fast_gettext
metadata-json-lint json (= 2.1.0)
puppet (>= 3.3) puppet (= 6.4.0)
puppet-blacksmith puppet-module-posix-default-r2.5
puppet-lint (>= 1.0.0) puppet-module-posix-dev-r2.5
puppetlabs_spec_helper (>= 1.0.0) puppet-module-win-default-r2.5
rspec-puppet puppet-module-win-dev-r2.5
rubocop
BUNDLED WITH BUNDLED WITH
1.16.1 1.17.3

View File

@@ -1,33 +1,76 @@
require 'puppetlabs_spec_helper/rake_tasks' require 'puppetlabs_spec_helper/rake_tasks'
require 'puppet-lint/tasks/puppet-lint' require 'puppet-syntax/tasks/puppet-syntax'
require 'metadata-json-lint/rake_task' require 'puppet_blacksmith/rake_tasks' if Bundler.rubygems.find_name('puppet-blacksmith').any?
require 'puppet_blacksmith/rake_tasks' require 'github_changelog_generator/task' if Bundler.rubygems.find_name('github_changelog_generator').any?
require 'puppet-strings/tasks' if Bundler.rubygems.find_name('puppet-strings').any?
if RUBY_VERSION >= '1.9' def changelog_user
require 'rubocop/rake_task' return unless Rake.application.top_level_tasks.include? "changelog"
RuboCop::RakeTask.new returnVal = nil || JSON.load(File.read('metadata.json'))['author']
raise "unable to find the changelog_user in .sync.yml, or the author in metadata.json" if returnVal.nil?
puts "GitHubChangelogGenerator user:#{returnVal}"
returnVal
end end
PuppetLint.configuration.send('disable_80chars') def changelog_project
PuppetLint.configuration.relative = true return unless Rake.application.top_level_tasks.include? "changelog"
PuppetLint.configuration.ignore_paths = ['spec/**/*.pp', 'pkg/**/*.pp', 'vendor/**/*.pp'] returnVal = nil || JSON.load(File.read('metadata.json'))['name']
raise "unable to find the changelog_project in .sync.yml or the name in metadata.json" if returnVal.nil?
puts "GitHubChangelogGenerator project:#{returnVal}"
returnVal
end
desc 'Validate manifests, templates, and ruby files' def changelog_future_release
task :validate do return unless Rake.application.top_level_tasks.include? "changelog"
Dir['manifests/**/*.pp'].each do |manifest| returnVal = "v%s" % JSON.load(File.read('metadata.json'))['version']
sh "puppet parser validate --noop #{manifest}" raise "unable to find the future_release (version) in metadata.json" if returnVal.nil?
puts "GitHubChangelogGenerator future_release:#{returnVal}"
returnVal
end
PuppetLint.configuration.send('disable_relative')
if Bundler.rubygems.find_name('github_changelog_generator').any?
GitHubChangelogGenerator::RakeTask.new :changelog do |config|
raise "Set CHANGELOG_GITHUB_TOKEN environment variable eg 'export CHANGELOG_GITHUB_TOKEN=valid_token_here'" if Rake.application.top_level_tasks.include? "changelog" and ENV['CHANGELOG_GITHUB_TOKEN'].nil?
config.user = "#{changelog_user}"
config.project = "#{changelog_project}"
config.future_release = "#{changelog_future_release}"
config.exclude_labels = ['maintenance']
config.header = "# Change log\n\nAll notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](http://semver.org)."
config.add_pr_wo_labels = true
config.issues = false
config.merge_prefix = "### UNCATEGORIZED PRS; GO LABEL THEM"
config.configure_sections = {
"Changed" => {
"prefix" => "### Changed",
"labels" => ["backwards-incompatible"],
},
"Added" => {
"prefix" => "### Added",
"labels" => ["feature", "enhancement"],
},
"Fixed" => {
"prefix" => "### Fixed",
"labels" => ["bugfix"],
},
}
end end
Dir['spec/**/*.rb', 'lib/**/*.rb'].each do |ruby_file| else
sh "ruby -c #{ruby_file}" unless ruby_file =~ %r{spec/fixtures} desc 'Generate a Changelog from GitHub'
end task :changelog do
Dir['templates/**/*.erb'].each do |template| raise <<EOM
sh "erb -P -x -T '-' #{template} | ruby -c" The changelog tasks depends on unreleased features of the github_changelog_generator gem.
Please manually add it to your .sync.yml for now, and run `pdk update`:
---
Gemfile:
optional:
':development':
- gem: 'github_changelog_generator'
git: 'https://github.com/skywinder/github-changelog-generator'
ref: '20ee04ba1234e9e83eb2ffb5056e23d641c7a018'
condition: "Gem::Version.new(RUBY_VERSION.dup) >= Gem::Version.new('2.2.2')"
EOM
end end
end end
desc 'Run metadata_lint, lint, validate, and spec tests.'
task :test do
[:metadata_lint, :lint, :validate, :spec].each do |test|
Rake::Task[test].invoke
end
end

55
appveyor.yml Normal file
View File

@@ -0,0 +1,55 @@
---
version: 1.1.x.{build}
branches:
only:
- master
skip_commits:
message: /^\(?doc\)?.*/
clone_depth: 10
init:
- SET
- 'mkdir C:\ProgramData\PuppetLabs\code && exit 0'
- 'mkdir C:\ProgramData\PuppetLabs\facter && exit 0'
- 'mkdir C:\ProgramData\PuppetLabs\hiera && exit 0'
- 'mkdir C:\ProgramData\PuppetLabs\puppet\var && exit 0'
environment:
matrix:
-
RUBY_VERSION: 24-x64
CHECK: syntax lint metadata_lint check:symlinks check:git_ignore check:dot_underscore check:test_file rubocop
-
PUPPET_GEM_VERSION: ~> 5.0
RUBY_VERSION: 24
CHECK: parallel_spec
-
PUPPET_GEM_VERSION: ~> 5.0
RUBY_VERSION: 24-x64
CHECK: parallel_spec
-
PUPPET_GEM_VERSION: ~> 6.0
RUBY_VERSION: 25
CHECK: parallel_spec
-
PUPPET_GEM_VERSION: ~> 6.0
RUBY_VERSION: 25-x64
CHECK: parallel_spec
matrix:
fast_finish: true
install:
- set PATH=C:\Ruby%RUBY_VERSION%\bin;%PATH%
- bundle install --jobs 4 --retry 2 --without system_tests
- type Gemfile.lock
build: off
test_script:
- bundle exec puppet -V
- ruby -v
- gem -v
- bundle -v
- bundle exec rake %CHECK%
notifications:
- provider: Email
to:
- nobody@nowhere.com
on_build_success: false
on_build_failure: false
on_build_status_changed: false

View File

@@ -2,15 +2,15 @@
"name": "optiz0r-sabayon", "name": "optiz0r-sabayon",
"version": "0.5.0", "version": "0.5.0",
"author": "Ben Roberts", "author": "Ben Roberts",
"license": "MIT",
"summary": "Extends Puppet with support for the Sabayon Linux distribution", "summary": "Extends Puppet with support for the Sabayon Linux distribution",
"license": "MIT",
"source": "https://github.com/Sabayon/puppet-sabayon.git", "source": "https://github.com/Sabayon/puppet-sabayon.git",
"project_page": "https://github.com/Sabayon/puppet-sabayon", "project_page": "https://github.com/Sabayon/puppet-sabayon",
"issues_url": "https://github.com/Sabayon/puppet-sabayon/issues", "issues_url": "https://github.com/Sabayon/puppet-sabayon/issues",
"tags": [ "dependencies": [
"sabayon",
"entropy"
], ],
"data_provider": "hiera",
"operatingsystem_support": [ "operatingsystem_support": [
{ {
"operatingsystem": "Sabayon", "operatingsystem": "Sabayon",
@@ -20,8 +20,17 @@
] ]
} }
], ],
"dependencies": [ "requirements": [
{
"name": "puppet",
"version_requirement": ">= 4.10.0 < 7.0.0"
}
], ],
"data_provider": "hiera" "tags": [
"sabayon",
"entropy"
],
"pdk-version": "1.10.0",
"template-url": "file:///opt/puppetlabs/pdk/share/cache/pdk-templates.git#1.10.0",
"template-ref": "1.10.0-0-gbba9ac3"
} }

7
spec/default_facts.yml Normal file
View File

@@ -0,0 +1,7 @@
# Use default_module_facts.yml for module specific facts.
#
# Facts specified here will override the values provided by rspec-puppet-facts.
---
ipaddress: "172.16.254.254"
is_pe: false
macaddress: "AA:AA:AA:AA:AA:AA"

View File

@@ -1 +1,47 @@
require 'puppetlabs_spec_helper/module_spec_helper' require 'puppetlabs_spec_helper/module_spec_helper'
require 'rspec-puppet-facts'
require 'spec_helper_local' if File.file?(File.join(File.dirname(__FILE__), 'spec_helper_local.rb'))
include RspecPuppetFacts
default_facts = {
puppetversion: Puppet.version,
facterversion: Facter.version,
}
default_fact_files = [
File.expand_path(File.join(File.dirname(__FILE__), 'default_facts.yml')),
File.expand_path(File.join(File.dirname(__FILE__), 'default_module_facts.yml')),
]
default_fact_files.each do |f|
next unless File.exist?(f) && File.readable?(f) && File.size?(f)
begin
default_facts.merge!(YAML.safe_load(File.read(f), [], [], true))
rescue => e
RSpec.configuration.reporter.message "WARNING: Unable to load #{f}: #{e}"
end
end
RSpec.configure do |c|
c.default_facts = default_facts
c.before :each do
# set to strictest setting for testing
# by default Puppet runs at warning level
Puppet.settings[:strict] = :warning
end
c.filter_run_excluding(bolt: true) unless ENV['GEM_BOLT']
c.after(:suite) do
end
end
def ensure_module_defined(module_name)
module_name.split('::').reduce(Object) do |last_module, next_module|
last_module.const_set(next_module, Module.new) unless last_module.const_defined?(next_module, false)
last_module.const_get(next_module, false)
end
end
# 'spec_overrides' from sync.yml will appear below this line