thor 1.3.0 → 1.3.1
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/lib/thor/actions/file_manipulation.rb +3 -5
- data/lib/thor/parser/argument.rb +1 -4
- data/lib/thor/parser/option.rb +2 -2
- data/lib/thor/parser/options.rb +2 -1
- data/lib/thor/shell/basic.rb +9 -9
- data/lib/thor/shell/html.rb +1 -1
- data/lib/thor/shell/table_printer.rb +5 -21
- data/lib/thor/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: d9d12a41fe3b4da55677d0c265e0c0ed194b7a63f7236c8703c0b33bce2eaea5
|
4
|
+
data.tar.gz: 5e95ec2585dcf45267d180b0dbb8985dd3f6edbfec27bb255060c2a337d8f2ba
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 14be531d0089734aa368df537cc975a1f5319e1b30bfe8288c3573681a16065a98f4a3e6c67fb6ad3eef05e968d2df69d622805557aafa4e90ef1c6a95b4a5ea
|
7
|
+
data.tar.gz: ce7d64257d5836b6c52d0722254b9a01fe2565a3ba6ec8da99c905412d5814038d0d71dec8859e1f76b24bc4e4fc0183c7f21bb352e6e1dbf5ab5d11f22ab096
|
@@ -10,7 +10,6 @@ class Thor
|
|
10
10
|
# destination<String>:: the relative path to the destination root.
|
11
11
|
# config<Hash>:: give :verbose => false to not log the status, and
|
12
12
|
# :mode => :preserve, to preserve the file mode from the source.
|
13
|
-
|
14
13
|
#
|
15
14
|
# ==== Examples
|
16
15
|
#
|
@@ -275,9 +274,8 @@ class Thor
|
|
275
274
|
end
|
276
275
|
end
|
277
276
|
|
278
|
-
# Uncomment all lines matching a given regex.
|
279
|
-
#
|
280
|
-
# between the comment hash and the beginning of the line.
|
277
|
+
# Uncomment all lines matching a given regex. Preserves indentation before
|
278
|
+
# the comment hash and removes the hash and any immediate following space.
|
281
279
|
#
|
282
280
|
# ==== Parameters
|
283
281
|
# path<String>:: path of the file to be changed
|
@@ -291,7 +289,7 @@ class Thor
|
|
291
289
|
def uncomment_lines(path, flag, *args)
|
292
290
|
flag = flag.respond_to?(:source) ? flag.source : flag
|
293
291
|
|
294
|
-
gsub_file(path, /^(\s*)#[[:blank:]]
|
292
|
+
gsub_file(path, /^(\s*)#[[:blank:]]?(.*#{flag})/, '\1\2', *args)
|
295
293
|
end
|
296
294
|
|
297
295
|
# Comment all lines matching a given regex. It will leave the space
|
data/lib/thor/parser/argument.rb
CHANGED
data/lib/thor/parser/option.rb
CHANGED
@@ -89,8 +89,8 @@ class Thor
|
|
89
89
|
|
90
90
|
sample = "[#{sample}]".dup unless required?
|
91
91
|
|
92
|
-
if boolean?
|
93
|
-
sample << ", [#{dasherize('no-' + human_name)}]
|
92
|
+
if boolean? && name != "force" && !name.match(/\A(no|skip)[\-_]/)
|
93
|
+
sample << ", [#{dasherize('no-' + human_name)}], [#{dasherize('skip-' + human_name)}]"
|
94
94
|
end
|
95
95
|
|
96
96
|
aliases_for_usage.ljust(padding) + sample
|
data/lib/thor/parser/options.rb
CHANGED
@@ -250,7 +250,8 @@ class Thor
|
|
250
250
|
@parsing_options
|
251
251
|
end
|
252
252
|
|
253
|
-
# Parse boolean values which can be given as --foo=true
|
253
|
+
# Parse boolean values which can be given as --foo=true or --foo for true values, or
|
254
|
+
# --foo=false, --no-foo or --skip-foo for false values.
|
254
255
|
#
|
255
256
|
def parse_boolean(switch)
|
256
257
|
if current_is_value?
|
data/lib/thor/shell/basic.rb
CHANGED
@@ -67,15 +67,15 @@ class Thor
|
|
67
67
|
# Readline.
|
68
68
|
#
|
69
69
|
# ==== Example
|
70
|
-
#
|
70
|
+
# ask("What is your name?")
|
71
71
|
#
|
72
|
-
#
|
72
|
+
# ask("What is the planet furthest from the sun?", :default => "Neptune")
|
73
73
|
#
|
74
|
-
#
|
74
|
+
# ask("What is your favorite Neopolitan flavor?", :limited_to => ["strawberry", "chocolate", "vanilla"])
|
75
75
|
#
|
76
|
-
#
|
76
|
+
# ask("What is your password?", :echo => false)
|
77
77
|
#
|
78
|
-
#
|
78
|
+
# ask("Where should the file be saved?", :path => true)
|
79
79
|
#
|
80
80
|
def ask(statement, *args)
|
81
81
|
options = args.last.is_a?(Hash) ? args.pop : {}
|
@@ -93,7 +93,7 @@ class Thor
|
|
93
93
|
# are passed straight to puts (behavior got from Highline).
|
94
94
|
#
|
95
95
|
# ==== Example
|
96
|
-
#
|
96
|
+
# say("I know you knew that.")
|
97
97
|
#
|
98
98
|
def say(message = "", color = nil, force_new_line = (message.to_s !~ /( |\t)\Z/))
|
99
99
|
return if quiet?
|
@@ -110,7 +110,7 @@ class Thor
|
|
110
110
|
# are passed straight to puts (behavior got from Highline).
|
111
111
|
#
|
112
112
|
# ==== Example
|
113
|
-
#
|
113
|
+
# say_error("error: something went wrong")
|
114
114
|
#
|
115
115
|
def say_error(message = "", color = nil, force_new_line = (message.to_s !~ /( |\t)\Z/))
|
116
116
|
return if quiet?
|
@@ -143,14 +143,14 @@ class Thor
|
|
143
143
|
stdout.flush
|
144
144
|
end
|
145
145
|
|
146
|
-
#
|
146
|
+
# Asks the user a question and returns true if the user replies "y" or
|
147
147
|
# "yes".
|
148
148
|
#
|
149
149
|
def yes?(statement, color = nil)
|
150
150
|
!!(ask(statement, color, add_to_history: false) =~ is?(:yes))
|
151
151
|
end
|
152
152
|
|
153
|
-
#
|
153
|
+
# Asks the user a question and returns true if the user replies "n" or
|
154
154
|
# "no".
|
155
155
|
#
|
156
156
|
def no?(statement, color = nil)
|
data/lib/thor/shell/html.rb
CHANGED
@@ -102,33 +102,17 @@ class Thor
|
|
102
102
|
|
103
103
|
def truncate(string)
|
104
104
|
return string unless @truncate
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
chars[0, @truncate - 3 - @indent].join + "..."
|
111
|
-
end
|
105
|
+
chars = string.chars.to_a
|
106
|
+
if chars.length <= @truncate
|
107
|
+
chars.join
|
108
|
+
else
|
109
|
+
chars[0, @truncate - 3 - @indent].join + "..."
|
112
110
|
end
|
113
111
|
end
|
114
112
|
|
115
113
|
def indentation
|
116
114
|
" " * @indent
|
117
115
|
end
|
118
|
-
|
119
|
-
if "".respond_to?(:encode)
|
120
|
-
def as_unicode
|
121
|
-
yield
|
122
|
-
end
|
123
|
-
else
|
124
|
-
def as_unicode
|
125
|
-
old = $KCODE # rubocop:disable Style/GlobalVars
|
126
|
-
$KCODE = "U" # rubocop:disable Style/GlobalVars
|
127
|
-
yield
|
128
|
-
ensure
|
129
|
-
$KCODE = old # rubocop:disable Style/GlobalVars
|
130
|
-
end
|
131
|
-
end
|
132
116
|
end
|
133
117
|
end
|
134
118
|
end
|
data/lib/thor/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: thor
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.3.
|
4
|
+
version: 1.3.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Yehuda Katz
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2024-02-26 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bundler
|
@@ -85,9 +85,9 @@ licenses:
|
|
85
85
|
- MIT
|
86
86
|
metadata:
|
87
87
|
bug_tracker_uri: https://github.com/rails/thor/issues
|
88
|
-
changelog_uri: https://github.com/rails/thor/releases/tag/v1.3.
|
88
|
+
changelog_uri: https://github.com/rails/thor/releases/tag/v1.3.1
|
89
89
|
documentation_uri: http://whatisthor.com/
|
90
|
-
source_code_uri: https://github.com/rails/thor/tree/v1.3.
|
90
|
+
source_code_uri: https://github.com/rails/thor/tree/v1.3.1
|
91
91
|
wiki_uri: https://github.com/rails/thor/wiki
|
92
92
|
rubygems_mfa_required: 'true'
|
93
93
|
post_install_message:
|