Compare commits

...

10 Commits
1.0.1 ... 1.1.0

Author SHA1 Message Date
Petr Korolev
7e2826e3b8 Update to version 1.1.0 2014-11-10 14:45:39 +02:00
Petr Korolev
c55881bdfa Merge branch 'new-features' 2014-11-10 14:45:15 +02:00
Petr Korolev
f6f9facc71 add changelog in lib to gitignore 2014-11-10 14:44:19 +02:00
Petr Korolev
807bacd95a formatting 2014-11-10 14:41:36 +02:00
Petr Korolev
936b191566 Fix bug with wrong credentials in 1.0.1 (fixed #12) 2014-11-10 14:40:10 +02:00
Petr Korolev
a33b52d6d0 typo fix 2014-11-10 14:39:31 +02:00
Petr Korolev
337c9a7d59 add option that close #11 2014-11-10 14:36:27 +02:00
Petr Korolev
8247fd8520 Merge branch 'new-features' 2014-11-10 14:15:53 +02:00
Petr Korolev
223cd2640c Merge remote-tracking branch 'origin/new-features' into new-features
Conflicts:
	lib/github_changelog_generator.rb

	Fix #9
2014-11-10 14:15:14 +02:00
Petr Korolev
2db69dd27c small fix 2014-11-07 18:37:10 +02:00
5 changed files with 34 additions and 18 deletions

1
.gitignore vendored
View File

@@ -0,0 +1 @@
/lib/CHANGELOG.md

View File

@@ -179,7 +179,7 @@ def run_bumping_script
bumped_version = bump_version(versions_array)
unless @options[:dry_run]
puts 'Are you sure? Click Y to continue:'
puts 'Are you sure? Press Y to continue:'
str = gets.chomp
if str != 'Y'
puts '-> exit'
@@ -196,7 +196,6 @@ def run_bumping_script
execute_line_if_not_dry_run("gem build #{spec_file}")
gem = find_current_gem_file
execute_line_if_not_dry_run("gem push #{gem}")
# execute_line_if_not_dry_run("pod trunk push #{spec_file}")
@@ -206,7 +205,7 @@ def revert_last_bump
spec_file = find_spec_file
result, _ = find_version_in_podspec(spec_file)
puts "DELETE tag #{result} and HARD reset HEAD~1?\nClick Y to continue:"
puts "DELETE tag #{result} and HARD reset HEAD~1?\nPress Y to continue:"
str = gets.chomp
if str != 'Y'
puts '-> exit'

View File

@@ -1,6 +1,6 @@
Gem::Specification.new do |s|
s.name = "github_changelog_generator"
s.version = "1.0.1"
s.version = "1.1.0"
s.default_executable = "github_changelog_generator"
s.required_ruby_version = '>= 1.9.3'

View File

@@ -60,7 +60,7 @@ class ChangelogGenerator
tag1 = @options[:tag1]
tag2 = @options[:tag2]
tags_strings = []
self.all_tags.each { |x| tags_strings.push(x['name'])}
self.all_tags.each { |x| tags_strings.push(x['name']) }
if tags_strings.include?(tag1)
if tags_strings.include?(tag2)
@@ -117,9 +117,14 @@ class ChangelogGenerator
puts "Receive tags for repo #{url}"
end
response = HTTParty.get(url,
:headers => {'Authorization' => "token #{@options[:token]}",
'User-Agent' => 'Changelog-Generator'})
if @options[:token]
response = HTTParty.get(url,
:headers => {'Authorization' => "token #{@options[:token]}",
'User-Agent' => 'Changelog-Generator'})
else
response = HTTParty.get(url,
:headers => {'User-Agent' => 'Changelog-Generator'})
end
json_parse = JSON.parse(response.body)
@@ -160,7 +165,7 @@ class ChangelogGenerator
issues = Array.new(@issues)
issues.delete_if{ |issue|
issues.delete_if { |issue|
if issue[:closed_at]
t = Time.parse(issue[:closed_at]).utc
tag_is_later_since = t > since_tag_time
@@ -196,7 +201,7 @@ class ChangelogGenerator
issues = Array.new(@issues)
issues.delete_if{ |issue|
issues.delete_if { |issue|
if issue[:closed_at]
t = Time.parse(issue[:closed_at]).utc
t > tag_time
@@ -234,19 +239,19 @@ class ChangelogGenerator
if issues
issues.each { |dict|
is_bug = false
is_enhancement = false
is_enhancement = false
dict.labels.each { |label|
if label.name == 'bug'
is_bug = true
end
if label.name == 'enhancement'
is_enhancement = true
is_enhancement = true
end
}
intro = 'Closed issue'
if is_bug
intro = 'Fixed bug'
intro = 'Fixed bug'
end
if is_enhancement
@@ -298,4 +303,4 @@ end
if __FILE__ == $0
changelog_generator = ChangelogGenerator.new
changelog_generator.compund_changelog
end
end

View File

@@ -3,14 +3,14 @@ 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 }
options = {:tag1 => nil, :tag2 => nil, :format => '%d/%m/%y', :output => 'CHANGELOG.md', :labels => %w(bug enhancement), :pulls => true, :issues => true, :verbose => true}
parser = OptionParser.new { |opts|
opts.banner = 'Usage: changelog_generator --user username --project project_name [options]'
opts.on('-u', '--user [USER]', 'Username of the owner of target GitHub repo (required)') do |last|
opts.banner = 'Usage: changelog_generator [options]'
opts.on('-u', '--user [USER]', 'Username of the owner of target GitHub repo') do |last|
options[:user] = last
end
opts.on('-p', '--project [PROJECT]', 'Name of project on GitHub (required)') do |last|
opts.on('-p', '--project [PROJECT]', 'Name of project on GitHub') do |last|
options[:project] = last
end
opts.on('-t', '--token [TOKEN]', 'To make more than 50 requests this script required your OAuth token for GitHub. You can generate it on https://github.com/settings/applications') do |last|
@@ -51,6 +51,17 @@ class Parser
exit
end
if !options[:user] && !options[:project]
remote = `git remote -vv`.split("\n")
match = /.*(?:[:\/])(\w*)\/((?:-|\w)*)\.git.*/.match(remote[0])
if match[1] && match[2]
puts "Detected user:#{match[1]}, project:#{match[2]}"
options[:user], options[:project] = match[1], match[2]
end
end
if !options[:user] || !options[:project]
puts parser.banner
exit