toys 0.3.3 → 0.3.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +17 -0
- data/builtins/do.rb +18 -2
- data/builtins/system.rb +10 -1
- data/lib/toys/standard_cli.rb +44 -14
- data/lib/toys/version.rb +1 -1
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0b6bf7f26f6ec380fcff62d91f671dd0ac535c740c5dab496ea681f9a94ec93c
|
4
|
+
data.tar.gz: 84b17a1f483b441c3944fa5dc46a9a672b2a339b71c2b5521ce01a7fe117be28
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: dbdc0f5c476a6bd8e46623b7d62b1263ef5e259bc1936991e31294d94083cd551ec078c30f4c05b1bbd966d34c3c49c76ab2f05b37cba68f79b8cf8565995d48
|
7
|
+
data.tar.gz: 4b46179105d491e4860418d2737c3dd190fd199a93f0cdcd7496943c2c05510d4fd0b787df0265b50a65bd962a36129258899ef4fd29faa9b609a4efc0ed37ee
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,22 @@
|
|
1
1
|
# Release History
|
2
2
|
|
3
|
+
### 0.3.4 / 2018-05-14
|
4
|
+
|
5
|
+
* CHANGED: Renamed switch to flag
|
6
|
+
* CHANGED: Renamed docs: parameter again, to desc: and long_desc: to match tool desc.
|
7
|
+
* CHANGED: desc is now a single string rather than an array.
|
8
|
+
* CHANGED: accept: parameter now controls whether a switch takes a value by default
|
9
|
+
* IMPROVED: Nicer help page format
|
10
|
+
* IMPROVED: gem_build template can suppress interactive confirmation.
|
11
|
+
* IMPROVED: system update builtin can optionally ask for confirmation.
|
12
|
+
* IMPROVED: Error reporting is significantly improved.
|
13
|
+
* IMPROVED: Logger colors the header when possible.
|
14
|
+
* IMPROVED: Style support for spinner helper
|
15
|
+
* IMPROVED: Set default descriptions for flags and args
|
16
|
+
* ADDED: Alias DSL methods `required`, `optional`, and `remaining`.
|
17
|
+
* FIXED: Subtools with no desc now properly pick up the default
|
18
|
+
* FIXED: Usage errors and show-help now interact in the right way
|
19
|
+
|
3
20
|
### 0.3.3 / 2018-05-09
|
4
21
|
|
5
22
|
* CHANGED: Renamed file_utils helper to fileutils.
|
data/builtins/do.rb
CHANGED
@@ -29,9 +29,25 @@
|
|
29
29
|
|
30
30
|
desc "Run multiple tools in order"
|
31
31
|
|
32
|
-
|
32
|
+
long_desc \
|
33
|
+
"The \"toys do\" builtin provides a convenient interface for running multiple tools in" \
|
34
|
+
" sequence. Provide the tools to run as arguments, separated by a delimiter (which is" \
|
35
|
+
" the string \",\" by default). Toys will run them in order, stopping if any tool" \
|
36
|
+
" returns a nonzero exit code.",
|
37
|
+
"",
|
38
|
+
"Example: Suppose you have a \"rails build\" tool and a \"deploy\" tool, each with some" \
|
39
|
+
" flags. You could run them in order, with their flags, like this:",
|
40
|
+
[" toys do rails build --staging , deploy --migrate"],
|
41
|
+
"",
|
42
|
+
"You may change the delimiter using the --delim flag. For example:",
|
43
|
+
[" toys do --delim=/ rails build --staging / deploy --migrate"]
|
33
44
|
|
34
|
-
|
45
|
+
flag :delim, "-d", "--delim=VALUE",
|
46
|
+
default: ",",
|
47
|
+
desc: "Set the delimiter",
|
48
|
+
long_desc: "Sets the delimiter that separates tool invocations. The default value is \",\"."
|
49
|
+
|
50
|
+
remaining_args :args, desc: "A series of tools to run, separated by the delimiter"
|
35
51
|
|
36
52
|
execute do
|
37
53
|
delim = self[:delim]
|
data/builtins/system.rb
CHANGED
@@ -29,6 +29,8 @@
|
|
29
29
|
|
30
30
|
desc "A group of system commands for toys"
|
31
31
|
|
32
|
+
long_desc "Contains tools that inspect, configure, and update toys itself."
|
33
|
+
|
32
34
|
tool "version" do
|
33
35
|
desc "Print current toys version."
|
34
36
|
|
@@ -40,7 +42,13 @@ end
|
|
40
42
|
tool "update" do
|
41
43
|
desc "Update toys if a newer version is available."
|
42
44
|
|
45
|
+
long_desc "Checks rubygems for a newer version of toys. If one is available, downloads" \
|
46
|
+
" and installs it."
|
47
|
+
|
48
|
+
flag :yes, "-y", "--yes", desc: "Do not ask for interactive confirmation"
|
49
|
+
|
43
50
|
use :exec
|
51
|
+
use :highline
|
44
52
|
|
45
53
|
execute do
|
46
54
|
logger.info "Checking rubygems for the latest toys release..."
|
@@ -49,7 +57,8 @@ tool "update" do
|
|
49
57
|
latest_version = ::Gem::Version.new($1)
|
50
58
|
cur_version = ::Gem::Version.new(::Toys::VERSION)
|
51
59
|
if latest_version > cur_version
|
52
|
-
|
60
|
+
exit(1) unless options[:yes] ||
|
61
|
+
agree("Update toys from #{cur_version} to #{latest_version}? (y/n) ")
|
53
62
|
sh("gem install toys")
|
54
63
|
elsif latest_version < cur_version
|
55
64
|
logger.warn("Toys is already at experimental version #{cur_version}, which is later than" \
|
data/lib/toys/standard_cli.rb
CHANGED
@@ -74,18 +74,21 @@ module Toys
|
|
74
74
|
#
|
75
75
|
BINARY_NAME = "toys".freeze
|
76
76
|
|
77
|
+
##
|
78
|
+
# Short description for the standard root tool
|
79
|
+
# @return [String]
|
80
|
+
#
|
81
|
+
DEFAULT_ROOT_DESC = "Your personal command line tool.".freeze
|
82
|
+
|
77
83
|
##
|
78
84
|
# Help text for the standard root tool
|
79
85
|
# @return [String]
|
80
86
|
#
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
" globally or scoped to specific directories that you choose." \
|
87
|
-
" For detailed information, see https://www.rubydoc.info/gems/toys"
|
88
|
-
)
|
87
|
+
DEFAULT_ROOT_LONG_DESC =
|
88
|
+
"Toys is your personal command line tool. You can add to the list of commands below by" \
|
89
|
+
" writing scripts in Ruby using a simple DSL, and toys will organize and document them" \
|
90
|
+
" and make them available globally or scoped to specific directories that you choose." \
|
91
|
+
" For detailed information, see https://www.rubydoc.info/gems/toys".freeze
|
89
92
|
|
90
93
|
##
|
91
94
|
# Create a standard CLI, configured with the appropriate paths and
|
@@ -135,20 +138,47 @@ module Toys
|
|
135
138
|
cli
|
136
139
|
end
|
137
140
|
|
141
|
+
# rubocop:disable Metrics/MethodLength
|
142
|
+
|
138
143
|
##
|
139
144
|
# Returns a the middleware for the standard Toys CLI.
|
140
145
|
#
|
141
146
|
# @return [Array]
|
142
147
|
#
|
143
148
|
def self.default_middleware_stack
|
144
|
-
version_displayer = Middleware::ShowVersion.root_version_displayer(::Toys::VERSION)
|
145
149
|
[
|
146
|
-
[
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
150
|
+
[
|
151
|
+
:set_default_descriptions,
|
152
|
+
default_root_desc: DEFAULT_ROOT_DESC,
|
153
|
+
default_root_long_desc: DEFAULT_ROOT_LONG_DESC
|
154
|
+
],
|
155
|
+
[
|
156
|
+
:show_help,
|
157
|
+
help_flags: true,
|
158
|
+
usage_flags: true,
|
159
|
+
recursive_flags: true,
|
160
|
+
search_flags: true,
|
161
|
+
allow_root_args: true
|
162
|
+
],
|
163
|
+
[
|
164
|
+
:show_version,
|
165
|
+
version_displayer: Middleware::ShowVersion.root_version_displayer(::Toys::VERSION)
|
166
|
+
],
|
167
|
+
[
|
168
|
+
:handle_usage_errors
|
169
|
+
],
|
170
|
+
[
|
171
|
+
:show_help,
|
172
|
+
fallback_execution: true,
|
173
|
+
recursive_flags: true,
|
174
|
+
search_flags: true
|
175
|
+
],
|
176
|
+
[
|
177
|
+
:add_verbosity_flags
|
178
|
+
]
|
151
179
|
]
|
152
180
|
end
|
181
|
+
|
182
|
+
# rubocop:enable Metrics/MethodLength
|
153
183
|
end
|
154
184
|
end
|
data/lib/toys/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: toys
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Daniel Azuma
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-05-
|
11
|
+
date: 2018-05-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: toys-core
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - '='
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 0.3.
|
19
|
+
version: 0.3.4
|
20
20
|
type: :runtime
|
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: 0.3.
|
26
|
+
version: 0.3.4
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: minitest
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|