Skip to content

Latest commit

 

History

History
336 lines (271 loc) · 17.6 KB

CHANGELOG.rdoc

File metadata and controls

336 lines (271 loc) · 17.6 KB

master

0.9.1 / 2010-05-02

  • Fix ActiveRecord 2.0.0 - 2.2.3 integrations failing if version info isn’t already loaded

  • Fix integration with dirty attribute tracking on DataMapper 0.10.3

  • Fix observers failing in ActiveRecord 3.0.0.beta4+ integrations

  • Fix deprecation warning in Rails 3 railtie [Chris Yuan]

0.9.0 / 2010-04-12

  • Use attribute-based event transitions whenever possible to ensure consistency

  • Fix action helpers being defined when the action is only defined in the machine’s owner class

  • Disable attribute-based event transitions in DataMapper 0.9.4 - 0.9.6 when dm-validations is being used

  • Add support for DataMapper 0.10.3+

  • Add around_transition callbacks

  • Fix transition failures during save not being handled correctly in Sequel 2.12.0+

  • Fix attribute-based event transitions not hooking in properly in DataMapper 0.10.0+ and Sequel 2.12.0+

  • Fix dynamic initial states causing errors in Ruby 1.9+ if no arguments are defined in the block

  • Add MongoMapper 0.5.5+ support

  • Add ActiveModel 3.0+ support for use with integrations that implement its interface

  • Fix DataMapper integration failing when ActiveSupport is loaded in place of Extlib

  • Add version dependencies for ruby-graphviz

  • Remove app-specific rails / merb rake tasks in favor of always running state_machine:draw

  • Add Rails 3 railtie for automatically loading rake tasks when installed as a gem

0.8.1 / 2010-03-14

  • Release gems via rake-gemcutter instead of rubyforge

  • Move rake tasks to lib/tasks

  • Dispatch state behavior to the superclass if it’s undefined for a particular state [Sandro Turriate and Tim Pope]

  • Fix state / event names not supporting i18n in ActiveRecord

  • Fix original ActiveRecord::Observer#update not being used for non-state_machine callbacks [Jeremy Wells]

  • Add support for ActiveRecord 3.0

  • Fix without_{name} scopes not quoting columns in ActiveRecord [Jon Evans]

  • Fix without_{name} scopes not scoping columns to the table in ActiveRecord and Sequel [Jon Evans]

  • Fix custom state attributes not being marked properly as changed in ActiveRecord

  • Fix tracked attributes changes in ActiveRecord / DataMapper integrations not working correctly for non-loopbacks [Joe Lind]

  • Fix plural scope names being incorrect for DataMapper 0.9.4 - 0.9.6

  • Fix deprecation warnings for ruby-graphviz 0.9.0+

  • Add support for ActiveRecord 2.0.*

  • Fix nil states being overwritten when they’re explicitly set in ORM integrations

  • Fix default states not getting set in ORM integrations if the column has a default

  • Fix event transitions being kept around while running actions/callbacks, sometimes preventing object marshalling

0.8.0 / 2009-08-15

  • Add support for DataMapper 0.10.0

  • Always interpet nil return values from actions as failed attempts

  • Fix loopbacks not causing records to save in ORM integrations if no other fields were changed

  • Fix events not failing with useful errors when an object’s state is invalid

  • Use more friendly NoMethodError messages for state-driven behaviors

  • Fix before_transition callbacks getting run twice when using event attributes in ORM integrations

  • Add the ability to query for the availability of specific transitions on an object

  • Allow after_transition callbacks to be explicitly run on failed attempts

  • By default, don’t run after_transition callbacks on failed attempts

  • Fix not allowing multiple methods to be specified as arguments in callbacks

  • Fix initial states being set when loading records from the database in Sequel integration

  • Allow static initial states to be set earlier in the initialization of an object

  • Use friendly validation errors for nil states

  • Fix states not being validated properly when using custom names in ActiveRecord / DataMapper integrations

0.7.6 / 2009-06-17

  • Allow multiple state machines on the same class to target the same attribute

  • Add support for :attribute to customize the attribute target, assuming the name is the first argument of #state_machine

  • Simplify reading from / writing to machine-related attributes on objects

  • Fix locale for ActiveRecord getting added to the i18n load path multiple times [Reiner Dieterich]

  • Fix callbacks, guards, and state-driven behaviors not always working on tainted classes [Brandon Dimcheff]

  • Use Ruby 1.9’s built-in Object#instance_exec for bound callbacks when it’s available

  • Improve performance of cached dynamic state lookups by 25%

0.7.5 / 2009-05-25

  • Add built-in caching for dynamic state values when the value only needs to be generated once

  • Fix flawed example for using record ids as state values

  • Don’t evaluate state values until they’re actually used in an object instance

  • Make it easier to use event attributes for actions defined in the same class as the state machine

  • Fix #save/save! running transitions in ActiveRecord integrations even when a machine’s action is not :save

0.7.4 / 2009-05-23

  • Fix #save! not firing event attributes properly in ActiveRecord integrations

  • Fix log files being included in gems

0.7.3 / 2009-04-25

  • Require DataMapper version be >= 0.9.4

  • Explicitly load Sequel’s built-in inflector (>= 2.12.0) for scope names

  • Don’t use qualified name for event attributes

  • Fix #valid? being defined for DataMapper resources when dm-validations isn’t loaded

  • Add auto-validation of values allowed for the state attribute in ORM integrations

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 {Time.now})

  • 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.