Sha256: 142930722d7180fbe87aefd88e766e34dea33758007cf196c27c18576dd56f6a

Contents?: true

Size: 541 Bytes

Versions: 3

Compression:

Stored size: 541 Bytes

Contents

module Ghit
  class RepoLocator

    class << self
      def open page = nil
        new(page).open
      end
    end

    def initialize(page = nil)
      @remote = Ghit::RemoteExtracter.extract!
      @page   = page
    end

    def open
      %x(open #{build_url})
    end

    private

    def build_url
      if is_http_remote?
        HttpRemoteUrlBuilder.new(@remote, @page).build
      else
        SshRemoteUrlBuilder.new(@remote, @page).build 
      end
    end

    def is_http_remote?
      @remote =~ /https?/
    end
  end

end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
ghit-0.1.0 lib/ghit/repo_locator.rb
ghit-0.0.2 lib/ghit/repo_locator.rb
ghit-0.0.1 lib/ghit/repo_locator.rb