Mercurial > repos > other > Puppet
annotate modules/concat/Rakefile @ 358:6c29af16b177
Fix PHP-as-html file serving
author | IBBoard <dev@ibboard.co.uk> |
---|---|
date | Sat, 03 Oct 2020 19:41:25 +0100 |
parents | d9352a684e62 |
children |
rev | line source |
---|---|
275
d9352a684e62
Mass update of modules to remove deprecation warnings
IBBoard <dev@ibboard.co.uk>
parents:
36
diff
changeset
|
1 require 'puppet_litmus/rake_tasks' if Bundler.rubygems.find_name('puppet_litmus').any? |
0
956e484adc12
Initial public release of Puppet configs
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
2 require 'puppetlabs_spec_helper/rake_tasks' |
275
d9352a684e62
Mass update of modules to remove deprecation warnings
IBBoard <dev@ibboard.co.uk>
parents:
36
diff
changeset
|
3 require 'puppet-syntax/tasks/puppet-syntax' |
d9352a684e62
Mass update of modules to remove deprecation warnings
IBBoard <dev@ibboard.co.uk>
parents:
36
diff
changeset
|
4 require 'puppet_blacksmith/rake_tasks' if Bundler.rubygems.find_name('puppet-blacksmith').any? |
d9352a684e62
Mass update of modules to remove deprecation warnings
IBBoard <dev@ibboard.co.uk>
parents:
36
diff
changeset
|
5 require 'github_changelog_generator/task' if Bundler.rubygems.find_name('github_changelog_generator').any? |
d9352a684e62
Mass update of modules to remove deprecation warnings
IBBoard <dev@ibboard.co.uk>
parents:
36
diff
changeset
|
6 require 'puppet-strings/tasks' if Bundler.rubygems.find_name('puppet-strings').any? |
d9352a684e62
Mass update of modules to remove deprecation warnings
IBBoard <dev@ibboard.co.uk>
parents:
36
diff
changeset
|
7 require 'puppet_pot_generator/rake_tasks' |
d9352a684e62
Mass update of modules to remove deprecation warnings
IBBoard <dev@ibboard.co.uk>
parents:
36
diff
changeset
|
8 |
d9352a684e62
Mass update of modules to remove deprecation warnings
IBBoard <dev@ibboard.co.uk>
parents:
36
diff
changeset
|
9 def changelog_user |
d9352a684e62
Mass update of modules to remove deprecation warnings
IBBoard <dev@ibboard.co.uk>
parents:
36
diff
changeset
|
10 return unless Rake.application.top_level_tasks.include? "changelog" |
d9352a684e62
Mass update of modules to remove deprecation warnings
IBBoard <dev@ibboard.co.uk>
parents:
36
diff
changeset
|
11 returnVal = nil || JSON.load(File.read('metadata.json'))['author'] |
d9352a684e62
Mass update of modules to remove deprecation warnings
IBBoard <dev@ibboard.co.uk>
parents:
36
diff
changeset
|
12 raise "unable to find the changelog_user in .sync.yml, or the author in metadata.json" if returnVal.nil? |
d9352a684e62
Mass update of modules to remove deprecation warnings
IBBoard <dev@ibboard.co.uk>
parents:
36
diff
changeset
|
13 puts "GitHubChangelogGenerator user:#{returnVal}" |
d9352a684e62
Mass update of modules to remove deprecation warnings
IBBoard <dev@ibboard.co.uk>
parents:
36
diff
changeset
|
14 returnVal |
d9352a684e62
Mass update of modules to remove deprecation warnings
IBBoard <dev@ibboard.co.uk>
parents:
36
diff
changeset
|
15 end |
d9352a684e62
Mass update of modules to remove deprecation warnings
IBBoard <dev@ibboard.co.uk>
parents:
36
diff
changeset
|
16 |
d9352a684e62
Mass update of modules to remove deprecation warnings
IBBoard <dev@ibboard.co.uk>
parents:
36
diff
changeset
|
17 def changelog_project |
d9352a684e62
Mass update of modules to remove deprecation warnings
IBBoard <dev@ibboard.co.uk>
parents:
36
diff
changeset
|
18 return unless Rake.application.top_level_tasks.include? "changelog" |
d9352a684e62
Mass update of modules to remove deprecation warnings
IBBoard <dev@ibboard.co.uk>
parents:
36
diff
changeset
|
19 |
d9352a684e62
Mass update of modules to remove deprecation warnings
IBBoard <dev@ibboard.co.uk>
parents:
36
diff
changeset
|
20 returnVal = nil |
d9352a684e62
Mass update of modules to remove deprecation warnings
IBBoard <dev@ibboard.co.uk>
parents:
36
diff
changeset
|
21 returnVal ||= begin |
d9352a684e62
Mass update of modules to remove deprecation warnings
IBBoard <dev@ibboard.co.uk>
parents:
36
diff
changeset
|
22 metadata_source = JSON.load(File.read('metadata.json'))['source'] |
d9352a684e62
Mass update of modules to remove deprecation warnings
IBBoard <dev@ibboard.co.uk>
parents:
36
diff
changeset
|
23 metadata_source_match = metadata_source && metadata_source.match(%r{.*\/([^\/]*?)(?:\.git)?\Z}) |
d9352a684e62
Mass update of modules to remove deprecation warnings
IBBoard <dev@ibboard.co.uk>
parents:
36
diff
changeset
|
24 |
d9352a684e62
Mass update of modules to remove deprecation warnings
IBBoard <dev@ibboard.co.uk>
parents:
36
diff
changeset
|
25 metadata_source_match && metadata_source_match[1] |
d9352a684e62
Mass update of modules to remove deprecation warnings
IBBoard <dev@ibboard.co.uk>
parents:
36
diff
changeset
|
26 end |
d9352a684e62
Mass update of modules to remove deprecation warnings
IBBoard <dev@ibboard.co.uk>
parents:
36
diff
changeset
|
27 |
d9352a684e62
Mass update of modules to remove deprecation warnings
IBBoard <dev@ibboard.co.uk>
parents:
36
diff
changeset
|
28 raise "unable to find the changelog_project in .sync.yml or calculate it from the source in metadata.json" if returnVal.nil? |
d9352a684e62
Mass update of modules to remove deprecation warnings
IBBoard <dev@ibboard.co.uk>
parents:
36
diff
changeset
|
29 |
d9352a684e62
Mass update of modules to remove deprecation warnings
IBBoard <dev@ibboard.co.uk>
parents:
36
diff
changeset
|
30 puts "GitHubChangelogGenerator project:#{returnVal}" |
d9352a684e62
Mass update of modules to remove deprecation warnings
IBBoard <dev@ibboard.co.uk>
parents:
36
diff
changeset
|
31 returnVal |
d9352a684e62
Mass update of modules to remove deprecation warnings
IBBoard <dev@ibboard.co.uk>
parents:
36
diff
changeset
|
32 end |
d9352a684e62
Mass update of modules to remove deprecation warnings
IBBoard <dev@ibboard.co.uk>
parents:
36
diff
changeset
|
33 |
d9352a684e62
Mass update of modules to remove deprecation warnings
IBBoard <dev@ibboard.co.uk>
parents:
36
diff
changeset
|
34 def changelog_future_release |
d9352a684e62
Mass update of modules to remove deprecation warnings
IBBoard <dev@ibboard.co.uk>
parents:
36
diff
changeset
|
35 return unless Rake.application.top_level_tasks.include? "changelog" |
d9352a684e62
Mass update of modules to remove deprecation warnings
IBBoard <dev@ibboard.co.uk>
parents:
36
diff
changeset
|
36 returnVal = "v%s" % JSON.load(File.read('metadata.json'))['version'] |
d9352a684e62
Mass update of modules to remove deprecation warnings
IBBoard <dev@ibboard.co.uk>
parents:
36
diff
changeset
|
37 raise "unable to find the future_release (version) in metadata.json" if returnVal.nil? |
d9352a684e62
Mass update of modules to remove deprecation warnings
IBBoard <dev@ibboard.co.uk>
parents:
36
diff
changeset
|
38 puts "GitHubChangelogGenerator future_release:#{returnVal}" |
d9352a684e62
Mass update of modules to remove deprecation warnings
IBBoard <dev@ibboard.co.uk>
parents:
36
diff
changeset
|
39 returnVal |
d9352a684e62
Mass update of modules to remove deprecation warnings
IBBoard <dev@ibboard.co.uk>
parents:
36
diff
changeset
|
40 end |
d9352a684e62
Mass update of modules to remove deprecation warnings
IBBoard <dev@ibboard.co.uk>
parents:
36
diff
changeset
|
41 |
d9352a684e62
Mass update of modules to remove deprecation warnings
IBBoard <dev@ibboard.co.uk>
parents:
36
diff
changeset
|
42 PuppetLint.configuration.send('disable_relative') |
0
956e484adc12
Initial public release of Puppet configs
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
43 |
275
d9352a684e62
Mass update of modules to remove deprecation warnings
IBBoard <dev@ibboard.co.uk>
parents:
36
diff
changeset
|
44 if Bundler.rubygems.find_name('github_changelog_generator').any? |
d9352a684e62
Mass update of modules to remove deprecation warnings
IBBoard <dev@ibboard.co.uk>
parents:
36
diff
changeset
|
45 GitHubChangelogGenerator::RakeTask.new :changelog do |config| |
d9352a684e62
Mass update of modules to remove deprecation warnings
IBBoard <dev@ibboard.co.uk>
parents:
36
diff
changeset
|
46 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? |
d9352a684e62
Mass update of modules to remove deprecation warnings
IBBoard <dev@ibboard.co.uk>
parents:
36
diff
changeset
|
47 config.user = "#{changelog_user}" |
d9352a684e62
Mass update of modules to remove deprecation warnings
IBBoard <dev@ibboard.co.uk>
parents:
36
diff
changeset
|
48 config.project = "#{changelog_project}" |
d9352a684e62
Mass update of modules to remove deprecation warnings
IBBoard <dev@ibboard.co.uk>
parents:
36
diff
changeset
|
49 config.future_release = "#{changelog_future_release}" |
d9352a684e62
Mass update of modules to remove deprecation warnings
IBBoard <dev@ibboard.co.uk>
parents:
36
diff
changeset
|
50 config.exclude_labels = ['maintenance'] |
d9352a684e62
Mass update of modules to remove deprecation warnings
IBBoard <dev@ibboard.co.uk>
parents:
36
diff
changeset
|
51 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)." |
d9352a684e62
Mass update of modules to remove deprecation warnings
IBBoard <dev@ibboard.co.uk>
parents:
36
diff
changeset
|
52 config.add_pr_wo_labels = true |
d9352a684e62
Mass update of modules to remove deprecation warnings
IBBoard <dev@ibboard.co.uk>
parents:
36
diff
changeset
|
53 config.issues = false |
d9352a684e62
Mass update of modules to remove deprecation warnings
IBBoard <dev@ibboard.co.uk>
parents:
36
diff
changeset
|
54 config.merge_prefix = "### UNCATEGORIZED PRS; GO LABEL THEM" |
d9352a684e62
Mass update of modules to remove deprecation warnings
IBBoard <dev@ibboard.co.uk>
parents:
36
diff
changeset
|
55 config.configure_sections = { |
d9352a684e62
Mass update of modules to remove deprecation warnings
IBBoard <dev@ibboard.co.uk>
parents:
36
diff
changeset
|
56 "Changed" => { |
d9352a684e62
Mass update of modules to remove deprecation warnings
IBBoard <dev@ibboard.co.uk>
parents:
36
diff
changeset
|
57 "prefix" => "### Changed", |
d9352a684e62
Mass update of modules to remove deprecation warnings
IBBoard <dev@ibboard.co.uk>
parents:
36
diff
changeset
|
58 "labels" => ["backwards-incompatible"], |
d9352a684e62
Mass update of modules to remove deprecation warnings
IBBoard <dev@ibboard.co.uk>
parents:
36
diff
changeset
|
59 }, |
d9352a684e62
Mass update of modules to remove deprecation warnings
IBBoard <dev@ibboard.co.uk>
parents:
36
diff
changeset
|
60 "Added" => { |
d9352a684e62
Mass update of modules to remove deprecation warnings
IBBoard <dev@ibboard.co.uk>
parents:
36
diff
changeset
|
61 "prefix" => "### Added", |
d9352a684e62
Mass update of modules to remove deprecation warnings
IBBoard <dev@ibboard.co.uk>
parents:
36
diff
changeset
|
62 "labels" => ["feature", "enhancement"], |
d9352a684e62
Mass update of modules to remove deprecation warnings
IBBoard <dev@ibboard.co.uk>
parents:
36
diff
changeset
|
63 }, |
d9352a684e62
Mass update of modules to remove deprecation warnings
IBBoard <dev@ibboard.co.uk>
parents:
36
diff
changeset
|
64 "Fixed" => { |
d9352a684e62
Mass update of modules to remove deprecation warnings
IBBoard <dev@ibboard.co.uk>
parents:
36
diff
changeset
|
65 "prefix" => "### Fixed", |
d9352a684e62
Mass update of modules to remove deprecation warnings
IBBoard <dev@ibboard.co.uk>
parents:
36
diff
changeset
|
66 "labels" => ["bugfix"], |
d9352a684e62
Mass update of modules to remove deprecation warnings
IBBoard <dev@ibboard.co.uk>
parents:
36
diff
changeset
|
67 }, |
d9352a684e62
Mass update of modules to remove deprecation warnings
IBBoard <dev@ibboard.co.uk>
parents:
36
diff
changeset
|
68 } |
d9352a684e62
Mass update of modules to remove deprecation warnings
IBBoard <dev@ibboard.co.uk>
parents:
36
diff
changeset
|
69 end |
d9352a684e62
Mass update of modules to remove deprecation warnings
IBBoard <dev@ibboard.co.uk>
parents:
36
diff
changeset
|
70 else |
d9352a684e62
Mass update of modules to remove deprecation warnings
IBBoard <dev@ibboard.co.uk>
parents:
36
diff
changeset
|
71 desc 'Generate a Changelog from GitHub' |
d9352a684e62
Mass update of modules to remove deprecation warnings
IBBoard <dev@ibboard.co.uk>
parents:
36
diff
changeset
|
72 task :changelog do |
d9352a684e62
Mass update of modules to remove deprecation warnings
IBBoard <dev@ibboard.co.uk>
parents:
36
diff
changeset
|
73 raise <<EOM |
d9352a684e62
Mass update of modules to remove deprecation warnings
IBBoard <dev@ibboard.co.uk>
parents:
36
diff
changeset
|
74 The changelog tasks depends on unreleased features of the github_changelog_generator gem. |
d9352a684e62
Mass update of modules to remove deprecation warnings
IBBoard <dev@ibboard.co.uk>
parents:
36
diff
changeset
|
75 Please manually add it to your .sync.yml for now, and run `pdk update`: |
d9352a684e62
Mass update of modules to remove deprecation warnings
IBBoard <dev@ibboard.co.uk>
parents:
36
diff
changeset
|
76 --- |
d9352a684e62
Mass update of modules to remove deprecation warnings
IBBoard <dev@ibboard.co.uk>
parents:
36
diff
changeset
|
77 Gemfile: |
d9352a684e62
Mass update of modules to remove deprecation warnings
IBBoard <dev@ibboard.co.uk>
parents:
36
diff
changeset
|
78 optional: |
d9352a684e62
Mass update of modules to remove deprecation warnings
IBBoard <dev@ibboard.co.uk>
parents:
36
diff
changeset
|
79 ':development': |
d9352a684e62
Mass update of modules to remove deprecation warnings
IBBoard <dev@ibboard.co.uk>
parents:
36
diff
changeset
|
80 - gem: 'github_changelog_generator' |
d9352a684e62
Mass update of modules to remove deprecation warnings
IBBoard <dev@ibboard.co.uk>
parents:
36
diff
changeset
|
81 git: 'https://github.com/skywinder/github-changelog-generator' |
d9352a684e62
Mass update of modules to remove deprecation warnings
IBBoard <dev@ibboard.co.uk>
parents:
36
diff
changeset
|
82 ref: '20ee04ba1234e9e83eb2ffb5056e23d641c7a018' |
d9352a684e62
Mass update of modules to remove deprecation warnings
IBBoard <dev@ibboard.co.uk>
parents:
36
diff
changeset
|
83 condition: "Gem::Version.new(RUBY_VERSION.dup) >= Gem::Version.new('2.2.2')" |
d9352a684e62
Mass update of modules to remove deprecation warnings
IBBoard <dev@ibboard.co.uk>
parents:
36
diff
changeset
|
84 EOM |
d9352a684e62
Mass update of modules to remove deprecation warnings
IBBoard <dev@ibboard.co.uk>
parents:
36
diff
changeset
|
85 end |
d9352a684e62
Mass update of modules to remove deprecation warnings
IBBoard <dev@ibboard.co.uk>
parents:
36
diff
changeset
|
86 end |
d9352a684e62
Mass update of modules to remove deprecation warnings
IBBoard <dev@ibboard.co.uk>
parents:
36
diff
changeset
|
87 |