consoler 1.2.0 → 1.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/tests.yml +34 -0
- data/README.md +15 -15
- data/consoler.gemspec +3 -3
- data/lib/consoler/matcher.rb +7 -1
- data/lib/consoler/version.rb +1 -1
- metadata +9 -10
- data/.travis.yml +0 -12
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 924c498b6db12469aef2fb31bbe7cc0bbcaa0e10cccb2a18b91584484b3cb189
|
4
|
+
data.tar.gz: f99cdb84ac04f1ce5baa60ce29ccd7667a5239c0b959b1310ce8f8a9da4292a9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 20ff199169e12d2bff2be0d12b3bcb6e615eb5613166406c4e46963e6716fd9b70306f7b6f561525f0783866f6d8e0d4c7315b73f98150d2133bccf4a643bc48
|
7
|
+
data.tar.gz: 34fb00e04d57de3fbcfc0b8242d01f5a76010860cac2fc78a69622ee3c7c89eb656a3f6d0abe05a7c38bdf71b97a97871c6738e488d52be203c5a2cc8bb603d4
|
@@ -0,0 +1,34 @@
|
|
1
|
+
name: tests
|
2
|
+
|
3
|
+
on:
|
4
|
+
push:
|
5
|
+
branches: [master]
|
6
|
+
pull_request:
|
7
|
+
branches: [master]
|
8
|
+
|
9
|
+
jobs:
|
10
|
+
tests:
|
11
|
+
runs-on: ubuntu-latest
|
12
|
+
|
13
|
+
strategy:
|
14
|
+
fail-fast: false
|
15
|
+
matrix:
|
16
|
+
ruby: ['2.4', '2.5', '2.6', '2.7', '3.0']
|
17
|
+
|
18
|
+
name: Ruby ${{ matrix.ruby }}
|
19
|
+
|
20
|
+
steps:
|
21
|
+
- uses: actions/checkout@v2
|
22
|
+
|
23
|
+
- name: Set up Ruby
|
24
|
+
# change this to (see https://github.com/ruby/setup-ruby#versioning):
|
25
|
+
uses: ruby/setup-ruby@v1
|
26
|
+
with:
|
27
|
+
ruby-version: ${{ matrix.ruby }}
|
28
|
+
bundler-cache: true
|
29
|
+
|
30
|
+
- name: Report Ruby version
|
31
|
+
run: ruby -v
|
32
|
+
|
33
|
+
- name: Run tests
|
34
|
+
run: bundle exec rake
|
data/README.md
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# Consoler [![
|
1
|
+
# Consoler [![Gem Version](https://badge.fury.io/rb/consoler.svg)](https://badge.fury.io/rb/consoler)
|
2
2
|
|
3
3
|
> Sinatra-like application builder for the console
|
4
4
|
|
@@ -38,11 +38,11 @@ app.run
|
|
38
38
|
|
39
39
|
Tests are run against multiple ruby versions (latest supported):
|
40
40
|
|
41
|
-
- `2.2.x`
|
42
|
-
- `2.3.x`
|
43
41
|
- `2.4.x`
|
44
42
|
- `2.5.x`
|
45
43
|
- `2.6.x`
|
44
|
+
- `2.7.x`
|
45
|
+
- `3.0.x`
|
46
46
|
|
47
47
|
No other requirements exist.
|
48
48
|
|
@@ -55,20 +55,20 @@ gem install consoler
|
|
55
55
|
or add to your `Gemfile` for applications
|
56
56
|
|
57
57
|
```ruby
|
58
|
-
gem 'consoler', '~> 1.2.
|
58
|
+
gem 'consoler', '~> 1.2.1'
|
59
59
|
```
|
60
60
|
|
61
61
|
or to your `.gemspec` file for gems
|
62
62
|
|
63
63
|
```ruby
|
64
64
|
Gem::Specification.new do |spec|
|
65
|
-
spec.add_dependency 'consoler', '~> 1.2.
|
65
|
+
spec.add_dependency 'consoler', '~> 1.2.1'
|
66
66
|
end
|
67
67
|
```
|
68
68
|
|
69
69
|
## Docs
|
70
70
|
|
71
|
-
Full API documentation can the found here: https://www.rubydoc.info/gems/consoler/1.2.
|
71
|
+
Full API documentation can the found here: https://www.rubydoc.info/gems/consoler/1.2.1
|
72
72
|
|
73
73
|
### API
|
74
74
|
|
@@ -152,15 +152,15 @@ ruby app.rb d --verbose
|
|
152
152
|
|
153
153
|
#### Options definition
|
154
154
|
|
155
|
-
| Option
|
156
|
-
|
|
157
|
-
| `-f`
|
158
|
-
| `--clean`
|
159
|
-
| `-v
|
160
|
-
| `<output_dir>`
|
161
|
-
| `--env=`
|
162
|
-
| `-e=`
|
163
|
-
| `[ .. ]`
|
155
|
+
| Option | Meaning | Example |
|
156
|
+
| --------------- | ------------------------------- | -------------------------------------- |
|
157
|
+
| `-f` | Short option with name `f` | `ruby app.rb build -f` |
|
158
|
+
| `--clean` | Long option with name `clean` | `ruby app.rb build --clean` |
|
159
|
+
| `-v\|--verbose` | Alias option for `v` | `ruby app.rb build --verbose` |
|
160
|
+
| `<output_dir>` | Argument with name `output_dir` | `ruby app.rb build dist/` |
|
161
|
+
| `--env=` | Long option with value | `ruby app.rb build --env production` |
|
162
|
+
| `-e=` | Short option with value | `ruby app.rb build -e production` |
|
163
|
+
| `[ .. ]` | Optional options/arguments | `ruby app.rb build` would match `[-v]` |
|
164
164
|
|
165
165
|
Some notes about these options:
|
166
166
|
|
data/consoler.gemspec
CHANGED
@@ -22,10 +22,10 @@ Gem::Specification.new do |spec|
|
|
22
22
|
# build docs on install
|
23
23
|
spec.metadata['yard.run'] = 'yri'
|
24
24
|
|
25
|
-
spec.required_ruby_version = '>= 2.
|
26
|
-
spec.add_development_dependency 'bundler', '~>
|
25
|
+
spec.required_ruby_version = '>= 2.4'
|
26
|
+
spec.add_development_dependency 'bundler', '~> 2.0'
|
27
27
|
spec.add_development_dependency 'minitest', '~> 5.11.3'
|
28
28
|
spec.add_development_dependency 'rake', '~> 12.3.0'
|
29
|
-
spec.add_development_dependency 'simplecov', '~> 0.
|
29
|
+
spec.add_development_dependency 'simplecov', '~> 0.16.1'
|
30
30
|
spec.add_development_dependency 'yard', '~> 0.9.12'
|
31
31
|
end
|
data/lib/consoler/matcher.rb
CHANGED
@@ -201,11 +201,13 @@ module Consoler
|
|
201
201
|
|
202
202
|
# Match arguments to defined option arguments
|
203
203
|
#
|
204
|
-
# @return [Array<String
|
204
|
+
# @return [Array<String>, nil] The remaining args,
|
205
|
+
# or <tt>nil</tt> if there are not enough arguments
|
205
206
|
def _match_arguments
|
206
207
|
@optionals_before = {}
|
207
208
|
@optionals_before_has_remaining = false
|
208
209
|
|
210
|
+
total_argument_values = @argument_values.size
|
209
211
|
argument_values_index = 0
|
210
212
|
|
211
213
|
_match_arguments_optionals_before
|
@@ -216,6 +218,8 @@ module Consoler
|
|
216
218
|
optionals.each do |_, optional|
|
217
219
|
optional.each do |before|
|
218
220
|
if before[:included]
|
221
|
+
return nil if argument_values_index >= total_argument_values
|
222
|
+
|
219
223
|
@matched_options[before[:name]] = @argument_values[argument_values_index]
|
220
224
|
argument_values_index += 1
|
221
225
|
end
|
@@ -224,6 +228,8 @@ module Consoler
|
|
224
228
|
|
225
229
|
# only fill mandatory argument if its not the :REMAINING key
|
226
230
|
if mandatory_arg_name != :REMAINING
|
231
|
+
return nil if argument_values_index >= total_argument_values
|
232
|
+
|
227
233
|
@matched_options[mandatory_arg_name] = @argument_values[argument_values_index]
|
228
234
|
argument_values_index += 1
|
229
235
|
end
|
data/lib/consoler/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: consoler
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.2.
|
4
|
+
version: 1.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tim
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2020-12-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '
|
19
|
+
version: '2.0'
|
20
20
|
type: :development
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '
|
26
|
+
version: '2.0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: minitest
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -58,14 +58,14 @@ dependencies:
|
|
58
58
|
requirements:
|
59
59
|
- - "~>"
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version: 0.
|
61
|
+
version: 0.16.1
|
62
62
|
type: :development
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
66
|
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version: 0.
|
68
|
+
version: 0.16.1
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: yard
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
@@ -87,9 +87,9 @@ extensions: []
|
|
87
87
|
extra_rdoc_files: []
|
88
88
|
files:
|
89
89
|
- ".editorconfig"
|
90
|
+
- ".github/workflows/tests.yml"
|
90
91
|
- ".gitignore"
|
91
92
|
- ".rubocop.yml"
|
92
|
-
- ".travis.yml"
|
93
93
|
- ".yardopts"
|
94
94
|
- Gemfile
|
95
95
|
- LICENSE.txt
|
@@ -117,15 +117,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
117
117
|
requirements:
|
118
118
|
- - ">="
|
119
119
|
- !ruby/object:Gem::Version
|
120
|
-
version: '2.
|
120
|
+
version: '2.4'
|
121
121
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
122
122
|
requirements:
|
123
123
|
- - ">="
|
124
124
|
- !ruby/object:Gem::Version
|
125
125
|
version: '0'
|
126
126
|
requirements: []
|
127
|
-
|
128
|
-
rubygems_version: 2.7.6
|
127
|
+
rubygems_version: 3.1.2
|
129
128
|
signing_key:
|
130
129
|
specification_version: 4
|
131
130
|
summary: Consoler
|