Skip to content

Instantly share code, notes, and snippets.

@oreoshake
Created June 21, 2016 01:34
Show Gist options
  • Save oreoshake/2e56d77834fabbd80ec1d7ee6f202f01 to your computer and use it in GitHub Desktop.
Save oreoshake/2e56d77834fabbd80ec1d7ee6f202f01 to your computer and use it in GitHub Desktop.
Seeing which GitHub projects can be monitored by Gemnasium
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