lite-command 3.2.1 → 3.3.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +10 -0
- data/Gemfile.lock +20 -20
- data/README.md +5 -6
- data/lib/lite/command/fault_streamer.rb +4 -4
- data/lib/lite/command/internals/attributes.rb +2 -2
- data/lib/lite/command/internals/executions.rb +5 -4
- data/lib/lite/command/internals/hooks.rb +2 -2
- data/lib/lite/command/internals/results.rb +1 -2
- data/lib/lite/command/internals/runtimes.rb +2 -0
- data/lib/lite/command/step.rb +1 -1
- data/lib/lite/command/utils.rb +6 -6
- data/lib/lite/command/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 715ff5866aa3e438fe2da7a110146697ba7cb096e6e971fd433b43004e950767
|
4
|
+
data.tar.gz: 896ab3c6aeca65820801d76669034635d2b71e46272a7ac568cd9998e378ca12
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f82235ae25a48c0662a3948a8fd3c5e06605a76b284bcabfea32aad3df5efa36cb48778ec3ced570dd14bb05433c76c7fd9aa71df2e96004f258fed8fd27632f
|
7
|
+
data.tar.gz: 01475342f8fe446f4ed69a7a4114fd7924a08fb96f3e659c3d65d332ff28c5c1fd4376a4c9dddd72f38074fb708252d9459bea11d913f9ef4d284edffd227f12
|
data/CHANGELOG.md
CHANGED
@@ -6,6 +6,16 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
6
6
|
|
7
7
|
## [Unreleased]
|
8
8
|
|
9
|
+
## [3.3.1] - 2024-11-06
|
10
|
+
### Removed
|
11
|
+
- Remove `to_hash` method
|
12
|
+
|
13
|
+
## [3.3.0] - 2024-11-01
|
14
|
+
### Changed
|
15
|
+
- Prefixed util method with `cmd_`
|
16
|
+
- Improve monotonic clock handling
|
17
|
+
- Improve order of hook calls
|
18
|
+
|
9
19
|
## [3.2.1] - 2024-10-29
|
10
20
|
### Changed
|
11
21
|
- Allow if and unless evaluations to happen at the same time
|
data/Gemfile.lock
CHANGED
@@ -1,16 +1,16 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
lite-command (3.
|
4
|
+
lite-command (3.3.1)
|
5
5
|
activemodel
|
6
6
|
ostruct
|
7
7
|
|
8
8
|
GEM
|
9
9
|
remote: https://rubygems.org/
|
10
10
|
specs:
|
11
|
-
actionpack (7.2.
|
12
|
-
actionview (= 7.2.
|
13
|
-
activesupport (= 7.2.
|
11
|
+
actionpack (7.2.2)
|
12
|
+
actionview (= 7.2.2)
|
13
|
+
activesupport (= 7.2.2)
|
14
14
|
nokogiri (>= 1.8.5)
|
15
15
|
racc
|
16
16
|
rack (>= 2.2.4, < 3.2)
|
@@ -19,16 +19,17 @@ GEM
|
|
19
19
|
rails-dom-testing (~> 2.2)
|
20
20
|
rails-html-sanitizer (~> 1.6)
|
21
21
|
useragent (~> 0.16)
|
22
|
-
actionview (7.2.
|
23
|
-
activesupport (= 7.2.
|
22
|
+
actionview (7.2.2)
|
23
|
+
activesupport (= 7.2.2)
|
24
24
|
builder (~> 3.1)
|
25
25
|
erubi (~> 1.11)
|
26
26
|
rails-dom-testing (~> 2.2)
|
27
27
|
rails-html-sanitizer (~> 1.6)
|
28
|
-
activemodel (7.2.
|
29
|
-
activesupport (= 7.2.
|
30
|
-
activesupport (7.2.
|
28
|
+
activemodel (7.2.2)
|
29
|
+
activesupport (= 7.2.2)
|
30
|
+
activesupport (7.2.2)
|
31
31
|
base64
|
32
|
+
benchmark (>= 0.3)
|
32
33
|
bigdecimal
|
33
34
|
concurrent-ruby (~> 1.0, >= 1.3.1)
|
34
35
|
connection_pool (>= 2.2.5)
|
@@ -40,6 +41,7 @@ GEM
|
|
40
41
|
tzinfo (~> 2.0, >= 2.0.5)
|
41
42
|
ast (2.4.2)
|
42
43
|
base64 (0.2.0)
|
44
|
+
benchmark (0.3.0)
|
43
45
|
bigdecimal (3.1.8)
|
44
46
|
builder (3.3.0)
|
45
47
|
concurrent-ruby (1.3.4)
|
@@ -57,7 +59,7 @@ GEM
|
|
57
59
|
irb (1.14.1)
|
58
60
|
rdoc (>= 4.0.0)
|
59
61
|
reline (>= 0.4.2)
|
60
|
-
json (2.
|
62
|
+
json (2.8.0)
|
61
63
|
language_server-protocol (3.17.0.3)
|
62
64
|
logger (1.6.1)
|
63
65
|
loofah (2.23.1)
|
@@ -70,7 +72,7 @@ GEM
|
|
70
72
|
racc (~> 1.4)
|
71
73
|
ostruct (0.6.0)
|
72
74
|
parallel (1.26.3)
|
73
|
-
parser (3.3.
|
75
|
+
parser (3.3.6.0)
|
74
76
|
ast (~> 2.4.1)
|
75
77
|
racc
|
76
78
|
psych (5.1.2)
|
@@ -81,9 +83,8 @@ GEM
|
|
81
83
|
rack (>= 3.0.0)
|
82
84
|
rack-test (2.1.0)
|
83
85
|
rack (>= 1.3)
|
84
|
-
rackup (2.
|
86
|
+
rackup (2.2.0)
|
85
87
|
rack (>= 3)
|
86
|
-
webrick (~> 1.8)
|
87
88
|
rails-dom-testing (2.2.0)
|
88
89
|
activesupport (>= 5.0.0)
|
89
90
|
minitest
|
@@ -91,9 +92,9 @@ GEM
|
|
91
92
|
rails-html-sanitizer (1.6.0)
|
92
93
|
loofah (~> 2.21)
|
93
94
|
nokogiri (~> 1.14)
|
94
|
-
railties (7.2.
|
95
|
-
actionpack (= 7.2.
|
96
|
-
activesupport (= 7.2.
|
95
|
+
railties (7.2.2)
|
96
|
+
actionpack (= 7.2.2)
|
97
|
+
activesupport (= 7.2.2)
|
97
98
|
irb (~> 1.13)
|
98
99
|
rackup (>= 1.0.0)
|
99
100
|
rake (>= 12.2)
|
@@ -119,7 +120,7 @@ GEM
|
|
119
120
|
diff-lcs (>= 1.2.0, < 2.0)
|
120
121
|
rspec-support (~> 3.13.0)
|
121
122
|
rspec-support (3.13.1)
|
122
|
-
rubocop (1.
|
123
|
+
rubocop (1.68.0)
|
123
124
|
json (~> 2.3)
|
124
125
|
language_server-protocol (>= 3.17.0)
|
125
126
|
parallel (~> 1.10)
|
@@ -129,7 +130,7 @@ GEM
|
|
129
130
|
rubocop-ast (>= 1.32.2, < 2.0)
|
130
131
|
ruby-progressbar (~> 1.7)
|
131
132
|
unicode-display_width (>= 2.4.0, < 3.0)
|
132
|
-
rubocop-ast (1.
|
133
|
+
rubocop-ast (1.34.0)
|
133
134
|
parser (>= 3.3.1.0)
|
134
135
|
rubocop-performance (1.22.1)
|
135
136
|
rubocop (>= 1.48.1, < 2.0)
|
@@ -140,7 +141,7 @@ GEM
|
|
140
141
|
rubocop (~> 1.61)
|
141
142
|
ruby-progressbar (1.13.0)
|
142
143
|
securerandom (0.3.1)
|
143
|
-
sqlite3 (2.
|
144
|
+
sqlite3 (2.2.0)
|
144
145
|
mini_portile2 (~> 2.8.0)
|
145
146
|
stringio (3.1.1)
|
146
147
|
thor (1.3.2)
|
@@ -148,7 +149,6 @@ GEM
|
|
148
149
|
concurrent-ruby (~> 1.0)
|
149
150
|
unicode-display_width (2.6.0)
|
150
151
|
useragent (0.16.10)
|
151
|
-
webrick (1.8.2)
|
152
152
|
zeitwerk (2.7.1)
|
153
153
|
|
154
154
|
PLATFORMS
|
data/README.md
CHANGED
@@ -392,14 +392,13 @@ multiple times. Hooks are ran in the following order:
|
|
392
392
|
|
393
393
|
```ruby
|
394
394
|
1. after_initialize
|
395
|
-
2.
|
395
|
+
2. before_execution
|
396
396
|
3. before_validation
|
397
397
|
4. after_validation
|
398
|
-
5.
|
399
|
-
6.
|
400
|
-
7.
|
401
|
-
8.
|
402
|
-
9. on_[complete, interrupted]
|
398
|
+
5. on_executing
|
399
|
+
6. on_[success, noop, invalid, failure, error]
|
400
|
+
7. on_[complete, interrupted]
|
401
|
+
8. after_execution
|
403
402
|
```
|
404
403
|
|
405
404
|
### Lifecycle Hooks
|
@@ -22,17 +22,17 @@ module Lite
|
|
22
22
|
end
|
23
23
|
|
24
24
|
def metadata
|
25
|
-
Utils.
|
25
|
+
Utils.cmd_try(object, :metadata) || command.metadata
|
26
26
|
end
|
27
27
|
|
28
28
|
def caused_by
|
29
|
-
Utils.
|
29
|
+
Utils.cmd_try(object, :caused_by) || command
|
30
30
|
end
|
31
31
|
|
32
32
|
def thrown_by
|
33
|
-
return object if Utils.
|
33
|
+
return object if Utils.cmd_try(object, :executed?)
|
34
34
|
|
35
|
-
Utils.
|
35
|
+
Utils.cmd_try(object, :thrown_by) || command.caused_by
|
36
36
|
end
|
37
37
|
|
38
38
|
def command_exception
|
@@ -36,7 +36,7 @@ module Lite
|
|
36
36
|
define_method(method_name) do
|
37
37
|
return unless respond_to?(from)
|
38
38
|
|
39
|
-
Utils.
|
39
|
+
Utils.cmd_try(send(from), method_name)
|
40
40
|
end
|
41
41
|
end
|
42
42
|
end
|
@@ -44,7 +44,7 @@ module Lite
|
|
44
44
|
end
|
45
45
|
|
46
46
|
def read_attribute_for_validation(method_name)
|
47
|
-
Utils.
|
47
|
+
Utils.cmd_try(self, method_name)
|
48
48
|
rescue NameError
|
49
49
|
# Do nothing, fallback to :undefined error
|
50
50
|
end
|
@@ -50,18 +50,19 @@ module Lite
|
|
50
50
|
increment_execution_index
|
51
51
|
assign_execution_cmd_id
|
52
52
|
start_monotonic_time
|
53
|
-
|
54
|
-
validate_context_attributes
|
53
|
+
|
55
54
|
run_hooks(:before_execution)
|
56
55
|
executing!
|
56
|
+
validate_context_attributes
|
57
57
|
run_hooks(:on_executing)
|
58
58
|
end
|
59
59
|
|
60
60
|
def after_execution
|
61
61
|
send(:"#{success? ? COMPLETE : INTERRUPTED}!")
|
62
|
-
run_hooks(:after_execution)
|
63
62
|
run_hooks(:"on_#{status}")
|
64
63
|
run_hooks(:"on_#{state}")
|
64
|
+
run_hooks(:after_execution)
|
65
|
+
|
65
66
|
stop_monotonic_time
|
66
67
|
append_execution_result
|
67
68
|
freeze_execution_objects
|
@@ -82,7 +83,7 @@ module Lite
|
|
82
83
|
def execute!
|
83
84
|
around_execution { call }
|
84
85
|
rescue StandardError => e
|
85
|
-
fault(e, Utils.
|
86
|
+
fault(e, Utils.cmd_try(e, :type) || ERROR, metadata, exception: e)
|
86
87
|
after_execution
|
87
88
|
raise(e)
|
88
89
|
end
|
@@ -23,7 +23,7 @@ module Lite
|
|
23
23
|
module ClassMethods
|
24
24
|
|
25
25
|
def hooks
|
26
|
-
@hooks ||= Utils.
|
26
|
+
@hooks ||= Utils.cmd_try(superclass, :hooks).dup || {}
|
27
27
|
end
|
28
28
|
|
29
29
|
HOOKS.each do |h|
|
@@ -41,7 +41,7 @@ module Lite
|
|
41
41
|
hooks = self.class.hooks[hook]
|
42
42
|
return if hooks.nil?
|
43
43
|
|
44
|
-
hooks.each { |h| Utils.
|
44
|
+
hooks.each { |h| Utils.cmd_call(self, h) }
|
45
45
|
end
|
46
46
|
|
47
47
|
end
|
data/lib/lite/command/step.rb
CHANGED
data/lib/lite/command/utils.rb
CHANGED
@@ -23,13 +23,13 @@ module Lite
|
|
23
23
|
!!(object_class <= other_class)
|
24
24
|
end
|
25
25
|
|
26
|
-
def
|
26
|
+
def cmd_try(object, method_name, *args, include_private: true)
|
27
27
|
return unless object.respond_to?(method_name, include_private)
|
28
28
|
|
29
29
|
object.send(method_name, *args)
|
30
30
|
end
|
31
31
|
|
32
|
-
def
|
32
|
+
def cmd_call(object, argument)
|
33
33
|
if argument.is_a?(Symbol) || argument.is_a?(String)
|
34
34
|
object.send(argument)
|
35
35
|
elsif argument.is_a?(Proc)
|
@@ -39,13 +39,13 @@ module Lite
|
|
39
39
|
end
|
40
40
|
end
|
41
41
|
|
42
|
-
def
|
42
|
+
def cmd_eval(object, options = {})
|
43
43
|
if options[:if] && options[:unless]
|
44
|
-
|
44
|
+
cmd_call(object, options[:if]) && !cmd_call(object, options[:unless])
|
45
45
|
elsif options[:if]
|
46
|
-
|
46
|
+
cmd_call(object, options[:if])
|
47
47
|
elsif options[:unless]
|
48
|
-
!
|
48
|
+
!cmd_call(object, options[:unless])
|
49
49
|
else
|
50
50
|
options.fetch(:default, true)
|
51
51
|
end
|
data/lib/lite/command/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: lite-command
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.
|
4
|
+
version: 3.3.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Juan Gomez
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-11-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activemodel
|
@@ -229,7 +229,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
229
229
|
- !ruby/object:Gem::Version
|
230
230
|
version: '0'
|
231
231
|
requirements: []
|
232
|
-
rubygems_version: 3.5.
|
232
|
+
rubygems_version: 3.5.22
|
233
233
|
signing_key:
|
234
234
|
specification_version: 4
|
235
235
|
summary: Ruby Command based framework (aka service objects)
|