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:
Olle Jonsson 2015-10-21 23:42:33 +02:00
parent 2dda090e6b
commit d227464c33

View File

@ -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,17 +192,23 @@ 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]
if ENV["RUBYLIB"] =~ /ruby-debug-ide/
options[:user] = "skywinder"
options[:project] = "changelog_test"
else
remote = `git config --get remote.#{options[:git_remote]}.url`
options[:user], options[:project] = user_project_from_remote(remote)
end
return if options[:user] && options[:project]
if ENV["RUBYLIB"] =~ /ruby-debug-ide/
options[:user] = "skywinder"
options[:project] = "changelog_test"
else
remote = `git config --get remote.#{options[:git_remote]}.url`
options[:user], options[:project] = user_project_from_remote(remote)
end
end