Sha256: 9b2f56977856936b4db1c0fe8829824be2d020604f48d83e554789feb4285582
Contents?: true
Size: 1.75 KB
Versions: 18
Compression:
Stored size: 1.75 KB
Contents
module Integrity module SCM class Git # From the git-pull man page: # # GIT URLS # One of the following notations can be used to name the remote repository: # # rsync://host.xz/path/to/repo.git/ # http://host.xz/path/to/repo.git/ # git://host.xz/~user/path/to/repo.git/ # ssh://[user@]host.xz[:port]/path/to/repo.git/ # ssh://[user@]host.xz/path/to/repo.git/ # ssh://[user@]host.xz/~user/path/to/repo.git/ # ssh://[user@]host.xz/~/path/to/repo.git # # SSH is the default transport protocol over the network. You can optionally # specify which user to log-in as, and an alternate, scp-like syntax is also # supported # # Both syntaxes support username expansion, as does the native git protocol, # but only the former supports port specification. The following three are # identical to the last three above, respectively: # # [user@]host.xz:/path/to/repo.git/ # [user@]host.xz:~user/path/to/repo.git/ # [user@]host.xz:path/to/repo.git # class URI def initialize(uri_string) @uri = Addressable::URI.parse(uri_string) end def working_tree_path strip_extension(path).gsub("/", "-") end private def strip_extension(string) uri = Pathname.new(string) if uri.extname.any? uri = Pathname.new(string) string.gsub(Regexp.new("#{uri.extname}\/?"), "") else string end end def path path = @uri.path path.gsub(/\~[a-zA-Z0-9]*\//, "").gsub(/^\//, "") end end end end end
Version data entries
18 entries across 18 versions & 7 rubygems