activeinteractor 0.1.1 → 0.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +10 -3
- data/lib/active_interactor/base.rb +1 -0
- data/lib/active_interactor/configuration.rb +5 -2
- data/lib/active_interactor/interactor/execution.rb +1 -7
- data/lib/active_interactor/organizer.rb +3 -1
- data/lib/active_interactor/version.rb +1 -1
- data/lib/rails/generators/active_interactor/install_generator.rb +4 -4
- data/lib/rails/generators/active_interactor.rb +5 -1
- data/lib/rails/generators/interactor/interactor_generator.rb +1 -1
- data/lib/rails/generators/interactor/organizer_generator.rb +1 -1
- data/lib/rails/generators/interactor/rspec_generator.rb +1 -1
- data/lib/rails/generators/interactor/test_unit_generator.rb +1 -1
- data/lib/rails/generators/templates/initializer.rb +7 -0
- metadata +5 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e933d8615e2b55bf47049e291b801193e2341b03e3c0a29bb8d8f7c8166adee3
|
4
|
+
data.tar.gz: afc759ee08f37bbbba50e2ac6c1508afb0d303c0f37ca5cdfcf75d6347e210b0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8edc74485608e067bb6e9e9df3a19d9c0651df4351c9e56239b41ce1fb39fa4d7595e08366799fcbcfa79390e0fe1a1f1b0a652e01f8855905d93dcc53d05b69
|
7
|
+
data.tar.gz: 0d8b82c2ebfce20b413a4563eb0244081b1ca3910186de9ad9880cc246408df68e282ef0ec21adb4f89eda7947fe79c62555f1c24c8795a08dff15bd7dec621d
|
data/CHANGELOG.md
CHANGED
@@ -7,12 +7,18 @@ and this project adheres to [Semantic Versioning].
|
|
7
7
|
|
8
8
|
## [Unreleased]
|
9
9
|
|
10
|
+
## [v0.1.2] - 2019-04-01
|
11
|
+
|
12
|
+
### Added
|
13
|
+
|
14
|
+
- #22: Allow the directory interactors are generated in to be configurable
|
15
|
+
|
10
16
|
## [v0.1.1] - 2019-03-30
|
11
17
|
|
12
18
|
### Fixed
|
13
19
|
|
14
|
-
- #15: NameError (uninitialized constant ActiveInteractor::Organizer)
|
15
|
-
- #16: NoMethodError (undefined method `merge
|
20
|
+
- #15: `NameError` (uninitialized constant `ActiveInteractor::Organizer`)
|
21
|
+
- #16: `NoMethodError` (undefined method `merge` for `ActiveInteractor::Context::Base`)
|
16
22
|
|
17
23
|
## v0.1.0 - 2019-03-30
|
18
24
|
|
@@ -21,5 +27,6 @@ and this project adheres to [Semantic Versioning].
|
|
21
27
|
[Keep a Changelog]: https://keepachangelog.com/en/1.0.0/
|
22
28
|
[Semantic Versioning]: https://semver.org/spec/v2.0.0.html
|
23
29
|
|
24
|
-
[Unreleased]: https://github.com/aaronmallen/activeinteractor/compare/v0.1.
|
30
|
+
[Unreleased]: https://github.com/aaronmallen/activeinteractor/compare/v0.1.2...HEAD
|
31
|
+
[v0.1.2]: https://github.com/aaronmallen/activeinteractor/compare/v0.1.1...v0.1.2
|
25
32
|
[v0.1.1]: https://github.com/aaronmallen/activeinteractor/compare/v0.1.0...v0.1.1
|
@@ -12,11 +12,14 @@ module ActiveInteractor
|
|
12
12
|
class Configuration
|
13
13
|
# The default configuration options for {Configuration}
|
14
14
|
# @return [Hash{Symbol => *}]
|
15
|
+
# * :logger - The Logger instance to use for logging
|
16
|
+
# * :dir_name - The directory interactors are generated in
|
15
17
|
DEFAULTS = {
|
16
|
-
logger: Logger.new(STDOUT)
|
18
|
+
logger: Logger.new(STDOUT),
|
19
|
+
dir_name: 'interactors'
|
17
20
|
}.freeze
|
18
21
|
|
19
|
-
attr_accessor :logger
|
22
|
+
attr_accessor :logger, :dir_name
|
20
23
|
|
21
24
|
# A new instance of {Configuration}
|
22
25
|
# @param options [Hash{Symbol => *}] the options to initialize the
|
@@ -5,14 +5,8 @@ module ActiveInteractor
|
|
5
5
|
module Execution
|
6
6
|
extend ActiveSupport::Concern
|
7
7
|
|
8
|
-
DELEGATED_WORKER_METHODS = %i[
|
9
|
-
execute_perform
|
10
|
-
execute_perform!
|
11
|
-
execute_rollback
|
12
|
-
].freeze
|
13
|
-
|
14
8
|
included do
|
15
|
-
delegate
|
9
|
+
delegate :execute_perform, :execute_perform!, :execute_rollback, to: :worker
|
16
10
|
end
|
17
11
|
|
18
12
|
private
|
@@ -38,7 +38,9 @@ module ActiveInteractor
|
|
38
38
|
# in favor of this default implementation.
|
39
39
|
def perform
|
40
40
|
self.class.organized.each do |interactor|
|
41
|
-
self.context = interactor.new(context)
|
41
|
+
self.context = interactor.new(context)
|
42
|
+
.tap(&:skip_clean_context!)
|
43
|
+
.execute_perform!
|
42
44
|
end
|
43
45
|
end
|
44
46
|
end
|
@@ -6,22 +6,22 @@ module ActiveInteractor
|
|
6
6
|
module Generators
|
7
7
|
class InstallGenerator < Base
|
8
8
|
def create_initializer
|
9
|
-
template 'initializer.rb',
|
9
|
+
template 'initializer.rb', Rails.root.join('config', 'initializers', 'active_interactor.rb')
|
10
10
|
end
|
11
11
|
|
12
12
|
def create_application_interactor
|
13
|
-
template 'application_interactor.erb',
|
13
|
+
template 'application_interactor.erb', Rails.root.join('app', app_dir_name, 'application_interactor.rb')
|
14
14
|
end
|
15
15
|
|
16
16
|
def create_interactor_concerns
|
17
|
-
create_file 'app
|
17
|
+
create_file Rails.root.join('app', app_dir_name, 'concerns', '.keep')
|
18
18
|
end
|
19
19
|
|
20
20
|
def autoload_interactors
|
21
21
|
application do
|
22
22
|
<<~CONFIG
|
23
23
|
# autoload interactors
|
24
|
-
config.autoload_paths += %w[app
|
24
|
+
config.autoload_paths += %w[app/#{app_dir_name}]
|
25
25
|
|
26
26
|
CONFIG
|
27
27
|
end
|
@@ -11,7 +11,7 @@ module ActiveInteractor
|
|
11
11
|
extend ActiveSupport::Concern
|
12
12
|
|
13
13
|
class_methods do
|
14
|
-
def
|
14
|
+
def base_root
|
15
15
|
__dir__
|
16
16
|
end
|
17
17
|
|
@@ -19,6 +19,10 @@ module ActiveInteractor
|
|
19
19
|
File.expand_path('templates', __dir__)
|
20
20
|
end
|
21
21
|
end
|
22
|
+
|
23
|
+
def app_dir_name
|
24
|
+
ActiveInteractor.configuration.dir_name
|
25
|
+
end
|
22
26
|
end
|
23
27
|
|
24
28
|
class Base < ::Rails::Generators::Base
|
@@ -6,7 +6,7 @@ class InteractorGenerator < ActiveInteractor::Generators::NamedBase
|
|
6
6
|
desc 'Generate an interactor'
|
7
7
|
|
8
8
|
def create_interactor
|
9
|
-
template 'interactor.erb',
|
9
|
+
template 'interactor.erb', Rails.root.join('app', app_dir_name, File.join(class_path), "#{file_name}.rb")
|
10
10
|
end
|
11
11
|
|
12
12
|
hook_for :test_framework, in: :interactor
|
@@ -9,7 +9,7 @@ module Interactor
|
|
9
9
|
argument :interactors, type: :array, default: [], banner: 'name name'
|
10
10
|
|
11
11
|
def create_organizer
|
12
|
-
template 'organizer.erb',
|
12
|
+
template 'organizer.erb', Rails.root.join('app', app_dir_name, File.join(class_path), "#{file_name}.rb")
|
13
13
|
end
|
14
14
|
|
15
15
|
hook_for :test_framework, in: :interactor
|
@@ -8,7 +8,7 @@ module Interactor
|
|
8
8
|
desc 'Generate an interactor spec'
|
9
9
|
|
10
10
|
def create_spec
|
11
|
-
template 'rspec.erb',
|
11
|
+
template 'rspec.erb', Rails.root.join('spec', app_dir_name, File.join(class_path), "#{file_name}_spec.rb")
|
12
12
|
end
|
13
13
|
end
|
14
14
|
end
|
@@ -8,7 +8,7 @@ module Interactor
|
|
8
8
|
desc 'Generate an interactor unit test'
|
9
9
|
|
10
10
|
def create_test
|
11
|
-
template 'test_unit.erb',
|
11
|
+
template 'test_unit.erb', Rails.root.join('test', app_dir_name, File.join(class_path), "#{file_name}_test.rb")
|
12
12
|
end
|
13
13
|
end
|
14
14
|
end
|
@@ -5,4 +5,11 @@ require 'active_interactor'
|
|
5
5
|
ActiveInteractor.configure do |config|
|
6
6
|
# Set the ActiveInteractor.logger to Rails.logger
|
7
7
|
config.logger = Rails.logger
|
8
|
+
|
9
|
+
# Set the default directory for interactors
|
10
|
+
# NOTE: if this is changed after `active_interactor:install`
|
11
|
+
# is generated you will need to update
|
12
|
+
# config/application.rb autoload paths with the
|
13
|
+
# new directory name.
|
14
|
+
# config.dir_name = 'interactors'
|
8
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.2
|
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-04-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activemodel
|
@@ -244,10 +244,10 @@ licenses:
|
|
244
244
|
- MIT
|
245
245
|
metadata:
|
246
246
|
bug_tracker_uri: https://github.com/aaronmallen/activeinteractor/issues
|
247
|
-
changelog_uri: https://github.com/aaronmallen/activeinteractor/blob/v0.1.
|
248
|
-
documentation_uri: https://www.rubydoc.info/gems/activeinteractor/0.1.
|
247
|
+
changelog_uri: https://github.com/aaronmallen/activeinteractor/blob/v0.1.2/CHANGELOG.md
|
248
|
+
documentation_uri: https://www.rubydoc.info/gems/activeinteractor/0.1.2
|
249
249
|
hompage_uri: https://github.com/aaronmallen/activeinteractor
|
250
|
-
source_code_uri: https://github.com/aaronmallen/activeinteractor/tree/v0.1.
|
250
|
+
source_code_uri: https://github.com/aaronmallen/activeinteractor/tree/v0.1.2
|
251
251
|
wiki_uri: https://github.com/aaronmallen/activeinteractor/wiki
|
252
252
|
post_install_message:
|
253
253
|
rdoc_options: []
|