Rubocop: less complex methods
- Changed one thing: failed return value on printing the banner when no user or project was found.
This commit is contained in:
parent
2dda090e6b
commit
d227464c33
|
@ -9,20 +9,14 @@ module GitHubChangelogGenerator
|
||||||
def self.parse_options
|
def self.parse_options
|
||||||
options = get_default_options
|
options = get_default_options
|
||||||
|
|
||||||
parser_file = ParserFile.new options
|
ParserFile.new(options).parse!
|
||||||
parser_file.parse!
|
|
||||||
|
|
||||||
parser = setup_parser(options)
|
parser = setup_parser(options)
|
||||||
parser.parse!
|
parser.parse!
|
||||||
|
|
||||||
if options[:user].nil? || options[:project].nil?
|
user_and_project_from_git(options)
|
||||||
detect_user_and_project(options, ARGV[0], ARGV[1])
|
|
||||||
end
|
|
||||||
|
|
||||||
if !options[:user] || !options[:project]
|
abort(parser.banner) unless options[:user] && options[:project]
|
||||||
puts parser.banner
|
|
||||||
exit
|
|
||||||
end
|
|
||||||
|
|
||||||
print_options(options)
|
print_options(options)
|
||||||
|
|
||||||
|
@ -198,10 +192,17 @@ module GitHubChangelogGenerator
|
||||||
options
|
options
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def self.user_and_project_from_git
|
||||||
|
if options[:user].nil? || options[:project].nil?
|
||||||
|
detect_user_and_project(options, ARGV[0], ARGV[1])
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
# Detects user and project from git
|
# Detects user and project from git
|
||||||
def self.detect_user_and_project(options, arg0 = nil, arg1 = nil)
|
def self.detect_user_and_project(options, arg0 = nil, arg1 = nil)
|
||||||
options[:user], options[:project] = user_project_from_option(arg0, arg1, options[:github_site])
|
options[:user], options[:project] = user_project_from_option(arg0, arg1, options[:github_site])
|
||||||
if !options[:user] || !options[:project]
|
return if options[:user] && options[:project]
|
||||||
|
|
||||||
if ENV["RUBYLIB"] =~ /ruby-debug-ide/
|
if ENV["RUBYLIB"] =~ /ruby-debug-ide/
|
||||||
options[:user] = "skywinder"
|
options[:user] = "skywinder"
|
||||||
options[:project] = "changelog_test"
|
options[:project] = "changelog_test"
|
||||||
|
@ -210,7 +211,6 @@ module GitHubChangelogGenerator
|
||||||
options[:user], options[:project] = user_project_from_remote(remote)
|
options[:user], options[:project] = user_project_from_remote(remote)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
|
||||||
|
|
||||||
# Try to find user and project name from git remote output
|
# Try to find user and project name from git remote output
|
||||||
#
|
#
|
||||||
|
|
Loading…
Reference in New Issue
Block a user