Class: EY::Repo
Instance Method Summary collapse
- #current_branch ⇒ Object
-
#initialize(path = File.expand_path('.')) ⇒ Repo
constructor
A new instance of Repo.
- #urls ⇒ Object
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.('.')) @path = path end |
Instance Method Details
#current_branch ⇒ Object
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 |
#urls ⇒ Object
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 |