Sha256: 14e4512e00ccb60bd58df44f70d99504b057e1e7d566650c564225beaf09b7cd

Contents?: true

Size: 1.32 KB

Versions: 15

Compression:

Stored size: 1.32 KB

Contents

#!/usr/bin/env ruby

require 'rbbt/workflow'

require 'rbbt-util'
require 'fileutils'
require 'rbbt/util/simpleopt'
require 'rbbt/workflow/step'
require 'rbbt/util/misc'

file = ARGV.shift

$seen = []
def get_step(file)
  file = file.sub(/\.(info|files)/,'')
  $seen << file
  Step.new file
end

def status_msg(status)
  color = case status
          when :error, :aborted, :missing
            :red
          when :streaming
            :yellow
          when :done
            :green
          else
            nil
          end
  Log.color(color, status)
end

def report_msg(status, name, path)

  parts = path.sub(/#{Regexp.quote(name)}$/,'').split "/"

  task = Log.color(:yellow, parts.pop)
  workflow = Log.color(:magenta, parts.pop)

  status_msg(status) << " " << [workflow, task, path] * " " << "\n"
end

def report(step, offset = 0)
  info = step.info || {}
  path  = step.path
  status = info[:status] || :missing
  name = info[:name] || File.basename(path)
  str = " " * offset
  str << report_msg(status, name, path)
  info[:dependencies].each do |task,name,path|
    new = ! $seen.include?(path)
    dep = get_step path
    if new
      str << report(dep, offset + 1)
    else
      str << Log.color(:blue, Log.uncolor(report(dep, offset+1)))
    end
  end if info[:dependencies]
  str
end

step = get_step file

puts report(step).strip

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
rbbt-util-5.13.20 share/rbbt_commands/workflow/prov
rbbt-util-5.13.19 share/rbbt_commands/workflow/prov
rbbt-util-5.13.18 share/rbbt_commands/workflow/prov
rbbt-util-5.13.17 share/rbbt_commands/workflow/prov
rbbt-util-5.13.16 share/rbbt_commands/workflow/prov
rbbt-util-5.13.15 share/rbbt_commands/workflow/prov
rbbt-util-5.13.14 share/rbbt_commands/workflow/prov
rbbt-util-5.13.13 share/rbbt_commands/workflow/prov
rbbt-util-5.13.12 share/rbbt_commands/workflow/prov
rbbt-util-5.13.11 share/rbbt_commands/workflow/prov
rbbt-util-5.13.10 share/rbbt_commands/workflow/prov
rbbt-util-5.13.9 share/rbbt_commands/workflow/prov
rbbt-util-5.13.8 share/rbbt_commands/workflow/prov
rbbt-util-5.13.7 share/rbbt_commands/workflow/prov
rbbt-util-5.13.6 share/rbbt_commands/workflow/prov