Sha256: 92c1f1079d647b6403d16b2a6bb2bd345f11036168959aa770a6aea6e36eafc5

Contents?: true

Size: 782 Bytes

Versions: 17

Compression:

Stored size: 782 Bytes

Contents

# -*- ruby -*-

begin
  require 'rgl/dot'
  require 'rgl/implicit'
rescue Exception
  nil
end

# Example usage:
#
#  rake -R/home/hd/src/rgl/rakelib -f /usr/lib/ruby/gems/1.8/gems/rails-1.0.0/Rakefile dep_graph
desc "Generate dependency graph of rake tasks"
task :dep_graph do |task|
  this_task = task.name

  dep = RGL::ImplicitGraph.new do |g|
    # vertices of the graph are all defined tasks without this task
    g.vertex_iterator do |b|
      Rake::Task.tasks.each do |t|
        b.call(t) unless t.name == this_task
      end
    end
    # neighbors of task t are its prerequisites
    g.adjacent_iterator { |t, b| t.prerequisites.each(&b) }
    g.directed = true
  end

  dep.write_to_graphic_file('png', this_task)
  puts "Wrote dependency graph to #{this_task}.png."
end

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
rgl-0.6.6 rakelib/dep_graph.rake
rgl-0.6.5 rakelib/dep_graph.rake
rgl-0.6.4 rakelib/dep_graph.rake
rgl-0.6.3 rakelib/dep_graph.rake
rgl-0.6.2 rakelib/dep_graph.rake
rgl-0.6.1 rakelib/dep_graph.rake
rgl-0.6.0 rakelib/dep_graph.rake
rgl-0.5.10 rakelib/dep_graph.rake
rgl-0.5.9 rakelib/dep_graph.rake
rgl-0.5.8 rakelib/dep_graph.rake
rgl-0.5.7 rakelib/dep_graph.rake
rgl-0.5.6 rakelib/dep_graph.rake
rgl-0.5.4 rakelib/dep_graph.rake
rgl-0.5.3 rakelib/dep_graph.rake
rgl-0.5.2 rakelib/dep_graph.rake
rgl-0.5.1 rakelib/dep_graph.rake
rgl-0.5.0 rakelib/dep_graph.rake