aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEnis Inan <enis.inan@puppet.com>2019-01-08 14:33:00 -0800
committerEnis Inan <enis.inan@puppet.com>2019-01-08 15:04:12 -0800
commit29651834001b1ae89e0927c726080aa34ef118df (patch)
tree4ebf6ab4898da2f665e0b321687dd1534b9f54ff
parent8a12be4134ad2478b3cb9e400c65bd555ed1513b (diff)
downloadpuppet-cron_core-29651834001b1ae89e0927c726080aa34ef118df.tar.gz
puppet-cron_core-29651834001b1ae89e0927c726080aa34ef118df.tar.bz2
(maint) Update to PDK 1.8.0; update all templates
-rw-r--r--.gitattributes1
-rw-r--r--.pdkignore13
-rw-r--r--.rubocop.yml4
-rw-r--r--.sync.yml4
-rw-r--r--.travis.yml15
-rw-r--r--Gemfile25
-rw-r--r--Rakefile1
-rw-r--r--metadata.json6
-rw-r--r--spec/default_facts.yml1
-rw-r--r--spec/spec_helper.rb28
10 files changed, 55 insertions, 43 deletions
diff --git a/.gitattributes b/.gitattributes
index 543dd6a..9032a01 100644
--- a/.gitattributes
+++ b/.gitattributes
@@ -2,3 +2,4 @@
*.erb eol=lf
*.pp eol=lf
*.sh eol=lf
+*.epp eol=lf
diff --git a/.pdkignore b/.pdkignore
index 650022e..b713b3b 100644
--- a/.pdkignore
+++ b/.pdkignore
@@ -22,3 +22,16 @@
/convert_report.txt
/update_report.txt
.DS_Store
+/appveyor.yml
+/.fixtures.yml
+/Gemfile
+/.gitattributes
+/.gitignore
+/.gitlab-ci.yml
+/.pdkignore
+/Rakefile
+/.rspec
+/.rubocop.yml
+/.travis.yml
+/.yardopts
+/spec/
diff --git a/.rubocop.yml b/.rubocop.yml
index 40b459e..c3ab58e 100644
--- a/.rubocop.yml
+++ b/.rubocop.yml
@@ -19,6 +19,10 @@ AllCops:
Metrics/LineLength:
Description: People have wide screens, use them.
Max: 260
+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.
diff --git a/.sync.yml b/.sync.yml
index 1b0f8ac..61ba852 100644
--- a/.sync.yml
+++ b/.sync.yml
@@ -1,6 +1,8 @@
---
.rubocop.yml:
default_configs:
+ Metrics/LineLength:
+ Max: 260
RSpec/NamedSubject:
Enabled: false
@@ -38,4 +40,4 @@ appveyor.yml:
.travis.yml:
remove_includes:
- env: PUPPET_GEM_VERSION="~> 4.0" CHECK=parallel_spec
- rvm: 2.1.9 \ No newline at end of file
+ rvm: 2.1.9
diff --git a/.travis.yml b/.travis.yml
index 9df4390..fdb8668 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -1,25 +1,24 @@
---
-sudo: false
dist: trusty
language: ruby
cache: bundler
before_install:
- - if [[ $TRAVIS_RUBY_VERSION =~ ^(2.1) ]]; then
- gem update --system 2.7.8 && gem install bundler -v '< 2' --no-document;
+ - if [ $BUNDLER_VERSION ]; then
+ gem install -v $BUNDLER_VERSION bundler --no-rdoc --no-ri;
fi
- bundle -v
- rm -f Gemfile.lock
- - gem update --system
+ - gem update --system $RUBYGEMS_VERSION
- gem --version
- bundle -v
script:
- 'bundle exec rake $CHECK'
bundler_args: --without system_tests
rvm:
- - 2.5.3
+ - 2.5.1
env:
global:
- - PUPPET_GEM_VERSION="~> 6.0"
+ - BEAKER_PUPPET_COLLECTION=puppet6 PUPPET_GEM_VERSION="~> 6.0"
matrix:
fast_finish: true
include:
@@ -29,9 +28,9 @@ matrix:
env: CHECK=parallel_spec
-
env: PUPPET_GEM_VERSION="~> 5.0" CHECK=parallel_spec
- rvm: 2.4.5
+ rvm: 2.4.4
-
- env: PUPPET_GEM_VERSION="~> 4.0" CHECK=parallel_spec
+ env: PUPPET_GEM_VERSION="~> 4.0" CHECK=parallel_spec RUBYGEMS_VERSION=2.7.8 BUNDLER_VERSION=1.17.3
rvm: 2.1.9
branches:
only:
diff --git a/Gemfile b/Gemfile
index b7a0fce..674b5b9 100644
--- a/Gemfile
+++ b/Gemfile
@@ -1,22 +1,15 @@
source ENV['GEM_SOURCE'] || 'https://rubygems.org'
def location_for(place_or_version, fake_version = nil)
- if place_or_version =~ %r{\A(git[:@][^#]*)#(.*)}
- [fake_version, { git: Regexp.last_match(1), branch: Regexp.last_match(2), require: false }].compact
- elsif place_or_version =~ %r{\Afile:\/\/(.*)}
- ['>= 0', { path: File.expand_path(Regexp.last_match(1)), require: false }]
- else
- [place_or_version, { require: false }]
- end
-end
+ git_url_regex = %r{\A(?<url>(https?|git)[:@][^#]*)(#(?<branch>.*))?}
+ file_url_regex = %r{\Afile:\/\/(?<path>.*)}
-def gem_type(place_or_version)
- if place_or_version =~ %r{\Agit[:@]}
- :git
- elsif !place_or_version.nil? && place_or_version.start_with?('file:')
- :file
+ if place_or_version && (git_url = place_or_version.match(git_url_regex))
+ [fake_version, { git: git_url[:url], branch: git_url[:branch], require: false }].compact
+ elsif place_or_version && (file_url = place_or_version.match(file_url_regex))
+ ['>= 0', { path: File.expand_path(file_url[:path]), require: false }]
else
- :gem
+ [place_or_version, { require: false }]
end
end
@@ -28,7 +21,8 @@ group :development do
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::Version.new(RUBY_VERSION.dup) == Gem::Version.new('2.4.4')
+ 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]
@@ -46,7 +40,6 @@ group :system_tests do
end
puppet_version = ENV['PUPPET_GEM_VERSION']
-puppet_type = gem_type(puppet_version)
facter_version = ENV['FACTER_GEM_VERSION']
hiera_version = ENV['HIERA_GEM_VERSION']
diff --git a/Rakefile b/Rakefile
index 204fb18..a6b14c5 100644
--- a/Rakefile
+++ b/Rakefile
@@ -2,6 +2,7 @@ require 'puppetlabs_spec_helper/rake_tasks'
require 'puppet-syntax/tasks/puppet-syntax'
require 'puppet_blacksmith/rake_tasks' if Bundler.rubygems.find_name('puppet-blacksmith').any?
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?
def changelog_user
return unless Rake.application.top_level_tasks.include? "changelog"
diff --git a/metadata.json b/metadata.json
index bfe4c87..712401b 100644
--- a/metadata.json
+++ b/metadata.json
@@ -78,7 +78,7 @@
"version_requirement": ">= 6.0.0 < 7.0.0"
}
],
- "pdk-version": "1.6.0",
+ "pdk-version": "1.8.0",
"template-url": "https://github.com/puppetlabs/pdk-templates.git",
- "template-ref": "1.7.0-0-g57412ed"
-}
+ "template-ref": "heads/master-0-ge116657"
+} \ No newline at end of file
diff --git a/spec/default_facts.yml b/spec/default_facts.yml
index 3248be5..ea1e480 100644
--- a/spec/default_facts.yml
+++ b/spec/default_facts.yml
@@ -2,7 +2,6 @@
#
# Facts specified here will override the values provided by rspec-puppet-facts.
---
-concat_basedir: "/tmp"
ipaddress: "172.16.254.254"
is_pe: false
macaddress: "AA:AA:AA:AA:AA:AA"
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb
index 5e721b7..35654b3 100644
--- a/spec/spec_helper.rb
+++ b/spec/spec_helper.rb
@@ -1,11 +1,7 @@
require 'puppetlabs_spec_helper/module_spec_helper'
require 'rspec-puppet-facts'
-begin
- require 'spec_helper_local' if File.file?(File.join(File.dirname(__FILE__), 'spec_helper_local.rb'))
-rescue LoadError => loaderror
- warn "Could not require spec_helper_local: #{loaderror.message}"
-end
+require 'spec_helper_local' if File.file?(File.join(File.dirname(__FILE__), 'spec_helper_local.rb'))
include RspecPuppetFacts
@@ -14,15 +10,19 @@ default_facts = {
facterversion: Facter.version,
}
-default_facts_path = File.expand_path(File.join(File.dirname(__FILE__), 'default_facts.yml'))
-default_module_facts_path = File.expand_path(File.join(File.dirname(__FILE__), 'default_module_facts.yml'))
+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')),
+]
-if File.exist?(default_facts_path) && File.readable?(default_facts_path)
- default_facts.merge!(YAML.safe_load(File.read(default_facts_path)))
-end
+default_fact_files.each do |f|
+ next unless File.exist?(f) && File.readable?(f) && File.size?(f)
-if File.exist?(default_module_facts_path) && File.readable?(default_module_facts_path)
- default_facts.merge!(YAML.safe_load(File.read(default_module_facts_path)))
+ begin
+ default_facts.merge!(YAML.safe_load(File.read(f)))
+ rescue => e
+ RSpec.configuration.reporter.message "WARNING: Unable to load #{f}: #{e}"
+ end
end
RSpec.configure do |c|
@@ -36,8 +36,8 @@ 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)
- last_module.const_get(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