Merge branch 'hotfix/fix-nil-tag'

This commit is contained in:
Petr Korolev 2015-03-05 14:35:56 +02:00
commit 27fa9e8e02
4 changed files with 17 additions and 44 deletions

View File

@ -1,23 +1,5 @@
# Change Log # Change Log
## [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)
**Merged pull requests:**
- fix \#3. hotfix. Should appear in v0.0.3 [\#4](https://github.com/skywinder/changelog_test/pull/4) ([skywinder](https://github.com/skywinder))
## [v0.0.2](https://github.com/skywinder/changelog_test/tree/v0.0.2) (2015-03-04)
[Full Changelog](https://github.com/skywinder/changelog_test/compare/v0.0.1...v0.0.2)
**Merged pull requests:**
- Here is a test hotfix should appear in v.0.0.2 [\#2](https://github.com/skywinder/changelog_test/pull/2) ([skywinder](https://github.com/skywinder))
## [v0.0.1](https://github.com/skywinder/changelog_test/tree/v0.0.1) (2015-03-02)
\* *This Change Log was automatically generated by [github_changelog_generator](https://github.com/skywinder/Github-Changelog-Generator)* \* *This Change Log was automatically generated by [github_changelog_generator](https://github.com/skywinder/Github-Changelog-Generator)*

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?
@ -113,11 +107,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"
@ -240,7 +229,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 +239,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 +304,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
@ -389,7 +375,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)

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',
@ -28,7 +28,6 @@ module GitHubChangelogGenerator
:unreleased => true, :unreleased => true,
:unreleased_label => 'Unreleased' :unreleased_label => 'Unreleased'
} }
options = hash
parser = OptionParser.new { |opts| parser = OptionParser.new { |opts|
opts.banner = 'Usage: github_changelog_generator [options]' opts.banner = 'Usage: github_changelog_generator [options]'
@ -149,6 +148,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.6'
end end