simple_command_dispatcher 3.0.4 → 4.0.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: affdce217794089694d86418bdc80a5901dbe7621498e9498b044250e49c6d1c
4
- data.tar.gz: 269ae817ca4bb2b199daba300bbce52f3aacce51d262d81f5a17171394218564
3
+ metadata.gz: 0144dd27d6c3f36427f08f5c44d12960a2a3d3807b08cad71ea1599ea13e8c32
4
+ data.tar.gz: 7c8505c9dda676c57695c1860972b5bbe3ad693b14e3c69e0468fda3292b7a62
5
5
  SHA512:
6
- metadata.gz: 6f229d94273cc3a072be9e9f1ed212c4fc50d0cc914e9ac425776912cdbdceaa706fcb80f26711317796fdade20fe6c6ad94a6bdcf39daebd4837d3825f24cef
7
- data.tar.gz: ab780c6fb47d74dede8675fafd9cf381f41d6307f1800bc65996b9392a0a358a226f676975006db90a4f2094fcb82671308582918f2867e9e2dc4a943dd0c427
6
+ metadata.gz: afaa936a89c964a9463652cdfc46c50e0c040ce6f57cf2c4b30ffe08f500ebc00ebf7947162c65894301e008776d8c10508353a684e1d6dc060c3dfdc4ef15ed
7
+ data.tar.gz: d9497737a1f54a2b43d2dbd54809c8af707da645ba7ef2aace3dc9706a31db051bbe002df484a79525d940c97be3a00bc609f6879434205ef46bf7763b74874c
@@ -1,40 +1,62 @@
1
- # This workflow uses actions that are not certified by GitHub.
2
- # They are provided by a third-party and are governed by
3
- # separate terms of service, privacy policy, and support
4
- # documentation.
5
- # This workflow will download a prebuilt Ruby version, install dependencies and run tests with Rake.
6
- # For more information see: https://github.com/marketplace/actions/setup-ruby-jruby-and-truffleruby
7
-
8
1
  name: Ruby
9
2
 
10
3
  on:
11
4
  push:
12
- branches: [ "main" ]
5
+ branches: ["main"]
13
6
  pull_request:
14
- branches: [ "main" ]
7
+ branches: ["main"]
15
8
 
16
9
  permissions:
17
10
  contents: read
18
11
 
19
12
  jobs:
20
13
  test:
21
-
22
- runs-on: ubuntu-latest
14
+ runs-on: ${{ matrix.os }}
23
15
  strategy:
24
16
  matrix:
25
- # Use `rbenv install -l` and only use the latest stable
26
- # version of ruby.
27
- ruby-version: ["3.0.1", "3.0.6", "3.1.4", "3.2.2"]
17
+ # See https://github.com/actions/runner-images
18
+ os:
19
+ [
20
+ ubuntu-22.04,
21
+ ubuntu-latest,
22
+ macos-13,
23
+ macos-14,
24
+ macos-15,
25
+ windows-2022,
26
+ windows-latest,
27
+ ]
28
+ # Use `rbenv install --list` to determine what stable ruby versions to test against.
29
+ ruby: ["3.3", "3.4"]
28
30
 
29
31
  steps:
30
- - uses: actions/checkout@v3
31
- - name: Set up Ruby
32
- # To automatically get bug fixes and new Ruby versions for ruby/setup-ruby,
33
- # change this to (see https://github.com/ruby/setup-ruby#versioning):
34
- # uses: ruby/setup-ruby@v1
35
- uses: ruby/setup-ruby@55283cc23133118229fd3f97f9336ee23a179fcf # v1.146.0
36
- with:
37
- ruby-version: ${{ matrix.ruby-version }}
38
- bundler-cache: true # runs 'bundle install' and caches installed gems automatically
39
- - name: Run tests
40
- run: bundle exec rake
32
+ - uses: actions/checkout@v3
33
+
34
+ - name: Set timezone on Linux
35
+ if: contains(matrix.os, 'ubuntu')
36
+ run: sudo timedatectl set-timezone 'America/New_York'
37
+
38
+ - name: Set timezone on macOS
39
+ if: contains(matrix.os, 'macos')
40
+ run: sudo systemsetup -settimezone America/New_York
41
+
42
+ - name: Set timezone on Windows
43
+ if: contains(matrix.os, 'windows')
44
+ run: tzutil /s "Eastern Standard Time"
45
+
46
+ - name: Set up Ruby
47
+ uses: ruby/setup-ruby@v1
48
+ with:
49
+ ruby-version: ${{ matrix.ruby }}
50
+ bundler-cache: true
51
+
52
+ - name: Update RubyGems
53
+ run: gem update --system
54
+
55
+ - name: Disable bundler frozen setting
56
+ run: bundle config set frozen false
57
+
58
+ - name: Install dependencies
59
+ run: bundle install
60
+
61
+ - name: Run tests
62
+ run: bundle exec rake
data/.gitignore CHANGED
@@ -17,4 +17,7 @@
17
17
  *.code-workspace
18
18
 
19
19
  scratch.rb
20
+ snippets.rb
20
21
  readme.txt
22
+
23
+ .claude/**/*
data/.rubocop.yml CHANGED
@@ -1,31 +1,22 @@
1
- # The behavior of RuboCop can be controlled via the .rubocop.yml
2
- # configuration file. It makes it possible to enable/disable
3
- # certain cops (checks) and to alter their behavior if they accept
4
- # any parameters. The file can be placed either in your home
5
- # directory or in some project directory.
6
- #
7
- # RuboCop will start looking for the configuration file in the directory
8
- # where the inspected file is and continue its way up to the root directory.
9
- #
10
- # See https://docs.rubocop.org/rubocop/configuration
11
- require:
12
- # - rubocop-performance
13
- # - rubocop-rspec
1
+ plugins:
2
+ - rubocop-performance
3
+ - rubocop-rspec
4
+ - rubocop-rake
14
5
 
15
6
  AllCops:
16
- SuggestExtensions: false
17
- TargetRubyVersion: 3.0.1
7
+ TargetRubyVersion: 3.4
18
8
  NewCops: enable
19
9
  Exclude:
20
- - '.git/**/*'
21
- - '.idea/**/*'
22
- - 'init/*'
23
- - 'Rakefile'
24
- - '*.gemspec'
25
- - 'spec/**/*'
26
- - 'vendor/**/*'
27
- - 'lib/tasks/**/*'
28
- - 'scratch.rb'
10
+ - "*.gemspec"
11
+ - ".git/**/*"
12
+ - ".idea/**/*"
13
+ - "Rakefile"
14
+ - "init/*"
15
+ # - "lib/tasks/*"
16
+ - "scratch*.rb"
17
+ - "snippets*.rb"
18
+ - "vendor/**/*"
19
+ - "spec/**/*"
29
20
 
30
21
  # Align the elements of a hash literal if they span more than one line.
31
22
  Layout/HashAlignment:
@@ -90,7 +81,7 @@ Layout/MultilineMethodCallIndentation:
90
81
  # Allow `debug` in tasks for now
91
82
  Lint/Debugger:
92
83
  Exclude:
93
- - 'RakeFile'
84
+ - "RakeFile"
94
85
 
95
86
  # A calculated magnitude based on number of assignments, branches, and
96
87
  # conditions.
@@ -102,9 +93,9 @@ Metrics/AbcSize:
102
93
  # Avoid long blocks with many lines.
103
94
  Metrics/BlockLength:
104
95
  Exclude:
105
- - 'RakeFile'
106
- - 'db/seeds.rb'
107
- - 'spec/**/*.rb'
96
+ - "RakeFile"
97
+ - "db/seeds.rb"
98
+ - "spec/**/*.rb"
108
99
 
109
100
  # Avoid classes longer than 100 lines of code.
110
101
  # NOTE: This is temporarily disabled until we can eliminate existing Rubocop
@@ -112,7 +103,7 @@ Metrics/BlockLength:
112
103
  Metrics/ClassLength:
113
104
  Max: 200
114
105
  Exclude:
115
- - 'spec/**/*.rb'
106
+ - "spec/**/*.rb"
116
107
 
117
108
  # A complexity metric that is strongly correlated to the number of test cases
118
109
  # needed to validate a method.
@@ -122,26 +113,20 @@ Metrics/CyclomaticComplexity:
122
113
  # Limit lines to 80 characters
123
114
  Layout/LineLength:
124
115
  Exclude:
125
- - 'RakeFile'
126
- - 'spec/**/*.rb'
116
+ - "RakeFile"
117
+ - "spec/**/*.rb"
127
118
 
128
119
  # Avoid methods longer than 15 lines of code.
129
120
  Metrics/MethodLength:
130
121
  Max: 20
131
-
122
+ AllowedMethods:
123
+ - swagger_path
124
+ - operation
132
125
 
133
126
  # A complexity metric geared towards measuring complexity for a human reader.
134
127
  Metrics/PerceivedComplexity:
135
128
  Max: 10
136
129
 
137
- # Naming/FileName:
138
- # Exclude:
139
- # - 'lib/file.rb'
140
-
141
- # Allow `downcase == ` instead of forcing `casecmp`
142
- #Performance/Casecmp:
143
- # Enabled: false
144
-
145
130
  # Require children definitions to be nested or compact in classes and modules
146
131
  Style/ClassAndModuleChildren:
147
132
  Enabled: false
@@ -166,7 +151,7 @@ Style/GuardClause:
166
151
 
167
152
  Style/MixinUsage:
168
153
  Exclude:
169
- - 'RakeFile'
154
+ - "RakeFile"
170
155
 
171
156
  # Avoid multi-line method signatures.
172
157
  Style/MultilineMethodSignature:
@@ -195,3 +180,13 @@ Style/StringMethods:
195
180
  # Checks for use of parentheses around ternary conditions.
196
181
  Style/TernaryParentheses:
197
182
  EnforcedStyle: require_parentheses_when_complex
183
+
184
+ # RSpec cops configuration
185
+ RSpec/MultipleExpectations:
186
+ Enabled: false
187
+
188
+ RSpec/MultipleMemoizedHelpers:
189
+ Max: 6
190
+
191
+ RSpec/NestedGroups:
192
+ Max: 4
data/.ruby-version CHANGED
@@ -1 +1 @@
1
- 3.0.1
1
+ 3.4.1
data/CHANGELOG.md CHANGED
@@ -1,59 +1,148 @@
1
- ### Version 3.0.3 [2024-08-03]
2
- * Update ruby gems.
3
- * Patch CVE related to rexml gem.
4
- ### Version 3.0.3 [2024-02-18]
5
- * Update ruby gems.
6
- ### Version 3.0.2 [2024-01-31]
7
- * Update ruby gems.
8
- ### Version 3.0.1 [2024-01-07]
9
- * Relax ruby version to Gem::Requirement.new('>= 3.0.1', '< 4.0')
10
- * Update ruby gems.
11
- ### Version 3.0.0 [2023-12-27]
12
- * Now requires Ruby >= 3.0
13
- * Now requires simple_command '~> 1.0', '>= 1.0.1'; I will try to remove this dependency somehow for users who are not using simple_command.
14
- * Update ruby gems.
15
- ### Version 2.0.1 [2023-12-02]
16
- * Update ruby gems.
17
- ### Version 2.0.0 [2023-11-01]
18
- * simple_command_dispatcher now depends on ruby version >= 2.7.0
19
- * Update ruby gems.
20
- ### Version 1.2.8 [2023-08-30]
21
- * Update ruby gems.
22
- ### Version 1.2.7
23
- * Update ruby gems.
24
- * Miscellaneous refactors.
25
- ### Version 1.2.6
26
- * Update ruby gems to patch CVE.
27
- ### Version 1.2.5
28
- * Check in Gemfile.lock
29
- ### Version 1.2.4
30
- * Now requires Ruby 2.6.3
31
- * Fix broken spec.
32
- * Update Ruby gems.
33
- * Patch CVEs: activesupport CVE-2020-8165, rake CVE-2020-8130, rdoc CVE-2021-31799, tzinfo CVE-2022-31163, yard CVE-2017-17042 and CVE-2019-1020001.
34
- * Fix rubocop violations.
35
- ### Version 1.2.3
36
- * Refactor 'requires' in configure.rb and simple_command_dispatcher.rb
37
- * Update gemspec summary and description
38
- ### Version 1.2.2
39
- * Bug fix
40
- * Fixed NoMethodError on 'configure' metnod when trying to include configuration block in /config/initializers/simple_command_dispatcher.rb
41
- ### Version 1.2.1
42
- * Configuration class
43
- * Added the new Configuration class that exposes the #allow_custom_classes property which takes a Boolean allowing/disallowing the use of custom commands to be used. See the documentation for details and usage.
44
- * Custom commands
45
- * Allow ability for users to use custom commands (i.e. classes that do not prepend the SimpleCommand module) as long as the command class respond_to? the ::call public class method. Note: Configuration#allow_custom_commands must be set to true to use custom commands.
46
- * Documentation updates
47
- * Add documentation for new Configuration class and miscellaneous other code additions/changes.
48
-
49
- ### Version 1.1.1
50
- * Documentation updates
51
- * Add example code in README.md to include clarification on command namespacing, and how to autoload command classes to avoid NameError exceptions when SimpleCommand::Dispatcher.call(...) is call due to uninitialized command constants.
52
-
53
- ## Version 1.1.0 - 2016-11-01 [YANKED]
54
- ## Version 1.0.0 - 2016-11-01 [YANKED]
55
- ## Version 0.2.0 - 2016-11-01 [YANKED]
56
- ## Version 0.1.3 - 2016-11-01 [YANKED]
57
- ## Version 0.1.2 - 2016-10-29 [YANKED]
58
- ## Version 0.1.1 - 2016-10-29 [YANKED]
59
- ## Version 0.1.0 - 2016-10-29 [YANKED]
1
+ # CHANGELOG
2
+
3
+ ## Version 4.0.0 - 2025-07-12
4
+
5
+ - **Documentation Overhaul**:
6
+
7
+ - Completely rewrote README.md with modern examples and comprehensive Rails integration guides
8
+ - Fixed documentation accuracy issues across all modules and classes
9
+ - Corrected method signatures and parameter types in YARD documentation
10
+ - Updated all examples to use keyword arguments and match current implementation
11
+ - Added comprehensive documentation for helper methods and error classes
12
+ - Added migration guide from v3.x to v4.x with breaking change explanations
13
+ - Included advanced usage patterns (route-based dispatch, batch execution, dynamic versioning)
14
+
15
+ - **Test Coverage Enhancements**:
16
+
17
+ - Added comprehensive test suite for `CommandNamespaceService` (previously untested)
18
+ - Replaced placeholder tests with full implementations for `Camelize` and `TrimAll` helpers
19
+ - Added thorough test coverage for `Kernel#eigenclass` extension
20
+ - Created direct unit tests for custom error classes with edge case testing
21
+ - Improved overall test coverage with real-world scenarios and Unicode support
22
+ - Added extensive edge case testing for input validation and error conditions
23
+
24
+ - **Helper Method Improvements**:
25
+
26
+ - Enhanced `Camelize` helper to better handle RESTful route conversion to Ruby constants
27
+ - Improved `TrimAll` helper with Unicode whitespace support using `\p{Space}` regex
28
+ - Added robust error handling and edge case management for various input types
29
+ - Optimized performance for route-to-constant transformations using Rails' proven methods
30
+ - Better handling of mixed separators (hyphens, dots, spaces, colons)
31
+
32
+ - **Code Quality & Tooling**:
33
+
34
+ - Fixed RuboCop configuration errors (typo in `plugins`, removed deprecated `RSpec/NotToNot`)
35
+ - Added proper `RSpec/NestedGroups` configuration
36
+ - All RuboCop checks now pass with zero offenses
37
+ - Improved code organization and consistency
38
+
39
+ - **Breaking Changes**:
40
+ - Minimum ruby version changed from 3.0.1 to 3.3
41
+ - Removed dependency on `simple_command` gem for lighter footprint
42
+ - Removed `allow_custom_commands` configuration option (all commands are now "custom")
43
+ - `SimpleCommandDispatcher.call` method signature changed to accept keyword arguments: `command:`, `command_namespace:`, and `request_params:`
44
+ - Changed gem namespace from `SimpleCommand::Dispatcher` to `SimpleCommandDispatcher`
45
+ - Removed `options:` parameter and all camelization options (camelization is now automatic)
46
+ - Fixed duplicate `Errors` namespacing on error classes under `SimpleCommandDispatcher::Errors`
47
+
48
+ ## Version 3.0.3 - 2024-08-03
49
+
50
+ - Update Ruby gems.
51
+ - Patch CVE related to `rexml` gem.
52
+
53
+ ## Version 3.0.3 - 2024-02-18
54
+
55
+ - Update Ruby gems.
56
+
57
+ ## Version 3.0.2 - 2024-01-31
58
+
59
+ - Update Ruby gems.
60
+
61
+ ## Version 3.0.1 - 2024-01-07
62
+
63
+ - Relax Ruby version requirement to `>= 3.0.1`, `< 4.0`.
64
+ - Update Ruby gems.
65
+
66
+ ## Version 3.0.0 - 2023-12-27
67
+
68
+ - Now requires Ruby `>= 3.0`.
69
+ - Now requires `simple_command` `~> 1.0`, `>= 1.0.1`.
70
+ - Note: Attempting to remove this dependency for users not using `simple_command`.
71
+ - Update Ruby gems.
72
+
73
+ ## Version 2.0.1 - 2023-12-02
74
+
75
+ - Update Ruby gems.
76
+
77
+ ## Version 2.0.0 - 2023-11-01
78
+
79
+ - `simple_command_dispatcher` now depends on Ruby `>= 2.7.0`.
80
+ - Update Ruby gems.
81
+
82
+ ## Version 1.2.8 - 2023-08-30
83
+
84
+ - Update Ruby gems.
85
+
86
+ ## Version 1.2.7
87
+
88
+ - Update Ruby gems.
89
+ - Miscellaneous refactors.
90
+
91
+ ## Version 1.2.6
92
+
93
+ - Update Ruby gems to patch CVE.
94
+
95
+ ## Version 1.2.5
96
+
97
+ - Check in `Gemfile.lock`.
98
+
99
+ ## Version 1.2.4
100
+
101
+ - Now requires Ruby `2.6.3`.
102
+ - Fix broken spec.
103
+ - Update Ruby gems.
104
+ - Patch CVEs:
105
+ - `activesupport` (CVE-2020-8165)
106
+ - `rake` (CVE-2020-8130)
107
+ - `rdoc` (CVE-2021-31799)
108
+ - `tzinfo` (CVE-2022-31163)
109
+ - `yard` (CVE-2017-17042, CVE-2019-1020001).
110
+ - Fix RuboCop violations.
111
+
112
+ ## Version 1.2.3
113
+
114
+ - Refactor `requires` in `configure.rb` and `simple_command_dispatcher.rb`.
115
+ - Update gemspec summary and description.
116
+
117
+ ## Version 1.2.2
118
+
119
+ - **Bug Fix**:
120
+ - Fixed `NoMethodError` in `configure` method when trying to include configuration block in `/config/initializers/simple_command_dispatcher.rb`.
121
+
122
+ ## Version 1.2.1
123
+
124
+ - **Configuration Class**:
125
+ - Added the new `Configuration` class exposing the `#allow_custom_classes` property.
126
+ - Allows/disallows the use of custom commands. See documentation for details and usage.
127
+ - **Custom Commands**:
128
+ - Allow users to use custom commands (i.e., classes that do not prepend the `SimpleCommand` module).
129
+ - Commands must respond to the `::call` public class method.
130
+ - Note: `Configuration#allow_custom_commands` must be set to `true` to use custom commands.
131
+ - **Documentation Updates**:
132
+ - Added documentation for the new `Configuration` class and miscellaneous other code additions/changes.
133
+
134
+ ## Version 1.1.1
135
+
136
+ - **Documentation Updates**:
137
+ - Added example code in `README.md` to clarify command namespacing and how to autoload command classes.
138
+ - Helps avoid `NameError` exceptions when `SimpleCommandDispatcher.call(...)` is invoked due to uninitialized command constants.
139
+
140
+ ## [YANKED VERSIONS]
141
+
142
+ - **Version 1.1.0** - 2016-11-01
143
+ - **Version 1.0.0** - 2016-11-01
144
+ - **Version 0.2.0** - 2016-11-01
145
+ - **Version 0.1.3** - 2016-11-01
146
+ - **Version 0.1.2** - 2016-10-29
147
+ - **Version 0.1.1** - 2016-10-29
148
+ - **Version 0.1.0** - 2016-10-29
data/Gemfile CHANGED
@@ -11,16 +11,13 @@ gem 'rake', '>= 13.0', '< 14.0'
11
11
 
12
12
  group :development do
13
13
  gem 'pry-byebug', '>= 3.9', '< 4.0'
14
- gem 'rdoc', '>= 6.4', '< 7.0'
15
14
  gem 'rubocop', '>= 1.62', '< 2.0'
16
15
  gem 'rubocop-performance', '>= 1.20', '< 2.0'
17
- gem 'rubocop-rspec', '>= 2.28', '< 3.0'
16
+ gem 'rubocop-rake', '>= 0.6', '< 1.0'
17
+ gem 'rubocop-rspec', '~> 3.0', '>= 3.0.3'
18
18
  end
19
19
 
20
20
  group :test do
21
21
  gem 'rspec', '>= 3.10', '< 4.0'
22
- end
23
-
24
- group :documentation do
25
- gem 'yard', '>= 0.9.28', '< 1.0'
22
+ gem 'simplecov', '>= 0.22.0', '< 1.0'
26
23
  end