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
|
||||
options = get_default_options
|
||||
|
||||
parser_file = ParserFile.new options
|
||||
parser_file.parse!
|
||||
ParserFile.new(options).parse!
|
||||
|
||||
parser = setup_parser(options)
|
||||
parser.parse!
|
||||
|
||||
if options[:user].nil? || options[:project].nil?
|
||||
detect_user_and_project(options, ARGV[0], ARGV[1])
|
||||
end
|
||||
user_and_project_from_git(options)
|
||||
|
||||
if !options[:user] || !options[:project]
|
||||
puts parser.banner
|
||||
exit
|
||||
end
|
||||
abort(parser.banner) unless options[:user] && options[:project]
|
||||
|
||||
print_options(options)
|
||||
|
||||
|
@ -198,10 +192,17 @@ module GitHubChangelogGenerator
|
|||
options
|
||||
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
|
||||
def self.detect_user_and_project(options, arg0 = nil, arg1 = nil)
|
||||
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/
|
||||
options[:user] = "skywinder"
|
||||
options[:project] = "changelog_test"
|
||||
|
@ -210,7 +211,6 @@ module GitHubChangelogGenerator
|
|||
options[:user], options[:project] = user_project_from_remote(remote)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# Try to find user and project name from git remote output
|
||||
#
|
||||
|
|
Loading…
Reference in New Issue
Block a user