Sha256: 7352a4610b366c4456f8c0c9643751f6e910e7a38189f7402338d8111f7ba297

Contents?: true

Size: 662 Bytes

Versions: 1

Compression:

Stored size: 662 Bytes

Contents

require 'dep_analyzer'

class RakeAnalyzer < DepAnalyzer
  def run
    require 'graph'
    g = Graph.new
    g.rotate

    current = nil
    `rake -P -s`.each_line do |line|
      case line
      when /^rake (.+)/
        name = $1
        # current = (name =~ /pkg/) ? nil : name
        current = name
        g[current] if current # force the node to exist, in case of a leaf
      when /^\s+(.+)/
        dep = $1
        next if current =~ /pkg/ and File.file? dep
        g[current] << dep if current
      else
        warn "unparsed: #{line.chomp}"
      end
    end


    g.boxes
    g.save "#{self.class}"
    system "open #{self.class}.png"
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
graph-1.2.0 lib/rake_analyzer.rb