simple_command_dispatcher 4.0.0 → 4.2.0
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 +61 -0
- data/Gemfile +2 -0
- data/Gemfile.lock +45 -20
- data/README.md +408 -262
- data/lib/simple_command_dispatcher/commands/command_callable.rb +104 -0
- data/lib/simple_command_dispatcher/commands/errors.rb +83 -0
- data/lib/simple_command_dispatcher/commands/utils.rb +20 -0
- data/lib/simple_command_dispatcher/configuration.rb +25 -6
- data/lib/simple_command_dispatcher/helpers/camelize.rb +1 -1
- data/lib/simple_command_dispatcher/logger.rb +21 -0
- data/lib/simple_command_dispatcher/services/command_service.rb +31 -31
- data/lib/simple_command_dispatcher/services/options_service.rb +37 -0
- data/lib/simple_command_dispatcher/version.rb +1 -1
- data/lib/simple_command_dispatcher.rb +38 -6
- data/simple_command_dispatcher.gemspec +6 -7
- metadata +19 -14
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f29164d7bff98aa5d0b2aed2e12adf6f4408d06bfa789a142b0cf234f656a95a
|
4
|
+
data.tar.gz: ce2ba1f720a44a1a9ced023a7b2769d2a2702d971a6c0a2643aa5926a2585df4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1a929a3e9025cfa05bab78e9ec0a33fe15d1b2ca0f1e5696bb3cc9a455cf01214f0b0a6cec737e026bc39ad95d356451fc2e25abaeadd38f72d3817d8431335f
|
7
|
+
data.tar.gz: 7f99ae544a0c2d31abfe8126a43d44766acb3eba9cd14298cc4f84fbe46ff3d5fcfda1a4734c4e2cac47b978bf56c8f6c288fbb031f5d5f61d6f4d3f31e0fad8
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,66 @@
|
|
1
1
|
# CHANGELOG
|
2
2
|
|
3
|
+
## Version 4.2.0 - 2025-10-07
|
4
|
+
|
5
|
+
- **New Feature: Configurable Logger with Debug Mode**:
|
6
|
+
|
7
|
+
- Added configurable logger with automatic Rails.logger detection
|
8
|
+
- Introduced debug mode for command execution debugging via `options: { debug: true }`
|
9
|
+
- Logger can be configured via `SimpleCommandDispatcher.configuration.logger`
|
10
|
+
- Added `OptionsService` for managing command execution options
|
11
|
+
- Enhanced `SimpleCommandDispatcher.call` with `options:` parameter to support debug logging
|
12
|
+
- When debug mode is enabled, detailed debug logging shows command execution flow
|
13
|
+
|
14
|
+
- **Test Coverage Improvements**:
|
15
|
+
|
16
|
+
- Achieved 100% test coverage across all modules (243 examples, 0 failures)
|
17
|
+
- Added comprehensive tests for `CommandCallable::Errors` class (15 new tests)
|
18
|
+
- Added comprehensive tests for `CommandCallable::Utils.array_wrap` method (8 new tests)
|
19
|
+
- Added tests for Rails logger auto-detection in configuration
|
20
|
+
- Added tests for debug mode functionality in command execution
|
21
|
+
- Enhanced test coverage for `OptionsService` and logger integration
|
22
|
+
|
23
|
+
- **Documentation Enhancements**:
|
24
|
+
|
25
|
+
- Updated API documentation for `SimpleCommandDispatcher.call` to include `options` parameter
|
26
|
+
- Added comprehensive documentation for `CommandCallable` module with usage examples
|
27
|
+
- Documented all public methods in `Errors` class with examples
|
28
|
+
- Added documentation for `OptionsService` class and debug mode
|
29
|
+
- Enhanced `Configuration` documentation to include logger attribute
|
30
|
+
- Fixed all YARD documentation to accurately reflect current implementation
|
31
|
+
- Added best practice guidance for private `initialize` in CommandCallable commands
|
32
|
+
|
33
|
+
- **Dependency Updates**:
|
34
|
+
|
35
|
+
- Added `irb` and `reline` gems to development dependencies
|
36
|
+
- Addresses Ruby 3.5 deprecation warnings for extracted standard library gems
|
37
|
+
- Rails 8 compatibility confirmed (supports ActiveSupport 8.x)
|
38
|
+
|
39
|
+
## Version 4.1.0 - 2025-07-14
|
40
|
+
|
41
|
+
- **New Feature: CommandCallable Module**:
|
42
|
+
|
43
|
+
- Introduced `SimpleCommandDispatcher::Commands::CommandCallable` module for standardizing command classes
|
44
|
+
- Provides automatic `.call` class method generation that instantiates and calls your command
|
45
|
+
- Built-in success/failure tracking with `success?` and `failure?` methods based on error state
|
46
|
+
- Automatic result tracking - command return values stored in `command.result`
|
47
|
+
- Consistent error handling with built-in `errors` object for error collection and management
|
48
|
+
- Call tracking to ensure methods work correctly and commands are properly executed
|
49
|
+
- Completely optional but recommended for building robust, maintainable commands
|
50
|
+
|
51
|
+
- **Enhanced Documentation**:
|
52
|
+
|
53
|
+
- Major README.md overhaul with real-world examples showcasing dynamic command execution
|
54
|
+
- Added comprehensive examples demonstrating convention over configuration approach
|
55
|
+
- Included versioned API command examples (V1 vs V2) showing practical usage patterns
|
56
|
+
- Added controller examples showing how to use `request.path` and `params` for dynamic routing
|
57
|
+
- Enhanced payment processing example with proper error handling and rescue patterns
|
58
|
+
- Added efficient database query examples using ActiveRecord scopes
|
59
|
+
- Improved parameter handling documentation showing kwargs vs single hash approaches
|
60
|
+
- Added alternative command splitting approach for more granular control
|
61
|
+
- Updated all examples to use `command` variable instead of `result` for clarity
|
62
|
+
- Added custom command guidance for users who prefer to roll their own implementations
|
63
|
+
|
3
64
|
## Version 4.0.0 - 2025-07-12
|
4
65
|
|
5
66
|
- **Documentation Overhaul**:
|
data/Gemfile
CHANGED
@@ -10,7 +10,9 @@ gem 'colorize', '>= 0.8.1', '< 2.0'
|
|
10
10
|
gem 'rake', '>= 13.0', '< 14.0'
|
11
11
|
|
12
12
|
group :development do
|
13
|
+
gem 'irb', '>= 1.0'
|
13
14
|
gem 'pry-byebug', '>= 3.9', '< 4.0'
|
15
|
+
gem 'reline', '>= 0.3'
|
14
16
|
gem 'rubocop', '>= 1.62', '< 2.0'
|
15
17
|
gem 'rubocop-performance', '>= 1.20', '< 2.0'
|
16
18
|
gem 'rubocop-rake', '>= 0.6', '< 1.0'
|
data/Gemfile.lock
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
simple_command_dispatcher (4.
|
5
|
-
activesupport (>= 7.0.8, <
|
4
|
+
simple_command_dispatcher (4.2.0)
|
5
|
+
activesupport (>= 7.0.8, < 9.0)
|
6
6
|
|
7
7
|
GEM
|
8
8
|
remote: https://rubygems.org/
|
9
9
|
specs:
|
10
|
-
activesupport (
|
10
|
+
activesupport (8.0.3)
|
11
11
|
base64
|
12
12
|
benchmark (>= 0.3)
|
13
13
|
bigdecimal
|
@@ -19,41 +19,61 @@ GEM
|
|
19
19
|
minitest (>= 5.1)
|
20
20
|
securerandom (>= 0.3)
|
21
21
|
tzinfo (~> 2.0, >= 2.0.5)
|
22
|
+
uri (>= 0.13.1)
|
22
23
|
ast (2.4.3)
|
23
24
|
base64 (0.3.0)
|
24
25
|
benchmark (0.4.1)
|
25
|
-
bigdecimal (3.
|
26
|
+
bigdecimal (3.3.0)
|
26
27
|
byebug (12.0.0)
|
27
28
|
coderay (1.1.3)
|
28
29
|
colorize (1.1.0)
|
29
30
|
concurrent-ruby (1.3.5)
|
30
|
-
connection_pool (2.5.
|
31
|
+
connection_pool (2.5.4)
|
32
|
+
date (3.4.1)
|
31
33
|
diff-lcs (1.6.2)
|
32
34
|
docile (1.4.1)
|
33
35
|
drb (2.2.3)
|
36
|
+
erb (5.0.3)
|
34
37
|
i18n (1.14.7)
|
35
38
|
concurrent-ruby (~> 1.0)
|
36
|
-
|
39
|
+
io-console (0.8.1)
|
40
|
+
irb (1.15.2)
|
41
|
+
pp (>= 0.6.0)
|
42
|
+
rdoc (>= 4.0.0)
|
43
|
+
reline (>= 0.4.2)
|
44
|
+
json (2.15.1)
|
37
45
|
language_server-protocol (3.17.0.5)
|
38
46
|
lint_roller (1.1.0)
|
39
47
|
logger (1.7.0)
|
40
48
|
method_source (1.1.0)
|
41
49
|
minitest (5.25.5)
|
42
50
|
parallel (1.27.0)
|
43
|
-
parser (3.3.
|
51
|
+
parser (3.3.9.0)
|
44
52
|
ast (~> 2.4.1)
|
45
53
|
racc
|
46
|
-
|
54
|
+
pp (0.6.3)
|
55
|
+
prettyprint
|
56
|
+
prettyprint (0.2.0)
|
57
|
+
prism (1.5.1)
|
47
58
|
pry (0.15.2)
|
48
59
|
coderay (~> 1.1)
|
49
60
|
method_source (~> 1.0)
|
50
61
|
pry-byebug (3.11.0)
|
51
62
|
byebug (~> 12.0)
|
52
63
|
pry (>= 0.13, < 0.16)
|
64
|
+
psych (5.2.6)
|
65
|
+
date
|
66
|
+
stringio
|
53
67
|
racc (1.8.1)
|
54
68
|
rainbow (3.1.1)
|
55
69
|
rake (13.3.0)
|
56
|
-
|
70
|
+
rdoc (6.15.0)
|
71
|
+
erb
|
72
|
+
psych (>= 4.0.0)
|
73
|
+
tsort
|
74
|
+
regexp_parser (2.11.3)
|
75
|
+
reline (0.6.2)
|
76
|
+
io-console (~> 0.5)
|
57
77
|
rspec (3.13.1)
|
58
78
|
rspec-core (~> 3.13.0)
|
59
79
|
rspec-expectations (~> 3.13.0)
|
@@ -66,8 +86,8 @@ GEM
|
|
66
86
|
rspec-mocks (3.13.5)
|
67
87
|
diff-lcs (>= 1.2.0, < 2.0)
|
68
88
|
rspec-support (~> 3.13.0)
|
69
|
-
rspec-support (3.13.
|
70
|
-
rubocop (1.
|
89
|
+
rspec-support (3.13.6)
|
90
|
+
rubocop (1.81.1)
|
71
91
|
json (~> 2.3)
|
72
92
|
language_server-protocol (~> 3.17.0.2)
|
73
93
|
lint_roller (~> 1.1.0)
|
@@ -75,20 +95,20 @@ GEM
|
|
75
95
|
parser (>= 3.3.0.2)
|
76
96
|
rainbow (>= 2.2.2, < 4.0)
|
77
97
|
regexp_parser (>= 2.9.3, < 3.0)
|
78
|
-
rubocop-ast (>= 1.
|
98
|
+
rubocop-ast (>= 1.47.1, < 2.0)
|
79
99
|
ruby-progressbar (~> 1.7)
|
80
100
|
unicode-display_width (>= 2.4.0, < 4.0)
|
81
|
-
rubocop-ast (1.
|
101
|
+
rubocop-ast (1.47.1)
|
82
102
|
parser (>= 3.3.7.2)
|
83
103
|
prism (~> 1.4)
|
84
|
-
rubocop-performance (1.
|
104
|
+
rubocop-performance (1.26.0)
|
85
105
|
lint_roller (~> 1.1)
|
86
106
|
rubocop (>= 1.75.0, < 2.0)
|
87
|
-
rubocop-ast (>= 1.
|
107
|
+
rubocop-ast (>= 1.44.0, < 2.0)
|
88
108
|
rubocop-rake (0.7.1)
|
89
109
|
lint_roller (~> 1.1)
|
90
110
|
rubocop (>= 1.72.1)
|
91
|
-
rubocop-rspec (3.
|
111
|
+
rubocop-rspec (3.7.0)
|
92
112
|
lint_roller (~> 1.1)
|
93
113
|
rubocop (~> 1.72, >= 1.72.1)
|
94
114
|
ruby-progressbar (1.13.0)
|
@@ -97,13 +117,16 @@ GEM
|
|
97
117
|
docile (~> 1.1)
|
98
118
|
simplecov-html (~> 0.11)
|
99
119
|
simplecov_json_formatter (~> 0.1)
|
100
|
-
simplecov-html (0.13.
|
120
|
+
simplecov-html (0.13.2)
|
101
121
|
simplecov_json_formatter (0.1.4)
|
122
|
+
stringio (3.1.7)
|
123
|
+
tsort (0.2.0)
|
102
124
|
tzinfo (2.0.6)
|
103
125
|
concurrent-ruby (~> 1.0)
|
104
|
-
unicode-display_width (3.
|
105
|
-
unicode-emoji (~> 4.
|
106
|
-
unicode-emoji (4.0
|
126
|
+
unicode-display_width (3.2.0)
|
127
|
+
unicode-emoji (~> 4.1)
|
128
|
+
unicode-emoji (4.1.0)
|
129
|
+
uri (1.0.4)
|
107
130
|
|
108
131
|
PLATFORMS
|
109
132
|
arm64-darwin-22
|
@@ -118,8 +141,10 @@ PLATFORMS
|
|
118
141
|
DEPENDENCIES
|
119
142
|
bundler (~> 2.5, >= 2.5.3)
|
120
143
|
colorize (>= 0.8.1, < 2.0)
|
144
|
+
irb (>= 1.0)
|
121
145
|
pry-byebug (>= 3.9, < 4.0)
|
122
146
|
rake (>= 13.0, < 14.0)
|
147
|
+
reline (>= 0.3)
|
123
148
|
rspec (>= 3.10, < 4.0)
|
124
149
|
rubocop (>= 1.62, < 2.0)
|
125
150
|
rubocop-performance (>= 1.20, < 2.0)
|