Merge branch 'new-features'
This commit is contained in:
commit
c55881bdfa
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -0,0 +1 @@
|
||||||
|
/lib/CHANGELOG.md
|
|
@ -179,7 +179,7 @@ def run_bumping_script
|
||||||
bumped_version = bump_version(versions_array)
|
bumped_version = bump_version(versions_array)
|
||||||
|
|
||||||
unless @options[:dry_run]
|
unless @options[:dry_run]
|
||||||
puts 'Are you sure? Click Y to continue:'
|
puts 'Are you sure? Press Y to continue:'
|
||||||
str = gets.chomp
|
str = gets.chomp
|
||||||
if str != 'Y'
|
if str != 'Y'
|
||||||
puts '-> exit'
|
puts '-> exit'
|
||||||
|
@ -196,7 +196,6 @@ def run_bumping_script
|
||||||
execute_line_if_not_dry_run("gem build #{spec_file}")
|
execute_line_if_not_dry_run("gem build #{spec_file}")
|
||||||
|
|
||||||
gem = find_current_gem_file
|
gem = find_current_gem_file
|
||||||
|
|
||||||
execute_line_if_not_dry_run("gem push #{gem}")
|
execute_line_if_not_dry_run("gem push #{gem}")
|
||||||
# execute_line_if_not_dry_run("pod trunk push #{spec_file}")
|
# execute_line_if_not_dry_run("pod trunk push #{spec_file}")
|
||||||
|
|
||||||
|
@ -206,7 +205,7 @@ def revert_last_bump
|
||||||
spec_file = find_spec_file
|
spec_file = find_spec_file
|
||||||
result, _ = find_version_in_podspec(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
|
str = gets.chomp
|
||||||
if str != 'Y'
|
if str != 'Y'
|
||||||
puts '-> exit'
|
puts '-> exit'
|
||||||
|
|
|
@ -60,7 +60,7 @@ class ChangelogGenerator
|
||||||
tag1 = @options[:tag1]
|
tag1 = @options[:tag1]
|
||||||
tag2 = @options[:tag2]
|
tag2 = @options[:tag2]
|
||||||
tags_strings = []
|
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?(tag1)
|
||||||
if tags_strings.include?(tag2)
|
if tags_strings.include?(tag2)
|
||||||
|
@ -117,9 +117,14 @@ class ChangelogGenerator
|
||||||
puts "Receive tags for repo #{url}"
|
puts "Receive tags for repo #{url}"
|
||||||
end
|
end
|
||||||
|
|
||||||
response = HTTParty.get(url,
|
if @options[:token]
|
||||||
:headers => {'Authorization' => "token #{@options[:token]}",
|
response = HTTParty.get(url,
|
||||||
'User-Agent' => 'Changelog-Generator'})
|
: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)
|
json_parse = JSON.parse(response.body)
|
||||||
|
|
||||||
|
@ -160,7 +165,7 @@ class ChangelogGenerator
|
||||||
|
|
||||||
issues = Array.new(@issues)
|
issues = Array.new(@issues)
|
||||||
|
|
||||||
issues.delete_if{ |issue|
|
issues.delete_if { |issue|
|
||||||
if issue[:closed_at]
|
if issue[:closed_at]
|
||||||
t = Time.parse(issue[:closed_at]).utc
|
t = Time.parse(issue[:closed_at]).utc
|
||||||
tag_is_later_since = t > since_tag_time
|
tag_is_later_since = t > since_tag_time
|
||||||
|
@ -196,7 +201,7 @@ class ChangelogGenerator
|
||||||
|
|
||||||
issues = Array.new(@issues)
|
issues = Array.new(@issues)
|
||||||
|
|
||||||
issues.delete_if{ |issue|
|
issues.delete_if { |issue|
|
||||||
if issue[:closed_at]
|
if issue[:closed_at]
|
||||||
t = Time.parse(issue[:closed_at]).utc
|
t = Time.parse(issue[:closed_at]).utc
|
||||||
t > tag_time
|
t > tag_time
|
||||||
|
@ -234,19 +239,19 @@ class ChangelogGenerator
|
||||||
if issues
|
if issues
|
||||||
issues.each { |dict|
|
issues.each { |dict|
|
||||||
is_bug = false
|
is_bug = false
|
||||||
is_enhancement = false
|
is_enhancement = false
|
||||||
dict.labels.each { |label|
|
dict.labels.each { |label|
|
||||||
if label.name == 'bug'
|
if label.name == 'bug'
|
||||||
is_bug = true
|
is_bug = true
|
||||||
end
|
end
|
||||||
if label.name == 'enhancement'
|
if label.name == 'enhancement'
|
||||||
is_enhancement = true
|
is_enhancement = true
|
||||||
end
|
end
|
||||||
}
|
}
|
||||||
|
|
||||||
intro = 'Closed issue'
|
intro = 'Closed issue'
|
||||||
if is_bug
|
if is_bug
|
||||||
intro = 'Fixed bug'
|
intro = 'Fixed bug'
|
||||||
end
|
end
|
||||||
|
|
||||||
if is_enhancement
|
if is_enhancement
|
||||||
|
|
|
@ -3,14 +3,14 @@ require 'optparse'
|
||||||
|
|
||||||
class Parser
|
class Parser
|
||||||
def self.parse_options
|
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|
|
parser = OptionParser.new { |opts|
|
||||||
opts.banner = 'Usage: changelog_generator --user username --project project_name [options]'
|
opts.banner = 'Usage: changelog_generator [options]'
|
||||||
opts.on('-u', '--user [USER]', 'Username of the owner of target GitHub repo (required)') do |last|
|
opts.on('-u', '--user [USER]', 'Username of the owner of target GitHub repo') do |last|
|
||||||
options[:user] = last
|
options[:user] = last
|
||||||
end
|
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
|
options[:project] = last
|
||||||
end
|
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|
|
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
|
exit
|
||||||
end
|
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]
|
if !options[:user] || !options[:project]
|
||||||
puts parser.banner
|
puts parser.banner
|
||||||
exit
|
exit
|
||||||
|
|
Loading…
Reference in New Issue
Block a user