Module: Avm::Git::Vendor::Github

Defined in:
lib/avm/git/vendor/github.rb

Class Method Summary collapse

Class Method Details

.to_ssh_url(url) ⇒ Object



8
9
10
11
12
13
14
15
# File 'lib/avm/git/vendor/github.rb', line 8

def to_ssh_url(url)
  return nil if url.blank?

  url_no_dot_git = url.gsub(/\.git\z/, '')

  m = %r{\Ahttps://github.com/([^/]+)/([^/]+)\z}.match(url_no_dot_git.to_s)
  m ? "[email protected]:#{m[1]}/#{m[2]}.git" : url
end