Compare commits
3 Commits
1.8.0
...
abonas-fix
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8941eb8280 | ||
|
|
905a04fb75 | ||
|
|
30b7f39c40 |
10
CHANGELOG.md
10
CHANGELOG.md
@@ -1,5 +1,15 @@
|
|||||||
# Change Log
|
# Change Log
|
||||||
|
|
||||||
|
## [Unreleased](https://github.com/skywinder/github-changelog-generator/tree/HEAD)
|
||||||
|
|
||||||
|
[Full Changelog](https://github.com/skywinder/github-changelog-generator/compare/1.7.0...HEAD)
|
||||||
|
|
||||||
|
**Merged pull requests:**
|
||||||
|
|
||||||
|
- Add a rake task [\#260](https://github.com/skywinder/github-changelog-generator/pull/260) ([raphink](https://github.com/raphink))
|
||||||
|
- Add release\_url option [\#259](https://github.com/skywinder/github-changelog-generator/pull/259) ([raphink](https://github.com/raphink))
|
||||||
|
- Add --since-tag, close [\#257](https://github.com/skywinder/github-changelog-generator/pull/257) ([raphink](https://github.com/raphink))
|
||||||
|
|
||||||
## [1.7.0](https://github.com/skywinder/github-changelog-generator/tree/1.7.0) (2015-07-16)
|
## [1.7.0](https://github.com/skywinder/github-changelog-generator/tree/1.7.0) (2015-07-16)
|
||||||
[Full Changelog](https://github.com/skywinder/github-changelog-generator/compare/1.6.2...1.7.0)
|
[Full Changelog](https://github.com/skywinder/github-changelog-generator/compare/1.6.2...1.7.0)
|
||||||
|
|
||||||
|
|||||||
10
README.md
10
README.md
@@ -92,7 +92,7 @@ Since GitHub allows you to make only 50 requests without authentication it's rec
|
|||||||
|
|
||||||
And:
|
And:
|
||||||
|
|
||||||
- Run with key `-t [your-40-digit-token]`
|
- Run with key `-t [your-16-digit-token]`
|
||||||
- Or set environment variable `CHANGELOG_GITHUB_TOKEN` and specify there your token.
|
- Or set environment variable `CHANGELOG_GITHUB_TOKEN` and specify there your token.
|
||||||
|
|
||||||
i.e. add to your `~/.bash_profile` or `~/.zshrc` or any other place to load ENV variables string :
|
i.e. add to your `~/.bash_profile` or `~/.zshrc` or any other place to load ENV variables string :
|
||||||
@@ -104,14 +104,6 @@ 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.
|
|
||||||
|
|
||||||
### Rake task
|
### Rake task
|
||||||
|
|
||||||
|
|||||||
@@ -16,8 +16,6 @@ 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
|
||||||
@@ -117,7 +115,7 @@ module GitHubChangelogGenerator
|
|||||||
#
|
#
|
||||||
# @return [Array] filtered issues and pull requests
|
# @return [Array] filtered issues and pull requests
|
||||||
def filter_issues_for_tags(newer_tag, older_tag)
|
def filter_issues_for_tags(newer_tag, older_tag)
|
||||||
filtered_pull_requests = delete_by_time(@pull_requests, :actual_date, older_tag, newer_tag)
|
filtered_pull_requests = delete_by_time(@pull_requests, :merged_at, older_tag, newer_tag)
|
||||||
filtered_issues = delete_by_time(@issues, :actual_date, older_tag, newer_tag)
|
filtered_issues = delete_by_time(@issues, :actual_date, older_tag, newer_tag)
|
||||||
|
|
||||||
newer_tag_name = newer_tag.nil? ? nil : newer_tag["name"]
|
newer_tag_name = newer_tag.nil? ? nil : newer_tag["name"]
|
||||||
|
|||||||
@@ -52,15 +52,6 @@ module GitHubChangelogGenerator
|
|||||||
[newer_tag_link, newer_tag_name, newer_tag_time]
|
[newer_tag_link, newer_tag_name, newer_tag_time]
|
||||||
end
|
end
|
||||||
|
|
||||||
# @return [Object] try to find newest tag using #Reader and :base option if specified otherwise returns nil
|
|
||||||
def detect_since_tag
|
|
||||||
if @options[:base] && File.file?(@options[:base])
|
|
||||||
reader = GitHubChangelogGenerator::Reader.new
|
|
||||||
content = reader.read(@options[:base])
|
|
||||||
return content[0]["version"] if content
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
# Return tags after filtering tags in lists provided by option: --between-tags & --exclude-tags
|
# Return tags after filtering tags in lists provided by option: --between-tags & --exclude-tags
|
||||||
#
|
#
|
||||||
# @return [Array]
|
# @return [Array]
|
||||||
@@ -70,12 +61,9 @@ module GitHubChangelogGenerator
|
|||||||
filter_excluded_tags(filtered_tags)
|
filter_excluded_tags(filtered_tags)
|
||||||
end
|
end
|
||||||
|
|
||||||
# @param [Array] all_tags all tags
|
|
||||||
# @return [Array] filtered tags according :since_tag option
|
|
||||||
def filter_since_tag(all_tags)
|
def filter_since_tag(all_tags)
|
||||||
filtered_tags = all_tags
|
filtered_tags = all_tags
|
||||||
tag = @options[:since_tag]
|
tag = @options[:since_tag]
|
||||||
tag ||= detect_since_tag
|
|
||||||
if tag
|
if tag
|
||||||
if all_tags.map(&:name).include? tag
|
if all_tags.map(&:name).include? tag
|
||||||
idx = all_tags.index { |t| t.name == tag }
|
idx = all_tags.index { |t| t.name == tag }
|
||||||
@@ -91,29 +79,6 @@ module GitHubChangelogGenerator
|
|||||||
filtered_tags
|
filtered_tags
|
||||||
end
|
end
|
||||||
|
|
||||||
# @param [Array] all_tags all tags
|
|
||||||
# @return [Array] filtered tags according :due_tag option
|
|
||||||
def filter_due_tag(all_tags)
|
|
||||||
filtered_tags = all_tags
|
|
||||||
tag = @options[:due_tag]
|
|
||||||
if tag
|
|
||||||
if (all_tags.count > 0) && (all_tags.map(&:name).include? tag)
|
|
||||||
idx = all_tags.index { |t| t.name == tag }
|
|
||||||
last_index = all_tags.count - 1
|
|
||||||
if idx > 0 && idx < last_index
|
|
||||||
filtered_tags = all_tags[idx + 1..last_index]
|
|
||||||
else
|
|
||||||
filtered_tags = []
|
|
||||||
end
|
|
||||||
else
|
|
||||||
Helper.log.warn "Warning: can't find tag #{tag}, specified with --due-tag option."
|
|
||||||
end
|
|
||||||
end
|
|
||||||
filtered_tags
|
|
||||||
end
|
|
||||||
|
|
||||||
# @param [Array] all_tags all tags
|
|
||||||
# @return [Array] filtered tags according :between_tags option
|
|
||||||
def filter_between_tags(all_tags)
|
def filter_between_tags(all_tags)
|
||||||
filtered_tags = all_tags
|
filtered_tags = all_tags
|
||||||
if @options[:between_tags]
|
if @options[:between_tags]
|
||||||
@@ -127,8 +92,6 @@ module GitHubChangelogGenerator
|
|||||||
filtered_tags
|
filtered_tags
|
||||||
end
|
end
|
||||||
|
|
||||||
# @param [Array] all_tags all tags
|
|
||||||
# @return [Array] filtered tags according :exclude_tags option
|
|
||||||
def filter_excluded_tags(all_tags)
|
def filter_excluded_tags(all_tags)
|
||||||
filtered_tags = all_tags
|
filtered_tags = all_tags
|
||||||
if @options[:exclude_tags]
|
if @options[:exclude_tags]
|
||||||
|
|||||||
@@ -50,9 +50,6 @@ 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
|
||||||
@@ -119,9 +116,6 @@ module GitHubChangelogGenerator
|
|||||||
opts.on("--since-tag x", "Change log will start after specified tag") do |v|
|
opts.on("--since-tag x", "Change log will start after specified tag") do |v|
|
||||||
options[:since_tag] = v
|
options[:since_tag] = v
|
||||||
end
|
end
|
||||||
opts.on("--due-tag x", "Change log will end before specified tag") do |v|
|
|
||||||
options[:due_tag] = v
|
|
||||||
end
|
|
||||||
opts.on("--max-issues [NUMBER]", Integer, "Max number of issues to fetch from GitHub. Default is unlimited") do |max|
|
opts.on("--max-issues [NUMBER]", Integer, "Max number of issues to fetch from GitHub. Default is unlimited") do |max|
|
||||||
options[:max_issues] = max
|
options[:max_issues] = max
|
||||||
end
|
end
|
||||||
@@ -162,7 +156,6 @@ 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,
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ module GitHubChangelogGenerator
|
|||||||
bug_labels enhancement_labels
|
bug_labels enhancement_labels
|
||||||
between_tags exclude_tags since_tag max_issues
|
between_tags exclude_tags since_tag max_issues
|
||||||
github_site github_endpoint simple_list
|
github_site github_endpoint simple_list
|
||||||
future_release verbose release_url )
|
future_release verbose )
|
||||||
|
|
||||||
OPTIONS.each do |o|
|
OPTIONS.each do |o|
|
||||||
attr_accessor o.to_sym
|
attr_accessor o.to_sym
|
||||||
|
|||||||
@@ -1,3 +1,3 @@
|
|||||||
module GitHubChangelogGenerator
|
module GitHubChangelogGenerator
|
||||||
VERSION = "1.8.0"
|
VERSION = "1.7.0"
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -90,70 +90,18 @@ describe GitHubChangelogGenerator::Generator do
|
|||||||
end
|
end
|
||||||
|
|
||||||
describe "#filter_since_tag" do
|
describe "#filter_since_tag" do
|
||||||
context "with filled array" do
|
subject { generator.filter_since_tag(tags_mash_from_strings(%w(1 2 3))) }
|
||||||
subject { generator.filter_since_tag(tags_mash_from_strings(%w(1 2 3))) }
|
|
||||||
|
|
||||||
context "with valid since tag" do
|
context "with valid since tag" do
|
||||||
let(:generator) { GitHubChangelogGenerator::Generator.new(since_tag: "2") }
|
let(:generator) { GitHubChangelogGenerator::Generator.new(since_tag: "2") }
|
||||||
it { is_expected.to be_a Array }
|
it { is_expected.to be_a Array }
|
||||||
it { is_expected.to match_array(tags_mash_from_strings(%w(1))) }
|
it { is_expected.to match_array(tags_mash_from_strings(%w(1))) }
|
||||||
end
|
|
||||||
|
|
||||||
context "with invalid since tag" do
|
|
||||||
let(:generator) { GitHubChangelogGenerator::Generator.new(since_tag: "Invalid tag") }
|
|
||||||
it { is_expected.to be_a Array }
|
|
||||||
it { is_expected.to match_array(tags_mash_from_strings(%w(1 2 3))) }
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
context "with empty array" do
|
context "with invalid since tag" do
|
||||||
subject { generator.filter_since_tag(tags_mash_from_strings(%w())) }
|
let(:generator) { GitHubChangelogGenerator::Generator.new(since_tag: %w(invalid tags)) }
|
||||||
|
it { is_expected.to be_a Array }
|
||||||
context "with valid since tag" do
|
it { is_expected.to match_array(tags_mash_from_strings(%w(1 2 3))) }
|
||||||
let(:generator) { GitHubChangelogGenerator::Generator.new(since_tag: "2") }
|
|
||||||
it { is_expected.to be_a Array }
|
|
||||||
it { is_expected.to match_array(tags_mash_from_strings(%w())) }
|
|
||||||
end
|
|
||||||
|
|
||||||
context "with invalid since tag" do
|
|
||||||
let(:generator) { GitHubChangelogGenerator::Generator.new(since_tag: "Invalid tag") }
|
|
||||||
it { is_expected.to be_a Array }
|
|
||||||
it { is_expected.to match_array(tags_mash_from_strings(%w())) }
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
describe "#filter_due_tag" do
|
|
||||||
context "with filled array" do
|
|
||||||
subject { generator.filter_due_tag(tags_mash_from_strings(%w(1 2 3))) }
|
|
||||||
|
|
||||||
context "with valid due tag" do
|
|
||||||
let(:generator) { GitHubChangelogGenerator::Generator.new(due_tag: "2") }
|
|
||||||
it { is_expected.to be_a Array }
|
|
||||||
it { is_expected.to match_array(tags_mash_from_strings(%w(3))) }
|
|
||||||
end
|
|
||||||
|
|
||||||
context "with invalid due tag" do
|
|
||||||
let(:generator) { GitHubChangelogGenerator::Generator.new(due_tag: "Invalid tag") }
|
|
||||||
it { is_expected.to be_a Array }
|
|
||||||
it { is_expected.to match_array(tags_mash_from_strings(%w(1 2 3))) }
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
context "with empty array" do
|
|
||||||
subject { generator.filter_due_tag(tags_mash_from_strings(%w())) }
|
|
||||||
|
|
||||||
context "with valid due tag" do
|
|
||||||
let(:generator) { GitHubChangelogGenerator::Generator.new(due_tag: "2") }
|
|
||||||
it { is_expected.to be_a Array }
|
|
||||||
it { is_expected.to match_array(tags_mash_from_strings(%w())) }
|
|
||||||
end
|
|
||||||
|
|
||||||
context "with invalid due tag" do
|
|
||||||
let(:generator) { GitHubChangelogGenerator::Generator.new(due_tag: "Invalid tag") }
|
|
||||||
it { is_expected.to be_a Array }
|
|
||||||
it { is_expected.to match_array(tags_mash_from_strings(%w())) }
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user