Created
October 17, 2014 14:59
-
-
Save theirix/7034971c3c11dcfbde01 to your computer and use it in GitHub Desktop.
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
#!/usr/bin/env ruby | |
# | |
# Classify homebrew formulas by origins | |
def repo f | |
STDERR.print '.' | |
`brew info #{f}`.split("\n").map(&:chomp).each do |s| | |
if s =~ /^From: (.*)/ | |
return $1.gsub(/^https:\/\/github.com\/(.*)\/blob\/.*/, '\1') | |
end | |
end | |
return nil | |
end | |
puts 'Determine formula origins...' | |
`brew list`.split("\n").map(&:chomp).map { |f| [f, repo(f)] }.group_by { |f,r| r }.each do |r,fa| | |
puts "\n#{r ? r : 'none'}" | |
fa.each{|f,_| puts "\t"+f } | |
end | |
# vim: ft=ruby |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment