Add --base option

This commit is contained in:
Raphaël Pinson 2015-08-04 16:03:13 +02:00
parent 295cfbc767
commit 4202b95076
3 changed files with 17 additions and 0 deletions

View File

@ -104,6 +104,17 @@ So, if you got error like this:
It's time to create this token or wait for 1 hour before GitHub reset the counter for your IP. It's time to create this token or wait for 1 hour before GitHub reset the counter for your IP.
## Migrating from a manual changelog
Knowing how dedicated you are to your project, you probably haven't been waiting for github-changelog-generator to keep a changelog,
but you most likely wouln't like to have to open issues and PRs for all past features listed in your historic changelog.
That's where `--base` comes handy. This option lets you pass a static changelog to be appended at the end of the generated entries.
If you have a `HISTORY.md` file in your project, it will automatically be picked as the static historical changelog and appended.
##Features and advantages of this project ##Features and advantages of this project
- Generate canonical, neat change log file, followed by [basic change log guidelines](http://keepachangelog.com/) :gem: - Generate canonical, neat change log file, followed by [basic change log guidelines](http://keepachangelog.com/) :gem:
- Possible to generate **Unreleased** changes (closed issues that have not released yet) :dizzy: - Possible to generate **Unreleased** changes (closed issues that have not released yet) :dizzy:

View File

@ -16,6 +16,8 @@ module GitHubChangelogGenerator
log += generate_log_for_all_tags log += generate_log_for_all_tags
end end
log += File.read(@options[:base]) if File.file?(@options[:base])
log += "\n\n\\* *This Change Log was automatically generated by [github_changelog_generator](https://github.com/skywinder/Github-Changelog-Generator)*" log += "\n\n\\* *This Change Log was automatically generated by [github_changelog_generator](https://github.com/skywinder/Github-Changelog-Generator)*"
@log = log @log = log
end end

View File

@ -50,6 +50,9 @@ module GitHubChangelogGenerator
opts.on("-o", "--output [NAME]", "Output file. Default is CHANGELOG.md") do |last| opts.on("-o", "--output [NAME]", "Output file. Default is CHANGELOG.md") do |last|
options[:output] = last options[:output] = last
end end
opts.on("-b", "--base [NAME]", "Optional base file to append generated changes to.") do |last|
options[:base] = last
end
opts.on("--bugs-label [LABEL]", "Setup custom label for bug-fixes section. Default is \"**Fixed bugs:**""") do |v| opts.on("--bugs-label [LABEL]", "Setup custom label for bug-fixes section. Default is \"**Fixed bugs:**""") do |v|
options[:bug_prefix] = v options[:bug_prefix] = v
end end
@ -153,6 +156,7 @@ module GitHubChangelogGenerator
tag2: nil, tag2: nil,
date_format: "%Y-%m-%d", date_format: "%Y-%m-%d",
output: "CHANGELOG.md", output: "CHANGELOG.md",
base: "HISTORY.md",
issues: true, issues: true,
add_issues_wo_labels: true, add_issues_wo_labels: true,
add_pr_wo_labels: true, add_pr_wo_labels: true,