From e9a7686b3e1b837f2ce0d591e6d8789f6c426f36 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thorsten=20B=C3=B6ttger?= Date: Thu, 6 Nov 2014 00:02:13 +0100 Subject: [PATCH] removed deprecated methods (mostly the ones prefixed with ) --- AASM4.md | 3 -- CHANGELOG.md | 1 + PLANNED_CHANGES.md | 7 ++++ lib/aasm/aasm.rb | 89 ---------------------------------------------- lib/aasm/event.rb | 6 ---- 5 files changed, 8 insertions(+), 98 deletions(-) delete mode 100644 AASM4.md create mode 100644 PLANNED_CHANGES.md diff --git a/AASM4.md b/AASM4.md deleted file mode 100644 index e858d0d..0000000 --- a/AASM4.md +++ /dev/null @@ -1,3 +0,0 @@ -# Planned changes for AASM 4.0 - - * remove old aasm DSL (like `aasm_state`) diff --git a/CHANGELOG.md b/CHANGELOG.md index 83127df..e3d9177 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -18,6 +18,7 @@ * **DSL change**: instance-based permissible_events has been removed in favor or events(:permissible => true) * **DSL change**: class-based events now returns a list of Event instances (instead of a hash with event names as keys) * **DSL change**: renamed permissible states and events to permitted states events + * removed deprecated methods (mostly the ones prefixed with `aasm_`) ## 3.4.0 diff --git a/PLANNED_CHANGES.md b/PLANNED_CHANGES.md new file mode 100644 index 0000000..e74feae --- /dev/null +++ b/PLANNED_CHANGES.md @@ -0,0 +1,7 @@ +# Planned changes for AASM 4.1 + + * remove support for `:on_transition` callback + +# Planned changes for AASM 4.0 + + * nothing left diff --git a/lib/aasm/aasm.rb b/lib/aasm/aasm.rb index 561d21d..a3222e7 100644 --- a/lib/aasm/aasm.rb +++ b/lib/aasm/aasm.rb @@ -26,59 +26,6 @@ module AASM @aasm end - # TODO remove this method in v4.0.0 - def aasm_initial_state(set_state=nil) - if set_state - warn ".aasm_initial_state(:name) is deprecated and will be removed in version 4.0.0; please use .aasm.initial_state = :name instead!" - AASM::StateMachine[self].initial_state = set_state - else - warn ".aasm_initial_state is deprecated and will be removed in version 4.0.0; please use .aasm.initial_state instead!" - AASM::StateMachine[self].initial_state - end - end - - # TODO remove this method in v4.0.0 - def aasm_from_states_for_state(state, options={}) - warn ".aasm_from_states_for_state is deprecated and will be removed in version 4.0.0; please use .aasm.from_states_for_state instead!" - aasm.from_states_for_state(state, options) - end - - # TODO remove this method in v4.0.0 - def aasm_initial_state=(state) - warn ".aasm_initial_state= is deprecated and will be removed in version 4.0.0" - AASM::StateMachine[self].initial_state = state - end - - # TODO remove this method in v4.0.0 - def aasm_state(name, options={}) - warn ".aasm_state is deprecated and will be removed in version 4.0.0; please use .aasm.state instead!" - aasm.state(name, options) - end - - # TODO remove this method in v4.0.0 - def aasm_event(name, options = {}, &block) - warn ".aasm_event is deprecated and will be removed in version 4.0.0; please use .aasm.event instead!" - aasm.event(name, options, &block) - end - - # TODO remove this method in v4.0.0 - def aasm_states - warn ".aasm_states is deprecated and will be removed in version 4.0.0; please use .aasm.states instead!" - aasm.states - end - - # TODO remove this method in v4.0.0 - def aasm_events - warn ".aasm_events is deprecated and will be removed in version 4.0.0; please use .aasm.events instead!" - aasm.events - end - - # TODO remove this method in v4.0.0 - def aasm_states_for_select - warn ".aasm_states_for_select is deprecated and will be removed in version 4.0.0; please use .aasm.states_for_select instead!" - aasm.states_for_select - end - # aasm.event(:event_name).human? def aasm_human_event_name(event) # event_name? AASM::Localizer.new.human_event_name(self, event) @@ -107,42 +54,6 @@ module AASM true end - # TODO remove this method in v4.0.0 - def aasm_current_state - warn "#aasm_current_state is deprecated and will be removed in version 4.0.0; please use #aasm.current_state instead!" - aasm.current_state - end - - # TODO remove this method in v4.0.0 - def aasm_enter_initial_state - warn "#aasm_enter_initial_state is deprecated and will be removed in version 4.0.0; please use #aasm.enter_initial_state instead!" - aasm.enter_initial_state - end - - # TODO remove this method in v4.0.0 - def aasm_events_for_current_state - warn "#aasm_events_for_current_state is deprecated and will be removed in version 4.0.0; please use #aasm.events(aasm.current_state) instead!" - aasm.events(aasm.current_state) - end - - # TODO remove this method in v4.0.0 - def aasm_permissible_events_for_current_state - warn "#aasm_permissible_events_for_current_state is deprecated and will be removed in version 4.0.0; please use #aasm.events(:permitted => true) instead!" - aasm.events(:permitted => true) - end - - # TODO remove this method in v4.0.0 - def aasm_events_for_state(state_name) - warn "#aasm_events_for_state(state_name) is deprecated and will be removed in version 4.0.0; please use #aasm.events(state_name) instead!" - aasm.events(state_name) - end - - # TODO remove this method in v4.0.0 - def aasm_human_state - warn "#aasm_human_state is deprecated and will be removed in version 4.0.0; please use #aasm.human_state instead!" - aasm.human_state - end - private # Takes args and a from state and removes the first diff --git a/lib/aasm/event.rb b/lib/aasm/event.rb index a3156a4..a2391c8 100644 --- a/lib/aasm/event.rb +++ b/lib/aasm/event.rb @@ -39,12 +39,6 @@ module AASM @transitions.select { |t| t.to == state } end - # TODO remove this method in v4.0.0 - def all_transitions - warn "Event#all_transitions is deprecated and will be removed in version 4.0.0; please use Event#transitions instead!" - transitions - end - def fire_callbacks(callback_name, record, *args) # strip out the first element in args if it's a valid to_state # #given where we're coming from, this condition implies args not empty