class RepoTools::Puller

Attributes

ssh_clone_url[R]

Public Class Methods

new(args) click to toggle source
# File lib/repo_tools/puller.rb, line 5
def initialize(args)
  @ssh_clone_url = args.fetch(:ssh_clone_url)
  @destination_dirname = args.fetch(:destination_dirname)
end

Public Instance Methods

clean_and_clone() click to toggle source
# File lib/repo_tools/puller.rb, line 10
def clean_and_clone
  return if git_status_checker.up_to_date?
  FileUtils.rm_rf destination_dirname
  clone
end
clone() click to toggle source
# File lib/repo_tools/puller.rb, line 20
def clone
  `git clone #{ssh_clone_url} #{destination_dirname}`
end
destination_dirname() click to toggle source
# File lib/repo_tools/puller.rb, line 24
def destination_dirname
  p = Pathname.new(@destination_dirname)
  FileUtils.mkdir_p(p.dirname)
  p
end
git_status_checker() click to toggle source
# File lib/repo_tools/puller.rb, line 16
def git_status_checker
  GitStatusChecker.new(destination_dirname)
end
project_name() click to toggle source
# File lib/repo_tools/puller.rb, line 30
def project_name
  ssh_clone_url.match(/\/((\w|\-)+)/)[1]
end