Sha256: 2d4609a9bdac6ea342f44210628db8624e976cc5d48bc7a1173d3c858ad24bea

Contents?: true

Size: 645 Bytes

Versions: 1

Compression:

Stored size: 645 Bytes

Contents

require 'escape'

module EY
  class Repo

    def initialize(path=File.expand_path('.'))
      @path = path
    end

    def current_branch
      if File.directory?(File.join(@path, ".git"))
        head = File.read(File.join(@path, ".git/HEAD")).chomp
        if head.gsub!("ref: refs/heads/", "")
          head
        else
          nil
        end
      else
        nil
      end
    end

    def urls
      lines = `git config -f #{Escape.shell_command([@path])}/.git/config --get-regexp 'remote.*.url'`.split(/\n/)
      raise NoRemotesError.new(@path) if lines.empty?
      lines.map { |c| c.split.last }
    end

  end # Repo
end # EY

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
engineyard-1.3.1 lib/engineyard/repo.rb