Last active
December 18, 2015 19:49
-
-
Save komasaru/5835990 to your computer and use it in GitHub Desktop.
Ruby script to get github repositories by octokit.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'octokit' | |
# API 呼び出し回数 | |
ratelimit = Octokit.ratelimit | |
ratelimit_remaining = Octokit.ratelimit_remaining | |
puts "Rate Limit Remaining: #{ratelimit_remaining} / #{ratelimit}" | |
puts | |
# インスタンス化 | |
# ==== 認証無しの場合 | |
repos = Octokit.repositories("komasaru", {sort: :pushed_at}) | |
# ==== OAuth 認証の場合 | |
#cl = Octokit::Client.new(login: "komasaru", oauth_token: "token_string") | |
#repos = cl.repositories("komasaru", {sort: :pushed_at}) | |
# 値取得 | |
repos.each do |repo| | |
puts "[ #{repo.name} ]" | |
puts "\tOwner : #{repo.owner.login}" | |
puts "\tFull Name : #{repo.full_name}" | |
puts "\tDescription : #{repo.description}" | |
puts "\tPrivate : #{repo.private}" | |
puts "\tLanguage : #{repo.language}" | |
puts "\tURL : #{repo.html_url}" | |
puts "\tCreated at : #{repo.created_at}" | |
puts "\tUpdated at : #{repo.updated_at}" | |
puts "\tPushed at : #{repo.pushed_at}" | |
puts | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment