class Dotpack::Cli::Repo

Public Instance Methods

clone(arg) click to toggle source
# File lib/dotpack/cli/repo.rb, line 13
def clone(arg)
  # Cache
  Dotpack::Repo.all
  
  url = arg
  name = arg.split('/').last
  if name.include? ".git"
    name[".git"] = ''
  end
  if arg =~ /\A[a-zA-Z0-9_-]+\/[\.a-zA-Z0-9_-]+\z/
    url = "https://github.com/#{arg}.git"
    name = arg.sub('/', '__')
  end
  Dir.chdir Config::BASE_DIR + '/repositories'
  return if Dir.exist? name
  system("git", "clone", url, name)
end
list() click to toggle source
# File lib/dotpack/cli/repo.rb, line 8
def list
  ::Dotpack::Repo.all.each{|r| puts r.name}
end
remove(*args) click to toggle source
# File lib/dotpack/cli/repo.rb, line 32
def remove(*args)
  args.each do |repo|
    r = ::Dotpack::Repo.find_by_name repo
    next if r.nil?
    FileUtils.rm_rf r.path
  end
end