Sha256: 5144d9e4fb6cb74af3078cc777bed552af1e1eb48ec071fa26b82c9c20872ca8

Contents?: true

Size: 776 Bytes

Versions: 4

Compression:

Stored size: 776 Bytes

Contents

require "rubygems"
require 'dep_analyzer'

class RakeAnalyzer < DepAnalyzer
  def run
    digraph do
      rotate
      boxes

      current = nil
      rake = Gem.bin_path('rake', 'rake') rescue 'rake'
      path = $:.join File::PATH_SEPARATOR

      content =
        if $stdin.tty? then
          `#{Gem.ruby} -I#{path} -S #{rake} -P -s`
        else
          $stdin.read
        end

      content.each_line do |line|
        case line
        when /^rake (.+)/
          name = $1
          current = name
          node current if current
        when /^\s+(.+)/
          dep = $1
          next if current =~ /pkg/ and File.file? dep
          edge current, dep if current
        else
          warn "unparsed: #{line.chomp}"
        end
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
graph-2.5.1 lib/rake_analyzer.rb
graph-2.5.0 lib/rake_analyzer.rb
graph-2.4.1 lib/rake_analyzer.rb
graph-2.4.0 lib/rake_analyzer.rb