From 4f78e0bf24db6fff5f844a708f4d714a5869455a Mon Sep 17 00:00:00 2001 From: Katie McLaughlin Date: Fri, 3 Oct 2014 12:08:29 +1000 Subject: [PATCH] Use octokit's auto pagination https://github.com/octokit/octokit.rb#auto-pagination --- lib/github-release.rb | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/lib/github-release.rb b/lib/github-release.rb index b0fd8d8..275da58 100644 --- a/lib/github-release.rb +++ b/lib/github-release.rb @@ -17,6 +17,8 @@ def run private def api @api ||= Octokit::Client.new(:access_token => token) + @api.auto_paginate = true + @api end def token @@ -91,20 +93,10 @@ def remote_name end def github_releases - @github_releases ||= api_repo_rels[:releases].get.data.map(&:tag_name) + @github_releases ||= api.releases(repo_name).map(&:tag_name) log_val(@github_releases) end - def api_repo - @api_repo ||= api.repo(repo_name) - log_val(@api_repo) - end - - def api_repo_rels - @api_repo_rels ||= api_repo.rels - log_val(@api_repo_rels) - end - def git_config(item, default = nil) @config_cache ||= {}