class Git::URL
def self.clone_to(url, bare: false, mirror: false)
-
(String)
- the name of the repository directory
Parameters:
-
url
(String
) -- the Git URL containing the repository directory
def self.clone_to(url, bare: false, mirror: false) uri = parse(url) path_parts = uri.path.split('/') path_parts.pop if path_parts.last == '.git' directory = path_parts.last if bare || mirror directory += '.git' unless directory.end_with?('.git') elsif directory.end_with?('.git') directory = directory[0..-5] end directory end