activeinteractor 0.1.6 → 0.1.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +9 -1
- data/README.md +5 -2
- data/lib/active_interactor/interactor/worker.rb +3 -1
- data/lib/active_interactor/version.rb +1 -1
- data/lib/rails/generators/active_interactor/install_generator.rb +7 -4
- data/lib/rails/generators/templates/{initializer.rb → initializer.erb} +4 -4
- metadata +6 -7
- data/lib/active_interactor/context/errors.rb +0 -28
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 62ffd94a00a7a624dc305a07dfb9347ac55d9b863b6a6acaf87d74a653bea21f
|
4
|
+
data.tar.gz: bf704329e8360caaa6c750fb65722e8bf3cd53c0c633d7d1ed96f1b68fd4af0b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 22600e40ed597c10695c5bc1859f7338495c25b2204d9d58f959be3c74cb1e943f98776e0669dfc12e784eaf16babab7fc0531a98e15fbf2e6a0bbd42710d693
|
7
|
+
data.tar.gz: f61f0ad8378ac49577e19c745566a202e5723cd107f7e867d0ed34249926c6827e258f81e42a7c617546e3e53448f106aba3a3754b1171fbb2d5c2f303217119
|
data/CHANGELOG.md
CHANGED
@@ -7,6 +7,12 @@ and this project adheres to [Semantic Versioning].
|
|
7
7
|
|
8
8
|
## [Unreleased]
|
9
9
|
|
10
|
+
## [v0.1.7] - 2019-09-10
|
11
|
+
|
12
|
+
### Fixed
|
13
|
+
|
14
|
+
- [#61] Ensure `Organizer` accurately reports context success
|
15
|
+
|
10
16
|
## [v0.1.6] - 2019-07-24
|
11
17
|
|
12
18
|
### Changed
|
@@ -68,7 +74,8 @@ and this project adheres to [Semantic Versioning].
|
|
68
74
|
|
69
75
|
<!-- versions -->
|
70
76
|
|
71
|
-
[Unreleased]: https://github.com/aaronmallen/activeinteractor/compare/v0.1.
|
77
|
+
[Unreleased]: https://github.com/aaronmallen/activeinteractor/compare/v0.1.7..HEAD
|
78
|
+
[v0.1.7]: https://github.com/aaronmallen/activeinteractor/compare/v0.1.6...v0.1.7
|
72
79
|
[v0.1.6]: https://github.com/aaronmallen/activeinteractor/compare/v0.1.5...v0.1.6
|
73
80
|
[v0.1.5]: https://github.com/aaronmallen/activeinteractor/compare/v0.1.4...v0.1.5
|
74
81
|
[v0.1.4]: https://github.com/aaronmallen/activeinteractor/compare/v0.1.3...v0.1.4
|
@@ -91,3 +98,4 @@ and this project adheres to [Semantic Versioning].
|
|
91
98
|
[#45]: https://github.com/aaronmallen/activeinteractor/pull/45
|
92
99
|
[#48]: https://github.com/aaronmallen/activeinteractor/pull/48
|
93
100
|
[#51]: https://github.com/aaronmallen/activeinteractor/pull/51
|
101
|
+
[#61]: https://github.com/aaronmallen/activeinteractor/pull/61
|
data/README.md
CHANGED
@@ -33,11 +33,14 @@ gem install activeinteractor
|
|
33
33
|
If you're working with a rails project you will also want to run:
|
34
34
|
|
35
35
|
```bash
|
36
|
-
rails generate active_interactor:install
|
36
|
+
rails generate active_interactor:install [directory]
|
37
37
|
```
|
38
38
|
|
39
|
+
The `directory` option allows you to customize what directory interactors
|
40
|
+
will live in within your application (defaults to 'interactors').
|
41
|
+
|
39
42
|
This will create an initializer and a new class called `ApplicationInteractor`
|
40
|
-
at `app
|
43
|
+
at `app/<interactor directory>/application_interactor.rb`
|
41
44
|
|
42
45
|
you can then automatically generate interactors and interactor organizers with:
|
43
46
|
|
@@ -63,8 +63,9 @@ module ActiveInteractor
|
|
63
63
|
|
64
64
|
def execute_context!
|
65
65
|
perform!
|
66
|
-
finalize_context!
|
67
66
|
context
|
67
|
+
ensure
|
68
|
+
finalize_context!
|
68
69
|
end
|
69
70
|
|
70
71
|
def fail_on_invalid_context!(validation_context = nil)
|
@@ -88,6 +89,7 @@ module ActiveInteractor
|
|
88
89
|
|
89
90
|
def rollback_context_and_raise!(exception)
|
90
91
|
context.rollback!
|
92
|
+
context.send(:mark_failed!)
|
91
93
|
raise exception
|
92
94
|
end
|
93
95
|
|
@@ -5,23 +5,26 @@ require_relative '../active_interactor'
|
|
5
5
|
module ActiveInteractor
|
6
6
|
module Generators
|
7
7
|
class InstallGenerator < Base
|
8
|
+
desc 'Install ActiveInteractor'
|
9
|
+
argument :directory, type: :string, default: 'interactors', banner: 'directory'
|
10
|
+
|
8
11
|
def create_initializer
|
9
|
-
template 'initializer.
|
12
|
+
template 'initializer.erb', Rails.root.join('config', 'initializers', 'active_interactor.rb')
|
10
13
|
end
|
11
14
|
|
12
15
|
def create_application_interactor
|
13
|
-
template 'application_interactor.erb', Rails.root.join('app',
|
16
|
+
template 'application_interactor.erb', Rails.root.join('app', directory, 'application_interactor.rb')
|
14
17
|
end
|
15
18
|
|
16
19
|
def create_interactor_concerns
|
17
|
-
create_file Rails.root.join('app',
|
20
|
+
create_file Rails.root.join('app', directory, 'concerns', '.keep')
|
18
21
|
end
|
19
22
|
|
20
23
|
def autoload_interactors
|
21
24
|
application do
|
22
25
|
<<~CONFIG
|
23
26
|
# autoload interactors
|
24
|
-
config.autoload_paths += %w[app/#{
|
27
|
+
config.autoload_paths += %w[app/#{directory}]
|
25
28
|
|
26
29
|
CONFIG
|
27
30
|
end
|
@@ -7,9 +7,9 @@ ActiveInteractor.configure do |config|
|
|
7
7
|
config.logger = Rails.logger
|
8
8
|
|
9
9
|
# Set the default directory for interactors
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
# new directory name.
|
10
|
+
<%- if directory != 'interactors' -%>
|
11
|
+
config.dir_name = '<%= directory %>'
|
12
|
+
<%- else -%>
|
14
13
|
# config.dir_name = 'interactors'
|
14
|
+
<%- end -%>
|
15
15
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: activeinteractor
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Aaron Allen
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-
|
11
|
+
date: 2019-09-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activemodel
|
@@ -221,7 +221,6 @@ files:
|
|
221
221
|
- lib/active_interactor/configuration.rb
|
222
222
|
- lib/active_interactor/context.rb
|
223
223
|
- lib/active_interactor/context/attributes.rb
|
224
|
-
- lib/active_interactor/context/errors.rb
|
225
224
|
- lib/active_interactor/error.rb
|
226
225
|
- lib/active_interactor/interactor.rb
|
227
226
|
- lib/active_interactor/interactor/callbacks.rb
|
@@ -237,7 +236,7 @@ files:
|
|
237
236
|
- lib/rails/generators/interactor/rspec_generator.rb
|
238
237
|
- lib/rails/generators/interactor/test_unit_generator.rb
|
239
238
|
- lib/rails/generators/templates/application_interactor.erb
|
240
|
-
- lib/rails/generators/templates/initializer.
|
239
|
+
- lib/rails/generators/templates/initializer.erb
|
241
240
|
- lib/rails/generators/templates/interactor.erb
|
242
241
|
- lib/rails/generators/templates/organizer.erb
|
243
242
|
- lib/rails/generators/templates/rspec.erb
|
@@ -247,10 +246,10 @@ licenses:
|
|
247
246
|
- MIT
|
248
247
|
metadata:
|
249
248
|
bug_tracker_uri: https://github.com/aaronmallen/activeinteractor/issues
|
250
|
-
changelog_uri: https://github.com/aaronmallen/activeinteractor/blob/v0.1.
|
251
|
-
documentation_uri: https://www.rubydoc.info/gems/activeinteractor/0.1.
|
249
|
+
changelog_uri: https://github.com/aaronmallen/activeinteractor/blob/v0.1.7/CHANGELOG.md
|
250
|
+
documentation_uri: https://www.rubydoc.info/gems/activeinteractor/0.1.7
|
252
251
|
hompage_uri: https://github.com/aaronmallen/activeinteractor
|
253
|
-
source_code_uri: https://github.com/aaronmallen/activeinteractor/tree/v0.1.
|
252
|
+
source_code_uri: https://github.com/aaronmallen/activeinteractor/tree/v0.1.7
|
254
253
|
wiki_uri: https://github.com/aaronmallen/activeinteractor/wiki
|
255
254
|
post_install_message:
|
256
255
|
rdoc_options: []
|
@@ -1,28 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module ActiveInteractor
|
4
|
-
module Context
|
5
|
-
# Raised when an interactor context fails
|
6
|
-
#
|
7
|
-
# @deprecated Use {#ActiveInteractor::Error::ContextFailure} instead
|
8
|
-
#
|
9
|
-
# @author Aaron Allen <hello@aaronmallen.me>
|
10
|
-
# @since 0.0.1
|
11
|
-
# @version 0.2
|
12
|
-
#
|
13
|
-
# @!attribute [r] context
|
14
|
-
# @return [Base] an instance of {Base}
|
15
|
-
class Failure < StandardError
|
16
|
-
attr_reader :context
|
17
|
-
|
18
|
-
# A new instance of {Failure}
|
19
|
-
# @param context [ActiveInteractor::Context::Base] an
|
20
|
-
# instance of {ActiveInteractor::Context::Base}
|
21
|
-
# @return [Failure] a new instance of {Failure}
|
22
|
-
def initialize(context = nil)
|
23
|
-
@context = context
|
24
|
-
super
|
25
|
-
end
|
26
|
-
end
|
27
|
-
end
|
28
|
-
end
|