lib/travis/cli/repo_command.rb in travis-1.8.1.travis.713.4 vs lib/travis/cli/repo_command.rb in travis-1.8.1.travis.717.4

- old
+ new

@@ -1,8 +1,7 @@ require 'travis/cli' require 'yaml' -require "addressable/uri" module Travis module CLI class RepoCommand < ApiCommand GIT_REGEX = %r{/?(.*/.+?)(\.git)?$} @@ -66,11 +65,11 @@ git_head = `git name-rev --name-only HEAD 2>#{IO::NULL}`.chomp git_remote = `git config --get branch.#{git_head}.remote 2>#{IO::NULL}`.chomp git_remote = 'origin' if git_remote.empty? git_info = `git ls-remote --get-url #{git_remote} 2>#{IO::NULL}`.chomp - if Addressable::URI.parse(git_info).path =~ GIT_REGEX + if parse_remote(git_info) =~ GIT_REGEX detectected_slug = $1 if interactive? if agree("Detected repository as #{color(detectected_slug, :info)}, is this correct? ") { |q| q.default = 'yes' } detectected_slug else @@ -78,9 +77,19 @@ end else info "detected repository as #{color(detectected_slug, :bold)}" detectected_slug end + end + end + + def parse_remote(url) + if url =~ /^git@[^:]+:/ + path = url.split(':').last + path = "/#{path}" unless path.start_with?('/') + path + else + URI.parse(url).path end end def load_slug stored = `git config --get travis.slug`.chomp