lite-command 1.0.10 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 6feebc5e78cac74077531519297ff22b363fb2222b25f81e7a9b8c19c2762ac7
4
- data.tar.gz: 21cd5b42655e169af48f0081c7cf63196c4779f9a0d07b74be8d9cc77eb3f8d8
3
+ metadata.gz: 1832d3973ed0b408d8c4c11d6fb0e53ab9184080bc5eca37d99c69ec7a29c09c
4
+ data.tar.gz: a7f5dc00b4b00587a8f4f9115637d02f69ad7218112b1a1b066a994e477be93d
5
5
  SHA512:
6
- metadata.gz: 5cb3f7fa8726bea8569e565a4c567f08a696b72d53bd85fe4a68dd0f4869be90cc60ef22e3968ab7cff314f97797d76ff0efc254112000282d0581b37eed634b
7
- data.tar.gz: 4bf282682cf120881ea8d30fabf3b1f87e9f612cc2ed7f1c0d16d397d4f82e881c86198f6e18b8452a12b7ffd706ed5eb12f133c5dad9038ca6bce943ed3dcb5
6
+ metadata.gz: 235acc1478d53eeb81f16419a3c53eaa1ca743f472872508e433d4031b1a5fbc19f6a1cdee11d1fa7f35b44031ef8cd6d36510646e5c8cf58748f8866e365bd3
7
+ data.tar.gz: eebb89a36eac24e2836c5742a78039c575bda0915696588da8cdbd1c0e4a40af976e6ab8412ab1e2d36790d422191aa2440f0d2fbdb3341b5c17d3679b32f8ac
@@ -2,9 +2,14 @@ require:
2
2
  - rubocop-performance
3
3
  - rubocop-rspec
4
4
  AllCops:
5
- TargetRubyVersion: 2.6
5
+ TargetRubyVersion: 2.7
6
+ NewCops: enable
6
7
  DisplayCopNames: true
7
8
  DisplayStyleGuide: true
9
+ Gemspec/RequiredRubyVersion:
10
+ Enabled: false
11
+ Layout/EmptyLinesAroundAttributeAccessor:
12
+ Enabled: true
8
13
  Layout/EmptyLinesAroundBlockBody:
9
14
  Exclude:
10
15
  - 'spec/**/**/*'
@@ -14,6 +19,12 @@ Layout/EmptyLinesAroundModuleBody:
14
19
  EnforcedStyle: empty_lines_except_namespace
15
20
  Layout/LineLength:
16
21
  Max: 100
22
+ Layout/SpaceAroundMethodCallOperator:
23
+ Enabled: true
24
+ Lint/RaiseException:
25
+ Enabled: true
26
+ Lint/StructNewOverride:
27
+ Enabled: true
17
28
  Metrics/BlockLength:
18
29
  Exclude:
19
30
  - 'spec/**/**/*'
@@ -4,6 +4,7 @@ cache: bundler
4
4
  rvm:
5
5
  - 2.5
6
6
  - 2.6
7
+ - 2.7
7
8
  - ruby-head
8
9
  matrix:
9
10
  fast_finish: true
@@ -6,7 +6,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
6
6
 
7
7
  ## [Unreleased]
8
8
 
9
+ ## [1.1.0] - 2019-06-06
10
+ ### Added
11
+ - Added procedure support for running multiple commands
12
+
9
13
  ## [1.0.10] - 2019-12-21
14
+ ### Added
15
+ - Added Ruby 2.7 support
10
16
  ### Removed
11
17
  - Removed generator empty directory check
12
18
 
@@ -1,68 +1,67 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- lite-command (1.0.10)
4
+ lite-command (1.1.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.0.2.1)
12
- actionview (= 6.0.2.1)
13
- activesupport (= 6.0.2.1)
11
+ actionpack (6.0.3.4)
12
+ actionview (= 6.0.3.4)
13
+ activesupport (= 6.0.3.4)
14
14
  rack (~> 2.0, >= 2.0.8)
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.0.2.1)
19
- activesupport (= 6.0.2.1)
18
+ actionview (6.0.3.4)
19
+ activesupport (= 6.0.3.4)
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.0.2.1)
25
- activesupport (= 6.0.2.1)
26
- activerecord (6.0.2.1)
27
- activemodel (= 6.0.2.1)
28
- activesupport (= 6.0.2.1)
29
- activesupport (6.0.2.1)
24
+ activemodel (6.0.3.4)
25
+ activesupport (= 6.0.3.4)
26
+ activerecord (6.0.3.4)
27
+ activemodel (= 6.0.3.4)
28
+ activesupport (= 6.0.3.4)
29
+ activesupport (6.0.3.4)
30
30
  concurrent-ruby (~> 1.0, >= 1.0.2)
31
31
  i18n (>= 0.7, < 2)
32
32
  minitest (~> 5.1)
33
33
  tzinfo (~> 1.1)
34
- zeitwerk (~> 2.2)
35
- ast (2.4.0)
34
+ zeitwerk (~> 2.2, >= 2.2.2)
35
+ ast (2.4.1)
36
36
  builder (3.2.4)
37
37
  colorize (0.8.1)
38
- concurrent-ruby (1.1.5)
39
- crass (1.0.5)
40
- database_cleaner (1.7.0)
41
- diff-lcs (1.3)
38
+ concurrent-ruby (1.1.7)
39
+ crass (1.0.6)
40
+ database_cleaner (1.8.5)
41
+ diff-lcs (1.4.4)
42
42
  erubi (1.9.0)
43
- fasterer (0.8.1)
43
+ fasterer (0.8.3)
44
44
  colorize (~> 0.7)
45
45
  ruby_parser (>= 3.14.1)
46
46
  generator_spec (0.9.4)
47
47
  activesupport (>= 3.0.0)
48
48
  railties (>= 3.0.0)
49
- i18n (1.7.0)
49
+ i18n (1.8.5)
50
50
  concurrent-ruby (~> 1.0)
51
- jaro_winkler (1.5.4)
52
51
  lite-errors (1.0.1)
53
52
  lite-memoize (1.0.3)
54
- loofah (2.4.0)
53
+ loofah (2.7.0)
55
54
  crass (~> 1.0.2)
56
55
  nokogiri (>= 1.5.9)
57
- method_source (0.9.2)
56
+ method_source (1.0.0)
58
57
  mini_portile2 (2.4.0)
59
- minitest (5.13.0)
60
- nokogiri (1.10.7)
58
+ minitest (5.14.2)
59
+ nokogiri (1.10.10)
61
60
  mini_portile2 (~> 2.4.0)
62
- parallel (1.19.1)
63
- parser (2.6.5.0)
64
- ast (~> 2.4.0)
65
- rack (2.0.8)
61
+ parallel (1.19.2)
62
+ parser (2.7.2.0)
63
+ ast (~> 2.4.1)
64
+ rack (2.2.3)
66
65
  rack-test (1.1.0)
67
66
  rack (>= 1.0, < 3)
68
67
  rails-dom-testing (2.0.3)
@@ -70,49 +69,57 @@ GEM
70
69
  nokogiri (>= 1.6)
71
70
  rails-html-sanitizer (1.3.0)
72
71
  loofah (~> 2.3)
73
- railties (6.0.2.1)
74
- actionpack (= 6.0.2.1)
75
- activesupport (= 6.0.2.1)
72
+ railties (6.0.3.4)
73
+ actionpack (= 6.0.3.4)
74
+ activesupport (= 6.0.3.4)
76
75
  method_source
77
76
  rake (>= 0.8.7)
78
77
  thor (>= 0.20.3, < 2.0)
79
78
  rainbow (3.0.0)
80
79
  rake (13.0.1)
81
- rspec (3.9.0)
82
- rspec-core (~> 3.9.0)
83
- rspec-expectations (~> 3.9.0)
84
- rspec-mocks (~> 3.9.0)
85
- rspec-core (3.9.0)
86
- rspec-support (~> 3.9.0)
87
- rspec-expectations (3.9.0)
80
+ regexp_parser (1.8.2)
81
+ rexml (3.2.4)
82
+ rspec (3.10.0)
83
+ rspec-core (~> 3.10.0)
84
+ rspec-expectations (~> 3.10.0)
85
+ rspec-mocks (~> 3.10.0)
86
+ rspec-core (3.10.0)
87
+ rspec-support (~> 3.10.0)
88
+ rspec-expectations (3.10.0)
88
89
  diff-lcs (>= 1.2.0, < 2.0)
89
- rspec-support (~> 3.9.0)
90
- rspec-mocks (3.9.0)
90
+ rspec-support (~> 3.10.0)
91
+ rspec-mocks (3.10.0)
91
92
  diff-lcs (>= 1.2.0, < 2.0)
92
- rspec-support (~> 3.9.0)
93
- rspec-support (3.9.0)
94
- rubocop (0.78.0)
95
- jaro_winkler (~> 1.5.1)
93
+ rspec-support (~> 3.10.0)
94
+ rspec-support (3.10.0)
95
+ rubocop (1.2.0)
96
96
  parallel (~> 1.10)
97
- parser (>= 2.6)
97
+ parser (>= 2.7.1.5)
98
98
  rainbow (>= 2.2.2, < 4.0)
99
+ regexp_parser (>= 1.8)
100
+ rexml
101
+ rubocop-ast (>= 1.0.1)
99
102
  ruby-progressbar (~> 1.7)
100
- unicode-display_width (>= 1.4.0, < 1.7)
101
- rubocop-performance (1.5.1)
102
- rubocop (>= 0.71.0)
103
- rubocop-rspec (1.37.1)
104
- rubocop (>= 0.68.1)
103
+ unicode-display_width (>= 1.4.0, < 2.0)
104
+ rubocop-ast (1.1.1)
105
+ parser (>= 2.7.1.5)
106
+ rubocop-performance (1.8.1)
107
+ rubocop (>= 0.87.0)
108
+ rubocop-ast (>= 0.4.0)
109
+ rubocop-rspec (2.0.0)
110
+ rubocop (~> 1.0)
111
+ rubocop-ast (>= 1.1.0)
105
112
  ruby-progressbar (1.10.1)
106
- ruby_parser (3.14.1)
113
+ ruby_parser (3.15.0)
107
114
  sexp_processor (~> 4.9)
108
- sexp_processor (4.13.0)
115
+ sexp_processor (4.15.1)
109
116
  sqlite3 (1.4.2)
110
117
  thor (1.0.1)
111
118
  thread_safe (0.3.6)
112
- tzinfo (1.2.5)
119
+ tzinfo (1.2.7)
113
120
  thread_safe (~> 0.1)
114
- unicode-display_width (1.6.0)
115
- zeitwerk (2.2.2)
121
+ unicode-display_width (1.7.0)
122
+ zeitwerk (2.4.1)
116
123
 
117
124
  PLATFORMS
118
125
  ruby
@@ -132,4 +139,4 @@ DEPENDENCIES
132
139
  sqlite3
133
140
 
134
141
  BUNDLED WITH
135
- 2.0.2
142
+ 2.1.4
data/README.md CHANGED
@@ -27,6 +27,7 @@ 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
@@ -60,8 +61,7 @@ end
60
61
  **Caller**
61
62
 
62
63
  ```ruby
63
- command = SearchMovies.call('Toy Story')
64
- command.call
64
+ SearchMovies.call('Toy Story')
65
65
  ```
66
66
 
67
67
  ## Complex
@@ -130,9 +130,39 @@ command.recall! #=> Clears the call, cache, errors, and then re-performs the cal
130
130
  command.result #=> { 'fingerprint_2' => [ 'Toy Story 2', ... ] }
131
131
  ```
132
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,
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,
155
+ MtvChannel.new
156
+ )
157
+
158
+ procedure.exit_on_failure = true
159
+ procedure.call
160
+ procedure.result #=> ['disney: #3']
161
+ ```
162
+
133
163
  ## Extensions
134
164
 
135
- Extend complex base command with any of the following extensions:
165
+ Extend complex (and procedures) base command with any of the following extensions:
136
166
 
137
167
  ### Errors (optional)
138
168
 
@@ -6,7 +6,7 @@ require 'lite/command/version'
6
6
  require "lite/command/extensions/#{name}"
7
7
  end
8
8
 
9
- %w[exceptions states complex simple].each do |name|
9
+ %w[exceptions states simple complex procedure].each do |name|
10
10
  require "lite/command/#{name}"
11
11
  end
12
12
 
@@ -0,0 +1,34 @@
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([]) do |command, results|
13
+ command.call
14
+
15
+ if respond_to?(:errors) && command.respond_to?(:errors) && command.failure?
16
+ merge_errors!(command)
17
+ break results if exit_on_failure?
18
+ else
19
+ results << command.result
20
+ end
21
+ end
22
+ end
23
+
24
+ def exit_on_failure?
25
+ @exit_on_failure ||= false
26
+ end
27
+
28
+ def steps
29
+ @steps ||= @args.flatten
30
+ end
31
+
32
+ end
33
+ end
34
+ end
@@ -3,7 +3,7 @@
3
3
  module Lite
4
4
  module Command
5
5
 
6
- VERSION ||= '1.0.10'
6
+ VERSION ||= '1.1.0'
7
7
 
8
8
  end
9
9
  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.10
4
+ version: 1.1.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: 2019-12-21 00:00:00.000000000 Z
11
+ date: 2020-11-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: lite-errors
@@ -192,7 +192,7 @@ dependencies:
192
192
  - - ">="
193
193
  - !ruby/object:Gem::Version
194
194
  version: '0'
195
- description:
195
+ description:
196
196
  email:
197
197
  - j.gomez@drexed.com
198
198
  executables: []
@@ -224,6 +224,7 @@ files:
224
224
  - lib/lite/command/extensions/errors.rb
225
225
  - lib/lite/command/extensions/memoize.rb
226
226
  - lib/lite/command/extensions/propagation.rb
227
+ - lib/lite/command/procedure.rb
227
228
  - lib/lite/command/simple.rb
228
229
  - lib/lite/command/states.rb
229
230
  - lib/lite/command/version.rb
@@ -232,7 +233,7 @@ homepage: http://drexed.github.io/lite-command
232
233
  licenses:
233
234
  - MIT
234
235
  metadata: {}
235
- post_install_message:
236
+ post_install_message:
236
237
  rdoc_options: []
237
238
  require_paths:
238
239
  - lib
@@ -247,8 +248,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
247
248
  - !ruby/object:Gem::Version
248
249
  version: '0'
249
250
  requirements: []
250
- rubygems_version: 3.1.1
251
- signing_key:
251
+ rubygems_version: 3.1.4
252
+ signing_key:
252
253
  specification_version: 4
253
254
  summary: Ruby Command based framework (aka service objects)
254
255
  test_files: []