class Rigit::Git

A utility class that handles all git operations.

Public Class Methods

clone(repo, target_path) click to toggle source

Clones a git repo.

# File lib/rigit/git.rb, line 5
def self.clone(repo, target_path)
  execute %Q[git clone #{repo} "#{target_path}"]
end
pull(target_path) click to toggle source

Pulls a git repo.

# File lib/rigit/git.rb, line 10
def self.pull(target_path)
  Dir.chdir target_path do
    execute %Q[git pull]
  end
end

Private Class Methods

execute(command) click to toggle source
# File lib/rigit/git.rb, line 18
def self.execute(command)
  if ENV['SIMULATE_GIT']
    puts "Simulated Execute: #{command}"
    true
  else
    system command
    $?&.exitstatus == 0
  end
end