Created
June 21, 2016 01:34
-
-
Save oreoshake/2e56d77834fabbd80ec1d7ee6f202f01 to your computer and use it in GitHub Desktop.
Seeing which GitHub projects can be monitored by Gemnasium
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' | |
require 'parallel' | |
DEPENDENCY_FILES = %w( | |
Gemfile | |
Gemfile.lock | |
package.json | |
bower.json | |
composer.json | |
requirements.txt | |
) | |
octokit = Octokit::Client.new(:access_token => ENV['GITHUB_AUTH_TOKEN']) | |
repos = octokit.organization_repositories("github") | |
puts "checking #{repos.count} repositories for dependency files" | |
projects_with_dependencies = Parallel.map(repos, in_threads: 64) do |repo| | |
file = DEPENDENCY_FILES.find {|path| octokit.contents(repo.full_name, :path => path)} | |
"#{repo.full_name}\n#{" - #{file}"}" if file | |
end.compact | |
puts "#{projects_with_dependencies.count} projects supported by gemnasium" | |
puts projects_with_dependencies.join("\n") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment