aasm 5.0.7 → 5.0.8

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: aa5a74637dafaa4c06da6c03e96342997692ad3f
4
- data.tar.gz: e46be5420174440acc2dea63d9e66958d7dc6efc
2
+ SHA256:
3
+ metadata.gz: c02be243049ac08482ee6dd9de9b388d7f965019012f680507b75aee43e1819c
4
+ data.tar.gz: e41809b4fd44cd1d5358e4da499c6b2691caf6a2b6f0b1cf24816458af711522
5
5
  SHA512:
6
- metadata.gz: 359caf35d39d769ec0cc3d805cface2f89946692e62b1dd984fc42830be53305c3abfb300163d6e2f46317673fbd3a1c9e8ea366328feebdedab5806b85f1fd0
7
- data.tar.gz: a1621683151f4ff00e1e83f4d7f3926bc1d5d4e0d945e2a38ed4f6355267c0165e2aabbeca553cdf17a8c9e4237130a0a63cc9715b0b0e8bb5801c71bd2bb053
6
+ metadata.gz: c5e49eeff60a68201dccfd988525030946a5f4e2ff080a8818ec729f7bb88291b6f333ccf8666a241dfb72b38a2f30333afbc4d284c3c6103eaab49446630b8e
7
+ data.tar.gz: d2d16d9368d1c8dfd8f50baaea1f07b525798a017fc612c27705161606ae27e1cdd1ea15b979d6d916cfd8abaa81479ff20c72577f8dbbd140dcb78572683845
@@ -2,6 +2,10 @@
2
2
 
3
3
  ## unreleased
4
4
 
5
+ ## 5.0.8
6
+
7
+ * Revert Fix for :after_commit within nested transaction because it adds after_commit_action dependency which is dependent on many gems.
8
+
5
9
  ## 5.0.7
6
10
 
7
11
  * Fix :after_commit within nested transaction [#666](https://github.com/aasm/aasm/pull/666), thanks to [stokarenko](https://github.com/stokarenko)
@@ -17,7 +17,6 @@ Gem::Specification.new do |s|
17
17
  s.required_ruby_version = '>= 1.9.3'
18
18
 
19
19
  s.add_dependency 'concurrent-ruby', '~> 1.0'
20
- s.add_dependency 'after_commit_action', '~> 1.0'
21
20
 
22
21
  s.add_development_dependency 'rake'
23
22
  s.add_development_dependency 'sdoc'
@@ -1,4 +1,3 @@
1
- require 'after_commit_action'
2
1
  require 'aasm/persistence/orm'
3
2
  module AASM
4
3
  module Persistence
@@ -29,7 +28,6 @@ module AASM
29
28
  # end
30
29
  #
31
30
  def self.included(base)
32
- base.send(:include, ::AfterCommitAction) unless base.include?(::AfterCommitAction)
33
31
  base.send(:include, AASM::Persistence::Base)
34
32
  base.send(:include, AASM::Persistence::ORM)
35
33
  base.send(:include, AASM::Persistence::ActiveRecordPersistence::InstanceMethods)
@@ -90,12 +88,6 @@ module AASM
90
88
  end
91
89
  end
92
90
 
93
- def aasm_execute_after_commit
94
- execute_after_commit do
95
- yield
96
- end
97
- end
98
-
99
91
  def aasm_enum(name=:default)
100
92
  case AASM::StateMachineStore.fetch(self.class, true).machine(name).config.enum
101
93
  when false then nil
@@ -81,10 +81,6 @@ module AASM
81
81
  true
82
82
  end
83
83
 
84
- def aasm_execute_after_commit
85
- yield
86
- end
87
-
88
84
  def aasm_write_state_attribute(state, name=:default)
89
85
  aasm_write_attribute(self.class.aasm(name).attribute_name, aasm_raw_attribute_value(state, name))
90
86
  end
@@ -120,32 +116,32 @@ module AASM
120
116
 
121
117
  # Returns true if event was fired successfully and transaction completed.
122
118
  def aasm_fire_event(state_machine_name, name, options, *args, &block)
123
- return super unless aasm_supports_transactions? && options[:persist]
124
-
125
- event = self.class.aasm(state_machine_name).state_machine.events[name]
126
- event.fire_callbacks(:before_transaction, self, *args)
127
- event.fire_global_callbacks(:before_all_transactions, self, *args)
128
-
129
- begin
130
- success = if options[:persist] && use_transactions?(state_machine_name)
131
- aasm_transaction(requires_new?(state_machine_name), requires_lock?(state_machine_name)) do
119
+ if aasm_supports_transactions? && options[:persist]
120
+ event = self.class.aasm(state_machine_name).state_machine.events[name]
121
+ event.fire_callbacks(:before_transaction, self, *args)
122
+ event.fire_global_callbacks(:before_all_transactions, self, *args)
123
+
124
+ begin
125
+ success = if options[:persist] && use_transactions?(state_machine_name)
126
+ aasm_transaction(requires_new?(state_machine_name), requires_lock?(state_machine_name)) do
127
+ super
128
+ end
129
+ else
132
130
  super
133
131
  end
134
- else
135
- super
136
- end
137
132
 
138
- if success
139
- aasm_execute_after_commit do
133
+ if success
140
134
  event.fire_callbacks(:after_commit, self, *args)
141
135
  event.fire_global_callbacks(:after_all_commits, self, *args)
142
136
  end
143
- end
144
137
 
145
- success
146
- ensure
147
- event.fire_callbacks(:after_transaction, self, *args)
148
- event.fire_global_callbacks(:after_all_transactions, self, *args)
138
+ success
139
+ ensure
140
+ event.fire_callbacks(:after_transaction, self, *args)
141
+ event.fire_global_callbacks(:after_all_transactions, self, *args)
142
+ end
143
+ else
144
+ super
149
145
  end
150
146
  end
151
147
 
@@ -1,3 +1,3 @@
1
1
  module AASM
2
- VERSION = "5.0.7"
2
+ VERSION = "5.0.8"
3
3
  end
@@ -613,38 +613,6 @@ if defined?(ActiveRecord)
613
613
  expect(validator).to be_running
614
614
  expect(validator.name).to eq("name")
615
615
  end
616
-
617
- context "nested transaction" do
618
- it "should fire :after_commit if root transaction was successful" do
619
- validator = Validator.create(:name => 'name')
620
- expect(validator).to be_sleeping
621
-
622
- validator.transaction do
623
- validator.run!
624
- expect(validator.name).to eq("name")
625
- expect(validator).to be_running
626
- end
627
-
628
- expect(validator.name).to eq("name changed")
629
- expect(validator.reload).to be_running
630
- end
631
- end
632
-
633
- it "should not fire :after_commit if root transaction failed" do
634
- validator = Validator.create(:name => 'name')
635
- expect(validator).to be_sleeping
636
-
637
- validator.transaction do
638
- validator.run!
639
- expect(validator.name).to eq("name")
640
- expect(validator).to be_running
641
-
642
- raise ActiveRecord::Rollback, "failed on purpose"
643
- end
644
-
645
- expect(validator.name).to eq("name")
646
- expect(validator.reload).to be_sleeping
647
- end
648
616
  end
649
617
 
650
618
  describe 'before and after transaction callbacks' do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: aasm
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.0.7
4
+ version: 5.0.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Thorsten Boettger
@@ -25,20 +25,6 @@ dependencies:
25
25
  - - "~>"
26
26
  - !ruby/object:Gem::Version
27
27
  version: '1.0'
28
- - !ruby/object:Gem::Dependency
29
- name: after_commit_action
30
- requirement: !ruby/object:Gem::Requirement
31
- requirements:
32
- - - "~>"
33
- - !ruby/object:Gem::Version
34
- version: '1.0'
35
- type: :runtime
36
- prerelease: false
37
- version_requirements: !ruby/object:Gem::Requirement
38
- requirements:
39
- - - "~>"
40
- - !ruby/object:Gem::Version
41
- version: '1.0'
42
28
  - !ruby/object:Gem::Dependency
43
29
  name: rake
44
30
  requirement: !ruby/object:Gem::Requirement
@@ -437,8 +423,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
437
423
  - !ruby/object:Gem::Version
438
424
  version: '0'
439
425
  requirements: []
440
- rubyforge_project:
441
- rubygems_version: 2.6.14
426
+ rubygems_version: 3.1.2
442
427
  signing_key:
443
428
  specification_version: 4
444
429
  summary: State machine mixin for Ruby objects