Class: MonoGitHub

Inherits:
Object
  • Object
show all
Defined in:
lib/mono/base.rb

Overview

todo/fix: ALWAYS assert name format

(rename to mononame and monopath) - why? why not?

Class Method Summary collapse

Class Method Details

.clone(name, depth: nil) ⇒ Object



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/mono/base.rb', line 9

def self.clone( name, depth: nil )
  ## lets you use:
  ##   @rubycoco/gitti  or
  ##   gitti@rubycoco
  ##  =>  rubycoco/gitti
  mononame  = Mononame.parse( name )
  path      = mononame.real_path

  org_path = File.dirname( path )
  FileUtils.mkdir_p( org_path ) unless Dir.exist?( org_path )   ## make sure path exists

  ### note: use a github clone url (using ssh) like:
  ##     [email protected]:rubycoco/gitti.git
  ssh_clone_url = "[email protected]:#{mononame.to_path}.git"

  Dir.chdir( org_path ) do
    Gitti::Git.clone( ssh_clone_url, depth: depth )
  end
end