Module: GitUrl
- Defined in:
- lib/git_url.rb
Constant Summary collapse
- SSH_REGEXP =
/\A(\w+@\w+(\.\w+)*):(.*)\z/
Class Method Summary collapse
Class Method Details
.normalize(url) ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 18 |
# File 'lib/git_url.rb', line 7 def normalize(url) if m = SSH_REGEXP.match(url) url = "ssh://#{m[1]}/#{m[3]}" end if url.start_with?("https://github.com/") && !url.end_with?(".git") url = url.gsub(%r{/\z}, "") url += ".git" end url end |