Skip to content

Commit

Permalink
Expose remote_host and remote_path as class methods on the :push meta.
Browse files Browse the repository at this point in the history
  • Loading branch information
benhoskings committed Nov 15, 2011
1 parent 73adb15 commit a2b097c
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions push.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,14 @@
def repo
@repo ||= Babushka::GitRepo.new('.')
end
def self.remote_host_and_path remote
@remote_host_and_path ||= shell("git config remote.#{remote}.url").split(':', 2)
end
def self.remote_host(remote) remote_host_and_path(remote).first end
def self.remote_path(remote) remote_host_and_path(remote).last end
def self.remote_head remote
host, path = shell("git config remote.#{remote}.url").split(':', 2)
@remote_head ||= shell!("ssh #{host} 'cd #{path} && git rev-parse --short HEAD 2>/dev/null || echo 0000000'")
host, path = remote_host_and_path(remote)
@remote_head ||= shell!("ssh #{remote_host} 'cd #{remote_path} && git rev-parse --short HEAD 2>/dev/null || echo 0000000'")
end
def remote_head
self.class.remote_head(remote)
Expand Down

0 comments on commit a2b097c

Please sign in to comment.