Sha256: 702e287325e0f0bf1a67cae55d323b47a11a15f4436d09de9544e81d7d30b813

Contents?: true

Size: 1.37 KB

Versions: 22

Compression:

Stored size: 1.37 KB

Contents

namespace :state_machine do
  desc 'Draws a set of state machines using GraphViz. Target files to load with FILE=x,y,z; Machine class with CLASS=x,y,z; Font name with FONT=x; Image format with FORMAT=x; Orientation with ORIENTATION=x'
  task :draw do
    # Load the library
    $:.unshift(File.dirname(__FILE__) + '/lib')
    require 'state_machine'
    
    # Build drawing options
    options = {}
    options[:file] = ENV['FILE'] if ENV['FILE']
    options[:path] = ENV['TARGET'] if ENV['TARGET']
    options[:format] = ENV['FORMAT'] if ENV['FORMAT']
    options[:font] = ENV['FONT'] if ENV['FONT']
    options[:orientation] = ENV['ORIENTATION'] if ENV['ORIENTATION']
    
    StateMachine::Machine.draw(ENV['CLASS'], options)
  end
  
  namespace :draw do
    desc 'Draws a set of state machines using GraphViz for a Ruby on Rails application.  Target class with CLASS=x,y,z; Font name with FONT=x; Image format with FORMAT=x; Orientation with ORIENTATION=x'
    task :rails => [:environment, 'state_machine:draw']
    
    desc 'Draws a set of state machines using GraphViz for a Merb application.  Target class with CLASS=x,y,z; Font name with FONT=x; Image format with FORMAT=x; Orientation with ORIENTATION=x'
    task :merb => [:merb_env] do
      # Fix ruby-graphviz being incompatible with Merb's process title
      $0 = 'rake'
      Rake::Task['state_machine:draw'].invoke
    end
  end
end

Version data entries

22 entries across 22 versions & 4 rubygems

Version Path
joelind-state_machine-0.8.1 tasks/state_machine.rb
pluginaweek-state_machine-0.7.6 tasks/state_machine.rb
pluginaweek-state_machine-0.8.0 tasks/state_machine.rb
branston-0.6.1 lib/branston/vendor/plugins/state_machine/tasks/state_machine.rb
branston-0.6.0 lib/branston/vendor/plugins/state_machine/tasks/state_machine.rb
branston-0.5.2 lib/branston/vendor/plugins/state_machine/tasks/state_machine.rb
branston-0.5.1 lib/branston/vendor/plugins/state_machine/tasks/state_machine.rb
branston-0.5.0 lib/branston/vendor/plugins/state_machine/tasks/state_machine.rb
branston-0.4.6 lib/branston/vendor/plugins/state_machine/tasks/state_machine.rb
branston-0.4.5 lib/branston/vendor/plugins/state_machine/tasks/state_machine.rb
branston-0.4.4 lib/branston/vendor/plugins/state_machine/tasks/state_machine.rb
branston-0.4.3 lib/branston/vendor/plugins/state_machine/tasks/state_machine.rb
branston-0.4.2 lib/branston/vendor/plugins/state_machine/tasks/state_machine.rb
branston-0.4.1 lib/branston/vendor/plugins/state_machine/tasks/state_machine.rb
branston-0.4.0 lib/branston/vendor/plugins/state_machine/tasks/state_machine.rb
state_machine-0.8.0 tasks/state_machine.rb
state_machine-0.7.6 tasks/state_machine.rb
state_machine-0.7.4 tasks/state_machine.rb
state_machine-0.7.2 tasks/state_machine.rb
state_machine-0.7.5 tasks/state_machine.rb