Created
December 11, 2013 14:55
-
-
Save mvidner/7911768 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 | |
# Usage: rake -P | rake-prereqs-dot | dotty - | |
# Convert the output of `rake -P/--prereqs` | |
# ("Display the tasks and dependencies, then exit.") | |
# to a graphviz graph | |
# Sample input | |
# -8<- | |
# rake check:osc | |
# rake check:syntax | |
# rake console | |
# rake osc:build | |
# check:osc | |
# package | |
# rake osc:commit | |
# osc:build | |
# rake osc:sr | |
# osc:commit | |
# rake package | |
# check:syntax | |
# tarball | |
# rake tarball | |
# -8<- | |
puts "digraph g {" | |
task = "?" | |
ARGF.each_line do |line| | |
line.chomp! | |
if line =~ /^rake (.*)/ | |
task = $1 | |
puts "\"#{task}\";" | |
else | |
puts "\"#{task}\" -> \"#{line.strip}\";" | |
end | |
end | |
puts "}" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment