Merge branch 'hotfix/update-changelog' into develop

This commit is contained in:
Petr Korolev 2016-07-22 11:17:55 +03:00
commit b08f881fb1
8 changed files with 115 additions and 60 deletions

View File

@ -1,5 +1,29 @@
# Change Log # Change Log
## [1.13.1](https://github.com/skywinder/github-changelog-generator/tree/1.13.1) (2016-07-22)
[Full Changelog](https://github.com/skywinder/github-changelog-generator/compare/1.13.0...1.13.1)
**Implemented enhancements:**
- Don't constrain runtime deps. [\#400](https://github.com/skywinder/github-changelog-generator/pull/400) ([jkeiser](https://github.com/jkeiser))
**Fixed bugs:**
- `--user` flag should not be ignored [\#397](https://github.com/skywinder/github-changelog-generator/issues/397)
- GHE not working with --github-site set to an enterprise site [\#395](https://github.com/skywinder/github-changelog-generator/issues/395)
**Closed issues:**
- Contributors Section [\#398](https://github.com/skywinder/github-changelog-generator/issues/398)
**Merged pull requests:**
- Ability to implicity set user and project from command line [\#401](https://github.com/skywinder/github-changelog-generator/pull/401) ([skywinder](https://github.com/skywinder))
- Show how to use it with Rakefile [\#399](https://github.com/skywinder/github-changelog-generator/pull/399) ([edusantana](https://github.com/edusantana))
- Adds documentation on using a GHE endpoint [\#396](https://github.com/skywinder/github-changelog-generator/pull/396) ([cormacmccarthy](https://github.com/cormacmccarthy))
- Rake task usage: Added a missing option exclude\_tags\_regex [\#393](https://github.com/skywinder/github-changelog-generator/pull/393) ([perlun](https://github.com/perlun))
- Parser: YARD docstrings and a rename, and RegExp named capture groups [\#391](https://github.com/skywinder/github-changelog-generator/pull/391) ([olleolleolle](https://github.com/olleolleolle))
## [1.13.0](https://github.com/skywinder/github-changelog-generator/tree/1.13.0) (2016-07-04) ## [1.13.0](https://github.com/skywinder/github-changelog-generator/tree/1.13.0) (2016-07-04)
[Full Changelog](https://github.com/skywinder/github-changelog-generator/compare/1.12.1...1.13.0) [Full Changelog](https://github.com/skywinder/github-changelog-generator/compare/1.12.1...1.13.0)

View File

@ -10,4 +10,6 @@ group :test do
gem "coveralls", "~>0.8", require: false gem "coveralls", "~>0.8", require: false
gem "simplecov", "~>0.10", require: false gem "simplecov", "~>0.10", require: false
gem "codeclimate-test-reporter", "~>0.4" gem "codeclimate-test-reporter", "~>0.4"
# JSON 2.0.1 is ruby 2.0+
gem "json", "< 2.0"
end end

View File

@ -1,24 +1,24 @@
PATH PATH
remote: . remote: .
specs: specs:
github_changelog_generator (1.13.0) github_changelog_generator (1.13.1)
colorize (~> 0.7) colorize (>= 0.7)
github_api (~> 0.12) github_api (>= 0.12)
rake (>= 10.0) rake (>= 10.0)
GEM GEM
remote: https://rubygems.org/ remote: https://rubygems.org/
specs: specs:
addressable (2.4.0) addressable (2.4.0)
ast (2.2.0) ast (2.3.0)
childprocess (0.5.9) childprocess (0.5.9)
ffi (~> 1.0, >= 1.0.11) ffi (~> 1.0, >= 1.0.11)
codeclimate-test-reporter (0.5.0) codeclimate-test-reporter (0.6.0)
simplecov (>= 0.7.1, < 1.0.0) simplecov (>= 0.7.1, < 1.0.0)
colorize (0.7.7) colorize (0.8.1)
coveralls (0.8.13) coveralls (0.8.14)
json (~> 1.8) json (>= 1.8, < 3)
simplecov (~> 0.11.0) simplecov (~> 0.12.0)
term-ansicolor (~> 1.3) term-ansicolor (~> 1.3)
thor (~> 0.19.1) thor (~> 0.19.1)
tins (~> 1.6.0) tins (~> 1.6.0)
@ -28,59 +28,58 @@ GEM
docile (1.1.5) docile (1.1.5)
faraday (0.9.2) faraday (0.9.2)
multipart-post (>= 1.2, < 3) multipart-post (>= 1.2, < 3)
ffi (1.9.10) ffi (1.9.14)
github_api (0.13.1) github_api (0.14.4)
addressable (~> 2.4.0) addressable (~> 2.4.0)
descendants_tracker (~> 0.0.4) descendants_tracker (~> 0.0.4)
faraday (~> 0.8, < 0.10) faraday (~> 0.8, < 0.10)
hashie (>= 3.4) hashie (>= 3.4)
multi_json (>= 1.7.5, < 2.0) oauth2 (~> 1.0.0)
oauth2
hashie (3.4.4) hashie (3.4.4)
iniparse (1.4.2) iniparse (1.4.2)
json (1.8.3) json (1.8.3)
jwt (1.5.1) jwt (1.5.4)
multi_json (1.12.0) multi_json (1.12.1)
multi_xml (0.5.5) multi_xml (0.5.5)
multipart-post (2.0.0) multipart-post (2.0.0)
oauth2 (1.1.0) oauth2 (1.0.0)
faraday (>= 0.8, < 0.10) faraday (>= 0.8, < 0.10)
jwt (~> 1.0, < 1.5.2) jwt (~> 1.0)
multi_json (~> 1.3) multi_json (~> 1.3)
multi_xml (~> 0.5) multi_xml (~> 0.5)
rack (>= 1.2, < 3) rack (~> 1.2)
overcommit (0.33.0) overcommit (0.34.2)
childprocess (~> 0.5.8) childprocess (~> 0.5.8)
iniparse (~> 1.4) iniparse (~> 1.4)
parser (2.3.1.0) parser (2.3.1.2)
ast (~> 2.2) ast (~> 2.2)
powerpack (0.1.1) powerpack (0.1.1)
rack (1.6.4) rack (1.6.4)
rainbow (2.1.0) rainbow (2.1.0)
rake (11.1.2) rake (11.2.2)
rspec (3.4.0) rspec (3.5.0)
rspec-core (~> 3.4.0) rspec-core (~> 3.5.0)
rspec-expectations (~> 3.4.0) rspec-expectations (~> 3.5.0)
rspec-mocks (~> 3.4.0) rspec-mocks (~> 3.5.0)
rspec-core (3.4.4) rspec-core (3.5.1)
rspec-support (~> 3.4.0) rspec-support (~> 3.5.0)
rspec-expectations (3.4.0) rspec-expectations (3.5.0)
diff-lcs (>= 1.2.0, < 2.0) diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.4.0) rspec-support (~> 3.5.0)
rspec-mocks (3.4.1) rspec-mocks (3.5.0)
diff-lcs (>= 1.2.0, < 2.0) diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.4.0) rspec-support (~> 3.5.0)
rspec-support (3.4.1) rspec-support (3.5.0)
rubocop (0.39.0) rubocop (0.41.2)
parser (>= 2.3.0.7, < 3.0) parser (>= 2.3.1.1, < 3.0)
powerpack (~> 0.1) powerpack (~> 0.1)
rainbow (>= 1.99.1, < 3.0) rainbow (>= 1.99.1, < 3.0)
ruby-progressbar (~> 1.7) ruby-progressbar (~> 1.7)
unicode-display_width (~> 1.0, >= 1.0.1) unicode-display_width (~> 1.0, >= 1.0.1)
ruby-progressbar (1.8.0) ruby-progressbar (1.8.1)
simplecov (0.11.2) simplecov (0.12.0)
docile (~> 1.1.0) docile (~> 1.1.0)
json (~> 1.8) json (>= 1.8, < 3)
simplecov-html (~> 0.10.0) simplecov-html (~> 0.10.0)
simplecov-html (0.10.0) simplecov-html (0.10.0)
term-ansicolor (1.3.2) term-ansicolor (1.3.2)
@ -88,7 +87,7 @@ GEM
thor (0.19.1) thor (0.19.1)
thread_safe (0.3.5) thread_safe (0.3.5)
tins (1.6.0) tins (1.6.0)
unicode-display_width (1.0.5) unicode-display_width (1.1.0)
PLATFORMS PLATFORMS
ruby ruby
@ -98,6 +97,7 @@ DEPENDENCIES
codeclimate-test-reporter (~> 0.4) codeclimate-test-reporter (~> 0.4)
coveralls (~> 0.8) coveralls (~> 0.8)
github_changelog_generator! github_changelog_generator!
json (< 2.0)
overcommit overcommit
rake rake
rspec (>= 3.2) rspec (>= 3.2)

View File

@ -24,11 +24,11 @@ Gem::Specification.new do |spec|
spec.require_paths = ["lib"] spec.require_paths = ["lib"]
spec.add_runtime_dependency "rake", ">= 10.0" spec.add_runtime_dependency "rake", ">= 10.0"
spec.add_runtime_dependency("github_api", ["~> 0.12"]) spec.add_runtime_dependency "github_api", ">= 0.12"
spec.add_runtime_dependency("colorize", ["~> 0.7"]) spec.add_runtime_dependency "colorize", ">= 0.7"
spec.add_development_dependency("overcommit", ">= 0.31") spec.add_development_dependency "overcommit", ">= 0.31"
spec.add_development_dependency("rspec", ">= 3.2") spec.add_development_dependency "rspec", ">= 3.2"
spec.add_development_dependency "bundler", ">= 1.7" spec.add_development_dependency "bundler", ">= 1.7"
spec.add_development_dependency("rubocop", ">= 0.31") spec.add_development_dependency "rubocop", ">= 0.31"
end end

View File

@ -14,7 +14,7 @@ module GitHubChangelogGenerator
parser = setup_parser(options) parser = setup_parser(options)
parser.parse! parser.parse!
user_and_project_from_git(options) fetch_user_and_project(options)
abort(parser.banner) unless options[:user] && options[:project] abort(parser.banner) unless options[:user] && options[:project]
@ -61,7 +61,7 @@ module GitHubChangelogGenerator
opts.on("-b", "--base [NAME]", "Optional base file to append generated changes to.") do |last| opts.on("-b", "--base [NAME]", "Optional base file to append generated changes to.") do |last|
options[:base] = last options[:base] = last
end end
opts.on("--bugs-label [LABEL]", "Setup custom label for bug-fixes section. Default is \"**Fixed bugs:**""") do |v| opts.on("--bugs-label [LABEL]", "Setup custom label for bug-fixes section. Default is \"**Fixed bugs:**\"") do |v|
options[:bug_prefix] = v options[:bug_prefix] = v
end end
opts.on("--enhancement-label [LABEL]", "Setup custom label for enhancements section. Default is \"**Implemented enhancements:**\"") do |v| opts.on("--enhancement-label [LABEL]", "Setup custom label for enhancements section. Default is \"**Implemented enhancements:**\"") do |v|
@ -208,24 +208,34 @@ module GitHubChangelogGenerator
end end
# If `:user` or `:project` not set in options, try setting them # If `:user` or `:project` not set in options, try setting them
def self.user_and_project_from_git(options) # Valid unnamed parameters:
# 1) in 1 param: repo_name/project
# 2) in 2 params: repo name project
def self.fetch_user_and_project(options)
if options[:user].nil? || options[:project].nil? if options[:user].nil? || options[:project].nil?
detect_user_and_project(options, ARGV[0], ARGV[1]) user, project = user_and_project_from_git(options, ARGV[0], ARGV[1])
options[:user] ||= user
options[:project] ||= project
end end
end end
# Sets `:user` and `:project` in `options` from CLI arguments or `git remote` # Sets `:user` and `:project` in `options` from CLI arguments or `git remote`
def self.detect_user_and_project(options, arg0 = nil, arg1 = nil) # @param [String] arg0 first argument in cli
options[:user], options[:project] = user_project_from_option(arg0, arg1, options[:github_site]) # @param [String] arg1 second argument in cli
return if options[:user] && options[:project] # @return [Array<String>] user and project, or nil if unsuccessful
def self.user_and_project_from_git(options, arg0 = nil, arg1 = nil)
if ENV["RUBYLIB"] =~ /ruby-debug-ide/ user, project = user_project_from_option(arg0, arg1, options[:github_site])
options[:user] = "skywinder" unless user && project
options[:project] = "changelog_test" if ENV["RUBYLIB"] =~ /ruby-debug-ide/
else user = "skywinder"
remote = `git config --get remote.#{options[:git_remote]}.url` project = "changelog_test"
options[:user], options[:project] = user_project_from_remote(remote) else
remote = `git config --get remote.#{options[:git_remote]}.url`
user, project = user_project_from_remote(remote)
end
end end
[user, project]
end end
# Returns GitHub username and project from CLI arguments # Returns GitHub username and project from CLI arguments
@ -245,7 +255,6 @@ module GitHubChangelogGenerator
if arg0 && !arg1 if arg0 && !arg1
# this match should parse strings such "https://github.com/skywinder/Github-Changelog-Generator" or # this match should parse strings such "https://github.com/skywinder/Github-Changelog-Generator" or
# "skywinder/Github-Changelog-Generator" to user and name # "skywinder/Github-Changelog-Generator" to user and name
puts arg0
match = /(?:.+#{Regexp.escape(github_site)}\/)?(.+)\/(.+)/.match(arg0) match = /(?:.+#{Regexp.escape(github_site)}\/)?(.+)\/(.+)/.match(arg0)
begin begin

View File

@ -46,7 +46,7 @@ module GitHubChangelogGenerator
# mimick parse_options # mimick parse_options
options = Parser.default_options options = Parser.default_options
Parser.user_and_project_from_git(options) Parser.fetch_user_and_project(options)
OPTIONS.each do |o| OPTIONS.each do |o|
v = instance_variable_get("@#{o}") v = instance_variable_get("@#{o}")

View File

@ -48,7 +48,7 @@ describe GitHubChangelogGenerator::ParserFile do
header: "=== Changelog ===")) header: "=== Changelog ==="))
end end
context "turns exclude-labels into an Array", bug: '#327' do context "turns exclude-labels into an Array", bug: "#327" do
let(:file) do let(:file) do
StringIO.new(<<EOF StringIO.new(<<EOF
exclude-labels=73a91042-da6f-11e5-9335-1040f38d7f90,7adf83b4-da6f-11e5-ae18-1040f38d7f90 exclude-labels=73a91042-da6f-11e5-9335-1040f38d7f90,7adf83b4-da6f-11e5-ae18-1040f38d7f90

View File

@ -56,5 +56,25 @@ describe GitHubChangelogGenerator::Parser do
it { is_expected.to be_a(Array) } it { is_expected.to be_a(Array) }
it { is_expected.to match_array([nil, nil]) } it { is_expected.to match_array([nil, nil]) }
end end
context "when all args is not nil" do
subject { GitHubChangelogGenerator::Parser.user_project_from_option("skywinder/ActionSheetPicker-3.0", "blah", "https://codeclimate.com") }
it { is_expected.to be_a(Array) }
it { is_expected.to match_array([nil, nil]) }
end
end
describe ".fetch_user_and_project" do
before :each do
ARGV = ["https://github.com/skywinder/github-changelog-generator"]
end
context do
let(:valid_user) { "initialized_user" }
let(:options) { { user: valid_user } }
let(:options_before_change) { options.dup }
it "should leave user unchanged" do
expect { GitHubChangelogGenerator::Parser.fetch_user_and_project(options) }.to change { options }
.from(options_before_change)
.to(options_before_change.merge(project: "github-changelog-generator"))
end
end
end end
end end