Sha256: eefcbfe933c8f93352f6aa35780b480db5617fffa669b1b8f2ae7cd0e32e8d04
Contents?: true
Size: 1.26 KB
Versions: 1
Compression:
Stored size: 1.26 KB
Contents
require 'build/files/monitor' require 'build/error' require 'build/node' require 'build/walker' require 'build/edge' module Build class Graph < Files::Monitor def initialize super @nodes = {} build_graph! end attr :nodes # You need to override this to traverse the top nodes as required: def traverse!(walker) #Array(top).each do |node| # node.update!(walker) #end end def walk(&block) Walker.new(self, &block) end def build_graph! # We build the graph without doing any actual execution: nodes = [] walker = walk do |walker, node| nodes << node yield walker, node end traverse! walker # We should update the status of all nodes in the graph once we've traversed the graph. nodes.each do |node| node.update_status! end end def update_with_log puts Rainbow("*** Graph update traversal ***").green start_time = Time.now walker = update! ensure end_time = Time.now elapsed_time = end_time - start_time $stdout.flush $stderr.puts Rainbow("Graph Update Time: %0.3fs" % elapsed_time).magenta end def update! walker = walk do |walker, node| yield walker, node end traverse! walker return walker end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
build-graph-0.1.0 | lib/build/graph.rb |