pluginaweek / state_machine
- Source
- Commits
- Network (26)
- Downloads (26)
- Wiki (1)
- Graphs
-
Tree:
5d5b3d2
state_machine / CHANGELOG.rdoc
master
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.
