Merge branch 'new-features'

This commit is contained in:
Petr Korolev 2014-11-10 16:18:39 +02:00
commit 0046f344a9
3 changed files with 47 additions and 34 deletions

View File

@ -2,12 +2,12 @@
## [1.1.0] (https://github.com/skywinder/Github-Changelog-Generator/tree/1.1.0)
#### 10/11/14
- *Fixed bug:* Bug with wrong credentials in 1.0.1 [\#12](https://github.com/skywinder/Github-Changelog-Generator/issues/12)
- *Implemented enhancement:* Detect username and project form origin [\#11](https://github.com/skywinder/Github-Changelog-Generator/issues/11)
- *Fixed bug:* Markdown formating in the last line wrong [\#9](https://github.com/skywinder/Github-Changelog-Generator/issues/9)
- *Fixed bug:* Bug with wrong credentials in 1.0.1 [\#12](https://github.com/skywinder/Github-Changelog-Generator/issues/12)
## [1.0.1] (https://github.com/skywinder/Github-Changelog-Generator/tree/1.0.1)
#### 10/11/14
- *Merged pull-request:* Implement support of different tags. [\#8](https://github.com/skywinder/Github-Changelog-Generator/pull/8)
@ -22,10 +22,10 @@
- *Implemented enhancement:* Add support for fixed issues and implemented enchanments. [\#6](https://github.com/skywinder/Github-Changelog-Generator/issues/6)
- *Fixed bug:* Last tag not appeared in changelog [\#5](https://github.com/skywinder/Github-Changelog-Generator/issues/5)
- *Implemented enhancement:* Implement option to specify output filename [\#4](https://github.com/skywinder/Github-Changelog-Generator/issues/4)
- *Fixed bug:* Last tag not appeared in changelog [\#5](https://github.com/skywinder/Github-Changelog-Generator/issues/5)
- *Closed issue:* Add support for issues in CHANGELOG [\#7](https://github.com/skywinder/Github-Changelog-Generator/pull/7)
- *Closed issue:* Fix parsing date of pull request [\#3](https://github.com/skywinder/Github-Changelog-Generator/pull/3)
@ -36,10 +36,10 @@
- *Merged pull-request:* Add option (-o --output) to specify name of the output file. [\#1](https://github.com/skywinder/Github-Changelog-Generator/pull/1)
- *Closed issue:* Add changelog generation for last tag [\#2](https://github.com/skywinder/Github-Changelog-Generator/pull/2)
- *Closed issue:* Add option (-o --output) to specify name of the output file. [\#1](https://github.com/skywinder/Github-Changelog-Generator/pull/1)
- *Closed issue:* Add changelog generation for last tag [\#2](https://github.com/skywinder/Github-Changelog-Generator/pull/2)
## [0.0.2] (https://github.com/skywinder/Github-Changelog-Generator/tree/0.0.2)
#### 06/11/14
## [0.0.1] (https://github.com/skywinder/Github-Changelog-Generator/tree/0.0.1)

View File

@ -228,7 +228,7 @@ class ChangelogGenerator
# Generate pull requests:
if pull_requests
pull_requests.each { |dict|
merge = "#{dict[:title]} [\\##{dict[:number]}](https://github.com/#{@options[:user]}/#{@options[:project]}/pull/#{dict[:number]})\n\n"
merge = "#{@options[:merge_prefix]}#{dict[:title]} [\\##{dict[:number]}](#{dict.html_url})\n\n"
log += "- #{merge}"
}
end
@ -237,6 +237,22 @@ class ChangelogGenerator
if @options[:issues]
# Generate issues:
if issues
issues.sort! { |x, y|
if x.labels.any? && y.labels.any?
x.labels[0].name <=> y.labels[0].name
else
if x.labels.any?
1
else
if y.labels.any?
-1
else
0
end
end
end
}.reverse!
end
issues.each { |dict|
is_bug = false
is_enhancement = false
@ -258,13 +274,10 @@ class ChangelogGenerator
intro = 'Implemented enhancement'
end
merge = "*#{intro}:* #{dict[:title]} [\\##{dict[:number]}](https://github.com/#{@options[:user]}/#{@options[:project]}/issues/#{dict[:number]})\n\n"
merge = "*#{intro}:* #{dict[:title]} [\\##{dict[:number]}](#{dict.html_url})\n\n"
log += "- #{merge}"
}
end
end
log
end

View File

@ -3,7 +3,7 @@ require 'optparse'
class Parser
def self.parse_options
options = {:tag1 => nil, :tag2 => nil, :format => '%d/%m/%y', :output => 'CHANGELOG.md', :labels => %w(bug enhancement), :pulls => true, :issues => true, :verbose => true, :add_issues_wo_labels => true }
options = {:tag1 => nil, :tag2 => nil, :format => '%d/%m/%y', :output => 'CHANGELOG.md', :labels => %w(bug enhancement), :pulls => true, :issues => true, :verbose => true, :add_issues_wo_labels => true, :merge_prefix => '*Merged pull-request:* ' }
parser = OptionParser.new { |opts|
opts.banner = 'Usage: changelog_generator [options]'