-
Notifications
You must be signed in to change notification settings - Fork 71
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
PDK template sync #550
Closed
Closed
PDK template sync #550
Changes from all commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
f53ee2f
Add .gitattributes from pdk-templates
DavidS 4fe1407
Root all .gitignores that should not need to match in subdirectories
DavidS 3141e7d
Sort .gitignore alphabetically
DavidS ca27122
Add additional ignores from pdk-templates
DavidS e020b24
Remove ignores that do not exist in pdk-templates
DavidS 36e71dd
Add the default .pdkignore file
DavidS 77e5268
Adjust .rspec to match pdk-templates
DavidS 4c258d4
Use default output-dir
DavidS f534677
Update to pdk-template Gemfile and puppet-module-gems
DavidS 4a56d3f
Update the Gemfile.erb to the pdk-template version
DavidS c5cecd9
Remove coverage configuration
DavidS ead79fe
Add strict and bolt options from pdk-templates
DavidS 4a43f22
Add ensure_module_defined method from pdk-templates
DavidS 1524d0f
Change optional task logic for :changelog task
DavidS c685be1
Use pdk-templates style conditional include of spec_helper_local
DavidS File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
*.rb eol=lf | ||
*.erb eol=lf | ||
*.pp eol=lf | ||
*.sh eol=lf | ||
*.epp eol=lf |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
.*.sw[op] | ||
.DS_Store | ||
.git/ | ||
.metadata | ||
.ruby-version | ||
.yardoc | ||
.yardwarns | ||
*.iml | ||
/.bundle/ | ||
/.idea/ | ||
/.vagrant/ | ||
/bin/ | ||
/convert_report.txt | ||
/coverage/ | ||
/doc/ | ||
/Gemfile.local | ||
/Gemfile.lock | ||
/junit/ | ||
/log/ | ||
/pkg/ | ||
/spec/fixtures/manifests/ | ||
/spec/fixtures/modules/ | ||
/tmp/ | ||
/update_report.txt | ||
/vendor/ | ||
<% if ! @configs['paths'].nil? -%> | ||
<% @configs['paths'].each do |path| -%> | ||
<%= path %> | ||
<% end -%> | ||
<% end -%> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
--format documentation | ||
--color | ||
--format documentation |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1 @@ | ||
--markup markdown | ||
--output-dir docs/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,66 +1,130 @@ | ||
source ENV['GEM_SOURCE'] || "https://rubygems.org" | ||
|
||
def location_for(place, fake_version = nil) | ||
if place =~ /^(git[:@][^#]*)#(.*)/ | ||
[fake_version, { :git => $1, :branch => $2, :require => false }].compact | ||
elsif place =~ /^file:\/\/(.*)/ | ||
['>= 0', { :path => File.expand_path($1), :require => false }] | ||
<% | ||
def gem_length(gem) | ||
if gem['from_env'] | ||
version_len = " *location_for(ENV['#{gem['from_env']}'])".length + ((" || '#{gem['version']}'".length if gem['version']) || 0) | ||
else | ||
[place, { :require => false }] | ||
version_len = (", '#{gem['version']}'".length if gem['version']) || 0 | ||
end | ||
|
||
gem['gem'].length + version_len | ||
end | ||
|
||
<% groups = {} -%> | ||
<% (@configs['required'].keys + ((@configs['optional'] || {}).keys)).uniq.each do |key| -%> | ||
<% groups[key] = (@configs['required'][key] || []) + ((@configs['optional'] || {})[key] || []) -%> | ||
<% end -%> | ||
<% -%> | ||
<% groups.each do |group, gems| -%> | ||
group <%= group %> do | ||
<% maxlen = gems.map! do |gem| -%> | ||
<% gem['platforms'].map!{|a| a.to_sym} unless gem['platforms'].nil? -%> | ||
<% { -%> | ||
<% 'gem' => gem['gem'], -%> | ||
<% 'version' => gem['version'], -%> | ||
<% 'platforms' => gem['platforms'], -%> | ||
<% 'require' => gem['require'], -%> | ||
<% 'git' => gem['git'], -%> | ||
<% 'branch' => gem['branch'], -%> | ||
<% 'ruby-version' => gem['ruby-version'], -%> | ||
<% 'ruby-operator' => gem['ruby-operator'], -%> | ||
<% 'length' => gem['gem'].length + (("', '".length if gem['version']) || 0) + gem['version'].to_s.length -%> | ||
<% } -%> | ||
<% end.map do |gem| -%> | ||
<% gem['length'] -%> | ||
<% end.max -%> | ||
<% gems.each do |gem| -%> | ||
<% if gem['gem'] == 'beaker-rspec' -%> | ||
if beaker_version = ENV['BEAKER_VERSION'] | ||
gem 'beaker', *location_for(beaker_version) | ||
else | ||
gem 'beaker', '>= 4.2.0', :require => false | ||
def gem_spec(gem, max_len) | ||
output = "\"#{gem['gem']}\"" | ||
|
||
if gem['version'] | ||
if gem['from_env'] | ||
output += ", *location_for(ENV['#{gem['from_env']}'] || '#{gem['version']}')" | ||
else | ||
output += ", '#{gem['version']}'" | ||
end | ||
end | ||
|
||
options = [] | ||
options << "require: false" if gem['from_env'].nil? | ||
options << "git: '#{gem['git']}'" unless gem['git'].nil? | ||
options << "branch: '#{gem['branch']}'" unless gem['branch'].nil? | ||
options << "ref: '#{gem['ref']}'" unless gem['ref'].nil? | ||
options << "platforms: #{gem['platforms'].inspect}" unless gem['platforms'].nil? | ||
|
||
unless options.empty? | ||
output += ', ' | ||
output += ' ' * (max_len - gem['length']) | ||
|
||
output += options.join(', ') | ||
end | ||
if beaker_rspec_version = ENV['BEAKER_RSPEC_VERSION'] | ||
gem 'beaker-rspec', *location_for(beaker_rspec_version) | ||
|
||
output += " if #{gem['condition']}" unless gem['condition'].nil? | ||
|
||
output | ||
end | ||
-%> | ||
source ENV['GEM_SOURCE'] || 'https://rubygems.org' | ||
|
||
def location_for(place_or_version, fake_version = nil) | ||
git_url_regex = %r{\A(?<url>(https?|git)[:@][^#]*)(#(?<branch>.*))?} | ||
file_url_regex = %r{\Afile:\/\/(?<path>.*)} | ||
|
||
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 'beaker-rspec', :require => false | ||
[place_or_version, { require: false }] | ||
end | ||
<% else -%> | ||
gem '<%= gem['gem'] %>'<%= ", '#{gem['version']}'" if gem['version'] %>, <%= ' ' * (maxlen - gem['length']) %> :require => false<%= ", :git => '#{gem['git']}'" if gem['git'] %><%= ", :branch => '#{gem['branch']}'" if gem['branch'] %><%= ", :platforms => #{gem['platforms']}" if gem['platforms'] %><%= " if RUBY_VERSION #{gem['ruby-operator']} '#{gem['ruby-version']}'" if (gem['ruby-operator'] && gem['ruby-version']) %> | ||
<% end -%> | ||
<% end -%> | ||
end | ||
|
||
ruby_version_segments = Gem::Version.new(RUBY_VERSION.dup).segments | ||
minor_version = ruby_version_segments[0..1].join('.') | ||
|
||
<% | ||
groups = {} | ||
(@configs['required'].keys + ((@configs['optional'] || {}).keys)).uniq.each do |key| | ||
groups[key] = (@configs['required'][key] || []) + ((@configs['optional'] || {})[key] || []) | ||
end | ||
-%> | ||
<% groups.each do |group, gems| -%> | ||
group <%= group %> do | ||
<% | ||
gems.map! do |gem| | ||
{ | ||
'gem' => gem['gem'], | ||
'version' => gem['version'], | ||
'platforms' => gem['platforms'].nil? ? nil : Array[*gem['platforms']].map(&:to_sym), | ||
'git' => gem['git'], | ||
'branch' => gem['branch'], | ||
'ref' => gem['ref'], | ||
'length' => gem_length(gem), | ||
'from_env' => gem['from_env'], | ||
'condition' => gem['condition'], | ||
} | ||
end | ||
|
||
maxlen = gems.map { |r| r['length'] }.max | ||
-%> | ||
<% gems.each do |gem| -%> | ||
gem <%= gem_spec(gem, maxlen) %> | ||
<% end -%> | ||
end | ||
<% end -%> | ||
|
||
puppet_version = ENV['PUPPET_GEM_VERSION'] | ||
facter_version = ENV['FACTER_GEM_VERSION'] | ||
hiera_version = ENV['HIERA_GEM_VERSION'] | ||
|
||
if facterversion = ENV['FACTER_GEM_VERSION'] | ||
gem 'facter', facterversion.to_s, :require => false, :groups => [:test] | ||
else | ||
gem 'facter', :require => false, :groups => [:test] | ||
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 | ||
|
||
ENV['PUPPET_VERSION'].nil? ? puppetversion = '<%= @configs['puppet_version'] || '~> 6.0' %>' : puppetversion = ENV['PUPPET_VERSION'].to_s | ||
gem 'puppet', puppetversion, :require => false, :groups => [:test] | ||
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about
if defined? GitHubChangelogGenerator
so you don't rely on bundler?