Compare commits

...

45 Commits

Author SHA1 Message Date
Petr Korolev
1232f339a0 Merge branch 'release/1.3.10' 2015-03-18 10:27:30 +02:00
Petr Korolev
3cc6418048 Update gemspec to version 1.3.10 2015-03-18 10:27:29 +02:00
Petr Korolev
a4f93feb7d This commit fix #69. 2015-03-18 10:18:58 +02:00
Petr Korolev
b0be9f8b06 Fix termination in case of empty unreleased section with --unreleased-only option. 2015-03-18 09:39:21 +02:00
Petr Korolev
aeaec739f5 Merge branch 'hotfix/readme' into develop 2015-03-17 17:07:36 +02:00
Petr Korolev
bf27187dd3 Merge branch 'hotfix/readme' 2015-03-17 17:07:27 +02:00
Petr Korolev
0e0295645d update readme 2015-03-17 17:07:12 +02:00
Petr Korolev
b2fac89ec1 Merge branch 'hotfix/readme' into develop 2015-03-09 09:59:14 +02:00
Petr Korolev
947163426b Merge branch 'hotfix/readme' 2015-03-09 09:59:13 +02:00
Petr Korolev
2900025f6f update readme 2015-03-09 09:59:04 +02:00
Petr Korolev
802fb44d38 Merge branch 'hotfix/update-changelog' into develop 2015-03-06 16:48:21 +02:00
Petr Korolev
8b299a0394 Merge branch 'hotfix/update-changelog' 2015-03-06 16:48:21 +02:00
Petr Korolev
111931a958 Update changelog for version 1.3.9 2015-03-06 16:48:20 +02:00
Petr Korolev
5a47a075e2 Merge branch 'release/1.3.9' into develop 2015-03-06 16:47:30 +02:00
Petr Korolev
a35d08f6c7 Merge branch 'release/1.3.9' 2015-03-06 16:47:30 +02:00
Petr Korolev
c2e73edc29 Update gemspec to version 1.3.9 2015-03-06 16:47:28 +02:00
Petr Korolev
045dff7cbc Fix: Improve method of detecting owner and repository. Fix #63 2015-03-06 16:32:59 +02:00
Petr Korolev
7c85082e7d Merge branch 'feature/limit-threads' into develop 2015-03-06 16:22:06 +02:00
Petr Korolev
cc65da5153 update changelog 2015-03-06 16:08:02 +02:00
Petr Korolev
c22f8b4a31 increase number of threads to 50, typo fix 2015-03-06 15:09:13 +02:00
Petr Korolev
2c46d32531 limit fetching up to 10 threads 2015-03-06 14:57:55 +02:00
Petr Korolev
e822ddfc98 update changelog 2015-03-05 17:20:57 +02:00
Petr Korolev
25a9490a07 Merge branch 'develop' 2015-03-05 17:20:17 +02:00
Petr Korolev
92a39a4107 Merge branch 'master' into develop 2015-03-05 17:20:04 +02:00
Petr Korolev
583021b474 Merge branch 'hotfix/update-changelog' 2015-03-05 17:15:42 +02:00
Petr Korolev
961aa20138 Merge branch 'hotfix/update-changelog' into develop 2015-03-05 17:15:42 +02:00
Petr Korolev
396622bec0 Update changelog for version 1.3.8 2015-03-05 17:15:40 +02:00
Petr Korolev
06575c9ab2 Merge branch 'release/1.3.8' 2015-03-05 17:14:52 +02:00
Petr Korolev
eba475ee76 Merge branch 'release/1.3.8' into develop 2015-03-05 17:14:52 +02:00
Petr Korolev
aa88122d48 Update gemspec to version 1.3.8 2015-03-05 17:14:51 +02:00
Petr Korolev
a69c2b5343 update gem 2015-03-05 17:14:40 +02:00
Petr Korolev
7fc862a100 update gem 2015-03-05 17:08:39 +02:00
Petr Korolev
87f95140d9 fix: remote branch parsing 2015-03-05 17:07:04 +02:00
Petr Korolev
75ae6f4a3a Merge branch 'hotfix/update-changelog' 2015-03-05 14:36:33 +02:00
Petr Korolev
31c13e8d1d Merge branch 'hotfix/update-changelog' into develop 2015-03-05 14:36:33 +02:00
Petr Korolev
a46fe7470b Update changelog for version 1.3.6 2015-03-05 14:36:31 +02:00
Petr Korolev
27fa9e8e02 Merge branch 'hotfix/fix-nil-tag' 2015-03-05 14:35:56 +02:00
Petr Korolev
b15f6b2837 Merge branch 'hotfix/fix-nil-tag' into develop 2015-03-05 14:35:56 +02:00
Petr Korolev
0706f89c02 Update gemspec to version 1.3.6 2015-03-05 14:35:54 +02:00
Petr Korolev
419e7e78ad Fix: exception in case no tags in repo 2015-03-05 14:33:01 +02:00
Petr Korolev
6159ebba2f refactoring 2015-03-05 13:20:51 +02:00
Petr Korolev
3a200e943c Merge branch 'hotfix/update-changelog' 2015-03-04 21:27:36 +02:00
Petr Korolev
4dc5a094d2 Merge branch 'hotfix/update-changelog' into develop 2015-03-04 21:27:36 +02:00
Petr Korolev
07d52c9465 Update changelog for version 1.3.5 2015-03-04 21:27:34 +02:00
Petr Korolev
0b1f0319db Merge branch 'release/1.3.5' into develop 2015-03-04 21:27:05 +02:00
7 changed files with 113 additions and 73 deletions

View File

@@ -1,5 +1,37 @@
# Change Log # Change Log
## [1.3.9](https://github.com/skywinder/Github-Changelog-Generator/tree/1.3.9) (2015-03-06)
[Full Changelog](https://github.com/skywinder/Github-Changelog-Generator/compare/1.3.8...1.3.9)
**Implemented enhancements:**
- Improve method of detecting owner and repository [\#63](https://github.com/skywinder/Github-Changelog-Generator/issues/63)
**Merged pull requests:**
- Concurrency problem in case of issues \> 2048 [\#65](https://github.com/skywinder/Github-Changelog-Generator/pull/65) ([skywinder](https://github.com/skywinder))
## [1.3.8](https://github.com/skywinder/Github-Changelog-Generator/tree/1.3.8) (2015-03-05)
[Full Changelog](https://github.com/skywinder/Github-Changelog-Generator/compare/1.3.6...1.3.8)
**Merged pull requests:**
- Fix `git remote` parsing in case, when script running without parameters inside destination directory [\#61](https://github.com/skywinder/Github-Changelog-Generator/pull/61) ([skywinder](https://github.com/skywinder))
## [1.3.6](https://github.com/skywinder/Github-Changelog-Generator/tree/1.3.6) (2015-03-05)
[Full Changelog](https://github.com/skywinder/Github-Changelog-Generator/compare/1.3.5...1.3.6)
## [1.3.5](https://github.com/skywinder/Github-Changelog-Generator/tree/1.3.5) (2015-03-04)
[Full Changelog](https://github.com/skywinder/Github-Changelog-Generator/compare/1.3.4...1.3.5)
**Fixed bugs:**
- Pull Requests in Wrong Tag [\#60](https://github.com/skywinder/Github-Changelog-Generator/issues/60)
## [1.3.4](https://github.com/skywinder/Github-Changelog-Generator/tree/1.3.4) (2015-03-03) ## [1.3.4](https://github.com/skywinder/Github-Changelog-Generator/tree/1.3.4) (2015-03-03)
[Full Changelog](https://github.com/skywinder/Github-Changelog-Generator/compare/1.3.3...1.3.4) [Full Changelog](https://github.com/skywinder/Github-Changelog-Generator/compare/1.3.3...1.3.4)

View File

@@ -62,8 +62,8 @@ Changelog generation has never been so easy.
github_changelog_generator github_changelog_generator
- or from anywhere: - or from anywhere:
- `github_changelog_generator -u github_username -p github_project`
github_changelog_generator -u github_username -p github_project - `github_changelog_generator github_username/github_project`
As output you will get `CHANGELOG.md` file with pretty *Markdown-formatted* changelog. As output you will get `CHANGELOG.md` file with pretty *Markdown-formatted* changelog.
@@ -116,19 +116,19 @@ It's time to create this token or wait for 1 hour before GitHub reset the counte
##Features and advantages of this project ##Features and advantages of this project
- Generate canonical change log file, followed by [keepachangelog.com guidlines](http://keepachangelog.com/) - Generate canonical change log file, followed by [keepachangelog.com guidlines](http://keepachangelog.com/)
- Simply add links for all closed issues and merged pull requests
- Possible to generate **Unreleased** changes (closed issues that have not released yet) - Possible to generate **Unreleased** changes (closed issues that have not released yet)
- Flexible format customisation: - **GitHub Enterprise support** via command line options!
- Customize issues, that should be added to changelog - Flexible format **customisation**:
- Custom date format supported - **Customize** issues, that **should be added** to changelog
- **Custom date format** supported
- Ability to manually specify in which version issue was fixed (in case, when closed date is not match) by setting `milestone` of issue the same name as tag of required version - Ability to manually specify in which version issue was fixed (in case, when closed date is not match) by setting `milestone` of issue the same name as tag of required version
- Ability to exclude specific issues from change log (by labels) - Ability to **exclude specific issues** from change log (by labels)
- Automatically exclude "questions" - issues marked as `question` labels (and other issues, that shouldn't be in change log file: with `duplicate invalid wontfix` labels) - **Automatically exclude "questions"** - issues marked as `question` labels (and other issues, that shouldn't be in change log file: with `duplicate invalid wontfix` labels)
- Distinguish bug fixes, enchantments, and closed issues according labels. - **Distinguish** bug fixes, enchantments, and closed issues **according labels**.
- **Issues** (closed issues w/o any labels) - Issues (closed issues w/o any labels)
- **Merged pull-requests** (all merged pull-requests) - Merged pull-requests (all merged pull-requests)
- **Bug-fixes** (by label `bug` in issue) - Bug-fixes (by label `bug` in issue)
- **Enhancements** (by label `enhancement` in issue) - Enhancements (by label `enhancement` in issue)
###Alternatives ###Alternatives
Here is a [wikipage list of alternatives](https://github.com/skywinder/Github-Changelog-Generator/wiki/Alternatives), that I found. But no one was satisfy my requirements. Here is a [wikipage list of alternatives](https://github.com/skywinder/Github-Changelog-Generator/wiki/Alternatives), that I found. But no one was satisfy my requirements.
@@ -139,7 +139,7 @@ Here is a [wikipage list of alternatives](https://github.com/skywinder/Github-Ch
### Projects using this library ### Projects using this library
[Wikipage with list of projects](https://github.com/skywinder/Github-Changelog-Generator/wiki/Projects-using-Github-Changelog-Generator) [Wikipage with list of projects](https://github.com/skywinder/Github-Changelog-Generator/wiki/Projects-using-Github-Changelog-Generator)
*If you are using `github_changelog_generator` for generation change log in your project or know of project that uses it, please add it to [this] (https://github.com/skywinder/Github-Changelog-Generator/wiki/Projects-using-Github-Changelog-Generator) list.* *If you are using `github_changelog_generator` for generation change log in your project or know another project that uses it, please add it to [this] (https://github.com/skywinder/Github-Changelog-Generator/wiki/Projects-using-Github-Changelog-Generator) list.*
## Am I missed some essential feature? ## Am I missed some essential feature?

View File

@@ -14,7 +14,7 @@ Gem::Specification.new do |spec|
spec.email = %q{sky4winder+github_changelog_generator@gmail.com} spec.email = %q{sky4winder+github_changelog_generator@gmail.com}
spec.date = `date +"%Y-%m-%d"`.strip! spec.date = `date +"%Y-%m-%d"`.strip!
spec.summary = %q{Script, that automatically generate changelog from your tags, issues, labels and pull requests.} spec.summary = %q{Script, that automatically generate changelog from your tags, issues, labels and pull requests.}
spec.description = %q{Script, that automatically generate changelog from your tags, issues, labels and pull requests.} spec.description = %q{Changelog generation has never been so easy. Fully automate changelog generation - this gem generate change log file based on tags, issues and merged pull requests from Github issue tracker.}
spec.homepage = %q{https://github.com/skywinder/Github-Changelog-Generator} spec.homepage = %q{https://github.com/skywinder/Github-Changelog-Generator}
spec.license = "MIT" spec.license = "MIT"

View File

@@ -1,5 +1,13 @@
# Change Log # Change Log
## [Unreleased](https://github.com/skywinder/changelog_test/tree/HEAD)
[Full Changelog](https://github.com/skywinder/changelog_test/compare/v0.0.3...HEAD)
**Merged pull requests:**
- Add automatically generated change log file. [\#5](https://github.com/skywinder/changelog_test/pull/5) ([skywinder](https://github.com/skywinder))
## [v0.0.3](https://github.com/skywinder/changelog_test/tree/v0.0.3) (2015-03-04) ## [v0.0.3](https://github.com/skywinder/changelog_test/tree/v0.0.3) (2015-03-04)
[Full Changelog](https://github.com/skywinder/changelog_test/compare/v0.0.2...v0.0.3) [Full Changelog](https://github.com/skywinder/changelog_test/compare/v0.0.2...v0.0.3)

View File

@@ -20,13 +20,7 @@ module GitHubChangelogGenerator
@options = Parser.parse_options @options = Parser.parse_options
if options[:verbose] fetch_github_token
puts 'Input options:'
pp options
puts ''
end
github_token
github_options = {per_page: PER_PAGE_NUMBER} github_options = {per_page: PER_PAGE_NUMBER}
github_options[:oauth_token] = @github_token unless @github_token.nil? github_options[:oauth_token] = @github_token unless @github_token.nil?
@@ -42,7 +36,6 @@ module GitHubChangelogGenerator
if @options[:pulls] if @options[:pulls]
@pull_requests = self.get_filtered_pull_requests @pull_requests = self.get_filtered_pull_requests
self.fetch_merged_at_pull_requests
else else
@pull_requests = [] @pull_requests = []
end end
@@ -113,11 +106,6 @@ module GitHubChangelogGenerator
puts JSON.pretty_generate(json) puts JSON.pretty_generate(json)
end end
def exec_command(cmd)
exec_cmd = "cd #{$project_path} and #{cmd}"
%x[#{exec_cmd}]
end
def fetch_merged_at_pull_requests def fetch_merged_at_pull_requests
if @options[:verbose] if @options[:verbose]
print "Fetching merged dates...\r" print "Fetching merged dates...\r"
@@ -149,12 +137,12 @@ module GitHubChangelogGenerator
def get_filtered_pull_requests def get_filtered_pull_requests
pull_requests = @pull_requests self.fetch_merged_at_pull_requests
filtered_pull_requests = pull_requests
filtered_pull_requests = @pull_requests.select {|pr| pr[:merged_at] != nil }
unless @options[:include_labels].nil? unless @options[:include_labels].nil?
filtered_pull_requests = pull_requests.select { |issue| filtered_pull_requests = @pull_requests.select { |issue|
#add all labels from @options[:incluse_labels] array #add all labels from @options[:incluse_labels] array
(issue.labels.map { |label| label.name } & @options[:include_labels]).any? (issue.labels.map { |label| label.name } & @options[:include_labels]).any?
} }
@@ -168,7 +156,7 @@ module GitHubChangelogGenerator
end end
if @options[:add_issues_wo_labels] if @options[:add_issues_wo_labels]
issues_wo_labels = pull_requests.select { issues_wo_labels = @pull_requests.select {
# add issues without any labels # add issues without any labels
|issue| !issue.labels.map { |label| label.name }.any? |issue| !issue.labels.map { |label| label.name }.any?
} }
@@ -240,7 +228,7 @@ module GitHubChangelogGenerator
log = '' log = ''
if @options[:unreleased] if @options[:unreleased] && @all_tags.count != 0
unreleased_log = self.generate_log_between_tags(self.all_tags[0], nil) unreleased_log = self.generate_log_between_tags(self.all_tags[0], nil)
if unreleased_log if unreleased_log
log += unreleased_log log += unreleased_log
@@ -250,8 +238,9 @@ module GitHubChangelogGenerator
(1 ... self.all_tags.size).each { |index| (1 ... self.all_tags.size).each { |index|
log += self.generate_log_between_tags(self.all_tags[index], self.all_tags[index-1]) log += self.generate_log_between_tags(self.all_tags[index], self.all_tags[index-1])
} }
if @all_tags.count != 0
log += generate_log_between_tags(nil, self.all_tags.last) log += generate_log_between_tags(nil, self.all_tags.last)
end
log log
end end
@@ -314,12 +303,8 @@ module GitHubChangelogGenerator
tags tags
end end
def github_token def fetch_github_token
if @options[:token] env_var = @options[:token] ? @options[:token] : (ENV.fetch 'CHANGELOG_GITHUB_TOKEN', nil)
return @github_token ||= @options[:token]
end
env_var = ENV.fetch 'CHANGELOG_GITHUB_TOKEN', nil
unless env_var unless env_var
puts "Warning: No token provided (-t option) and variable $CHANGELOG_GITHUB_TOKEN was not found.".yellow puts "Warning: No token provided (-t option) and variable $CHANGELOG_GITHUB_TOKEN was not found.".yellow
@@ -346,7 +331,7 @@ module GitHubChangelogGenerator
if filtered_issues.empty? && filtered_pull_requests.empty? && newer_tag.nil? if filtered_issues.empty? && filtered_pull_requests.empty? && newer_tag.nil?
# do not generate empty unreleased section # do not generate empty unreleased section
return nil return ''
end end
self.create_log(filtered_pull_requests, filtered_issues, newer_tag, older_tag_name) self.create_log(filtered_pull_requests, filtered_issues, newer_tag, older_tag_name)
@@ -389,7 +374,7 @@ module GitHubChangelogGenerator
def delete_by_time(array, hash_key, older_tag = nil, newer_tag = nil) def delete_by_time(array, hash_key, older_tag = nil, newer_tag = nil)
raise 'At least on of the tags should be not nil!' if (older_tag.nil? && newer_tag.nil?) raise 'At least one of the tags should be not nil!' if (older_tag.nil? && newer_tag.nil?)
newer_tag_time = self.get_time_of_tag(newer_tag) newer_tag_time = self.get_time_of_tag(newer_tag)
older_tag_time = self.get_time_of_tag(older_tag) older_tag_time = self.get_time_of_tag(older_tag)
@@ -607,11 +592,23 @@ module GitHubChangelogGenerator
end end
# Async fetching events: # Async fetching events:
threads = []
fetch_events_async(@issues + @pull_requests)
#to clear line from prev print
print " \r"
if @options[:verbose]
puts 'Fetching events for issues and PR: Done!'
end
end
def fetch_events_async(issues)
i = 0 i = 0
max_thread_number = 50
@issues.each { |issue| threads = []
issues.each_slice(max_thread_number) { |issues_slice|
issues_slice.each { |issue|
threads << Thread.new { threads << Thread.new {
obj = @github.issues.events.list user: @options[:user], repo: @options[:project], issue_number: issue['number'] obj = @github.issues.events.list user: @options[:user], repo: @options[:project], issue_number: issue['number']
issue[:events] = obj.body issue[:events] = obj.body
@@ -619,24 +616,9 @@ module GitHubChangelogGenerator
i +=1 i +=1
} }
} }
@pull_requests.each { |pull_request|
threads << Thread.new {
obj = @github.issues.events.list user: @options[:user], repo: @options[:project], issue_number: pull_request['number']
pull_request[:events] = obj.body
print "Fetching events for issues and PR: #{i+1}/#{@issues.count + @pull_requests.count}\r"
i +=1
}
}
threads.each { |thr| thr.join } threads.each { |thr| thr.join }
threads = []
#to clear line from prev print }
print " \r"
if @options[:verbose]
puts "Fetching events for issues and PR: Done! #{i}/#{@issues.count + @pull_requests.count}"
end
end end
end end

View File

@@ -6,8 +6,8 @@ require_relative 'version'
module GitHubChangelogGenerator module GitHubChangelogGenerator
class Parser class Parser
def self.parse_options def self.parse_options
# :include_labels => %w(bug enhancement),
hash = { options = {
:tag1 => nil, :tag1 => nil,
:tag2 => nil, :tag2 => nil,
:format => '%Y-%m-%d', :format => '%Y-%m-%d',
@@ -26,9 +26,9 @@ module GitHubChangelogGenerator
:filter_issues_by_milestone => true, :filter_issues_by_milestone => true,
:compare_link => true, :compare_link => true,
:unreleased => true, :unreleased => true,
:unreleased_label => 'Unreleased' :unreleased_label => 'Unreleased',
:branch => 'origin'
} }
options = hash
parser = OptionParser.new { |opts| parser = OptionParser.new { |opts|
opts.banner = 'Usage: github_changelog_generator [options]' opts.banner = 'Usage: github_changelog_generator [options]'
@@ -129,12 +129,24 @@ module GitHubChangelogGenerator
end end
if !options[:user] && !options[:project] if !options[:user] && !options[:project]
remote = `git remote -vv`.split("\n") remote = `git config --get remote.#{options[:branch]}.url`
match = /.*(?:[:\/])((?:-|\w|\.)*)\/((?:-|\w|\.)*)?(?:\.git).*/.match(remote[0]) # try to find repo in format:
# origin git@github.com:skywinder/Github-Changelog-Generator.git (fetch)
# git@github.com:skywinder/Github-Changelog-Generator.git
match = /.*(?:[:\/])((?:-|\w|\.)*)\/((?:-|\w|\.)*)(?:\.git).*/.match(remote)
if match && match[1] && match[2] if match && match[1] && match[2]
puts "Detected user:#{match[1]}, project:#{match[2]}" puts "Detected user:#{match[1]}, project:#{match[2]}"
options[:user], options[:project] = match[1], match[2] options[:user], options[:project] = match[1], match[2]
else
# try to find repo in format:
# origin https://github.com/skywinder/ChangelogMerger (fetch)
# https://github.com/skywinder/ChangelogMerger
match = /.*\/((?:-|\w|\.)*)\/((?:-|\w|\.)*).*/.match(remote)
if match && match[1] && match[2]
puts "Detected user:#{match[1]}, project:#{match[2]}"
options[:user], options[:project] = match[1], match[2]
end
end end
end end
@@ -149,6 +161,12 @@ module GitHubChangelogGenerator
options[:tag2] = ARGV[1] options[:tag2] = ARGV[1]
end end
if options[:verbose]
puts 'Performing task with options:'
pp options
puts ''
end
options options
end end
end end

View File

@@ -1,3 +1,3 @@
module GitHubChangelogGenerator module GitHubChangelogGenerator
VERSION = '1.3.5' VERSION = '1.3.10'
end end