fix arg is nil

This commit is contained in:
Petr Korolev 2015-05-25 15:39:24 +03:00
parent 8f4a931256
commit d2cd79e710

View File

@ -149,12 +149,13 @@ module GitHubChangelogGenerator
# #
# @param [String] output of git remote command # @param [String] output of git remote command
# @return [Array] user and project # @return [Array] user and project
def self.user_project_from_option(arg0, arg2, github_site = "github.com") def self.user_project_from_option(arg0, arg1, github_site = nil)
user = nil user = nil
project = nil project = nil
github_site ||= "github.com"
if arg0 && !arg2 if arg0 && !arg1
# this match should parse strings such "https://github.com/skywinder/Github-Changelog-Generator" or "skywinder/Github-Changelog-Generator" to user and name # this match should parse strings such "https://github.com/skywinder/Github-Changelog-Generator" or "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