lite-command 1.1.1 → 1.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +1 -0
- data/CHANGELOG.md +6 -2
- data/Gemfile.lock +67 -58
- data/README.md +3 -2
- data/lib/lite/command/complex.rb +1 -1
- data/lib/lite/command/exceptions.rb +1 -0
- data/lib/lite/command/procedure.rb +18 -1
- data/lib/lite/command/version.rb +1 -1
- data/lite-command.gemspec +1 -0
- metadata +17 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8276865933176a07427bd4a80d4d3bcdf256feb6eaccb7826853f66a5dabc3a0
|
4
|
+
data.tar.gz: 623626a014811b47eddc3a2adbe757444083c0d0ec98a5aad30b50a5b5b9e606
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b215647faddd4a9ffe954f4a439cfcc6cf59c60d5719541abe2b74c544e0eaee9a425833009eefc31c664e5c38f9d972e0e0e8490328d0612f2f357d7f21e81a
|
7
|
+
data.tar.gz: ce6049235be9c026c1ce070e22bb3dd5ca740bed64a15f5fc5f25f007b398aefa17de2e6118376bf6a437326735ee0ec384615b725e774f055818f2aa7d128fe
|
data/.rubocop.yml
CHANGED
data/CHANGELOG.md
CHANGED
@@ -6,11 +6,15 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
6
6
|
|
7
7
|
## [Unreleased]
|
8
8
|
|
9
|
-
## [1.
|
9
|
+
## [1.2.0] - 2021-02-04
|
10
|
+
### Changed
|
11
|
+
- Add failed_steps to procedure
|
12
|
+
|
13
|
+
## [1.1.1] - 2019-12-08
|
10
14
|
### Changed
|
11
15
|
- Improve procedure error merging
|
12
16
|
|
13
|
-
## [1.1.0] - 2019-
|
17
|
+
## [1.1.0] - 2019-12-06
|
14
18
|
### Added
|
15
19
|
- Added procedure support for running multiple commands
|
16
20
|
|
data/Gemfile.lock
CHANGED
@@ -1,66 +1,73 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
lite-command (1.
|
4
|
+
lite-command (1.2.0)
|
5
5
|
lite-errors
|
6
6
|
lite-memoize
|
7
7
|
|
8
8
|
GEM
|
9
9
|
remote: https://rubygems.org/
|
10
10
|
specs:
|
11
|
-
actionpack (6.
|
12
|
-
actionview (= 6.
|
13
|
-
activesupport (= 6.
|
14
|
-
rack (~> 2.0, >= 2.0.
|
11
|
+
actionpack (6.1.1)
|
12
|
+
actionview (= 6.1.1)
|
13
|
+
activesupport (= 6.1.1)
|
14
|
+
rack (~> 2.0, >= 2.0.9)
|
15
15
|
rack-test (>= 0.6.3)
|
16
16
|
rails-dom-testing (~> 2.0)
|
17
17
|
rails-html-sanitizer (~> 1.0, >= 1.2.0)
|
18
|
-
actionview (6.
|
19
|
-
activesupport (= 6.
|
18
|
+
actionview (6.1.1)
|
19
|
+
activesupport (= 6.1.1)
|
20
20
|
builder (~> 3.1)
|
21
21
|
erubi (~> 1.4)
|
22
22
|
rails-dom-testing (~> 2.0)
|
23
23
|
rails-html-sanitizer (~> 1.1, >= 1.2.0)
|
24
|
-
activemodel (6.
|
25
|
-
activesupport (= 6.
|
26
|
-
activerecord (6.
|
27
|
-
activemodel (= 6.
|
28
|
-
activesupport (= 6.
|
29
|
-
activesupport (6.
|
24
|
+
activemodel (6.1.1)
|
25
|
+
activesupport (= 6.1.1)
|
26
|
+
activerecord (6.1.1)
|
27
|
+
activemodel (= 6.1.1)
|
28
|
+
activesupport (= 6.1.1)
|
29
|
+
activesupport (6.1.1)
|
30
30
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
31
|
-
i18n (>=
|
32
|
-
minitest (
|
33
|
-
tzinfo (~>
|
34
|
-
zeitwerk (~> 2.
|
35
|
-
ast (2.4.
|
31
|
+
i18n (>= 1.6, < 2)
|
32
|
+
minitest (>= 5.1)
|
33
|
+
tzinfo (~> 2.0)
|
34
|
+
zeitwerk (~> 2.3)
|
35
|
+
ast (2.4.2)
|
36
36
|
builder (3.2.4)
|
37
37
|
colorize (0.8.1)
|
38
|
-
concurrent-ruby (1.1.
|
38
|
+
concurrent-ruby (1.1.8)
|
39
39
|
crass (1.0.6)
|
40
|
-
database_cleaner (
|
40
|
+
database_cleaner (2.0.1)
|
41
|
+
database_cleaner-active_record (~> 2.0.0)
|
42
|
+
database_cleaner-active_record (2.0.0)
|
43
|
+
activerecord (>= 5.a)
|
44
|
+
database_cleaner-core (~> 2.0.0)
|
45
|
+
database_cleaner-core (2.0.1)
|
41
46
|
diff-lcs (1.4.4)
|
42
|
-
erubi (1.
|
47
|
+
erubi (1.10.0)
|
43
48
|
fasterer (0.8.3)
|
44
49
|
colorize (~> 0.7)
|
45
50
|
ruby_parser (>= 3.14.1)
|
46
51
|
generator_spec (0.9.4)
|
47
52
|
activesupport (>= 3.0.0)
|
48
53
|
railties (>= 3.0.0)
|
49
|
-
i18n (1.8.
|
54
|
+
i18n (1.8.8)
|
50
55
|
concurrent-ruby (~> 1.0)
|
51
56
|
lite-errors (1.0.1)
|
52
57
|
lite-memoize (1.0.3)
|
53
|
-
loofah (2.
|
58
|
+
loofah (2.9.0)
|
54
59
|
crass (~> 1.0.2)
|
55
60
|
nokogiri (>= 1.5.9)
|
56
61
|
method_source (1.0.0)
|
57
|
-
mini_portile2 (2.
|
58
|
-
minitest (5.14.
|
59
|
-
nokogiri (1.
|
60
|
-
mini_portile2 (~> 2.
|
61
|
-
|
62
|
-
|
62
|
+
mini_portile2 (2.5.0)
|
63
|
+
minitest (5.14.3)
|
64
|
+
nokogiri (1.11.1)
|
65
|
+
mini_portile2 (~> 2.5.0)
|
66
|
+
racc (~> 1.4)
|
67
|
+
parallel (1.20.1)
|
68
|
+
parser (3.0.0.0)
|
63
69
|
ast (~> 2.4.1)
|
70
|
+
racc (1.5.2)
|
64
71
|
rack (2.2.3)
|
65
72
|
rack-test (1.1.0)
|
66
73
|
rack (>= 1.0, < 3)
|
@@ -69,57 +76,58 @@ GEM
|
|
69
76
|
nokogiri (>= 1.6)
|
70
77
|
rails-html-sanitizer (1.3.0)
|
71
78
|
loofah (~> 2.3)
|
72
|
-
railties (6.
|
73
|
-
actionpack (= 6.
|
74
|
-
activesupport (= 6.
|
79
|
+
railties (6.1.1)
|
80
|
+
actionpack (= 6.1.1)
|
81
|
+
activesupport (= 6.1.1)
|
75
82
|
method_source
|
76
83
|
rake (>= 0.8.7)
|
77
|
-
thor (
|
84
|
+
thor (~> 1.0)
|
78
85
|
rainbow (3.0.0)
|
79
|
-
rake (13.0.
|
80
|
-
regexp_parser (
|
86
|
+
rake (13.0.3)
|
87
|
+
regexp_parser (2.0.3)
|
81
88
|
rexml (3.2.4)
|
82
89
|
rspec (3.10.0)
|
83
90
|
rspec-core (~> 3.10.0)
|
84
91
|
rspec-expectations (~> 3.10.0)
|
85
92
|
rspec-mocks (~> 3.10.0)
|
86
|
-
rspec-core (3.10.
|
93
|
+
rspec-core (3.10.1)
|
87
94
|
rspec-support (~> 3.10.0)
|
88
|
-
rspec-expectations (3.10.
|
95
|
+
rspec-expectations (3.10.1)
|
89
96
|
diff-lcs (>= 1.2.0, < 2.0)
|
90
97
|
rspec-support (~> 3.10.0)
|
91
|
-
rspec-mocks (3.10.
|
98
|
+
rspec-mocks (3.10.2)
|
92
99
|
diff-lcs (>= 1.2.0, < 2.0)
|
93
100
|
rspec-support (~> 3.10.0)
|
94
|
-
rspec-support (3.10.
|
95
|
-
rubocop (1.
|
101
|
+
rspec-support (3.10.2)
|
102
|
+
rubocop (1.9.1)
|
96
103
|
parallel (~> 1.10)
|
97
|
-
parser (>=
|
104
|
+
parser (>= 3.0.0.0)
|
98
105
|
rainbow (>= 2.2.2, < 4.0)
|
99
|
-
regexp_parser (>= 1.8)
|
106
|
+
regexp_parser (>= 1.8, < 3.0)
|
100
107
|
rexml
|
101
|
-
rubocop-ast (>= 1.0.
|
108
|
+
rubocop-ast (>= 1.2.0, < 2.0)
|
102
109
|
ruby-progressbar (~> 1.7)
|
103
|
-
unicode-display_width (>= 1.4.0, <
|
104
|
-
rubocop-ast (1.
|
110
|
+
unicode-display_width (>= 1.4.0, < 3.0)
|
111
|
+
rubocop-ast (1.4.1)
|
105
112
|
parser (>= 2.7.1.5)
|
106
|
-
rubocop-performance (1.
|
107
|
-
rubocop (>= 0.
|
113
|
+
rubocop-performance (1.9.2)
|
114
|
+
rubocop (>= 0.90.0, < 2.0)
|
108
115
|
rubocop-ast (>= 0.4.0)
|
109
|
-
rubocop-
|
116
|
+
rubocop-rake (0.5.1)
|
117
|
+
rubocop
|
118
|
+
rubocop-rspec (2.2.0)
|
110
119
|
rubocop (~> 1.0)
|
111
120
|
rubocop-ast (>= 1.1.0)
|
112
|
-
ruby-progressbar (1.
|
113
|
-
ruby_parser (3.15.
|
121
|
+
ruby-progressbar (1.11.0)
|
122
|
+
ruby_parser (3.15.1)
|
114
123
|
sexp_processor (~> 4.9)
|
115
|
-
sexp_processor (4.15.
|
124
|
+
sexp_processor (4.15.2)
|
116
125
|
sqlite3 (1.4.2)
|
117
|
-
thor (1.0
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
zeitwerk (2.4.1)
|
126
|
+
thor (1.1.0)
|
127
|
+
tzinfo (2.0.4)
|
128
|
+
concurrent-ruby (~> 1.0)
|
129
|
+
unicode-display_width (2.0.0)
|
130
|
+
zeitwerk (2.4.2)
|
123
131
|
|
124
132
|
PLATFORMS
|
125
133
|
ruby
|
@@ -135,8 +143,9 @@ DEPENDENCIES
|
|
135
143
|
rspec
|
136
144
|
rubocop
|
137
145
|
rubocop-performance
|
146
|
+
rubocop-rake
|
138
147
|
rubocop-rspec
|
139
148
|
sqlite3
|
140
149
|
|
141
150
|
BUNDLED WITH
|
142
|
-
2.
|
151
|
+
2.2.8
|
data/README.md
CHANGED
@@ -141,7 +141,7 @@ class SearchChannels < Lite::Command::Procedure; end
|
|
141
141
|
|
142
142
|
procedure = SearchChannels.call(
|
143
143
|
DisneyChannel.new,
|
144
|
-
EspnChannel.new,
|
144
|
+
EspnChannel.new(current_station),
|
145
145
|
MtvChannel.new
|
146
146
|
)
|
147
147
|
|
@@ -151,13 +151,14 @@ procedure.steps #=> [<DisneyChannel @result="...">, <EspnChannel @result="..."
|
|
151
151
|
# If the errors extension is added you can stop the procedure at first failure.
|
152
152
|
procedure = SearchChannels.new(
|
153
153
|
DisneyChannel.new,
|
154
|
-
ErrorChannel.new,
|
154
|
+
ErrorChannel.new(current_station),
|
155
155
|
MtvChannel.new
|
156
156
|
)
|
157
157
|
|
158
158
|
procedure.exit_on_failure = true
|
159
159
|
procedure.call
|
160
160
|
procedure.result #=> ['disney: #3']
|
161
|
+
procedure.failed_steps #=> [{ index: 1, step: 2, name: 'ErrorChannel', args: [current_station], errors: ['field error message'] }]
|
161
162
|
```
|
162
163
|
|
163
164
|
## Extensions
|
data/lib/lite/command/complex.rb
CHANGED
@@ -9,10 +9,11 @@ module Lite
|
|
9
9
|
attr_accessor :exit_on_failure
|
10
10
|
|
11
11
|
def execute
|
12
|
-
steps.each_with_object([]) do |command, results|
|
12
|
+
steps.each_with_object([]).with_index do |(command, results), i|
|
13
13
|
command.call
|
14
14
|
|
15
15
|
if command.respond_to?(:errors) && command.failure?
|
16
|
+
failed_steps << failed_step(i, command)
|
16
17
|
merge_errors!(command) if respond_to?(:errors)
|
17
18
|
break results if exit_on_failure?
|
18
19
|
else
|
@@ -25,10 +26,26 @@ module Lite
|
|
25
26
|
@exit_on_failure ||= false
|
26
27
|
end
|
27
28
|
|
29
|
+
def failed_steps
|
30
|
+
@failed_steps ||= []
|
31
|
+
end
|
32
|
+
|
28
33
|
def steps
|
29
34
|
@steps ||= @args.flatten
|
30
35
|
end
|
31
36
|
|
37
|
+
private
|
38
|
+
|
39
|
+
def failed_step(index, command)
|
40
|
+
{
|
41
|
+
index: index,
|
42
|
+
step: index + 1,
|
43
|
+
name: command.class.name,
|
44
|
+
args: command.args,
|
45
|
+
errors: command&.errors&.full_messages
|
46
|
+
}
|
47
|
+
end
|
48
|
+
|
32
49
|
end
|
33
50
|
end
|
34
51
|
end
|
data/lib/lite/command/version.rb
CHANGED
data/lite-command.gemspec
CHANGED
@@ -49,6 +49,7 @@ Gem::Specification.new do |spec|
|
|
49
49
|
spec.add_development_dependency 'rspec'
|
50
50
|
spec.add_development_dependency 'rubocop'
|
51
51
|
spec.add_development_dependency 'rubocop-performance'
|
52
|
+
spec.add_development_dependency 'rubocop-rake'
|
52
53
|
spec.add_development_dependency 'rubocop-rspec'
|
53
54
|
spec.add_development_dependency 'sqlite3'
|
54
55
|
end
|
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: 1.
|
4
|
+
version: 1.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Juan Gomez
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-02-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: lite-errors
|
@@ -164,6 +164,20 @@ dependencies:
|
|
164
164
|
- - ">="
|
165
165
|
- !ruby/object:Gem::Version
|
166
166
|
version: '0'
|
167
|
+
- !ruby/object:Gem::Dependency
|
168
|
+
name: rubocop-rake
|
169
|
+
requirement: !ruby/object:Gem::Requirement
|
170
|
+
requirements:
|
171
|
+
- - ">="
|
172
|
+
- !ruby/object:Gem::Version
|
173
|
+
version: '0'
|
174
|
+
type: :development
|
175
|
+
prerelease: false
|
176
|
+
version_requirements: !ruby/object:Gem::Requirement
|
177
|
+
requirements:
|
178
|
+
- - ">="
|
179
|
+
- !ruby/object:Gem::Version
|
180
|
+
version: '0'
|
167
181
|
- !ruby/object:Gem::Dependency
|
168
182
|
name: rubocop-rspec
|
169
183
|
requirement: !ruby/object:Gem::Requirement
|
@@ -248,7 +262,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
248
262
|
- !ruby/object:Gem::Version
|
249
263
|
version: '0'
|
250
264
|
requirements: []
|
251
|
-
rubygems_version: 3.
|
265
|
+
rubygems_version: 3.2.8
|
252
266
|
signing_key:
|
253
267
|
specification_version: 4
|
254
268
|
summary: Ruby Command based framework (aka service objects)
|