Skip to content

Commit

Permalink
PDK update and check Ruby 1.9.3 syntax
Browse files Browse the repository at this point in the history
As long as we support PE 2016.4, 2018.1, and therefore jruby 1.7, we
need to keep syntax compatible with Ruby 1.9.3.
  • Loading branch information
reidmv committed Feb 27, 2019
1 parent c5e6da6 commit 376a69f
Show file tree
Hide file tree
Showing 5 changed files with 192 additions and 177 deletions.
1 change: 1 addition & 0 deletions .puppet-lint.rc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
--relative
3 changes: 3 additions & 0 deletions .sync.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@ spec/default_facts.yml:
# This is raised in https://github.com/puppetlabs/pdk-templates/issues/132
appveyor.yml:
matrix:
# Must check Ruby 1.9.3 syntax as long as we support PE versions with jruby 1.7
- RUBY_VERSION: 193
CHECK: rubocop
- RUBY_VERSION: 24-x64
CHECK: "syntax lint metadata_lint check:symlinks check:git_ignore check:dot_underscore check:test_file rubocop"
- PUPPET_GEM_VERSION: ~> 4.0
Expand Down
152 changes: 76 additions & 76 deletions Rakefile
Original file line number Diff line number Diff line change
@@ -1,76 +1,76 @@
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"
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

def changelog_project
return unless Rake.application.top_level_tasks.include? "changelog"
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

def changelog_future_release
return unless Rake.application.top_level_tasks.include? "changelog"
returnVal = JSON.load(File.read('metadata.json'))['version']
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
else
desc 'Generate a Changelog from GitHub'
task :changelog do
raise <<EOM
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
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"
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

def changelog_project
return unless Rake.application.top_level_tasks.include? "changelog"
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

def changelog_future_release
return unless Rake.application.top_level_tasks.include? "changelog"
returnVal = JSON.load(File.read('metadata.json'))['version']
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
else
desc 'Generate a Changelog from GitHub'
task :changelog do
raise <<EOM
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

137 changes: 74 additions & 63 deletions appveyor.yml
Original file line number Diff line number Diff line change
@@ -1,63 +1,74 @@
---
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: ~> 6.0
RUBY_VERSION: 25
CHECK: spec
-
PUPPET_GEM_VERSION: ~> 6.0
RUBY_VERSION: 25-x64
CHECK: spec
-
PUPPET_GEM_VERSION: ~> 4.0
RUBY_VERSION: 21
CHECK: spec
-
PUPPET_GEM_VERSION: ~> 4.0
RUBY_VERSION: 21-x64
CHECK: spec
-
PUPPET_GEM_VERSION: ~> 5.0
RUBY_VERSION: 24
CHECK: spec
-
PUPPET_GEM_VERSION: ~> 5.0
RUBY_VERSION: 24-x64
CHECK: 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
---
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
-
RUBY_VERSION: 193
CHECK: rubocop
-
PUPPET_GEM_VERSION: ~> 4.0
RUBY_VERSION: 21
CHECK: spec
-
PUPPET_GEM_VERSION: ~> 4.0
RUBY_VERSION: 21-x64
CHECK: spec
-
PUPPET_GEM_VERSION: ~> 5.0
RUBY_VERSION: 24
CHECK: spec
-
PUPPET_GEM_VERSION: ~> 5.0
RUBY_VERSION: 24-x64
CHECK: 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
76 changes: 38 additions & 38 deletions metadata.json
Original file line number Diff line number Diff line change
@@ -1,39 +1,39 @@
{
"name": "puppetlabs-scheduled_task",
"version": "1.0.0",
"author": "puppetlabs",
"summary": "Manage scheduled tasks for Windows Server 2008 and newer operating systems.",
"license": "Apache-2.0",
"source": "https://github.com/puppetlabs/puppetlabs-scheduled_task.git",
"project_page": "https://github.com/puppetlabs/puppetlabs-scheduled_task",
"issues_url": "https://tickets.puppet.com/browse/MODULES",
"dependencies": [

],
"operatingsystem_support": [
{
"operatingsystem": "windows",
"operatingsystemrelease": [
"2008",
"2008 R2",
"2012",
"2012 R2",
"2016",
"2019",
"7",
"8",
"8.1",
"10"
]
}
],
"requirements": [
{
"name": "puppet",
"version_requirement": ">= 4.9.0 < 7.0.0"
}
],
"pdk-version": "1.8.0",
"template-url": "https://github.com/puppetlabs/pdk-templates",
"template-ref": "heads/master-0-g7281db5"
{
"name": "puppetlabs-scheduled_task",
"version": "1.0.0",
"author": "puppetlabs",
"summary": "Manage scheduled tasks for Windows Server 2008 and newer operating systems.",
"license": "Apache-2.0",
"source": "https://github.com/puppetlabs/puppetlabs-scheduled_task.git",
"project_page": "https://github.com/puppetlabs/puppetlabs-scheduled_task",
"issues_url": "https://tickets.puppet.com/browse/MODULES",
"dependencies": [

],
"operatingsystem_support": [
{
"operatingsystem": "windows",
"operatingsystemrelease": [
"2008",
"2008 R2",
"2012",
"2012 R2",
"2016",
"2019",
"7",
"8",
"8.1",
"10"
]
}
],
"requirements": [
{
"name": "puppet",
"version_requirement": ">= 4.9.0 < 7.0.0"
}
],
"pdk-version": "1.9.0",
"template-url": "https://github.com/puppetlabs/pdk-templates",
"template-ref": "heads/master-0-gccb6124"
}

0 comments on commit 376a69f

Please sign in to comment.