Sha256: 611caa9fc98c210a596d5acaef412ef17e6a37d6d7a6a08b7ef140963701a2b8

Contents?: true

Size: 807 Bytes

Versions: 3

Compression:

Stored size: 807 Bytes

Contents

require 'octokit'
require 'eldritch'

Octokit.auto_paginate = true

module PairingMatrix
  class GithubCommitReader < CommitReader
    def initialize(config)
      super(config)
      @github_client = github_client
    end

    def read(since)
      commits = []
      together do
        @config.github_repos.map do |repo|
          async do
            commits << fetch_commits(repo, since)
          end
        end
      end
      commits.flatten
    end

    private
    def fetch_commits(repo, since)
      @github_client.commits_since(repo, since).map { |commit| commit.commit.message }
    end

    def github_client
      if @config.has_github_access_token?
        Octokit::Client.new(:access_token => @config.github_access_token)
      else
        Octokit::Client.new
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
pairing_matrix-2.0 lib/pairing_matrix/github_commit_reader.rb
pairing_matrix-1.2 lib/pairing_matrix/github_commit_reader.rb
pairing_matrix-1.1.1 lib/pairing_matrix/github_commit_reader.rb