Class: Gpr::Commands::Get
Constant Summary
Constants included from Gpr
Instance Method Summary collapse
-
#initialize(thor) ⇒ Get
constructor
A new instance of Get.
Methods inherited from Base
Constructor Details
#initialize(thor) ⇒ Get
Returns a new instance of Get.
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/gpr/commands/get.rb', line 8 def initialize(thor) thor.class_eval do desc 'get', 'Get a repository' def get(param) host, user, repository = param.match(/.+(\/\/|@)(.+)\.git$/)[2].split(/(:|\/)/).delete_if.with_index { |_c, index| index.odd? } path = "#{::Gpr::APP_PATH}/#{host}/#{user}/#{repository}" if Dir.exist?(path) puts "#{'Warning'.color(:red).style(:underscore)}: #{user}/#{repository} already registered" return end `git clone #{param} #{path}` end end end |