toys-core 0.6.0 → 0.6.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 +4 -0
- data/lib/toys/core_version.rb +1 -1
- data/lib/toys/loader.rb +21 -15
- metadata +5 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ac33c1214b7ae27c8ecea97837cd1ba186dfc3715db69ef52ef9dc24e56f8064
|
4
|
+
data.tar.gz: 9e8cc340e38cd320893cf9ee47c31c138ea42f9850c8efebb315a9e60182d791
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e77ed0de1cc6ee14300c4787c334f3ecd97e338d16df4e9004b303a618163b6cd07709cf1d956e9278b9e52624105cdfd87010c55d111580a164a9a6cddf9b4f
|
7
|
+
data.tar.gz: 02521cfe60b37bb36c7a5550a2c33a42e4de6f74350fa3b852c333642fc7aa0e7e7b4523a94219236f1523ad7a9c3f5297a2467b2a03b5337234fb059eac730c
|
data/CHANGELOG.md
CHANGED
data/lib/toys/core_version.rb
CHANGED
data/lib/toys/loader.rb
CHANGED
@@ -341,7 +341,7 @@ module Toys
|
|
341
341
|
|
342
342
|
private
|
343
343
|
|
344
|
-
ALLOWED_DELIMITERS = %r{^[\./:]*$}
|
344
|
+
ALLOWED_DELIMITERS = %r{^[\./:]*$}.freeze
|
345
345
|
|
346
346
|
def process_extra_delimiters(input)
|
347
347
|
unless ALLOWED_DELIMITERS =~ input
|
@@ -374,19 +374,12 @@ module Toys
|
|
374
374
|
# priority tool that has been defined. If no tool has been defined with
|
375
375
|
# the given name, returns `nil`.
|
376
376
|
#
|
377
|
-
# @private
|
378
|
-
#
|
379
377
|
def get_active_tool(words, looked_up = [])
|
380
378
|
tool_data = get_tool_data(words)
|
381
379
|
result = tool_data.active_definition
|
382
380
|
case result
|
383
381
|
when Definition::Alias
|
384
|
-
|
385
|
-
if looked_up.include?(words)
|
386
|
-
raise ToolDefinitionError, "Circular alias references: #{looked_up.inspect}"
|
387
|
-
end
|
388
|
-
looked_up << words
|
389
|
-
get_active_tool(words, looked_up)
|
382
|
+
resolve_alias(result, looked_up)
|
390
383
|
when Definition::Tool
|
391
384
|
result
|
392
385
|
else
|
@@ -394,6 +387,18 @@ module Toys
|
|
394
387
|
end
|
395
388
|
end
|
396
389
|
|
390
|
+
##
|
391
|
+
# Resolves the given alias
|
392
|
+
#
|
393
|
+
def resolve_alias(alias_tool, looked_up = [])
|
394
|
+
words = alias_tool.target_name
|
395
|
+
if looked_up.include?(words)
|
396
|
+
raise ToolDefinitionError, "Circular alias references: #{looked_up.inspect}"
|
397
|
+
end
|
398
|
+
looked_up << words
|
399
|
+
get_active_tool(words, looked_up)
|
400
|
+
end
|
401
|
+
|
397
402
|
def resolve_middleware(input)
|
398
403
|
input = Array(input)
|
399
404
|
cls = input.first
|
@@ -526,16 +531,17 @@ module Toys
|
|
526
531
|
def filter_hidden_subtools(tools)
|
527
532
|
result = []
|
528
533
|
tools.each_with_index do |tool, index|
|
529
|
-
|
530
|
-
unless tool.runnable?
|
531
|
-
next_tool = tools[index + 1]
|
532
|
-
next if next_tool && next_tool.full_name.slice(0..-2) == tool.full_name
|
533
|
-
end
|
534
|
-
result << tool
|
534
|
+
result << tool unless tool_hidden?(tool, tools[index + 1])
|
535
535
|
end
|
536
536
|
result
|
537
537
|
end
|
538
538
|
|
539
|
+
def tool_hidden?(tool, next_tool)
|
540
|
+
return true if tool.full_name.any? { |n| n.start_with?("_") }
|
541
|
+
return tool_hidden?(resolve_alias(tool), nil) if tool.is_a? Definition::Alias
|
542
|
+
!tool.runnable? && next_tool && next_tool.full_name.slice(0..-2) == tool.full_name
|
543
|
+
end
|
544
|
+
|
539
545
|
def calc_remaining_words(words1, words2)
|
540
546
|
index = 0
|
541
547
|
lengths = [words1.length, words2.length]
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: toys-core
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.6.
|
4
|
+
version: 0.6.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Daniel Azuma
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2019-01-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: highline
|
@@ -86,14 +86,14 @@ dependencies:
|
|
86
86
|
requirements:
|
87
87
|
- - "~>"
|
88
88
|
- !ruby/object:Gem::Version
|
89
|
-
version: 0.
|
89
|
+
version: 0.62.0
|
90
90
|
type: :development
|
91
91
|
prerelease: false
|
92
92
|
version_requirements: !ruby/object:Gem::Requirement
|
93
93
|
requirements:
|
94
94
|
- - "~>"
|
95
95
|
- !ruby/object:Gem::Version
|
96
|
-
version: 0.
|
96
|
+
version: 0.62.0
|
97
97
|
- !ruby/object:Gem::Dependency
|
98
98
|
name: yard
|
99
99
|
requirement: !ruby/object:Gem::Requirement
|
@@ -180,8 +180,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
180
180
|
- !ruby/object:Gem::Version
|
181
181
|
version: '0'
|
182
182
|
requirements: []
|
183
|
-
|
184
|
-
rubygems_version: 2.7.6
|
183
|
+
rubygems_version: 3.0.2
|
185
184
|
signing_key:
|
186
185
|
specification_version: 4
|
187
186
|
summary: Framework for creating command line binaries
|