Created
May 14, 2025 16:43
-
-
Save reasonset/f6adf5cadc4bb7fa2832c63a75e267bc to your computer and use it in GitHub Desktop.
This file contains hidden or 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/ruby | |
require 'set' | |
lib = Set.new | |
ARGV.each do |dir| | |
Dir.glob("#{dir}/**/*.rb").each do |rb| | |
File.foreach(rb) do |line| | |
if line =~ /^\s*require\s+["'](.*?)["']\s*$/ | |
lib_str = $1 | |
break if lib_str[0, 8] == "bundler/" # Skip file using bundler. | |
lib.add lib_str | |
end | |
end | |
end | |
end | |
lib.each do |l| | |
begin | |
require l | |
rescue | |
puts l | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment