class Danger::FindRepoInfoFromLogs

Attributes

github_host[R]
remote_logs[R]

Public Class Methods

new(github_host, remote_logs) click to toggle source
# File lib/danger/ci_source/support/find_repo_info_from_logs.rb, line 5
def initialize(github_host, remote_logs)
  @github_host = github_host
  @remote_logs = remote_logs
end

Public Instance Methods

call() click to toggle source
# File lib/danger/ci_source/support/find_repo_info_from_logs.rb, line 10
def call
  matched = remote.match(regexp)

  if matched
    RepoInfo.new(matched["repo_slug"], nil)
  end
end

Private Instance Methods

regexp() click to toggle source
# File lib/danger/ci_source/support/find_repo_info_from_logs.rb, line 26
def regexp
  %r{
    #{Regexp.escape(github_host)}
    (:|/|(:/))
    (?<repo_slug>[^/]+/.+?)
    (?:\.git)?$
  }x
end
remote() click to toggle source
# File lib/danger/ci_source/support/find_repo_info_from_logs.rb, line 22
def remote
  remote_logs.lines.grep(/Fetch URL/)[0].split(": ".freeze, 2)[1]
end