Skip to content

Instantly share code, notes, and snippets.

@toroidal-code
Forked from nickmccurdy/license_finder.rb
Last active December 20, 2015 00:38
Show Gist options
  • Save toroidal-code/6042795 to your computer and use it in GitHub Desktop.
Save toroidal-code/6042795 to your computer and use it in GitHub Desktop.
require 'octokit'
require 'colorize'
print 'GitHub username: '
username = $stdin.gets.strip
repos = Octokit.repos(username, {type: 'public'}).map { |repo| repo['full_name'] }
puts 'Searching for license files...'
repos.each do |repo|
print repo, '... '
files = Octokit.contents repo
licensed = files.any? { |f| f['name'] == 'LICENSE.txt' || f['name'] == 'LICENSE' }
puts licensed ? 'yes'.green : 'no'.red
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment