lib/convenient_service/configs/standard.rb in convenient_service-0.7.0 vs lib/convenient_service/configs/standard.rb in convenient_service-0.8.0
- old
+ new
@@ -1,223 +1,135 @@
# frozen_string_literal: true
module ConvenientService
module Configs
+ ##
+ # Default configuration for the user-defined services.
+ #
module Standard
include Support::Concern
##
- # IMPORTANT: Order of plugins matters.
+ # @internal
+ # IMPORTANT: Order of plugins matters.
#
- # NOTE: `class_exec` (that is used under the hood by `included`) defines `class Result` in the global namespace.
- # That is why `class self::Result` is used.
+ # NOTE: `class_exec` (that is used under the hood by `included`) defines `class Result` in the global namespace.
+ # That is why `class self::Result` is used.
+ # - https://stackoverflow.com/a/51965126/12201472
#
- # https://stackoverflow.com/a/51965126/12201472
- #
# rubocop:disable Lint/ConstantDefinitionInBlock
included do
- include Core
+ include Configs::Minimal
concerns do
- use Plugins::Common::HasInternals::Concern
- use Plugins::Common::HasConstructor::Concern
- use Plugins::Common::HasConstructorWithoutInitialize::Concern
-
use Plugins::Common::CachesConstructorParams::Concern
use Plugins::Common::CanBeCopied::Concern
- use Plugins::Service::HasResult::Concern
- use Plugins::Service::HasResultShortSyntax::Concern
- use Plugins::Service::HasResultSteps::Concern
use Plugins::Service::CanRecalculateResult::Concern
+ use Plugins::Service::HasResultShortSyntax::Concern
use Plugins::Service::HasResultStatusCheckShortSyntax::Concern
use Plugins::Common::HasCallbacks::Concern
use Plugins::Common::HasAroundCallbacks::Concern
-
- use Plugins::Service::HasInspect::Concern
end
middlewares :initialize do
- use Plugins::Common::NormalizesEnv::Middleware
-
use Plugins::Common::CachesConstructorParams::Middleware
end
middlewares :result do
- use Plugins::Common::NormalizesEnv::Middleware
+ insert_before \
+ Plugins::Service::HasResult::Middleware,
+ Plugins::Common::HasCallbacks::Middleware
- use Plugins::Common::HasCallbacks::Middleware
- use Plugins::Common::HasAroundCallbacks::Middleware
+ insert_after \
+ Plugins::Common::HasCallbacks::Middleware,
+ Plugins::Common::HasAroundCallbacks::Middleware
- use Plugins::Service::HasResult::Middleware
- use Plugins::Service::HasResultSteps::Middleware
-
use Plugins::Service::RaisesOnDoubleResult::Middleware
use Plugins::Common::CachesReturnValue::Middleware
end
middlewares :step do
- use Plugins::Common::NormalizesEnv::Middleware
-
use Plugins::Common::HasCallbacks::Middleware
use Plugins::Common::HasAroundCallbacks::Middleware
end
middlewares :success do
- use Plugins::Common::NormalizesEnv::Middleware
-
use Plugins::Service::HasResultShortSyntax::Success::Middleware
end
middlewares :failure do
- use Plugins::Common::NormalizesEnv::Middleware
-
use Plugins::Service::HasResultShortSyntax::Failure::Middleware
end
middlewares :error do
- use Plugins::Common::NormalizesEnv::Middleware
-
use Plugins::Service::HasResultShortSyntax::Error::Middleware
end
- middlewares :result, scope: :class do
- use Plugins::Common::NormalizesEnv::Middleware
- end
-
middlewares :step, scope: :class do
- use Plugins::Common::NormalizesEnv::Middleware
-
use Plugins::Service::HasResultMethodSteps::Middleware
end
- class self::Internals
- include Core
-
- concerns do
- use Plugins::Internals::HasCache::Concern
- end
- end
-
class self::Result
- include Core
-
concerns do
- use Plugins::Common::HasInternals::Concern
- use Plugins::Common::HasConstructor::Concern
-
- use Plugins::Result::HasJsendStatusAndAttributes::Concern
-
use Plugins::Result::HasResultShortSyntax::Concern
use Plugins::Result::CanRecalculateResult::Concern
use Plugins::Result::HasStep::Concern
use Plugins::Result::CanHaveParentResult::Concern
-
- use Plugins::Result::HasInspect::Concern
end
middlewares :initialize do
- use Plugins::Common::NormalizesEnv::Middleware
-
- use Plugins::Result::HasJsendStatusAndAttributes::Middleware
-
use Plugins::Result::HasStep::Initialize::Middleware
use Plugins::Result::CanHaveParentResult::Initialize::Middleware
end
middlewares :success? do
- use Plugins::Common::NormalizesEnv::Middleware
-
use Plugins::Result::MarksResultStatusAsChecked::Middleware
end
middlewares :failure? do
- use Plugins::Common::NormalizesEnv::Middleware
-
use Plugins::Result::MarksResultStatusAsChecked::Middleware
end
middlewares :error? do
- use Plugins::Common::NormalizesEnv::Middleware
-
use Plugins::Result::MarksResultStatusAsChecked::Middleware
end
middlewares :not_success? do
- use Plugins::Common::NormalizesEnv::Middleware
-
use Plugins::Result::MarksResultStatusAsChecked::Middleware
end
middlewares :not_failure? do
- use Plugins::Common::NormalizesEnv::Middleware
-
use Plugins::Result::MarksResultStatusAsChecked::Middleware
end
middlewares :not_error? do
- use Plugins::Common::NormalizesEnv::Middleware
-
use Plugins::Result::MarksResultStatusAsChecked::Middleware
end
middlewares :data do
- use Plugins::Common::NormalizesEnv::Middleware
-
use Plugins::Result::RaisesOnNotCheckedResultStatus::Middleware
end
middlewares :message do
- use Plugins::Common::NormalizesEnv::Middleware
-
use Plugins::Result::RaisesOnNotCheckedResultStatus::Middleware
end
middlewares :code do
- use Plugins::Common::NormalizesEnv::Middleware
-
use Plugins::Result::RaisesOnNotCheckedResultStatus::Middleware
end
middlewares :to_kwargs do
- use Plugins::Common::NormalizesEnv::Middleware
-
use Plugins::Result::HasStep::ToKwargs::Middleware
use Plugins::Result::CanHaveParentResult::ToKwargs::Middleware
end
-
- class self::Internals
- include Core
-
- concerns do
- use Plugins::Internals::HasCache::Concern
- end
- end
end
class self::Step
- include Core
-
- concerns do
- use Plugins::Common::HasInternals::Concern
-
- use Plugins::Step::HasInspect::Concern
- end
-
middlewares :calculate_result do
- use Plugins::Common::NormalizesEnv::Middleware
-
use Plugins::Step::CanHaveParentResult::Middleware
- end
-
- class self::Internals
- include Core
-
- concerns do
- use Plugins::Internals::HasCache::Concern
- end
end
end
if Dependencies.rspec.loaded?
concerns do