Class: Dotpack::Cli::Repo
- Inherits:
-
Thor
- Object
- Thor
- Dotpack::Cli::Repo
- Defined in:
- lib/dotpack/cli/repo.rb
Instance Method Summary collapse
Instance Method Details
#clone(arg) ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/dotpack/cli/repo.rb', line 13 def clone(arg) 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 ⇒ Object
8 9 10 |
# File 'lib/dotpack/cli/repo.rb', line 8 def list ::Dotpack::Repo.all.each{|r| puts r.name} end |
#remove(*args) ⇒ Object
29 30 31 32 33 34 35 |
# File 'lib/dotpack/cli/repo.rb', line 29 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 |