class Pipely::Tasks::Graph

Attributes

definition[RW]

Pipeline definition instance

name[RW]

Name of task.

default:

:graph
path[RW]

Path to write graph images to.

default:

"graphs"
verbose[RW]

Use verbose output. If this is set to true, the task will print the local and remote paths of each step file it uploads to S3.

default:

true

Public Class Methods

new(*args, &task_block) click to toggle source
# File lib/pipely/tasks/graph.rb, line 32
def initialize(*args, &task_block)
  setup_ivars(args)

  # create the `path` directory if it doesn't exist
  directory path

  namespace name do
    task :full => path do |_, task_args|
      RakeFileUtils.send(:verbose, verbose) do
        if task_block
          task_block.call(*[self, task_args].slice(0, task_block.arity))
        end

        run_task verbose
      end
    end

    task :open => :full do
      `open #{target_filename}`
    end
  end

  desc "Graphs the full pipeline definition using Graphviz"
  task name => "#{name}:full"
end

Public Instance Methods

run_task(verbose) click to toggle source
# File lib/pipely/tasks/graph.rb, line 64
def run_task(verbose)
  puts "Generating #{target_filename}" if verbose
  Pipely.draw(definition.to_json, target_filename)
end
setup_ivars(args) click to toggle source
# File lib/pipely/tasks/graph.rb, line 58
def setup_ivars(args)
  @name = args.shift || :graph
  @verbose = true
  @path = "graphs"
end
target_filename() click to toggle source
# File lib/pipely/tasks/graph.rb, line 69
def target_filename
  "#{path}/#{definition.base_filename}.png"
end