triggerable 0.1.17 → 0.1.18
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/lib/triggerable/actions/lambda_action.rb +7 -6
- data/lib/triggerable/version.rb +1 -1
- data/triggerable.gemspec +3 -3
- metadata +17 -17
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 8819ecc987d3d89dece7d8cebfd48d37f81659d62d076e09fe53d81947c2f1f8
|
4
|
+
data.tar.gz: ecb46118f0a3c7414def71f0ad17860bd31521167ad7eb2df480d45f34dc3219
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: aaca95a6769d8f5724431d8b1f6c755e6d17ddcc7ef04a999ca43e42e8441c42571f192fe1f8b71ab0503e77de0140ccf1c8339d70355a36a3d8afa44cf56821
|
7
|
+
data.tar.gz: 662ed66f69a40a427afa83b05510dab479750133452da1923443e728eef3be9d9f07e36c1384b2bf51aa784be635a109d283ac33c274d60c82a10b3dd14eb5db
|
@@ -1,28 +1,29 @@
|
|
1
1
|
module Triggerable
|
2
2
|
module Actions
|
3
3
|
class LambdaAction < Action
|
4
|
-
def initialize
|
4
|
+
def initialize(block)
|
5
5
|
@block = block
|
6
6
|
end
|
7
7
|
|
8
|
-
def run_for!
|
8
|
+
def run_for!(object, trigger_name)
|
9
9
|
proc = @block
|
10
10
|
object.instance_eval do
|
11
11
|
change_whodunnit = trigger_name.present? && defined?(PaperTrail)
|
12
|
+
paper_trail = (defined?(PaperTrail::Request) ? PaperTrail.request : PaperTrail) if change_whodunnit
|
12
13
|
old_whodunnit = nil
|
13
14
|
|
14
15
|
if change_whodunnit
|
15
|
-
old_whodunnit =
|
16
|
-
|
16
|
+
old_whodunnit = paper_trail.whodunnit
|
17
|
+
paper_trail.whodunnit = trigger_name
|
17
18
|
end
|
18
19
|
|
19
20
|
begin
|
20
21
|
instance_exec(&proc)
|
21
22
|
ensure
|
22
|
-
|
23
|
+
paper_trail.whodunnit = old_whodunnit if change_whodunnit
|
23
24
|
end
|
24
25
|
end
|
25
26
|
end
|
26
27
|
end
|
27
28
|
end
|
28
|
-
end
|
29
|
+
end
|
data/lib/triggerable/version.rb
CHANGED
data/triggerable.gemspec
CHANGED
@@ -18,11 +18,11 @@ Gem::Specification.new do |spec|
|
|
18
18
|
spec.test_files = Dir['spec/**/*.rb']
|
19
19
|
spec.require_paths = ["lib"]
|
20
20
|
|
21
|
-
spec.add_development_dependency "bundler"
|
21
|
+
spec.add_development_dependency "bundler"
|
22
22
|
spec.add_development_dependency "rake"
|
23
23
|
spec.add_development_dependency "rspec"
|
24
|
-
spec.add_development_dependency "activesupport", "~> 4.
|
25
|
-
spec.add_development_dependency "activerecord", "~> 4.
|
24
|
+
spec.add_development_dependency "activesupport", "~> 4.1.0"
|
25
|
+
spec.add_development_dependency "activerecord", "~> 4.1.0"
|
26
26
|
spec.add_development_dependency "sqlite3"
|
27
27
|
spec.add_development_dependency "simplecov"
|
28
28
|
end
|
metadata
CHANGED
@@ -1,29 +1,29 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: triggerable
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.18
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- DmitryTsepelev
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2018-04-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - "
|
17
|
+
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '
|
19
|
+
version: '0'
|
20
20
|
type: :development
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- - "
|
24
|
+
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '
|
26
|
+
version: '0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: rake
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -58,28 +58,28 @@ dependencies:
|
|
58
58
|
requirements:
|
59
59
|
- - "~>"
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version: 4.
|
61
|
+
version: 4.1.0
|
62
62
|
type: :development
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
66
|
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version: 4.
|
68
|
+
version: 4.1.0
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: activerecord
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
73
|
- - "~>"
|
74
74
|
- !ruby/object:Gem::Version
|
75
|
-
version: 4.
|
75
|
+
version: 4.1.0
|
76
76
|
type: :development
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
80
|
- - "~>"
|
81
81
|
- !ruby/object:Gem::Version
|
82
|
-
version: 4.
|
82
|
+
version: 4.1.0
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
84
|
name: sqlite3
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
@@ -175,18 +175,18 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
175
175
|
version: '0'
|
176
176
|
requirements: []
|
177
177
|
rubyforge_project:
|
178
|
-
rubygems_version: 2.6
|
178
|
+
rubygems_version: 2.7.6
|
179
179
|
signing_key:
|
180
180
|
specification_version: 4
|
181
181
|
summary: Triggerable is a powerful engine for adding a conditional behaviour for ActiveRecord
|
182
182
|
models.
|
183
183
|
test_files:
|
184
|
-
- spec/
|
185
|
-
- spec/
|
184
|
+
- spec/spec_helper.rb
|
185
|
+
- spec/schema.rb
|
186
|
+
- spec/integration/short_syntax_spec.rb
|
186
187
|
- spec/integration/automations_spec.rb
|
188
|
+
- spec/integration/actions_spec.rb
|
187
189
|
- spec/integration/conditions_spec.rb
|
188
|
-
- spec/integration/short_syntax_spec.rb
|
189
|
-
- spec/models.rb
|
190
|
-
- spec/schema.rb
|
191
190
|
- spec/scopes_spec.rb
|
192
|
-
- spec/
|
191
|
+
- spec/conditions_spec.rb
|
192
|
+
- spec/models.rb
|