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