toolx 0.2.1 → 0.2.3
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/lib/tasks/types.rake +16 -0
- data/lib/templates/types.rb +4 -0
- data/lib/toolx/core/operation/flow.rb +8 -7
- data/lib/toolx/core/operation/params_wrapper.rb +2 -0
- data/lib/toolx/core/operation/response_wrapper.rb +2 -0
- data/lib/toolx/version.rb +1 -1
- data/lib/toolx.rb +1 -0
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ab4f3af6bd6512a1a0db4eb3f0d24b0ab12d07b46150bf481862fd7c0b0a76ee
|
4
|
+
data.tar.gz: d1f3c32d678d96285cb683c146372437ae2a00000483019876bec3e0d53cc3a1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 91a3d2d5726133924461dadcde633c1121b94b694c94f7b27842edf7acbea8bc2549fe1c0232df5484c59a13cfa1687a43eb86b55153a5bb1c9c3f8afd8139af
|
7
|
+
data.tar.gz: 06ac13ddeebfb93c702daf6e809f76a248622ed1d9036561f4927b19439ef9553493c2850bf015a90aa5b265ea2c31402d8150b1db5fcecd0774cec250218e0e
|
@@ -0,0 +1,16 @@
|
|
1
|
+
namespace :toolx do
|
2
|
+
namespace :types do
|
3
|
+
desc 'Generate types.rb initializer for custom types (operations, etc.)'
|
4
|
+
task :generate do
|
5
|
+
file_name = Rails.root.join('config', 'initializers', 'types.rb')
|
6
|
+
next puts "Already executed" if File.exist?(file_name)
|
7
|
+
|
8
|
+
template_root_path = File.expand_path("../templates", __dir__)
|
9
|
+
source_file_name = 'types.rb'
|
10
|
+
source = File.read(File.join(template_root_path, source_file_name), trim_mode: '-')
|
11
|
+
File.write(Rails.root.join(file_name).to_s, source)
|
12
|
+
|
13
|
+
puts "Types generated at #{Pathname.new(file_name).relative_path_from(Rails.root)}"
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
@@ -1,3 +1,5 @@
|
|
1
|
+
require_relative '../errors/nested_standard_error'
|
2
|
+
|
1
3
|
module Toolx::Core::Operation::Flow
|
2
4
|
def self.included(base)
|
3
5
|
base.send(:extend, ClassMethods)
|
@@ -15,7 +17,7 @@ module Toolx::Core::Operation::Flow
|
|
15
17
|
end
|
16
18
|
|
17
19
|
class Executor
|
18
|
-
ExecutorError = Class.new(
|
20
|
+
ExecutorError = Class.new(::Toolx::Core::Errors::NestedStandardError)
|
19
21
|
OperationAlreadyInitialized = Class.new(ExecutorError)
|
20
22
|
OperationNotInitialized = Class.new(ExecutorError)
|
21
23
|
|
@@ -192,7 +194,11 @@ module Toolx::Core::Operation::Flow
|
|
192
194
|
action = actions[kind]
|
193
195
|
|
194
196
|
if action.is_a?(Symbol) && bind_object
|
195
|
-
arity =
|
197
|
+
arity = begin
|
198
|
+
bind_object.method(action).arity
|
199
|
+
rescue NameError => e
|
200
|
+
raise ExecutorError, "Action '#{action}' not found in #{bind_object.class.name}. Details: #{e.message}"
|
201
|
+
end
|
196
202
|
case arity
|
197
203
|
when 0 then bind_object.send(action)
|
198
204
|
when 1 then bind_object.send(action, response)
|
@@ -205,11 +211,6 @@ module Toolx::Core::Operation::Flow
|
|
205
211
|
else action.call(response, self)
|
206
212
|
end
|
207
213
|
end
|
208
|
-
|
209
|
-
# bind_object.send(action, self) if action.is_a?(Symbol) && bind_object
|
210
|
-
# action.call(self) if action.is_a?(Proc)
|
211
|
-
rescue NameError => e
|
212
|
-
raise ExecutorError, "Action '#{action}' not found in #{bind_object.class.name}" if bind_object
|
213
214
|
end
|
214
215
|
|
215
216
|
def execute_actions
|
data/lib/toolx/version.rb
CHANGED
data/lib/toolx.rb
CHANGED
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: toolx
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Pawel Niemczyk
|
8
8
|
bindir: exe
|
9
9
|
cert_chain: []
|
10
|
-
date: 2025-06-
|
10
|
+
date: 2025-06-30 00:00:00.000000000 Z
|
11
11
|
dependencies:
|
12
12
|
- !ruby/object:Gem::Dependency
|
13
13
|
name: statesman
|
@@ -281,10 +281,12 @@ files:
|
|
281
281
|
- lib/tasks/aliases.rake
|
282
282
|
- lib/tasks/annotate_rb.rake
|
283
283
|
- lib/tasks/stateman.rake
|
284
|
+
- lib/tasks/types.rake
|
284
285
|
- lib/templates/.annotaterb.yml
|
285
286
|
- lib/templates/stateman/migration.rb.erb
|
286
287
|
- lib/templates/stateman/state_machine.rb.erb
|
287
288
|
- lib/templates/stateman/transition.rb.erb
|
289
|
+
- lib/templates/types.rb
|
288
290
|
- lib/toolx.rb
|
289
291
|
- lib/toolx/core/concerns/custom_identifier.rb
|
290
292
|
- lib/toolx/core/concerns/date_time_to_boolean.rb
|