Sha256: 9ded4fa8cc9d5a31ae780b82833939148f47e23ec35ae36bc400d275ec123168

Contents?: true

Size: 801 Bytes

Versions: 5

Compression:

Stored size: 801 Bytes

Contents

namespace :state_shifter do
  desc 'Draws state machines using GraphViz (options: CLASS=User,Vehicle; FONT=Arial; FORMAT=png; ORIENTATION=portrait; OUTPUT_FILENAME=filename)'
  task :draw do

    unless ENV['CLASS']
      puts 'you need to specify at least one CLASS'
      exit 1
    end

    options = {}

    options[:format]          = ENV['FORMAT'] || 'png'
    options[:output_filename] = ENV['OUTPUT_FILENAME'] || "#{ENV['CLASS']}.#{options[:format]}"
    options[:font]            = ENV['FONT'] || 'Arial'
    options[:orientation]     = ENV['ORIENTATION'] || 'portrait'

    if defined?(Rails)
      Rake::Task['environment'].invoke
    else
      $:.unshift(File.dirname(__FILE__) + '/..')
      require 'state_shifter'
    end

    StateShifter::Draw.graph(ENV['CLASS'], options)
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
state_shifter-1.1.3 lib/tasks/state_shifter.rake
state_shifter-1.1.2 lib/tasks/state_shifter.rake
state_shifter-1.0.7 lib/tasks/state_shifter.rake
state_shifter-1.0.5 lib/tasks/state_shifter.rake
state_shifter-1.0.3 lib/tasks/state_shifter.rake