class Danger::FindRepoInfoFromURL

Constants

REGEXP
REGEXPBB

Regex used to extract info from Bitbucket server URLs, as they use a quite different format

Attributes

url[R]

Public Class Methods

new(url) click to toggle source
# File lib/danger/ci_source/support/find_repo_info_from_url.rb, line 22
def initialize(url)
  @url = url
end

Public Instance Methods

call() click to toggle source
# File lib/danger/ci_source/support/find_repo_info_from_url.rb, line 26
def call
  matched = url.match(REGEXPBB)

  if matched
    RepoInfo.new("#{matched[1]}/#{matched[2]}", matched[3])
  else
    matched = url.match(REGEXP)
    if matched
      RepoInfo.new(matched[:slug], matched[:id])
    end
  end
end