Created
March 30, 2011 11:19
-
-
Save h-lame/894223 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
require 'rubygems' | |
fetcher = Gem::SpecFetcher.fetcher | |
my_dep = 'activesupport' | |
# 1st arg = all (true to get all versions, false to get latest) | |
# 2nd arg = prerelase (true to get pre-release gems, false to get stable) | |
all_gems = fetcher.list(false, false) | |
my_deps = [] | |
all_gems.each do |uri, gems| | |
gems.each do |gem| | |
begin | |
spec = fetcher.fetch_spec gem, uri | |
my_deps << [gem, uri] if (spec.runtime_dependencies + spec.dependencies).any? {|d| d.name == my_dep} | |
ensure | |
# urr something borked with this gemspec | |
end | |
end | |
end | |
require 'rubygems/commands/query_command' | |
Gem::Commands::QueryCommand.new.send(:output_query_results, my_deps) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment