Skip to content

Commit 87485b0

Browse files
committed
(CAT-1608) - PDK update
1 parent f8485f9 commit 87485b0

File tree

12 files changed

+87
-92
lines changed

12 files changed

+87
-92
lines changed

.gitattributes

Lines changed: 5 additions & 0 deletions
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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
/log/
1717
/pkg/
1818
/spec/fixtures/manifests/
19-
/spec/fixtures/modules/
19+
/spec/fixtures/modules/*
2020
/tmp/
2121
/vendor/
2222
/convert_report.txt

.pdkignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
/log/
1717
/pkg/
1818
/spec/fixtures/manifests/
19-
/spec/fixtures/modules/
19+
/spec/fixtures/modules/*
2020
/tmp/
2121
/vendor/
2222
/convert_report.txt

.rubocop.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ AllCops:
99
DisplayCopNames: true
1010
ExtraDetails: true
1111
DisplayStyleGuide: true
12-
TargetRubyVersion: '2.6'
12+
TargetRubyVersion: '2.7'
1313
Include:
1414
- "**/*.rb"
1515
Exclude:

.rubocop_todo.yml

Lines changed: 6 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,11 @@
11
# This configuration was generated by
22
# `rubocop --auto-gen-config`
3-
# on 2023-08-17 08:54:57 UTC using RuboCop version 1.48.1.
3+
# on 2023-11-29 07:54:54 UTC using RuboCop version 1.48.1.
44
# The point is for the user to remove these configuration records
55
# one by one as the offenses are removed from the code base.
66
# Note that changes in the inspected code, or installation of new
77
# versions of RuboCop, may require this file to be generated again.
88

9-
# Offense count: 4
10-
# Configuration parameters: Severity, Include.
11-
# Include: **/*.gemfile, **/Gemfile, **/gems.rb
12-
Bundler/DuplicatedGem:
13-
Exclude:
14-
- 'Gemfile'
15-
169
# Offense count: 3
1710
# Configuration parameters: AllowedMethods.
1811
# AllowedMethods: enums
@@ -26,11 +19,6 @@ Lint/EmptyBlock:
2619
Exclude:
2720
- 'lib/puppet/provider/windows_env/windows_env.rb'
2821

29-
# Offense count: 1
30-
Lint/MixedRegexpCaptureTypes:
31-
Exclude:
32-
- 'Gemfile'
33-
3422
# Offense count: 5
3523
# Configuration parameters: AllowedMethods, AllowedPatterns, CountRepeatedAttributes.
3624
Metrics/AbcSize:
@@ -57,20 +45,6 @@ Metrics/MethodLength:
5745
Metrics/PerceivedComplexity:
5846
Max: 25
5947

60-
# Offense count: 1
61-
# Configuration parameters: ForbiddenDelimiters.
62-
# ForbiddenDelimiters: (?i-mx:(^|\s)(EO[A-Z]{1}|END)(\s|$))
63-
Naming/HeredocDelimiterNaming:
64-
Exclude:
65-
- 'Rakefile'
66-
67-
# Offense count: 13
68-
# Configuration parameters: EnforcedStyle, AllowedIdentifiers, AllowedPatterns.
69-
# SupportedStyles: snake_case, camelCase
70-
Naming/VariableName:
71-
Exclude:
72-
- 'Rakefile'
73-
7448
# Offense count: 2
7549
# Configuration parameters: Prefixes, AllowedPatterns.
7650
# Prefixes: when, with, without
@@ -90,11 +64,6 @@ RSpec/DescribeClass:
9064
- 'spec/acceptance/windows_env_spec.rb'
9165
- 'spec/unit/puppet/type/windows_env_type_spec.rb'
9266

93-
# Offense count: 1
94-
Security/Eval:
95-
Exclude:
96-
- 'Gemfile'
97-
9867
# Offense count: 1
9968
# This cop supports unsafe autocorrection (--autocorrect-all).
10069
# Configuration parameters: EnforcedStyle.
@@ -111,6 +80,11 @@ Style/Documentation:
11180
- 'test/**/*'
11281
- 'lib/puppet/provider/windows_env/windows_env.rb'
11382

83+
# Offense count: 1
84+
Style/MixinUsage:
85+
Exclude:
86+
- 'spec/spec_helper.rb'
87+
11488
# Offense count: 1
11589
# This cop supports unsafe autocorrection (--autocorrect-all).
11690
Style/SlicingWithRange:

.sync.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,5 @@ spec/acceptance/nodesets/ec2/ubuntu-1604-x64.yml:
1111
delete: true
1212
spec/acceptance/nodesets/archlinux-2-x64.yml:
1313
delete: true
14+
.rubocop.yml:
15+
unmanaged: true

.vscode/extensions.json

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

Gemfile

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ group :development do
2323
gem "voxpupuli-puppet-lint-plugins", '~> 5.0', require: false
2424
gem "facterdb", '~> 1.18', require: false
2525
gem "metadata-json-lint", '~> 3.0', require: false
26-
gem "puppetlabs_spec_helper", '~> 6.0', require: false
2726
gem "rspec-puppet-facts", '~> 2.0', require: false
2827
gem "codecov", '~> 0.2', require: false
2928
gem "dependency_checker", '~> 1.0.0', require: false
@@ -35,12 +34,15 @@ group :development do
3534
gem "rubocop-performance", '= 1.16.0', require: false
3635
gem "rubocop-rspec", '= 2.19.0', require: false
3736
gem "rb-readline", '= 0.5.5', require: false, platforms: [:mswin, :mingw, :x64_mingw]
38-
gem "github_changelog_generator", '= 1.15.2', require: false
3937
end
4038
group :system_tests do
4139
gem "puppet_litmus", '~> 1.0', require: false, platforms: [:ruby, :x64_mingw]
4240
gem "serverspec", '~> 2.41', require: false
4341
end
42+
group :release_prep do
43+
gem "puppet-strings", '~> 4.0', require: false
44+
gem "puppetlabs_spec_helper", '~> 7.0', require: false
45+
end
4446

4547
puppet_version = ENV['PUPPET_GEM_VERSION']
4648
facter_version = ENV['FACTER_GEM_VERSION']

Rakefile

Lines changed: 43 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -1,91 +1,88 @@
11
# frozen_string_literal: true
22

33
require 'bundler'
4-
require 'puppet_litmus/rake_tasks' if Bundler.rubygems.find_name('puppet_litmus').any?
4+
require 'puppet_litmus/rake_tasks' if Gem.loaded_specs.key? 'puppet_litmus'
55
require 'puppetlabs_spec_helper/rake_tasks'
66
require 'puppet-syntax/tasks/puppet-syntax'
7-
require 'github_changelog_generator/task' if Bundler.rubygems.find_name('github_changelog_generator').any?
8-
require 'puppet-strings/tasks' if Bundler.rubygems.find_name('puppet-strings').any?
7+
require 'github_changelog_generator/task' if Gem.loaded_specs.key? 'github_changelog_generator'
8+
require 'puppet-strings/tasks' if Gem.loaded_specs.key? 'puppet-strings'
99

1010
def changelog_user
11-
return unless Rake.application.top_level_tasks.include? 'changelog'
12-
13-
returnVal = nil || JSON.parse(File.read('metadata.json'))['author']
14-
raise 'unable to find the changelog_user in .sync.yml, or the author in metadata.json' if returnVal.nil?
15-
11+
return unless Rake.application.top_level_tasks.include? "changelog"
12+
returnVal = nil || JSON.load(File.read('metadata.json'))['author']
13+
raise "unable to find the changelog_user in .sync.yml, or the author in metadata.json" if returnVal.nil?
1614
puts "GitHubChangelogGenerator user:#{returnVal}"
1715
returnVal
1816
end
1917

2018
def changelog_project
21-
return unless Rake.application.top_level_tasks.include? 'changelog'
19+
return unless Rake.application.top_level_tasks.include? "changelog"
2220

2321
returnVal = nil
2422
returnVal ||= begin
25-
metadata_source = JSON.parse(File.read('metadata.json'))['source']
26-
metadata_source_match = metadata_source&.match(%r{.*/([^/]*?)(?:\.git)?\Z})
23+
metadata_source = JSON.load(File.read('metadata.json'))['source']
24+
metadata_source_match = metadata_source && metadata_source.match(%r{.*\/([^\/]*?)(?:\.git)?\Z})
2725

2826
metadata_source_match && metadata_source_match[1]
2927
end
3028

31-
raise 'unable to find the changelog_project in .sync.yml or calculate it from the source in metadata.json' if returnVal.nil?
29+
raise "unable to find the changelog_project in .sync.yml or calculate it from the source in metadata.json" if returnVal.nil?
3230

3331
puts "GitHubChangelogGenerator project:#{returnVal}"
3432
returnVal
3533
end
3634

3735
def changelog_future_release
38-
return unless Rake.application.top_level_tasks.include? 'changelog'
39-
40-
returnVal = format('v%s', JSON.parse(File.read('metadata.json'))['version'])
41-
raise 'unable to find the future_release (version) in metadata.json' if returnVal.nil?
42-
36+
return unless Rake.application.top_level_tasks.include? "changelog"
37+
returnVal = "v%s" % JSON.load(File.read('metadata.json'))['version']
38+
raise "unable to find the future_release (version) in metadata.json" if returnVal.nil?
4339
puts "GitHubChangelogGenerator future_release:#{returnVal}"
4440
returnVal
4541
end
4642

47-
PuppetLint.configuration.send(:disable_relative)
43+
PuppetLint.configuration.send('disable_relative')
4844

49-
if Bundler.rubygems.find_name('github_changelog_generator').any?
50-
GitHubChangelogGenerator::RakeTask.new :changelog do |config|
51-
raise "Set CHANGELOG_GITHUB_TOKEN environment variable eg 'export CHANGELOG_GITHUB_TOKEN=valid_token_here'" if Rake.application.top_level_tasks.include?('changelog') && ENV['CHANGELOG_GITHUB_TOKEN'].nil?
5245

53-
config.user = changelog_user.to_s
54-
config.project = changelog_project.to_s
55-
config.future_release = changelog_future_release.to_s
46+
if Gem.loaded_specs.key? 'github_changelog_generator'
47+
GitHubChangelogGenerator::RakeTask.new :changelog do |config|
48+
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?
49+
config.user = "#{changelog_user}"
50+
config.project = "#{changelog_project}"
51+
config.future_release = "#{changelog_future_release}"
5652
config.exclude_labels = ['maintenance']
5753
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)."
5854
config.add_pr_wo_labels = true
5955
config.issues = false
60-
config.merge_prefix = '### UNCATEGORIZED PRS; LABEL THEM ON GITHUB'
56+
config.merge_prefix = "### UNCATEGORIZED PRS; LABEL THEM ON GITHUB"
6157
config.configure_sections = {
62-
'Changed' => {
63-
'prefix' => '### Changed',
64-
'labels' => ['backwards-incompatible']
58+
"Changed" => {
59+
"prefix" => "### Changed",
60+
"labels" => ["backwards-incompatible"],
6561
},
66-
'Added' => {
67-
'prefix' => '### Added',
68-
'labels' => %w[enhancement feature]
62+
"Added" => {
63+
"prefix" => "### Added",
64+
"labels" => ["enhancement", "feature"],
65+
},
66+
"Fixed" => {
67+
"prefix" => "### Fixed",
68+
"labels" => ["bug", "documentation", "bugfix"],
6969
},
70-
'Fixed' => {
71-
'prefix' => '### Fixed',
72-
'labels' => %w[bug documentation bugfix]
73-
}
7470
}
7571
end
7672
else
7773
desc 'Generate a Changelog from GitHub'
7874
task :changelog do
79-
raise <<~EOM
80-
The changelog tasks depends on recent features of the github_changelog_generator gem.
81-
Please manually add it to your .sync.yml for now, and run `pdk update`:
82-
---
83-
Gemfile:
84-
optional:
85-
':development':
86-
- gem: 'github_changelog_generator'
87-
version: '~> 1.15'
88-
condition: "Gem::Version.new(RUBY_VERSION.dup) >= Gem::Version.new('2.3.0')"
89-
EOM
75+
raise <<EOM
76+
The changelog tasks depends on recent features of the github_changelog_generator gem.
77+
Please manually add it to your .sync.yml for now, and run `pdk update`:
78+
---
79+
Gemfile:
80+
optional:
81+
':development':
82+
- gem: 'github_changelog_generator'
83+
version: '~> 1.15'
84+
condition: "Gem::Version.new(RUBY_VERSION.dup) >= Gem::Version.new('2.3.0')"
85+
EOM
9086
end
9187
end
88+

metadata.json

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,6 @@
1313
"version_requirement": ">= 8.4.0 < 10.0.0"
1414
}
1515
],
16-
"requirements": [
17-
{
18-
"name": "puppet",
19-
"version_requirement": ">= 7.0.0 < 9.0.0"
20-
}
21-
],
2216
"operatingsystem_support": [
2317
{
2418
"operatingsystem": "Windows",
@@ -29,7 +23,13 @@
2923
]
3024
}
3125
],
32-
"pdk-version": "2.7.1",
26+
"requirements": [
27+
{
28+
"name": "puppet",
29+
"version_requirement": ">= 7.0.0 < 9.0.0"
30+
}
31+
],
32+
"pdk-version": "3.0.0",
3333
"template-url": "https://github.com/puppetlabs/pdk-templates.git#main",
34-
"template-ref": "tags/2.7.5-0-ge5b0114"
34+
"template-ref": "heads/main-0-g01c6a19"
3535
}

0 commit comments

Comments
 (0)