From 672a2e52e1f9d3599541acbf486506dc86159abc Mon Sep 17 00:00:00 2001 From: Roland Walker Date: Mon, 10 Feb 2014 09:35:38 -0500 Subject: [PATCH] devscript: show new release in changelog draft rather than the old release --- RELEASING.md | 16 ++++++++-------- developer/bin/generate_changelog | 21 ++++++++++++++++++++- 2 files changed, 28 insertions(+), 9 deletions(-) diff --git a/RELEASING.md b/RELEASING.md index 464ac55672..12d219fcec 100644 --- a/RELEASING.md +++ b/RELEASING.md @@ -31,33 +31,33 @@ down than floating in a brain somewhere. 4. Decide whether to bump the minor or patch fields in the next tag, based on whether or not features were added. Run the shell command ```bash - new_tag="$(developer/bin/get_release_tag -next)"; echo "$new_tag" # or use -next -patch + export NEW_RELEASE_TAG="$(developer/bin/get_release_tag -next)"; echo "$NEW_RELEASE_TAG" # or use -next -patch ``` - and make sure the value in `$new_tag` is what you want. + and make sure the value in `$NEW_RELEASE_TAG` is what you want. 5. Optionally run `developer/bin/project_stats release` for overall release stats. 6. Bump the `VERSION` string which is stored in the file `lib/cask/version.rb`. - It should match `$new_tag`, EXCEPT that the leading `v` character should be - removed fom the version number in the Ruby code. + It should match `$NEW_RELEASE_TAG`, EXCEPT that the leading `v` character should be + removed from the version number in the Ruby code. 7. Generate a draft changelog for the new release you are creating by running `developer/bin/generate_changelog`. Edit the draft changelog, and prepend it to `CHANGELOG.md`, following the patterns used elsewhere in the file. 8. Make a commit containing `CHANGELOG.md` and `lib/cask/version.rb`. Like this: ```bash git add CHANGELOG.md lib/cask/version.rb - git commit -m "cut $new_tag" + git commit -m "cut $NEW_RELEASE_TAG" ``` 9. Tag that commit, ensuring that you provide a message so we get an annotated tag. Like this: ```bash - git tag -m "$new_tag" "$new_tag" + git tag -m "$NEW_RELEASE_TAG" "$NEW_RELEASE_TAG" ``` 10. Push the commit and the tag: ```bash git push --follow-tags ``` -11. Unset `$new_tag`; you don't need it anymore. +11. Unset `$NEW_RELEASE_TAG`; you don't need it anymore. ```bash - unset new_tag + unset NEW_RELEASE_TAG ``` 12. Open your browser to . Then click the link for your newly-pushed tag. Click the "Edit Tag" button in diff --git a/developer/bin/generate_changelog b/developer/bin/generate_changelog index 43b8a5ef76..6bf1ee63dd 100755 --- a/developer/bin/generate_changelog +++ b/developer/bin/generate_changelog @@ -103,6 +103,25 @@ def last_release end end +def next_release + if @next_release.nil? + if ENV.key?('NEW_RELEASE_TAG') + @next_release = ENV['NEW_RELEASE_TAG'] + else + @next_release = Open3.popen3( + './developer/bin/get_release_tag', '-next' + ) do |stdin, stdout, stderr| + begin + stdout.gets.chomp + rescue + end + end + end + else + @next_release + end +end + def verify_git_object(object) sha = Open3.popen3(*%w[ git rev-parse -q --verify @@ -205,7 +224,7 @@ end def header <