annotate modules/sshkeys_core/Rakefile @ 426:1d6cf5d981be

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