Class: RepoHelper

Inherits:
Object
  • Object
show all
Defined in:
lib/kitchen/sharedtests/repo_helper.rb

Constant Summary collapse

URL_PATTERNS =
[
  /^(ssh:\/\/)[email protected]:(?<user>[^\/]+)\/(?<repo>.+)\.git$/,
  /^https:\/\/github.com\/(?<user>[^\/]+)\/(?<repo>.+)\.git$/,
  /^[email protected]:(?<user>[^\/]+)\/(?<repo>.+)\.git$/,
  /^(ssh:\/\/)[email protected]\/(?<user>[^\/]+)\/(?<repo>.+)\.git$/,
  /^https:\/\/([^@]+@)?bitbucket.org\/(?<user>[^\/]+)\/(?<repo>.+)\.git$/,
  /^(ssh:\/\/)?git@(?<host>[^:]*):(?<user>[^\/]+)\/(?<repo>.+)\.git$/
]

Class Method Summary collapse

Class Method Details

.get_repo(url) ⇒ Object



12
13
14
15
# File 'lib/kitchen/sharedtests/repo_helper.rb', line 12

def self.get_repo url
  # find the url pattern that matches the url
  URL_PATTERNS.map{|p| p.match url }.compact.first
end