class Hub::Context::Remote

Public Instance Methods

==(other) click to toggle source
Calls superclass method
# File lib/hub/context.rb, line 392
def ==(other)
  other.respond_to?(:to_str) ? name == other.to_str : super
end
github_url() click to toggle source
# File lib/hub/context.rb, line 405
def github_url
  urls.detect {|url| local_repo.known_host?(url.host) }
end
project() click to toggle source
# File lib/hub/context.rb, line 396
def project
  urls.each { |url|
    if valid = GithubProject.from_url(url, local_repo)
      return valid
    end
  }
  nil
end
uri_parse(uri) click to toggle source
# File lib/hub/context.rb, line 427
def uri_parse uri
  uri = URI.parse uri
  if uri.host != local_repo.default_host
    ssh = local_repo.ssh_config
    uri.host = ssh.get_value(uri.host, :HostName) { uri.host }
  end
  uri
end
urls() click to toggle source
# File lib/hub/context.rb, line 409
def urls
  @urls ||= raw_urls.map do |url|
    with_normalized_url(url) do |normalized|
      begin
        uri_parse(normalized)
      rescue URI::InvalidURIError
      end
    end
  end.compact
end
with_normalized_url(url) { |url| ... } click to toggle source
# File lib/hub/context.rb, line 420
def with_normalized_url(url)
  if url =~ %r{^[\w-]+://} || url =~ %r{^([^/]+?):}
    url = "ssh://#{$1}/#{$'}" if $1
    yield url
  end
end