diff options
author | Tom Duffield <tom@chef.io> | 2016-11-07 13:57:54 -0600 |
---|---|---|
committer | Tom Duffield <tom@chef.io> | 2016-11-09 12:59:09 -0600 |
commit | f84b6352a347b823b82d2c5f8e3e3905d6948221 (patch) | |
tree | d513a15387866f09d2cb236d85fc06d651d8afca /tasks | |
parent | f9ff77143b853cea88377ec9affcca534609f3b5 (diff) | |
download | chef-f84b6352a347b823b82d2c5f8e3e3905d6948221.tar.gz |
Use the `changelog` namespace for Rake tasks
Signed-off-by: Tom Duffield <tom@chef.io>
Diffstat (limited to 'tasks')
-rw-r--r-- | tasks/changelog.rb | 43 |
1 files changed, 21 insertions, 22 deletions
diff --git a/tasks/changelog.rb b/tasks/changelog.rb index c710409345..989c43845d 100644 --- a/tasks/changelog.rb +++ b/tasks/changelog.rb @@ -1,31 +1,30 @@ begin require "github_changelog_generator/task" - # Take the current changelog and move it to HISTORY.md. Should be done when - # cutting a release - task :archive_changelog do - changelog = File.readlines("CHANGELOG.md") - File.open("HISTORY.md", "w+") { |f| f.write(changelog[2..-1].join("")) } - end + namespace :changelog do + # Take the current changelog and move it to HISTORY.md. Removes lines that + # would get duplicated the next time we pull HISTORY into the CHANGELOG. + task :archive do + changelog = File.readlines("CHANGELOG.md") + File.open("HISTORY.md", "w+") { |f| f.write(changelog[2..-4].join("")) } + end - # Run this to just update the changelog for the current release. This will - # take what is in History and generate a changelog of PRs between the most - # recent tag in HISTORY.md and HEAD. - GitHubChangelogGenerator::RakeTask.new :update_changelog do |config| - config.future_release = Chef::VERSION - config.between_tags = ["v#{Chef::VERSION}"] - config.max_issues = 0 - config.add_issues_wo_labels = false - config.enhancement_labels = "enhancement,Enhancement,New Feature,Feature".split(",") - config.bug_labels = "bug,Bug,Improvement,Upstream Bug".split(",") - config.exclude_labels = "duplicate,question,invalid,wontfix,no_changelog,Exclude From Changelog,Question,Discussion".split(",") - config.header = "This changelog reflects the current state of chef's master branch on github and may not reflect the current released version of chef, which is [![Gem Version](https://badge.fury.io/rb/chef.svg)](https://badge.fury.io/rb/chef)" + # Run this to just update the changelog for the current release. This will + # take what is in History and generate a changelog of PRs between the most + # recent tag in HISTORY.md and HEAD. + GitHubChangelogGenerator::RakeTask.new :update do |config| + config.future_release = Chef::VERSION + config.between_tags = ["v#{Chef::VERSION}"] + config.max_issues = 0 + config.add_issues_wo_labels = false + config.enhancement_labels = "enhancement,Enhancement,New Feature,Feature".split(",") + config.bug_labels = "bug,Bug,Improvement,Upstream Bug".split(",") + config.exclude_labels = "duplicate,question,invalid,wontfix,no_changelog,Exclude From Changelog,Question,Discussion".split(",") + config.header = "This changelog reflects the current state of chef's master branch on github and may not reflect the current released version of chef, which is [![Gem Version](https://badge.fury.io/rb/chef.svg)](https://badge.fury.io/rb/chef)" + end end - task :changelog do - Rake::Task["archive_changelog"].execute - Rake::Task["update_changelog"].execute - end + task :changelog => "changelog:update" rescue LoadError puts "github_changelog_generator is not available. gem install github_changelog_generator to generate changelogs" end |