Fetching contributors…
Cannot retrieve contributors at this time
246 lines (196 sloc) 12.4 KB


0.7.2 / 2009-04-08

  • Add support for running multiple methods in a callback without using blocks

  • Add more flexibility around how callbacks are defined

  • Add security documentation around mass-assignment in ORM integrations

  • Fix event attribute transitions being publicly accessible

0.7.1 / 2009-04-05

  • Fix machines failing to generate graphs when run from Merb tasks

0.7.0 / 2009-04-04

  • Add #{attribute}_event for automatically firing events when the object's action is called

  • Make it easier to override state-driven behaviors

  • Rollback state changes when the action fails during transitions

  • Use :messages instead of :invalid_message for customizing validation errors

  • Use more human-readable validation errors

  • Add support for more ActiveRecord observer hooks

  • Add support for targeting multiple specific state machines in DataMapper observer hooks

  • Don't pass the result of the action as an argument to callbacks (access via Transition#result)

  • Fix incorrect results being used when running transitions in parallel

  • Fix transition args not being set when run in parallel

  • Allow callback terminators to be set on an application-wide basis

  • Only catch :halt during before / after transition callbacks

  • Fix ActiveRecord predicates being overwritten if they're already defined in the class

  • Allow machine options to be set on an integration-wide basis

  • Turn transactions off by default in DataMapper integrations

  • Add support for configuring the use of transactions

  • Simplify reading/writing of attributes

  • Simplify access to state machines via #state_machine(:attribute) without generating dupes

  • Fix assumptions that dm-validations is always available in DataMapper integration

  • Automatically define DataMapper properties for machine attributes if they don't exist

  • Add Transition#qualified_event, #qualified_from_name, and #qualified_to_name

  • Add #fire_events / #fire_events! for running events on multiple state machines in parallel

  • Rename next_#{event}_transition to #{event}_transition

  • Add #{attribute}_transitions for getting the list of transitions that can be run on an object

  • Add #{attribute}_events for getting the list of events that can be fired on an object

  • Use generated non-bang event when running bang version so that overriding one affects the other

  • Provide access to arguments passed into an event from transition callbacks via Transition#args

0.6.3 / 2009-03-10

  • Add support for customizing the graph's orientation

  • Use the standard visualizations for initial (open arrow) and final (double circle) states

  • Highlight final states in GraphViz drawings

0.6.2 / 2009-03-08

  • Make it easier to override generated instance / class methods

0.6.1 / 2009-03-07

  • Add i18n support for ActiveRecord validation errors

  • Add a validation error when failing to transition for ActiveRecord / DataMapper / Sequel integrations

0.6.0 / 2009-03-03

  • Allow multiple conditions for callbacks / class behaviors

  • Add support for state-driven class behavior with :if/:unless options

  • Alias Machine#event as Machine#on

  • Fix nil from/to states not being handled properly

  • Simplify hooking callbacks into loopbacks

  • Add simplified transition/callback requirement syntax

0.5.2 / 2009-02-17

  • Improve pretty-print of events

  • Simplify state/event matching design, improving guard performance by 30%

  • Add better error notification when conflicting guard options are defined

  • Fix scope name pluralization not being applied correctly

0.5.1 / 2009-02-11

  • Allow states to be drawn as ellipses to accommodate long names

  • Fix rake tasks not being registered in Rails/Merb applications

  • Never automatically define machine attribute accessors when using an integration

0.5.0 / 2009-01-11

  • Add to_name and from_name to transition objects

  • Add nicely formatted #inspect for transitions

  • Fix ActiveRecord integrations failing when the database doesn't exist yet

  • Fix states not being drawn in GraphViz graphs in the correct order

  • Add nicely formatted #inspect for states and events

  • Simplify machine context-switching

  • Store events/states in enumerable node collections

  • No longer allow subclasses to change the integration

  • Move fire! action logic into the Event class (no longer calls fire action on the object)

  • Allow states in subclasses to have different values

  • Recommend that all states be referenced as symbols instead of strings

  • All states must now be named (and can be associated with other value types)

  • Add support for customizing the actual stored value for a state

  • Add compatibility with Ruby 1.9+

0.4.3 / 2008-12-28

  • Allow dm-observer integration to be optional

  • Fix non-lambda callbacks not working for DataMapper/Sequel

0.4.2 / 2008-12-28

  • Fix graphs not being drawn the same way consistently

  • Add support for sharing transitions across multiple events

  • Add support for state-driven behavior

  • Simplify initialize hooks, requiring super to be called instead

  • Add :namespace option for generated state predicates / event methods

0.4.1 / 2008-12-16

  • Fix nil states not being handled properly in guards, known states, or visualizations

  • Fix the same node being used for different dynamic states in GraphViz output

  • Always include initial state in the list of known states even if it's dynamic

  • Use consistent naming scheme for dynamic states in GraphViz output

  • Allow blocks to be directly passed into machine class

  • Fix attribute predicates not working on attributes that represent columns in ActiveRecord

0.4.0 / 2008-12-14

  • Remove the PluginAWeek namespace

  • Add generic attribute predicate (e.g. “#{attribute}?(state_name)”) and state predicates (e.g. “#{state}?”)

  • Add Sequel support

  • Fix aliasing :initialize on ActiveRecord models causing warnings when the environment is reloaded

  • Fix ActiveRecord state machines trying to query the database on unmigrated models

  • Fix initial states not getting set when the current value is an empty string [Aaron Gibralter]

  • Add rake tasks for generating graphviz files for state machines [Nate Murray]

  • Fix initial state not being included in list of known states

  • Add other_states directive for defining additional states not referenced in transitions or callbacks [Pete Forde]

  • Add next_#{event}_transition for getting the next transition that would be performed if the event were invoked

  • Add the ability to override the pluralized name of an attribute for creating scopes

  • Add the ability to halt callback chains by: throw :halt

  • Add support for dynamic to states in transitions (e.g. :to => lambda {})

  • Add support for using real blocks in before_transition/after_transition calls instead of using the :do option

  • Add DataMapper support

  • Include states referenced in transition callbacks in the list of a machine's known states

  • Only generate the known states for a machine on demand, rather than calculating beforehand

  • Add the ability to skip state change actions during a transition (e.g. vehicle.ignite(false))

  • Add the ability for the state change action (e.g. save for ActiveRecord) to be configurable

  • Allow state machines to be defined on any Ruby class, not just ActiveRecord (removes all external dependencies)

  • Refactor transitions, guards, and callbacks for better organization/design

  • Use a class containing the transition context in callbacks, rather than an ordered list of each individual attribute

  • Add without_#{attribute} named scopes (opposite of the existing with_#{attribute} named scopes) [Sean O'Brien]

0.3.1 / 2008-10-26

  • Fix the initial state not getting set when the state attribute is mass-assigned but protected

  • Change how the base module is included to prevent namespacing conflicts

0.3.0 / 2008-09-07

  • No longer allow additional arguments to be passed into event actions

  • Add support for can_#{event}? for checking whether an event can be fired based on the current state of the record

  • Don't use callbacks for performing transitions

  • Fix state machines in subclasses not knowing what states/events/transitions were defined by superclasses

  • Replace all before/after_exit/enter/loopback callback hooks and :before/:after options for events with before_transition/after_transition callbacks, e.g.

    before_transition :from => 'parked', :do => :lock_doors # was before_exit :parked, :lock_doors after_transition :on => 'ignite', :do => :turn_on_radio # was event :ignite, :after => :turn_on_radio do

  • Always save when an event is fired even if it results in a loopback [Jürgen Strobel]

  • Ensure initial state callbacks are invoked in the proper order when an event is fired on a new record

  • Add before_loopback and after_loopback hooks [Jürgen Strobel]

0.2.1 / 2008-07-05

  • Add more descriptive exceptions

  • Assume the default state attribute is “state” if one is not provided

  • Add :except_from option for transitions if you want to blacklist states

  • Add PluginAWeek::StateMachine::Machine#states

  • Add PluginAWeek::StateMachine::Event#transitions

  • Allow creating transitions with no from state (effectively allowing the transition for any from state)

  • Reduce the number of objects created for each transition

0.2.0 / 2008-06-29

  • Add a non-bang version of events (e.g. park) that will return a boolean value for success

  • Raise an exception if the bang version of events are used (e.g. park!) and no transition is successful

  • Change callbacks to act a little more like ActiveRecord

  • Avoid using string evaluation for dynamic methods

0.1.1 / 2008-06-22

  • Remove log files from gems

0.1.0 / 2008-05-05

  • Completely rewritten from scratch

  • Renamed to state_machine

  • Removed database dependencies

  • Removed models in favor of an attribute-agnostic design

  • Use ActiveSupport::Callbacks instead of eval_call

  • Remove dry_transaction_rollbacks dependencies

  • Added functional tests

  • Updated documentation

0.0.1 / 2007-09-26

  • Add dependency on custom_callbacks

  • Move test fixtures out of the test application root directory

  • Improve documentation

  • Remove the StateExtension module in favor of adding singleton methods to the stateful class

  • Convert dos newlines to unix newlines

  • Fix error message when a given event can't be found in the database

  • Add before_#{action} and #{action} callbacks when an event is performed

  • All state and event callbacks can now explicitly return false in order to cancel the action

  • Refactor ActiveState callback creation

  • Refactor unit tests so that they use mock classes instead of themselves

  • Allow force_reload option to be set in the state association

  • Don't save the entire model when updating the state_id

  • Raise exception if a class tries to define a state more than once

  • Add tests for PluginAWeek::Has::States::ActiveState

  • Refactor active state/active event creation

  • Fix owner_type not being set correctly in active states/events of subclasses

  • Allow subclasses to override the initial state

  • Fix problem with migrations using default null when column cannot be null

  • Moved deadline support into a separate plugin (has_state_deadlines).

  • Added many more unit tests.

  • Simplified many of the interfaces for maintainability.

  • Added support for turning off recording state changes.

  • Removed the short_description and long_description columns, in favor of an optional human_name column.

  • Fixed not overriding the correct equality methods in the StateTransition class.

  • Added to_sym to State and Event.

  • State#name and Event#name now return the string version of the name instead of the symbol version.

  • Added State#human_name and Event#human_name to automatically figure out what the human name is if it isn't specified in the table.

  • Updated manual rollbacks to use the new Rails edge api (ActiveRecord::Rollback exception).

  • Moved StateExtension class into a separate file in order to help keep the has_state files clean.

  • Renamed InvalidState and InvalidEvent exceptions to StateNotFound and EventNotFound in order to follow the ActiveRecord convention (i.e. RecordNotFound).

  • Added StateNotActive and EventNotActive exceptions to help differentiate between states which don't exist and states which weren't defined in the class.

  • Added support for defining callbacks like so:

    def before_exit_parked end

    def after_enter_idling end

  • Added support for defining callbacks using class methods:

    before_exit_parked :fasten_seatbelt

  • Added event callbacks after the transition has occurred (e.g. after_park)

  • State callbacks no longer receive any of the arguments that were provided in the event action

  • Updated license to include our names.