lite-command 3.2.0 → 3.2.1
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 +4 -0
- data/Gemfile.lock +1 -1
- data/README.md +12 -22
- data/lib/lite/command/utils.rb +3 -1
- data/lib/lite/command/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e36dd86e0746fcaaa37f79e73a94b0ae406e1989c02105c6378c5f1ea8694165
|
4
|
+
data.tar.gz: a10c6bda6ce19982ef9b983faa7ffa7ad3063ae8fc627229dc725238475c86c3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f71e320cd7ec5b4c105900fd984c6f73fa30323ef734cf03b8b6333eebed459ac9c54234433864ce20b719ffa80eff6b3da9f4021257b965c7bc8380a3310518
|
7
|
+
data.tar.gz: 78563217138c0d55133d344e914a9edb59cf9e59aaece25af3d1486657741151737d21f33a054821b80f26e3fd6bc92934e27bc3b9b3287cce969017284fa495
|
data/CHANGELOG.md
CHANGED
@@ -6,6 +6,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
6
6
|
|
7
7
|
## [Unreleased]
|
8
8
|
|
9
|
+
## [3.2.1] - 2024-10-29
|
10
|
+
### Changed
|
11
|
+
- Allow if and unless evaluations to happen at the same time
|
12
|
+
|
9
13
|
## [3.2.0] - 2024-10-29
|
10
14
|
### Changed
|
11
15
|
- Move callbacks to hooks instead of try methods
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -289,10 +289,10 @@ cmd.context.decrypted_message #=> "Hola Mundo"
|
|
289
289
|
# With invalid options:
|
290
290
|
cmd = DecryptSecretMessage.call(encrypted_message: "idk", version: "v23")
|
291
291
|
cmd.status #=> "invalid"
|
292
|
-
cmd.reason #=> "Encrypted message is too short (minimum is 10 character). Version is not included in list
|
292
|
+
cmd.reason #=> "Encrypted message is too short (minimum is 10 character). Encrypted message has invalid magic numbers. Version is not included in list."
|
293
293
|
cmd.metadata #=> {
|
294
294
|
#=> user: ["is not included in list"],
|
295
|
-
#=> encrypted_message: ["is too short (minimum is 10 character)"]
|
295
|
+
#=> encrypted_message: ["is too short (minimum is 10 character)", "has invalid magic numbers"]
|
296
296
|
#=> }
|
297
297
|
```
|
298
298
|
|
@@ -388,28 +388,18 @@ cmd.bad?("Other reason") #=> false
|
|
388
388
|
|
389
389
|
Use hooks to run arbituary code at transition points and on finalized internals.
|
390
390
|
All hooks are ran in the order they are defined. Hooks types can be defined
|
391
|
-
multiple times.
|
392
|
-
command with a successful child command.
|
391
|
+
multiple times. Hooks are ran in the following order:
|
393
392
|
|
394
393
|
```ruby
|
395
|
-
|
396
|
-
|
397
|
-
|
398
|
-
|
399
|
-
|
400
|
-
|
401
|
-
|
402
|
-
|
403
|
-
|
404
|
-
---> 6d. BarCommand.after_validation
|
405
|
-
---> 6e. BarCommand.before_execution
|
406
|
-
---> 6f. BarCommand.on_executing
|
407
|
-
---> 6g. BarCommand.after_execution
|
408
|
-
---> 6h. BarCommand.on_failure
|
409
|
-
---> 6i. BarCommand.on_interrupted
|
410
|
-
-> 7. FooCommand.after_execution
|
411
|
-
-> 8. FooCommand.on_failure
|
412
|
-
-> 9. FooCommand.on_interrupted
|
394
|
+
1. after_initialize
|
395
|
+
2. on_pending
|
396
|
+
3. before_validation
|
397
|
+
4. after_validation
|
398
|
+
5. before_execution
|
399
|
+
6. on_executing
|
400
|
+
7. after_execution
|
401
|
+
8. on_[success, noop, invalid, failure, error]
|
402
|
+
9. on_[complete, interrupted]
|
413
403
|
```
|
414
404
|
|
415
405
|
### Lifecycle Hooks
|
data/lib/lite/command/utils.rb
CHANGED
@@ -40,7 +40,9 @@ module Lite
|
|
40
40
|
end
|
41
41
|
|
42
42
|
def evaluate(object, options = {})
|
43
|
-
if options[:if]
|
43
|
+
if options[:if] && options[:unless]
|
44
|
+
call(object, options[:if]) && !call(object, options[:unless])
|
45
|
+
elsif options[:if]
|
44
46
|
call(object, options[:if])
|
45
47
|
elsif options[:unless]
|
46
48
|
!call(object, options[:unless])
|
data/lib/lite/command/version.rb
CHANGED