class Rugged::Repository

Constants

Ref

Public Class Methods

clone_at(url, path) click to toggle source
# File lib/lyp/git_based_rugged.rb, line 13
def self.clone_at(url, path)
  `git clone -q \"#{url}\" \"#{path}\"`
  new(path)
end
new(path) click to toggle source
# File lib/lyp/git_based_rugged.rb, line 18
def initialize(path)
  @path = path
  exec('status')
end

Public Instance Methods

checkout(ref, opts) click to toggle source
# File lib/lyp/git_based_rugged.rb, line 31
def checkout(ref, opts)
  # strategy: :force
  exec("checkout -qf #{ref}")
end
exec(cmd) click to toggle source
# File lib/lyp/git_based_rugged.rb, line 40
def exec(cmd)
  `cd #{@path} && git #{cmd}`
end
head() click to toggle source
# File lib/lyp/git_based_rugged.rb, line 25
def head
  h = exec("show-ref --head").lines.map {|r| r =~ /^(\S+)\sHEAD$/ && $1}[0]
  Ref.new(h)
end
tags() click to toggle source
# File lib/lyp/git_based_rugged.rb, line 36
def tags
  exec("tag").lines.map {|l| Ref.new(l.chomp)}
end