class Travis::CLI::RepoCommand
def detect_slug
def detect_slug 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 detectected_slug = $1 if interactive? if agree("Detected repository as #{color(detectected_slug, :info)}, is this correct? ") { |q| q.default = 'yes' } detectected_slug else ask("Repository slug (owner/name): ") { |q| q.default = detectected_slug } end else info "detected repository as #{color(detectected_slug, :bold)}" detectected_slug end end end