Sha256: 63ae55dd3f4eda9f7289e7da711b1789432bc2ff28ac22dce62dc6f11e76d1fc

Contents?: true

Size: 656 Bytes

Versions: 172

Compression:

Stored size: 656 Bytes

Contents

require "danger/ci_source/support/repo_info"

module Danger
  class FindRepoInfoFromLogs
    def initialize(github_host, remote_logs)
      @github_host = github_host
      @remote_logs = remote_logs
    end

    def call
      matched = remote.match(regexp)

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

    private

    attr_reader :remote_logs, :github_host

    def remote
      remote_logs.lines.grep(/Fetch URL/)[0].split(": ".freeze, 2)[1]
    end

    def regexp
      %r{
        #{Regexp.escape(github_host)}
        (:|/|(:/))
        (?<repo_slug>[^/]+/.+?)
        (?:\.git)?$
      }x
    end
  end
end

Version data entries

172 entries across 172 versions & 2 rubygems

Version Path
danger-5.5.9 lib/danger/ci_source/support/find_repo_info_from_logs.rb
danger-5.5.8 lib/danger/ci_source/support/find_repo_info_from_logs.rb
danger-5.5.7 lib/danger/ci_source/support/find_repo_info_from_logs.rb
danger-5.5.6 lib/danger/ci_source/support/find_repo_info_from_logs.rb
danger-5.5.5 lib/danger/ci_source/support/find_repo_info_from_logs.rb
danger-5.5.4 lib/danger/ci_source/support/find_repo_info_from_logs.rb
danger-5.5.3 lib/danger/ci_source/support/find_repo_info_from_logs.rb
danger-5.5.2 lib/danger/ci_source/support/find_repo_info_from_logs.rb
danger-5.5.1 lib/danger/ci_source/support/find_repo_info_from_logs.rb
danger-5.5.0 lib/danger/ci_source/support/find_repo_info_from_logs.rb
danger-5.4.3 lib/danger/ci_source/support/find_repo_info_from_logs.rb
danger-5.4.2 lib/danger/ci_source/support/find_repo_info_from_logs.rb
danger-5.4.1 lib/danger/ci_source/support/find_repo_info_from_logs.rb
danger-5.4.0 lib/danger/ci_source/support/find_repo_info_from_logs.rb
danger-5.3.5 lib/danger/ci_source/support/find_repo_info_from_logs.rb
danger-5.3.4 lib/danger/ci_source/support/find_repo_info_from_logs.rb
danger-5.3.3 lib/danger/ci_source/support/find_repo_info_from_logs.rb
danger-5.3.2 lib/danger/ci_source/support/find_repo_info_from_logs.rb
danger-5.3.1 lib/danger/ci_source/support/find_repo_info_from_logs.rb
danger-5.3.0 lib/danger/ci_source/support/find_repo_info_from_logs.rb