Class: Vpr::GitParser
- Inherits:
-
Object
- Object
- Vpr::GitParser
- Defined in:
- lib/vpr/git_parser.rb
Constant Summary collapse
- REGEXP =
%r{ (?<protocol>(http://|https://|git://|ssh://))* (?<username>[^@]+@)* (?<host>[^/]+) [/:] (?<owner>[^/]+) / (?<repo>[^\/]+[^(.git)]) }x.freeze
Class Method Summary collapse
Class Method Details
.current_branch ⇒ Object
24 25 26 27 |
# File 'lib/vpr/git_parser.rb', line 24 def current_branch git = Git.open(git_dir) git.current_branch end |
.host ⇒ Object
29 30 31 32 33 34 |
# File 'lib/vpr/git_parser.rb', line 29 def host remote_uri = remotes[Configuration.remote] matched = remote_uri.match(REGEXP) matched[:host] end |
.repo_url ⇒ Object
17 18 19 20 21 22 |
# File 'lib/vpr/git_parser.rb', line 17 def repo_url remote_uri = remotes[Configuration.remote] matched = remote_uri.match(REGEXP) File.join("https://#{matched[:host]}", matched[:owner], matched[:repo]) end |