class RailGrinder::Repository

Represent a git repository. Handle cloning a repo into a project, and once it's there, performing commits and pushes.

Public Class Methods

new(url, repo_dir) click to toggle source
# File lib/rail_grinder/repository.rb, line 20
def initialize(url, repo_dir)
  unless url
    raise "Please provide the url to a git repository.\n eg. $ rg.rb add git@gitlab.com:lycoperdon/foo.git"
  end
  @url = url
  @path = "#{repo_dir}/#{RailGrinder.inferred_name(@url)}"

  system "git clone #{@url} #{@path}"
  # Make sure the clone call went Ok
  if $CHILD_STATUS.signaled?
    puts "!! child died with signal %d, %s coredump" % [$CHILD_STATUS.termsig, $CHILD_STATUS.coredump? ? 'with' : 'without']
  elsif $CHILD_STATUS.exitstatus != 0
    puts "!! child exited with value %d\n" % [$CHILD_STATUS.exitstatus]
  end
end