Last active
August 29, 2015 14:10
-
-
Save jennifersmith/3f22988c52ee46ce10c1 to your computer and use it in GitHub Desktop.
Convert requires into a graph - this is pretty dreadful please can someone do better?
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
egrep -e "require\s\"([a-z]|_|/)+\"" -o -r lib | ./sniffrequires.rb | dot -Tsvg > /tmp/foo.svg; open /tmp/foo.svg |
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/ruby | |
puts "digraph {" | |
$stdin.each do | line | | |
/lib\/(?<from>(\w|\/)+)(\.rb)?:require \"(?<to>(\w|\/)+)/i =~ line | |
puts "\t #{from.gsub("/", "_")} -> #{to.gsub("/", "_")}" | |
end | |
puts "}" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
To be fair, the parser version is possibly worse :D
https://github.com/jennifersmith/rubygraph