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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 6fc01244224cb4f82dd203b789591041faf4d0e155236d2aa68a1f6df3b418d8
4
- data.tar.gz: 77e069e564822a8a91050bac2bba8b3e76d4c36c460852fa29219af9e7c4a32c
3
+ metadata.gz: ab4f3af6bd6512a1a0db4eb3f0d24b0ab12d07b46150bf481862fd7c0b0a76ee
4
+ data.tar.gz: d1f3c32d678d96285cb683c146372437ae2a00000483019876bec3e0d53cc3a1
5
5
  SHA512:
6
- metadata.gz: b6cf65409dfd5aebac40a2ce888ebc2cd71d426849df88624323d6a7dc8f2c6dd25317852d320dee7036930841dd3bc8d92584af7b5607dfb78b2104252d1d6b
7
- data.tar.gz: 1c67d81bd13da36a9e3c745939f006119fdf8f03449cdf069fada40901b9e460c054b77979d1d79d907eb42b01073756fa0336c3fe3c2b258d77a837a18d8986
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
@@ -0,0 +1,4 @@
1
+ require 'dry-types'
2
+ module Types
3
+ include Dry.Types()
4
+ 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(StandardError)
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 = bind_object.method(action).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
@@ -1,3 +1,5 @@
1
+ require 'dry-struct'
2
+
1
3
  module Toolx::Core::Operation::ParamsWrapper
2
4
  def initialize(*args, **kwargs)
3
5
  params = args.first.nil? ? kwargs : args.first
@@ -1,3 +1,5 @@
1
+ require 'dry-struct'
2
+
1
3
  module Toolx::Core::Operation::ResponseWrapper
2
4
  def perform(*args, **params)
3
5
  response = if args.present? || params.present?
data/lib/toolx/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Toolx
4
- VERSION = '0.2.1'
4
+ VERSION = '0.2.3'
5
5
  end
data/lib/toolx.rb CHANGED
@@ -27,4 +27,5 @@ if defined?(Rake)
27
27
  load "#{spec.gem_dir}/lib/tasks/stateman.rake"
28
28
  load "#{spec.gem_dir}/lib/tasks/annotate_rb.rake"
29
29
  load "#{spec.gem_dir}/lib/tasks/aliases.rake"
30
+ load "#{spec.gem_dir}/lib/tasks/types.rake"
30
31
  end
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.1
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-26 00:00:00.000000000 Z
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