class Pa::Client

Public Class Methods

branches(repo) click to toggle source
# File lib/pa/client.rb, line 4
def branches(repo)
  client.branches repo
end
commits(repo, branch, per_page = 5) click to toggle source
# File lib/pa/client.rb, line 8
def commits(repo, branch, per_page = 5)
  client.commits(repo, branch, per_page: per_page).each_with_object({}) do |commit, res|
    res[commit.sha] = { message: commit.commit.message,
                        author: commit.commit.author.name,
                        date: commit.commit.committer.date.in_time_zone(App.config.timezone) }
  end
end
puts(commits) click to toggle source
# File lib/pa/client.rb, line 16
def puts(commits)
  tp commits.values.reject { |h| h[:message].start_with? 'Merge' }
            .sort_by { |h| h[:date] }.reverse[0..5],
     { message: { width: 60 } }, :author, :date
end

Private Class Methods

client() click to toggle source
# File lib/pa/client.rb, line 24
def client
  @client ||= Octokit::Client.new(access_token: App.config.token)
end