Class: EY::Repo

Inherits:
Object show all
Defined in:
lib/engineyard/repo.rb

Instance Method Summary collapse

Constructor Details

#initialize(path = File.expand_path('.')) ⇒ Repo

Returns a new instance of Repo.



4
5
6
# File 'lib/engineyard/repo.rb', line 4

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

Instance Method Details

#current_branchObject



8
9
10
11
12
13
14
15
# File 'lib/engineyard/repo.rb', line 8

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

#urlsObject



17
18
19
20
21
# File 'lib/engineyard/repo.rb', line 17

def urls
  `git config -f #{@path}/.git/config --get-regexp 'remote.*.url'`.split(/\n/).map do |c|
    c.split.last
  end
end