Created
November 11, 2017 21:22
-
-
Save jamesridgway/b9c3018176d986fefd01699af694f4e8 to your computer and use it in GitHub Desktop.
List language and byte count statistics for all GitHub repositories
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' | |
client = Octokit::Client.new(:access_token => ENV['GITHUB_ACCESS_TOKEN']) | |
repos = client.repos({}, query: {type: 'owner', sort: 'asc'}).select { |repo| !repo.fork } | |
language_stats = {} | |
repos.each do |repo| | |
repo_id = "#{repo.owner.login}/#{repo.name}" | |
repo_languages = client.languages(repo_id).to_h | |
language_stats.merge!(repo_languages){ |k, a_value, b_value| a_value + b_value } | |
end | |
language_stats.each do |language, bytes| | |
puts "#{language}: #{bytes}" | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment