lite-command 1.0.8 → 1.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/.rubocop.yml +15 -3
- data/.travis.yml +1 -0
- data/CHANGELOG.md +23 -0
- data/Gemfile.lock +91 -75
- data/README.md +44 -18
- data/lib/generators/rails/USAGE +0 -1
- data/lib/generators/rails/command_generator.rb +0 -7
- data/lib/generators/rails/templates/command.rb.tt +1 -1
- data/lib/lite/command.rb +1 -2
- data/lib/lite/command/complex.rb +1 -1
- data/lib/lite/command/exceptions.rb +1 -0
- data/lib/lite/command/procedure.rb +51 -0
- data/lib/lite/command/version.rb +1 -1
- data/lite-command.gemspec +1 -0
- metadata +22 -10
- data/lib/generators/lite/command/install_generator.rb +0 -17
- data/lib/generators/lite/command/templates/install.rb +0 -4
- data/lib/generators/rails/templates/spec.rb.tt +0 -7
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
|
@@ -1,12 +1,16 @@
|
|
|
1
1
|
require:
|
|
2
2
|
- rubocop-performance
|
|
3
|
+
- rubocop-rake
|
|
3
4
|
- rubocop-rspec
|
|
4
5
|
AllCops:
|
|
5
|
-
TargetRubyVersion: 2.
|
|
6
|
+
TargetRubyVersion: 2.7
|
|
7
|
+
NewCops: enable
|
|
6
8
|
DisplayCopNames: true
|
|
7
9
|
DisplayStyleGuide: true
|
|
8
|
-
|
|
9
|
-
|
|
10
|
+
Gemspec/RequiredRubyVersion:
|
|
11
|
+
Enabled: false
|
|
12
|
+
Layout/EmptyLinesAroundAttributeAccessor:
|
|
13
|
+
Enabled: true
|
|
10
14
|
Layout/EmptyLinesAroundBlockBody:
|
|
11
15
|
Exclude:
|
|
12
16
|
- 'spec/**/**/*'
|
|
@@ -14,6 +18,14 @@ Layout/EmptyLinesAroundClassBody:
|
|
|
14
18
|
EnforcedStyle: empty_lines_except_namespace
|
|
15
19
|
Layout/EmptyLinesAroundModuleBody:
|
|
16
20
|
EnforcedStyle: empty_lines_except_namespace
|
|
21
|
+
Layout/LineLength:
|
|
22
|
+
Max: 100
|
|
23
|
+
Layout/SpaceAroundMethodCallOperator:
|
|
24
|
+
Enabled: true
|
|
25
|
+
Lint/RaiseException:
|
|
26
|
+
Enabled: true
|
|
27
|
+
Lint/StructNewOverride:
|
|
28
|
+
Enabled: true
|
|
17
29
|
Metrics/BlockLength:
|
|
18
30
|
Exclude:
|
|
19
31
|
- 'spec/**/**/*'
|
data/.travis.yml
CHANGED
data/CHANGELOG.md
CHANGED
|
@@ -6,6 +6,29 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
6
6
|
|
|
7
7
|
## [Unreleased]
|
|
8
8
|
|
|
9
|
+
## [1.2.0] - 2021-02-04
|
|
10
|
+
### Changed
|
|
11
|
+
- Add failed_steps to procedure
|
|
12
|
+
|
|
13
|
+
## [1.1.1] - 2019-12-08
|
|
14
|
+
### Changed
|
|
15
|
+
- Improve procedure error merging
|
|
16
|
+
|
|
17
|
+
## [1.1.0] - 2019-12-06
|
|
18
|
+
### Added
|
|
19
|
+
- Added procedure support for running multiple commands
|
|
20
|
+
|
|
21
|
+
## [1.0.10] - 2019-12-21
|
|
22
|
+
### Added
|
|
23
|
+
- Added Ruby 2.7 support
|
|
24
|
+
### Removed
|
|
25
|
+
- Removed generator empty directory check
|
|
26
|
+
|
|
27
|
+
## [1.0.9] - 2019-12-20
|
|
28
|
+
### Removed
|
|
29
|
+
- Removed lite-command generator
|
|
30
|
+
- Removed rspec file from rails generator
|
|
31
|
+
|
|
9
32
|
## [1.0.8] - 2019-09-16
|
|
10
33
|
### Changed
|
|
11
34
|
- Changed create propagation to check errors instead of persistence
|
data/Gemfile.lock
CHANGED
|
@@ -1,118 +1,133 @@
|
|
|
1
1
|
PATH
|
|
2
2
|
remote: .
|
|
3
3
|
specs:
|
|
4
|
-
lite-command (1.0
|
|
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)
|
|
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.
|
|
36
|
-
builder (3.2.
|
|
31
|
+
i18n (>= 1.6, < 2)
|
|
32
|
+
minitest (>= 5.1)
|
|
33
|
+
tzinfo (~> 2.0)
|
|
34
|
+
zeitwerk (~> 2.3)
|
|
35
|
+
ast (2.4.2)
|
|
36
|
+
builder (3.2.4)
|
|
37
37
|
colorize (0.8.1)
|
|
38
|
-
concurrent-ruby (1.1.
|
|
39
|
-
crass (1.0.
|
|
40
|
-
database_cleaner (
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
38
|
+
concurrent-ruby (1.1.8)
|
|
39
|
+
crass (1.0.6)
|
|
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)
|
|
46
|
+
diff-lcs (1.4.4)
|
|
47
|
+
erubi (1.10.0)
|
|
48
|
+
fasterer (0.8.3)
|
|
44
49
|
colorize (~> 0.7)
|
|
45
|
-
ruby_parser (>= 3.
|
|
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.
|
|
54
|
+
i18n (1.8.8)
|
|
50
55
|
concurrent-ruby (~> 1.0)
|
|
51
|
-
jaro_winkler (1.5.3)
|
|
52
56
|
lite-errors (1.0.1)
|
|
53
57
|
lite-memoize (1.0.3)
|
|
54
|
-
loofah (2.
|
|
58
|
+
loofah (2.9.0)
|
|
55
59
|
crass (~> 1.0.2)
|
|
56
60
|
nokogiri (>= 1.5.9)
|
|
57
|
-
method_source (0.
|
|
58
|
-
mini_portile2 (2.
|
|
59
|
-
minitest (5.
|
|
60
|
-
nokogiri (1.
|
|
61
|
-
mini_portile2 (~> 2.
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
61
|
+
method_source (1.0.0)
|
|
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)
|
|
69
|
+
ast (~> 2.4.1)
|
|
70
|
+
racc (1.5.2)
|
|
71
|
+
rack (2.2.3)
|
|
66
72
|
rack-test (1.1.0)
|
|
67
73
|
rack (>= 1.0, < 3)
|
|
68
74
|
rails-dom-testing (2.0.3)
|
|
69
75
|
activesupport (>= 4.2.0)
|
|
70
76
|
nokogiri (>= 1.6)
|
|
71
|
-
rails-html-sanitizer (1.
|
|
72
|
-
loofah (~> 2.
|
|
73
|
-
railties (6.
|
|
74
|
-
actionpack (= 6.
|
|
75
|
-
activesupport (= 6.
|
|
77
|
+
rails-html-sanitizer (1.3.0)
|
|
78
|
+
loofah (~> 2.3)
|
|
79
|
+
railties (6.1.1)
|
|
80
|
+
actionpack (= 6.1.1)
|
|
81
|
+
activesupport (= 6.1.1)
|
|
76
82
|
method_source
|
|
77
83
|
rake (>= 0.8.7)
|
|
78
|
-
thor (
|
|
84
|
+
thor (~> 1.0)
|
|
79
85
|
rainbow (3.0.0)
|
|
80
|
-
rake (
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
rspec-
|
|
85
|
-
|
|
86
|
-
rspec-
|
|
87
|
-
rspec-
|
|
86
|
+
rake (13.0.3)
|
|
87
|
+
regexp_parser (2.0.3)
|
|
88
|
+
rexml (3.2.4)
|
|
89
|
+
rspec (3.10.0)
|
|
90
|
+
rspec-core (~> 3.10.0)
|
|
91
|
+
rspec-expectations (~> 3.10.0)
|
|
92
|
+
rspec-mocks (~> 3.10.0)
|
|
93
|
+
rspec-core (3.10.1)
|
|
94
|
+
rspec-support (~> 3.10.0)
|
|
95
|
+
rspec-expectations (3.10.1)
|
|
88
96
|
diff-lcs (>= 1.2.0, < 2.0)
|
|
89
|
-
rspec-support (~> 3.
|
|
90
|
-
rspec-mocks (3.
|
|
97
|
+
rspec-support (~> 3.10.0)
|
|
98
|
+
rspec-mocks (3.10.2)
|
|
91
99
|
diff-lcs (>= 1.2.0, < 2.0)
|
|
92
|
-
rspec-support (~> 3.
|
|
93
|
-
rspec-support (3.
|
|
94
|
-
rubocop (
|
|
95
|
-
jaro_winkler (~> 1.5.1)
|
|
100
|
+
rspec-support (~> 3.10.0)
|
|
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)
|
|
106
|
+
regexp_parser (>= 1.8, < 3.0)
|
|
107
|
+
rexml
|
|
108
|
+
rubocop-ast (>= 1.2.0, < 2.0)
|
|
99
109
|
ruby-progressbar (~> 1.7)
|
|
100
|
-
unicode-display_width (>= 1.4.0, <
|
|
101
|
-
rubocop-
|
|
102
|
-
|
|
103
|
-
rubocop-
|
|
104
|
-
rubocop (>= 0.
|
|
105
|
-
|
|
106
|
-
|
|
110
|
+
unicode-display_width (>= 1.4.0, < 3.0)
|
|
111
|
+
rubocop-ast (1.4.1)
|
|
112
|
+
parser (>= 2.7.1.5)
|
|
113
|
+
rubocop-performance (1.9.2)
|
|
114
|
+
rubocop (>= 0.90.0, < 2.0)
|
|
115
|
+
rubocop-ast (>= 0.4.0)
|
|
116
|
+
rubocop-rake (0.5.1)
|
|
117
|
+
rubocop
|
|
118
|
+
rubocop-rspec (2.2.0)
|
|
119
|
+
rubocop (~> 1.0)
|
|
120
|
+
rubocop-ast (>= 1.1.0)
|
|
121
|
+
ruby-progressbar (1.11.0)
|
|
122
|
+
ruby_parser (3.15.1)
|
|
107
123
|
sexp_processor (~> 4.9)
|
|
108
|
-
sexp_processor (4.
|
|
109
|
-
sqlite3 (1.4.
|
|
110
|
-
thor (
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
zeitwerk (2.1.10)
|
|
124
|
+
sexp_processor (4.15.2)
|
|
125
|
+
sqlite3 (1.4.2)
|
|
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)
|
|
116
131
|
|
|
117
132
|
PLATFORMS
|
|
118
133
|
ruby
|
|
@@ -128,8 +143,9 @@ DEPENDENCIES
|
|
|
128
143
|
rspec
|
|
129
144
|
rubocop
|
|
130
145
|
rubocop-performance
|
|
146
|
+
rubocop-rake
|
|
131
147
|
rubocop-rspec
|
|
132
148
|
sqlite3
|
|
133
149
|
|
|
134
150
|
BUNDLED WITH
|
|
135
|
-
2.
|
|
151
|
+
2.2.8
|
data/README.md
CHANGED
|
@@ -27,18 +27,21 @@ Or install it yourself as:
|
|
|
27
27
|
* [Setup](#setup)
|
|
28
28
|
* [Simple](#simple)
|
|
29
29
|
* [Complex](#complex)
|
|
30
|
+
* [Procedure](#procedure)
|
|
30
31
|
* [Extensions](#extensions)
|
|
31
32
|
|
|
32
33
|
## Setup
|
|
33
34
|
|
|
34
|
-
`rails g
|
|
35
|
-
`../app/commands/application_command.rb`
|
|
35
|
+
`rails g command NAME` will generate the following file:
|
|
36
36
|
|
|
37
|
-
```
|
|
38
|
-
|
|
39
|
-
end
|
|
37
|
+
```erb
|
|
38
|
+
app/commands/[NAME]_command.rb
|
|
40
39
|
```
|
|
41
40
|
|
|
41
|
+
If a `ApplicationCommand` file in the `app/commands` directory is available, the
|
|
42
|
+
generator will create file that inherit from `ApplicationCommand` if not it will
|
|
43
|
+
fallback to `Lite::Command::Complex`.
|
|
44
|
+
|
|
42
45
|
## Simple
|
|
43
46
|
|
|
44
47
|
Simple commands build quick class based calls but cannot be extended.
|
|
@@ -47,13 +50,9 @@ This is more of a traditional command service call as it only exposes a `call` m
|
|
|
47
50
|
```ruby
|
|
48
51
|
class SearchMovies < Lite::Command::Simple
|
|
49
52
|
|
|
50
|
-
class
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
# NOTE: This class method is required
|
|
54
|
-
def execute(*args)
|
|
55
|
-
{ generate_fingerprint => movies_by_name }
|
|
56
|
-
end
|
|
53
|
+
# NOTE: This class method is required
|
|
54
|
+
def self.execute(*args)
|
|
55
|
+
{ generate_fingerprint => movies_by_name }
|
|
57
56
|
end
|
|
58
57
|
|
|
59
58
|
end
|
|
@@ -62,8 +61,7 @@ end
|
|
|
62
61
|
**Caller**
|
|
63
62
|
|
|
64
63
|
```ruby
|
|
65
|
-
|
|
66
|
-
command.call
|
|
64
|
+
SearchMovies.call('Toy Story')
|
|
67
65
|
```
|
|
68
66
|
|
|
69
67
|
## Complex
|
|
@@ -71,9 +69,6 @@ command.call
|
|
|
71
69
|
Complex commands can be used in instance and class based calls and
|
|
72
70
|
extended with access to errors and memoization.
|
|
73
71
|
|
|
74
|
-
Use `rails g decorator NAME` will generate the following file:
|
|
75
|
-
`../app/decorators/[name]_decorator.rb`
|
|
76
|
-
|
|
77
72
|
You will then need to fill this class with the required `execute` method as shown below:
|
|
78
73
|
|
|
79
74
|
```ruby
|
|
@@ -135,9 +130,40 @@ command.recall! #=> Clears the call, cache, errors, and then re-performs the cal
|
|
|
135
130
|
command.result #=> { 'fingerprint_2' => [ 'Toy Story 2', ... ] }
|
|
136
131
|
```
|
|
137
132
|
|
|
133
|
+
## Procedure
|
|
134
|
+
|
|
135
|
+
Procedures run a collection of commands. It uses the the complex procedure API
|
|
136
|
+
so it has access to all the methods. The `execute` method is already defined to
|
|
137
|
+
handle most common procedure steps. It can be use directly or subclassed.
|
|
138
|
+
|
|
139
|
+
```ruby
|
|
140
|
+
class SearchChannels < Lite::Command::Procedure; end
|
|
141
|
+
|
|
142
|
+
procedure = SearchChannels.call(
|
|
143
|
+
DisneyChannel.new,
|
|
144
|
+
EspnChannel.new(current_station),
|
|
145
|
+
MtvChannel.new
|
|
146
|
+
)
|
|
147
|
+
|
|
148
|
+
procedure.result #=> ['disney: #3', 'espn: #59', 'mtv: #212']
|
|
149
|
+
procedure.steps #=> [<DisneyChannel @result="...">, <EspnChannel @result="...">, <MtvChannel @result="...">]
|
|
150
|
+
|
|
151
|
+
# If the errors extension is added you can stop the procedure at first failure.
|
|
152
|
+
procedure = SearchChannels.new(
|
|
153
|
+
DisneyChannel.new,
|
|
154
|
+
ErrorChannel.new(current_station),
|
|
155
|
+
MtvChannel.new
|
|
156
|
+
)
|
|
157
|
+
|
|
158
|
+
procedure.exit_on_failure = true
|
|
159
|
+
procedure.call
|
|
160
|
+
procedure.result #=> ['disney: #3']
|
|
161
|
+
procedure.failed_steps #=> [{ index: 1, step: 2, name: 'ErrorChannel', args: [current_station], errors: ['field error message'] }]
|
|
162
|
+
```
|
|
163
|
+
|
|
138
164
|
## Extensions
|
|
139
165
|
|
|
140
|
-
Extend complex base command with any of the following extensions:
|
|
166
|
+
Extend complex (and procedures) base command with any of the following extensions:
|
|
141
167
|
|
|
142
168
|
### Errors (optional)
|
|
143
169
|
|
data/lib/generators/rails/USAGE
CHANGED
|
@@ -10,16 +10,9 @@ module Rails
|
|
|
10
10
|
|
|
11
11
|
def copy_files
|
|
12
12
|
path = File.join('app', 'commands', class_path, "#{file_name}_command.rb")
|
|
13
|
-
empty_directory('app/commands')
|
|
14
13
|
template('command.rb.tt', path)
|
|
15
14
|
end
|
|
16
15
|
|
|
17
|
-
def copy_specs
|
|
18
|
-
path = File.join('spec', 'commands', class_path, "#{file_name}_command_spec.rb")
|
|
19
|
-
empty_directory('spec/commands')
|
|
20
|
-
template('spec.rb.tt', path)
|
|
21
|
-
end
|
|
22
|
-
|
|
23
16
|
private
|
|
24
17
|
|
|
25
18
|
def file_name
|
data/lib/lite/command.rb
CHANGED
|
@@ -6,9 +6,8 @@ require 'lite/command/version'
|
|
|
6
6
|
require "lite/command/extensions/#{name}"
|
|
7
7
|
end
|
|
8
8
|
|
|
9
|
-
%w[exceptions states complex
|
|
9
|
+
%w[exceptions states simple complex procedure].each do |name|
|
|
10
10
|
require "lite/command/#{name}"
|
|
11
11
|
end
|
|
12
12
|
|
|
13
|
-
require 'generators/lite/command/install_generator'
|
|
14
13
|
require 'generators/rails/command_generator'
|
data/lib/lite/command/complex.rb
CHANGED
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Lite
|
|
4
|
+
module Command
|
|
5
|
+
class Procedure < Complex
|
|
6
|
+
|
|
7
|
+
include Lite::Command::Extensions::Errors
|
|
8
|
+
|
|
9
|
+
attr_accessor :exit_on_failure
|
|
10
|
+
|
|
11
|
+
def execute
|
|
12
|
+
steps.each_with_object([]).with_index do |(command, results), i|
|
|
13
|
+
command.call
|
|
14
|
+
|
|
15
|
+
if command.respond_to?(:errors) && command.failure?
|
|
16
|
+
failed_steps << failed_step(i, command)
|
|
17
|
+
merge_errors!(command) if respond_to?(:errors)
|
|
18
|
+
break results if exit_on_failure?
|
|
19
|
+
else
|
|
20
|
+
results << command.result
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
def exit_on_failure?
|
|
26
|
+
@exit_on_failure ||= false
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
def failed_steps
|
|
30
|
+
@failed_steps ||= []
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
def steps
|
|
34
|
+
@steps ||= @args.flatten
|
|
35
|
+
end
|
|
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
|
+
|
|
49
|
+
end
|
|
50
|
+
end
|
|
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.0
|
|
4
|
+
version: 1.2.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Juan Gomez
|
|
8
|
-
autorequire:
|
|
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
|
|
@@ -192,7 +206,7 @@ dependencies:
|
|
|
192
206
|
- - ">="
|
|
193
207
|
- !ruby/object:Gem::Version
|
|
194
208
|
version: '0'
|
|
195
|
-
description:
|
|
209
|
+
description:
|
|
196
210
|
email:
|
|
197
211
|
- j.gomez@drexed.com
|
|
198
212
|
executables: []
|
|
@@ -215,18 +229,16 @@ files:
|
|
|
215
229
|
- _config.yml
|
|
216
230
|
- bin/console
|
|
217
231
|
- bin/setup
|
|
218
|
-
- lib/generators/lite/command/install_generator.rb
|
|
219
|
-
- lib/generators/lite/command/templates/install.rb
|
|
220
232
|
- lib/generators/rails/USAGE
|
|
221
233
|
- lib/generators/rails/command_generator.rb
|
|
222
234
|
- lib/generators/rails/templates/command.rb.tt
|
|
223
|
-
- lib/generators/rails/templates/spec.rb.tt
|
|
224
235
|
- lib/lite/command.rb
|
|
225
236
|
- lib/lite/command/complex.rb
|
|
226
237
|
- lib/lite/command/exceptions.rb
|
|
227
238
|
- lib/lite/command/extensions/errors.rb
|
|
228
239
|
- lib/lite/command/extensions/memoize.rb
|
|
229
240
|
- lib/lite/command/extensions/propagation.rb
|
|
241
|
+
- lib/lite/command/procedure.rb
|
|
230
242
|
- lib/lite/command/simple.rb
|
|
231
243
|
- lib/lite/command/states.rb
|
|
232
244
|
- lib/lite/command/version.rb
|
|
@@ -235,7 +247,7 @@ homepage: http://drexed.github.io/lite-command
|
|
|
235
247
|
licenses:
|
|
236
248
|
- MIT
|
|
237
249
|
metadata: {}
|
|
238
|
-
post_install_message:
|
|
250
|
+
post_install_message:
|
|
239
251
|
rdoc_options: []
|
|
240
252
|
require_paths:
|
|
241
253
|
- lib
|
|
@@ -250,8 +262,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
250
262
|
- !ruby/object:Gem::Version
|
|
251
263
|
version: '0'
|
|
252
264
|
requirements: []
|
|
253
|
-
rubygems_version: 3.
|
|
254
|
-
signing_key:
|
|
265
|
+
rubygems_version: 3.2.8
|
|
266
|
+
signing_key:
|
|
255
267
|
specification_version: 4
|
|
256
268
|
summary: Ruby Command based framework (aka service objects)
|
|
257
269
|
test_files: []
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
require 'rails/generators'
|
|
4
|
-
|
|
5
|
-
module Lite
|
|
6
|
-
module Command
|
|
7
|
-
class InstallGenerator < Rails::Generators::Base
|
|
8
|
-
|
|
9
|
-
source_root File.expand_path('../templates', __FILE__)
|
|
10
|
-
|
|
11
|
-
def copy_application_query_file
|
|
12
|
-
copy_file('install.rb', 'app/commands/application_command.rb')
|
|
13
|
-
end
|
|
14
|
-
|
|
15
|
-
end
|
|
16
|
-
end
|
|
17
|
-
end
|