THis fix #397
This commit is contained in:
parent
f32a02a75b
commit
939f6fd768
|
@ -213,24 +213,31 @@ module GitHubChangelogGenerator
|
||||||
# 2) in 2 params: repo name project
|
# 2) in 2 params: repo name project
|
||||||
def self.fetch_user_and_project(options)
|
def self.fetch_user_and_project(options)
|
||||||
if options[:user].nil? || options[:project].nil?
|
if options[:user].nil? || options[:project].nil?
|
||||||
user_and_project_from_git(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`
|
||||||
|
# @param [String] arg0 first argument in cli
|
||||||
|
# @param [String] arg1 second argument in cli
|
||||||
|
# @return [Array<String>] user and project, or nil if unsuccessful
|
||||||
def self.user_and_project_from_git(options, arg0 = nil, arg1 = nil)
|
def self.user_and_project_from_git(options, arg0 = nil, arg1 = nil)
|
||||||
options[:user], options[:project] = user_project_from_option(arg0, arg1, options[:github_site])
|
user, project = user_project_from_option(arg0, arg1, options[:github_site])
|
||||||
return if options[:user] && options[:project]
|
unless user && project
|
||||||
|
|
||||||
if ENV["RUBYLIB"] =~ /ruby-debug-ide/
|
if ENV["RUBYLIB"] =~ /ruby-debug-ide/
|
||||||
options[:user] = "skywinder"
|
user = "skywinder"
|
||||||
options[:project] = "changelog_test"
|
project = "changelog_test"
|
||||||
else
|
else
|
||||||
remote = `git config --get remote.#{options[:git_remote]}.url`
|
remote = `git config --get remote.#{options[:git_remote]}.url`
|
||||||
options[:user], options[:project] = user_project_from_remote(remote)
|
user, project = user_project_from_remote(remote)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
[user, project]
|
||||||
|
end
|
||||||
|
|
||||||
# Returns GitHub username and project from CLI arguments
|
# Returns GitHub username and project from CLI arguments
|
||||||
#
|
#
|
||||||
# @param arg0 [String] This parameter takes two forms: Either a full
|
# @param arg0 [String] This parameter takes two forms: Either a full
|
||||||
|
|
Loading…
Reference in New Issue
Block a user