-
-
Save akitaonrails/424698 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
# | |
# Instructions: | |
# | |
# * Download Microsoft Journal Sample code February 1997: | |
# | |
# http://globalfilesearch.com/download.aspx?path=ringtail.its.monash.edu.au/pub/msj/newfiles/MSJFEB97.EXE | |
# | |
# * Extract depends.exe from 'Under the Hood' folder and place along this script. | |
# | |
# * call it with 'ruby detect.rb' | |
# | |
# NOTE: Some gems contains fat-binaries, look for 1.8/ext.so, that means it has both (1.8 and 1.9) | |
# | |
require 'rubygems' | |
pattern = /ruby18/ | |
# Iterate over all gems looking for path occurrences | |
Gem.source_index.each do |full_name, spec| | |
if spec.extensions.any? | |
reqs = spec.require_paths.join(',') | |
lookout = File.join(spec.installation_path, 'gems', full_name, "{#{reqs}}", "**", "*.so") | |
Dir.glob(lookout).each do |ext| | |
output = `depends #{ext.gsub(File::SEPARATOR, File::ALT_SEPARATOR)}` | |
if output =~ pattern | |
warn "Gem #{full_name} extension '#{File.basename(File.dirname(ext))}/#{File.basename(ext)}' depends on supplied pattern." | |
end | |
end | |
end | |
spec.files.select { |f| f =~ /\.so$/ }.each do |ext| | |
ext = File.join(spec.installation_path, 'gems', full_name, ext) | |
output = `depends #{ext.gsub(File::SEPARATOR, File::ALT_SEPARATOR)}` | |
if output =~ pattern | |
warn "Gem #{full_name} extension '#{File.basename(File.dirname(ext))}/#{File.basename(ext)}' depends on supplied pattern." | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment