thor 1.0.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/README.md +1 -7
- data/lib/thor/actions/create_link.rb +2 -1
- data/lib/thor/actions/file_manipulation.rb +9 -7
- data/lib/thor/actions/inject_into_file.rb +1 -2
- data/lib/thor/actions.rb +7 -3
- data/lib/thor/base.rb +9 -0
- data/lib/thor/core_ext/hash_with_indifferent_access.rb +6 -0
- data/lib/thor/error.rb +10 -5
- data/lib/thor/parser/arguments.rb +5 -1
- data/lib/thor/parser/options.rb +28 -9
- data/lib/thor/shell/basic.rb +27 -6
- data/lib/thor/shell/color.rb +5 -1
- data/lib/thor/shell.rb +1 -1
- data/lib/thor/util.rb +1 -1
- data/lib/thor/version.rb +1 -1
- data/lib/thor.rb +5 -13
- data/thor.gemspec +8 -0
- metadata +10 -5
- data/CHANGELOG.md +0 -216
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 30e79d2b0a96e87c8e6348467db577c6ad1e9acbbbac5d375417bc3e5a2b7698
|
4
|
+
data.tar.gz: 701f1ab842da90e599b96bd00d90481d716eb29e39e0283b5ff527c2033fc742
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 73b1ac80575d4422204cd8072950b5594739db3b6f3fde0f2f04359d51b1d4428524d25b9a3003ae9ec3f6be615cf635f3057bbc65558e6a17ba490ff045988b
|
7
|
+
data.tar.gz: eb7761a5e6f3674cb3231398145978b0eb53a6fa2c10e4cb9e99d8d523988efcefc8cae5dd163b8a3d6ead7424422d58b92311c200790ad6e2416e3f9757a90e
|
data/README.md
CHANGED
@@ -2,14 +2,8 @@ Thor
|
|
2
2
|
====
|
3
3
|
|
4
4
|
[![Gem Version](http://img.shields.io/gem/v/thor.svg)][gem]
|
5
|
-
[![Build Status](http://img.shields.io/travis/erikhuda/thor.svg)][travis]
|
6
|
-
[![Code Climate](http://img.shields.io/codeclimate/github/erikhuda/thor.svg)][codeclimate]
|
7
|
-
[![Coverage Status](http://img.shields.io/coveralls/erikhuda/thor.svg)][coveralls]
|
8
5
|
|
9
6
|
[gem]: https://rubygems.org/gems/thor
|
10
|
-
[travis]: http://travis-ci.org/erikhuda/thor
|
11
|
-
[codeclimate]: https://codeclimate.com/github/erikhuda/thor
|
12
|
-
[coveralls]: https://coveralls.io/r/erikhuda/thor
|
13
7
|
|
14
8
|
Description
|
15
9
|
-----------
|
@@ -35,7 +29,7 @@ Usage and documentation
|
|
35
29
|
-----------------------
|
36
30
|
Please see the [wiki][] for basic usage and other documentation on using Thor. You can also checkout the [official homepage][homepage].
|
37
31
|
|
38
|
-
[wiki]: https://github.com/
|
32
|
+
[wiki]: https://github.com/rails/thor/wiki
|
39
33
|
[homepage]: http://whatisthor.com/
|
40
34
|
|
41
35
|
Contributing
|
@@ -33,7 +33,8 @@ class Thor
|
|
33
33
|
# Boolean:: true if it is identical, false otherwise.
|
34
34
|
#
|
35
35
|
def identical?
|
36
|
-
|
36
|
+
source = File.expand_path(render, File.dirname(destination))
|
37
|
+
exists? && File.identical?(source, destination)
|
37
38
|
end
|
38
39
|
|
39
40
|
def invoke!
|
@@ -210,9 +210,9 @@ class Thor
|
|
210
210
|
#
|
211
211
|
# ==== Examples
|
212
212
|
#
|
213
|
-
# inject_into_class "app/controllers/application_controller.rb", ApplicationController, " filter_parameter :password\n"
|
213
|
+
# inject_into_class "app/controllers/application_controller.rb", "ApplicationController", " filter_parameter :password\n"
|
214
214
|
#
|
215
|
-
# inject_into_class "app/controllers/application_controller.rb", ApplicationController do
|
215
|
+
# inject_into_class "app/controllers/application_controller.rb", "ApplicationController" do
|
216
216
|
# " filter_parameter :password\n"
|
217
217
|
# end
|
218
218
|
#
|
@@ -233,9 +233,9 @@ class Thor
|
|
233
233
|
#
|
234
234
|
# ==== Examples
|
235
235
|
#
|
236
|
-
# inject_into_module "app/helpers/application_helper.rb", ApplicationHelper, " def help; 'help'; end\n"
|
236
|
+
# inject_into_module "app/helpers/application_helper.rb", "ApplicationHelper", " def help; 'help'; end\n"
|
237
237
|
#
|
238
|
-
# inject_into_module "app/helpers/application_helper.rb", ApplicationHelper do
|
238
|
+
# inject_into_module "app/helpers/application_helper.rb", "ApplicationHelper" do
|
239
239
|
# " def help; 'help'; end\n"
|
240
240
|
# end
|
241
241
|
#
|
@@ -251,7 +251,8 @@ class Thor
|
|
251
251
|
# path<String>:: path of the file to be changed
|
252
252
|
# flag<Regexp|String>:: the regexp or string to be replaced
|
253
253
|
# replacement<String>:: the replacement, can be also given as a block
|
254
|
-
# config<Hash>:: give :verbose => false to not log the status
|
254
|
+
# config<Hash>:: give :verbose => false to not log the status, and
|
255
|
+
# :force => true, to force the replacement regardles of runner behavior.
|
255
256
|
#
|
256
257
|
# ==== Example
|
257
258
|
#
|
@@ -262,9 +263,10 @@ class Thor
|
|
262
263
|
# end
|
263
264
|
#
|
264
265
|
def gsub_file(path, flag, *args, &block)
|
265
|
-
return unless behavior == :invoke
|
266
266
|
config = args.last.is_a?(Hash) ? args.pop : {}
|
267
267
|
|
268
|
+
return unless behavior == :invoke || config.fetch(:force, false)
|
269
|
+
|
268
270
|
path = File.expand_path(path, destination_root)
|
269
271
|
say_status :gsub, relative_to_original_destination_root(path), config.fetch(:verbose, true)
|
270
272
|
|
@@ -329,7 +331,7 @@ class Thor
|
|
329
331
|
path = File.expand_path(path, destination_root)
|
330
332
|
|
331
333
|
say_status :remove, relative_to_original_destination_root(path), config.fetch(:verbose, true)
|
332
|
-
if !options[:pretend] && File.exist?(path)
|
334
|
+
if !options[:pretend] && (File.exist?(path) || File.symlink?(path))
|
333
335
|
require "fileutils"
|
334
336
|
::FileUtils.rm_rf(path)
|
335
337
|
end
|
@@ -106,12 +106,11 @@ class Thor
|
|
106
106
|
# Adds the content to the file.
|
107
107
|
#
|
108
108
|
def replace!(regexp, string, force)
|
109
|
-
return if pretend?
|
110
109
|
content = File.read(destination)
|
111
110
|
if force || !content.include?(replacement)
|
112
111
|
success = content.gsub!(regexp, string)
|
113
112
|
|
114
|
-
File.open(destination, "wb") { |file| file.write(content) }
|
113
|
+
File.open(destination, "wb") { |file| file.write(content) } unless pretend?
|
115
114
|
success
|
116
115
|
end
|
117
116
|
end
|
data/lib/thor/actions.rb
CHANGED
@@ -161,6 +161,8 @@ class Thor
|
|
161
161
|
# to the block you provide. The path is set back to the previous path when
|
162
162
|
# the method exits.
|
163
163
|
#
|
164
|
+
# Returns the value yielded by the block.
|
165
|
+
#
|
164
166
|
# ==== Parameters
|
165
167
|
# dir<String>:: the directory to move to.
|
166
168
|
# config<Hash>:: give :verbose => true to log and use padding.
|
@@ -179,16 +181,18 @@ class Thor
|
|
179
181
|
FileUtils.mkdir_p(destination_root)
|
180
182
|
end
|
181
183
|
|
184
|
+
result = nil
|
182
185
|
if pretend
|
183
186
|
# In pretend mode, just yield down to the block
|
184
|
-
block.arity == 1 ? yield(destination_root) : yield
|
187
|
+
result = block.arity == 1 ? yield(destination_root) : yield
|
185
188
|
else
|
186
189
|
require "fileutils"
|
187
|
-
FileUtils.cd(destination_root) { block.arity == 1 ? yield(destination_root) : yield }
|
190
|
+
FileUtils.cd(destination_root) { result = block.arity == 1 ? yield(destination_root) : yield }
|
188
191
|
end
|
189
192
|
|
190
193
|
@destination_stack.pop
|
191
194
|
shell.padding -= 1 if verbose
|
195
|
+
result
|
192
196
|
end
|
193
197
|
|
194
198
|
# Goes to the root and execute the given block.
|
@@ -219,7 +223,7 @@ class Thor
|
|
219
223
|
|
220
224
|
contents = if is_uri
|
221
225
|
require "open-uri"
|
222
|
-
open(path, "Accept" => "application/x-thor-template", &:read)
|
226
|
+
URI.open(path, "Accept" => "application/x-thor-template", &:read)
|
223
227
|
else
|
224
228
|
open(path, &:read)
|
225
229
|
end
|
data/lib/thor/base.rb
CHANGED
@@ -22,6 +22,15 @@ class Thor
|
|
22
22
|
|
23
23
|
TEMPLATE_EXTNAME = ".tt"
|
24
24
|
|
25
|
+
class << self
|
26
|
+
def deprecation_warning(message) #:nodoc:
|
27
|
+
unless ENV['THOR_SILENCE_DEPRECATION']
|
28
|
+
warn "Deprecation warning: #{message}\n" +
|
29
|
+
'You can silence deprecations warning by setting the environment variable THOR_SILENCE_DEPRECATION.'
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
25
34
|
module Base
|
26
35
|
attr_accessor :options, :parent_options, :args
|
27
36
|
|
data/lib/thor/error.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
class Thor
|
2
|
-
Correctable = if defined?(DidYouMean::SpellChecker) && defined?(DidYouMean::Correctable)
|
2
|
+
Correctable = if defined?(DidYouMean::SpellChecker) && defined?(DidYouMean::Correctable) # rubocop:disable Naming/ConstantName
|
3
3
|
# In order to support versions of Ruby that don't have keyword
|
4
4
|
# arguments, we need our own spell checker class that doesn't take key
|
5
5
|
# words. Even though this code wouldn't be hit because of the check
|
@@ -102,9 +102,14 @@ class Thor
|
|
102
102
|
end
|
103
103
|
|
104
104
|
if Correctable
|
105
|
-
DidYouMean
|
106
|
-
|
107
|
-
|
108
|
-
|
105
|
+
if DidYouMean.respond_to?(:correct_error)
|
106
|
+
DidYouMean.correct_error(Thor::UndefinedCommandError, UndefinedCommandError::SpellChecker)
|
107
|
+
DidYouMean.correct_error(Thor::UnknownArgumentError, UnknownArgumentError::SpellChecker)
|
108
|
+
else
|
109
|
+
DidYouMean::SPELL_CHECKERS.merge!(
|
110
|
+
'Thor::UndefinedCommandError' => UndefinedCommandError::SpellChecker,
|
111
|
+
'Thor::UnknownArgumentError' => UnknownArgumentError::SpellChecker
|
112
|
+
)
|
113
|
+
end
|
109
114
|
end
|
110
115
|
end
|
@@ -30,7 +30,11 @@ class Thor
|
|
30
30
|
|
31
31
|
arguments.each do |argument|
|
32
32
|
if !argument.default.nil?
|
33
|
-
|
33
|
+
begin
|
34
|
+
@assigns[argument.human_name] = argument.default.dup
|
35
|
+
rescue TypeError # Compatibility shim for un-dup-able Fixnum in Ruby < 2.4
|
36
|
+
@assigns[argument.human_name] = argument.default
|
37
|
+
end
|
34
38
|
elsif argument.required?
|
35
39
|
@non_assigned_required << argument
|
36
40
|
end
|
data/lib/thor/parser/options.rb
CHANGED
@@ -45,6 +45,7 @@ class Thor
|
|
45
45
|
@switches = {}
|
46
46
|
@extra = []
|
47
47
|
@stopped_parsing_after_extra_index = nil
|
48
|
+
@is_treated_as_value = false
|
48
49
|
|
49
50
|
options.each do |option|
|
50
51
|
@switches[option.switch_name] = option
|
@@ -74,8 +75,19 @@ class Thor
|
|
74
75
|
end
|
75
76
|
end
|
76
77
|
|
78
|
+
def shift
|
79
|
+
@is_treated_as_value = false
|
80
|
+
super
|
81
|
+
end
|
82
|
+
|
83
|
+
def unshift(arg, is_value: false)
|
84
|
+
@is_treated_as_value = is_value
|
85
|
+
super(arg)
|
86
|
+
end
|
87
|
+
|
77
88
|
def parse(args) # rubocop:disable MethodLength
|
78
89
|
@pile = args.dup
|
90
|
+
@is_treated_as_value = false
|
79
91
|
@parsing_options = true
|
80
92
|
|
81
93
|
while peek
|
@@ -88,7 +100,10 @@ class Thor
|
|
88
100
|
when SHORT_SQ_RE
|
89
101
|
unshift($1.split("").map { |f| "-#{f}" })
|
90
102
|
next
|
91
|
-
when EQ_RE
|
103
|
+
when EQ_RE
|
104
|
+
unshift($2, is_value: true)
|
105
|
+
switch = $1
|
106
|
+
when SHORT_NUM
|
92
107
|
unshift($2)
|
93
108
|
switch = $1
|
94
109
|
when LONG_RE, SHORT_RE
|
@@ -133,20 +148,22 @@ class Thor
|
|
133
148
|
|
134
149
|
protected
|
135
150
|
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
151
|
+
def assign_result!(option, result)
|
152
|
+
if option.repeatable && option.type == :hash
|
153
|
+
(@assigns[option.human_name] ||= {}).merge!(result)
|
154
|
+
elsif option.repeatable
|
155
|
+
(@assigns[option.human_name] ||= []) << result
|
156
|
+
else
|
157
|
+
@assigns[option.human_name] = result
|
158
|
+
end
|
143
159
|
end
|
144
|
-
|
160
|
+
|
145
161
|
# Check if the current value in peek is a registered switch.
|
146
162
|
#
|
147
163
|
# Two booleans are returned. The first is true if the current value
|
148
164
|
# starts with a hyphen; the second is true if it is a registered switch.
|
149
165
|
def current_is_switch?
|
166
|
+
return [false, false] if @is_treated_as_value
|
150
167
|
case peek
|
151
168
|
when LONG_RE, SHORT_RE, EQ_RE, SHORT_NUM
|
152
169
|
[true, switch?($1)]
|
@@ -158,6 +175,7 @@ class Thor
|
|
158
175
|
end
|
159
176
|
|
160
177
|
def current_is_switch_formatted?
|
178
|
+
return false if @is_treated_as_value
|
161
179
|
case peek
|
162
180
|
when LONG_RE, SHORT_RE, EQ_RE, SHORT_NUM, SHORT_SQ_RE
|
163
181
|
true
|
@@ -167,6 +185,7 @@ class Thor
|
|
167
185
|
end
|
168
186
|
|
169
187
|
def current_is_value?
|
188
|
+
return true if @is_treated_as_value
|
170
189
|
peek && (!parsing_options? || super)
|
171
190
|
end
|
172
191
|
|
data/lib/thor/shell/basic.rb
CHANGED
@@ -94,6 +94,8 @@ class Thor
|
|
94
94
|
# say("I know you knew that.")
|
95
95
|
#
|
96
96
|
def say(message = "", color = nil, force_new_line = (message.to_s !~ /( |\t)\Z/))
|
97
|
+
return if quiet?
|
98
|
+
|
97
99
|
buffer = prepare_message(message, *color)
|
98
100
|
buffer << "\n" if force_new_line && !message.to_s.end_with?("\n")
|
99
101
|
|
@@ -101,6 +103,23 @@ class Thor
|
|
101
103
|
stdout.flush
|
102
104
|
end
|
103
105
|
|
106
|
+
# Say (print) an error to the user. If the sentence ends with a whitespace
|
107
|
+
# or tab character, a new line is not appended (print + flush). Otherwise
|
108
|
+
# are passed straight to puts (behavior got from Highline).
|
109
|
+
#
|
110
|
+
# ==== Example
|
111
|
+
# say_error("error: something went wrong")
|
112
|
+
#
|
113
|
+
def say_error(message = "", color = nil, force_new_line = (message.to_s !~ /( |\t)\Z/))
|
114
|
+
return if quiet?
|
115
|
+
|
116
|
+
buffer = prepare_message(message, *color)
|
117
|
+
buffer << "\n" if force_new_line && !message.to_s.end_with?("\n")
|
118
|
+
|
119
|
+
stderr.print(buffer)
|
120
|
+
stderr.flush
|
121
|
+
end
|
122
|
+
|
104
123
|
# Say a status with the given color and appends the message. Since this
|
105
124
|
# method is used frequently by actions, it allows nil or false to be given
|
106
125
|
# in log_status, avoiding the message from being shown. If a Symbol is
|
@@ -109,13 +128,14 @@ class Thor
|
|
109
128
|
def say_status(status, message, log_status = true)
|
110
129
|
return if quiet? || log_status == false
|
111
130
|
spaces = " " * (padding + 1)
|
112
|
-
color = log_status.is_a?(Symbol) ? log_status : :green
|
113
|
-
|
114
131
|
status = status.to_s.rjust(12)
|
132
|
+
margin = " " * status.length + spaces
|
133
|
+
|
134
|
+
color = log_status.is_a?(Symbol) ? log_status : :green
|
115
135
|
status = set_color status, color, true if color
|
116
136
|
|
117
|
-
|
118
|
-
buffer = "#{
|
137
|
+
message = message.to_s.chomp.gsub(/(?<!\A)^/, margin)
|
138
|
+
buffer = "#{status}#{spaces}#{message}\n"
|
119
139
|
|
120
140
|
stdout.print(buffer)
|
121
141
|
stdout.flush
|
@@ -230,8 +250,9 @@ class Thor
|
|
230
250
|
paras = message.split("\n\n")
|
231
251
|
|
232
252
|
paras.map! do |unwrapped|
|
233
|
-
|
234
|
-
|
253
|
+
words = unwrapped.split(" ")
|
254
|
+
counter = words.first.length
|
255
|
+
words.inject do |memo, word|
|
235
256
|
word = word.gsub(/\n\005/, "\n").gsub(/\005/, "\n")
|
236
257
|
counter = 0 if word.include? "\n"
|
237
258
|
if (counter + word.length + 1) < width
|
data/lib/thor/shell/color.rb
CHANGED
@@ -97,7 +97,11 @@ class Thor
|
|
97
97
|
protected
|
98
98
|
|
99
99
|
def can_display_colors?
|
100
|
-
|
100
|
+
are_colors_supported? && !are_colors_disabled?
|
101
|
+
end
|
102
|
+
|
103
|
+
def are_colors_supported?
|
104
|
+
stdout.tty? && ENV["TERM"] != "dumb"
|
101
105
|
end
|
102
106
|
|
103
107
|
def are_colors_disabled?
|
data/lib/thor/shell.rb
CHANGED
@@ -21,7 +21,7 @@ class Thor
|
|
21
21
|
end
|
22
22
|
|
23
23
|
module Shell
|
24
|
-
SHELL_DELEGATED_METHODS = [:ask, :error, :set_color, :yes?, :no?, :say, :say_status, :print_in_columns, :print_table, :print_wrapped, :file_collision, :terminal_width]
|
24
|
+
SHELL_DELEGATED_METHODS = [:ask, :error, :set_color, :yes?, :no?, :say, :say_error, :say_status, :print_in_columns, :print_table, :print_wrapped, :file_collision, :terminal_width]
|
25
25
|
attr_writer :shell
|
26
26
|
|
27
27
|
autoload :Basic, File.expand_path("shell/basic", __dir__)
|
data/lib/thor/util.rb
CHANGED
@@ -211,7 +211,7 @@ class Thor
|
|
211
211
|
#
|
212
212
|
def globs_for(path)
|
213
213
|
path = escape_globs(path)
|
214
|
-
["#{path}/Thorfile", "#{path}/*.thor", "#{path}/tasks/*.thor", "#{path}/lib/tasks
|
214
|
+
["#{path}/Thorfile", "#{path}/*.thor", "#{path}/tasks/*.thor", "#{path}/lib/tasks/**/*.thor"]
|
215
215
|
end
|
216
216
|
|
217
217
|
# Return the path to the ruby interpreter taking into account multiple
|
data/lib/thor/version.rb
CHANGED
data/lib/thor.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
|
-
require "set"
|
2
1
|
require_relative "thor/base"
|
3
2
|
|
4
3
|
class Thor
|
4
|
+
$thor_runner ||= false
|
5
5
|
class << self
|
6
6
|
# Allows for custom "Command" package naming.
|
7
7
|
#
|
@@ -323,7 +323,7 @@ class Thor
|
|
323
323
|
# ==== Parameters
|
324
324
|
# Symbol ...:: A list of commands that should be affected.
|
325
325
|
def stop_on_unknown_option!(*command_names)
|
326
|
-
stop_on_unknown_option
|
326
|
+
@stop_on_unknown_option = stop_on_unknown_option | command_names
|
327
327
|
end
|
328
328
|
|
329
329
|
def stop_on_unknown_option?(command) #:nodoc:
|
@@ -337,29 +337,22 @@ class Thor
|
|
337
337
|
# ==== Parameters
|
338
338
|
# Symbol ...:: A list of commands that should be affected.
|
339
339
|
def disable_required_check!(*command_names)
|
340
|
-
disable_required_check
|
340
|
+
@disable_required_check = disable_required_check | command_names
|
341
341
|
end
|
342
342
|
|
343
343
|
def disable_required_check?(command) #:nodoc:
|
344
344
|
command && disable_required_check.include?(command.name.to_sym)
|
345
345
|
end
|
346
346
|
|
347
|
-
def deprecation_warning(message) #:nodoc:
|
348
|
-
unless ENV['THOR_SILENCE_DEPRECATION']
|
349
|
-
warn "Deprecation warning: #{message}\n" +
|
350
|
-
'You can silence deprecations warning by setting the environment variable THOR_SILENCE_DEPRECATION.'
|
351
|
-
end
|
352
|
-
end
|
353
|
-
|
354
347
|
protected
|
355
348
|
|
356
349
|
def stop_on_unknown_option #:nodoc:
|
357
|
-
@stop_on_unknown_option ||=
|
350
|
+
@stop_on_unknown_option ||= []
|
358
351
|
end
|
359
352
|
|
360
353
|
# help command has the required check disabled by default.
|
361
354
|
def disable_required_check #:nodoc:
|
362
|
-
@disable_required_check ||=
|
355
|
+
@disable_required_check ||= [:help]
|
363
356
|
end
|
364
357
|
|
365
358
|
# The method responsible for dispatching given the args.
|
@@ -405,7 +398,6 @@ class Thor
|
|
405
398
|
# the namespace should be displayed as arguments.
|
406
399
|
#
|
407
400
|
def banner(command, namespace = nil, subcommand = false)
|
408
|
-
$thor_runner ||= false
|
409
401
|
command.formatted_usage(self, $thor_runner, subcommand).split("\n").map do |formatted_usage|
|
410
402
|
"#{basename} #{formatted_usage}"
|
411
403
|
end.join("\n")
|
data/thor.gemspec
CHANGED
@@ -13,6 +13,14 @@ Gem::Specification.new do |spec|
|
|
13
13
|
spec.homepage = "http://whatisthor.com/"
|
14
14
|
spec.licenses = %w(MIT)
|
15
15
|
spec.name = "thor"
|
16
|
+
spec.metadata = {
|
17
|
+
"bug_tracker_uri" => "https://github.com/rails/thor/issues",
|
18
|
+
"changelog_uri" => "https://github.com/rails/thor/releases/tag/v#{Thor::VERSION}",
|
19
|
+
"documentation_uri" => "http://whatisthor.com/",
|
20
|
+
"source_code_uri" => "https://github.com/rails/thor/tree/v#{Thor::VERSION}",
|
21
|
+
"wiki_uri" => "https://github.com/rails/thor/wiki",
|
22
|
+
"rubygems_mfa_required" => "true",
|
23
|
+
}
|
16
24
|
spec.require_paths = %w(lib)
|
17
25
|
spec.required_ruby_version = ">= 2.0.0"
|
18
26
|
spec.required_rubygems_version = ">= 1.3.5"
|
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.
|
4
|
+
version: 1.2.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: 2022-01-04 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bundler
|
@@ -39,7 +39,6 @@ extensions: []
|
|
39
39
|
extra_rdoc_files: []
|
40
40
|
files:
|
41
41
|
- ".document"
|
42
|
-
- CHANGELOG.md
|
43
42
|
- CONTRIBUTING.md
|
44
43
|
- LICENSE.md
|
45
44
|
- README.md
|
@@ -79,7 +78,13 @@ files:
|
|
79
78
|
homepage: http://whatisthor.com/
|
80
79
|
licenses:
|
81
80
|
- MIT
|
82
|
-
metadata:
|
81
|
+
metadata:
|
82
|
+
bug_tracker_uri: https://github.com/rails/thor/issues
|
83
|
+
changelog_uri: https://github.com/rails/thor/releases/tag/v1.2.1
|
84
|
+
documentation_uri: http://whatisthor.com/
|
85
|
+
source_code_uri: https://github.com/rails/thor/tree/v1.2.1
|
86
|
+
wiki_uri: https://github.com/rails/thor/wiki
|
87
|
+
rubygems_mfa_required: 'true'
|
83
88
|
post_install_message:
|
84
89
|
rdoc_options: []
|
85
90
|
require_paths:
|
@@ -95,7 +100,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
95
100
|
- !ruby/object:Gem::Version
|
96
101
|
version: 1.3.5
|
97
102
|
requirements: []
|
98
|
-
rubygems_version: 3.
|
103
|
+
rubygems_version: 3.2.32
|
99
104
|
signing_key:
|
100
105
|
specification_version: 4
|
101
106
|
summary: Thor is a toolkit for building powerful command-line interfaces.
|
data/CHANGELOG.md
DELETED
@@ -1,216 +0,0 @@
|
|
1
|
-
# 1.0.0
|
2
|
-
* Drop support to Ruby 1.8 and 1.9.
|
3
|
-
* Deprecate relying on default `exit_on_failure?`.
|
4
|
-
In preparation to make Thor commands exit when there is a failure we are deprecating
|
5
|
-
defining a command without defining what behavior is expected when there is a failure.
|
6
|
-
|
7
|
-
To fix the deprecation you need to define a class method called `exit_on_failure?` returning
|
8
|
-
|
9
|
-
`false` if you want the current behavior or `true` if you want the new behavior.
|
10
|
-
* Deprecate defining an option with the default value using a different type as defined in the option.
|
11
|
-
* Allow options to be repeatable. See #674.
|
12
|
-
|
13
|
-
# 0.20.3
|
14
|
-
* Support old versions of `did_you_mean`.
|
15
|
-
|
16
|
-
# 0.20.2
|
17
|
-
* Fix `did_you_mean` support.
|
18
|
-
|
19
|
-
# 0.20.1
|
20
|
-
* Support new versions of ERB.
|
21
|
-
* Fix `check_unknown_options!` to not check the content that was not parsed, i.e. after a `--` or after the first unknown with `stop_on_unknown_option!`
|
22
|
-
* Add `did_you_mean` support.
|
23
|
-
|
24
|
-
## 0.20.0
|
25
|
-
* Add `check_default_type!` to check if the default value of an option matches the defined type.
|
26
|
-
It removes the warning on usage and gives the command authors the possibility to check for programming errors.
|
27
|
-
|
28
|
-
* Add `disable_required_check!` to disable check for required options in some commands.
|
29
|
-
It is a substitute of `disable_class_options` that was not working as intended.
|
30
|
-
|
31
|
-
* Add `inject_into_module`.
|
32
|
-
|
33
|
-
## 0.19.4, release 2016-11-28
|
34
|
-
* Rename `Thor::Base#thor_reserved_word?` to `#is_thor_reserved_word?`
|
35
|
-
|
36
|
-
## 0.19.3, release 2016-11-27
|
37
|
-
* Output a warning instead of raising an exception when a default option value doesn't match its specified type
|
38
|
-
|
39
|
-
## 0.19.2, release 2016-11-26
|
40
|
-
* Fix bug with handling of colors passed to `ask` (and methods like `yes?` and `no?` which it underpins)
|
41
|
-
* Allow numeric arguments to be negative
|
42
|
-
* Ensure that default option values are of the specified type (e.g. you can't specify `"foo"` as the default for a numeric option), but make symbols and strings interchangeable
|
43
|
-
* Add `Thor::Shell::Basic#indent` method for intending output
|
44
|
-
* Fix `remove_command` for an inherited command (see #451)
|
45
|
-
* Allow hash arguments to only have each key provided once (see #455)
|
46
|
-
* Allow commands to disable class options, for instance for "help" commands (see #363)
|
47
|
-
* Do not generate a negative option (`--no-no-foo`) for already negative boolean options (`--no-foo`)
|
48
|
-
* Improve compatibility of `Thor::CoreExt::HashWithIndifferentAccess` with Ruby standard library `Hash`
|
49
|
-
* Allow specifying a custom binding for template evaluation (e.g. `#key?` and `#fetch`)
|
50
|
-
* Fix support for subcommand-specific "help"s
|
51
|
-
* Use a string buffer when handling ERB for Ruby 2.3 compatibility
|
52
|
-
* Update dependencies
|
53
|
-
|
54
|
-
## 0.19.1, release 2014-03-24
|
55
|
-
* Fix `say` non-String break regression
|
56
|
-
|
57
|
-
## 0.19.0, release 2014-03-22
|
58
|
-
* Add support for a default to #ask
|
59
|
-
* Avoid @namespace not initialized warning
|
60
|
-
* Avoid private attribute? warning
|
61
|
-
* Fix initializing with unknown options
|
62
|
-
* Loosen required_rubygems_version for compatibility with Ubuntu 10.04
|
63
|
-
* Shell#ask: support a noecho option for stdin
|
64
|
-
* Shell#ask: change API to be :echo => false
|
65
|
-
* Display a message without a stack trace for ambiguous commands
|
66
|
-
* Make say and say_status thread safe
|
67
|
-
* Dependency for console io version check
|
68
|
-
* Alias --help to help on subcommands
|
69
|
-
* Use mime-types 1.x for Ruby 1.8.7 compatibility for Ruby 1.8 only
|
70
|
-
* Accept .tt files as templates
|
71
|
-
* Check if numeric value is in enum
|
72
|
-
* Use Readline for user input
|
73
|
-
* Fix dispatching of subcommands (concerning :help and *args)
|
74
|
-
* Fix warnings when running specs with `$VERBOSE = true`
|
75
|
-
* Make subcommand help more consistent
|
76
|
-
* Make the current command chain accessible in command
|
77
|
-
|
78
|
-
## 0.18.1, release 2013-03-30
|
79
|
-
* Revert regressions found in 0.18.0
|
80
|
-
|
81
|
-
## 0.18.0, release 2013-03-26
|
82
|
-
* Remove rake2thor
|
83
|
-
* Only display colors if output medium supports colors
|
84
|
-
* Pass parent_options to subcommands
|
85
|
-
* Fix non-dash-prefixed aliases
|
86
|
-
* Make error messages more helpful
|
87
|
-
* Rename "task" to "command"
|
88
|
-
* Add the method to allow for custom package name
|
89
|
-
|
90
|
-
## 0.17.0, release 2013-01-24
|
91
|
-
* Add better support for tasks that accept arbitrary additional arguments (e.g. things like `bundle exec`)
|
92
|
-
* Add #stop_on_unknown_option!
|
93
|
-
* Only strip from stdin.gets if it wasn't ended with EOF
|
94
|
-
* Allow "send" as a task name
|
95
|
-
* Allow passing options as arguments after "--"
|
96
|
-
* Autoload Thor::Group
|
97
|
-
|
98
|
-
## 0.16.0, release 2012-08-14
|
99
|
-
* Add enum to string arguments
|
100
|
-
|
101
|
-
## 0.15.4, release 2012-06-29
|
102
|
-
* Fix regression when destination root contains reserved regexp characters
|
103
|
-
|
104
|
-
## 0.15.3, release 2012-06-18
|
105
|
-
* Support strict_args_position! for backwards compatibility
|
106
|
-
* Escape Dir glob characters in paths
|
107
|
-
|
108
|
-
## 0.15.2, released 2012-05-07
|
109
|
-
* Added print_in_columns
|
110
|
-
* Exposed terminal_width as a public API
|
111
|
-
|
112
|
-
## 0.15.1, release 2012-05-06
|
113
|
-
* Fix Ruby 1.8 truncation bug with unicode chars
|
114
|
-
* Fix shell delegate methods to pass their block
|
115
|
-
* Don't output trailing spaces when printing the last column in a table
|
116
|
-
|
117
|
-
## 0.15, released 2012-04-29
|
118
|
-
* Alias method_options to options
|
119
|
-
* Refactor say to allow multiple colors
|
120
|
-
* Exposed error as a public API
|
121
|
-
* Exposed file_collision as a public API
|
122
|
-
* Exposed print_wrapped as a public API
|
123
|
-
* Exposed set_color as a public API
|
124
|
-
* Fix number-formatting bugs in print_table
|
125
|
-
* Fix "indent" typo in print_table
|
126
|
-
* Fix Errno::EPIPE when piping tasks to `head`
|
127
|
-
* More friendly error messages
|
128
|
-
|
129
|
-
## 0.14, released 2010-07-25
|
130
|
-
* Added CreateLink class and #link_file method
|
131
|
-
* Made Thor::Actions#run use system as default method for system calls
|
132
|
-
* Allow use of private methods from superclass as tasks
|
133
|
-
* Added mute(&block) method which allows to run block without any output
|
134
|
-
* Removed config[:pretend]
|
135
|
-
* Enabled underscores for command line switches
|
136
|
-
* Added Thor::Base.basename which is used by both Thor.banner and Thor::Group.banner
|
137
|
-
* Deprecated invoke() without arguments
|
138
|
-
* Added :only and :except to check_unknown_options
|
139
|
-
|
140
|
-
## 0.13, released 2010-02-03
|
141
|
-
* Added :lazy_default which is only triggered if a switch is given
|
142
|
-
* Added Thor::Shell::HTML
|
143
|
-
* Added subcommands
|
144
|
-
* Decoupled Thor::Group and Thor, so it's easier to vendor
|
145
|
-
* Added check_unknown_options! in case you want error messages to be raised in valid switches
|
146
|
-
* run(command) should return the results of command
|
147
|
-
|
148
|
-
## 0.12, released 2010-01-02
|
149
|
-
* Methods generated by attr_* are automatically not marked as tasks
|
150
|
-
* inject_into_file does not add the same content twice, unless :force is set
|
151
|
-
* Removed rr in favor to rspec mock framework
|
152
|
-
* Improved output for thor -T
|
153
|
-
* [#7] Do not force white color on status
|
154
|
-
* [#8] Yield a block with the filename on directory
|
155
|
-
|
156
|
-
## 0.11, released 2009-07-01
|
157
|
-
* Added a rake compatibility layer. It allows you to use spec and rdoc tasks on
|
158
|
-
Thor classes.
|
159
|
-
* BACKWARDS INCOMPATIBLE: aliases are not generated automatically anymore
|
160
|
-
since it may cause wrong behavior in the invocation system.
|
161
|
-
* thor help now show information about any class/task. All those calls are
|
162
|
-
possible:
|
163
|
-
|
164
|
-
thor help describe
|
165
|
-
thor help describe:amazing
|
166
|
-
Or even with default namespaces:
|
167
|
-
|
168
|
-
thor help :spec
|
169
|
-
* Thor::Runner now invokes the default task if none is supplied:
|
170
|
-
|
171
|
-
thor describe # invokes the default task, usually help
|
172
|
-
* Thor::Runner now works with mappings:
|
173
|
-
|
174
|
-
thor describe -h
|
175
|
-
* Added some documentation and code refactoring.
|
176
|
-
|
177
|
-
## 0.9.8, released 2008-10-20
|
178
|
-
* Fixed some tiny issues that were introduced lately.
|
179
|
-
|
180
|
-
## 0.9.7, released 2008-10-13
|
181
|
-
* Setting global method options on the initialize method works as expected:
|
182
|
-
All other tasks will accept these global options in addition to their own.
|
183
|
-
* Added 'group' notion to Thor task sets (class Thor); by default all tasks
|
184
|
-
are in the 'standard' group. Running 'thor -T' will only show the standard
|
185
|
-
tasks - adding --all will show all tasks. You can also filter on a specific
|
186
|
-
group using the --group option: thor -T --group advanced
|
187
|
-
|
188
|
-
## 0.9.6, released 2008-09-13
|
189
|
-
* Generic improvements
|
190
|
-
|
191
|
-
## 0.9.5, released 2008-08-27
|
192
|
-
* Improve Windows compatibility
|
193
|
-
* Update (incorrect) README and task.thor sample file
|
194
|
-
* Options hash is now frozen (once returned)
|
195
|
-
* Allow magic predicates on options object. For instance: `options.force?`
|
196
|
-
* Add support for :numeric type
|
197
|
-
* BACKWARDS INCOMPATIBLE: Refactor Thor::Options. You cannot access shorthand forms in options hash anymore (for instance, options[:f])
|
198
|
-
* Allow specifying optional args with default values: method_options(:user => "mislav")
|
199
|
-
* Don't write options for nil or false values. This allows, for example, turning color off when running specs.
|
200
|
-
* Exit with the status of the spec command to help CI stuff out some.
|
201
|
-
|
202
|
-
## 0.9.4, released 2008-08-13
|
203
|
-
* Try to add Windows compatibility.
|
204
|
-
* BACKWARDS INCOMPATIBLE: options hash is now accessed as a property in your class and is not passed as last argument anymore
|
205
|
-
* Allow options at the beginning of the argument list as well as the end.
|
206
|
-
* Make options available with symbol keys in addition to string keys.
|
207
|
-
* Allow true to be passed to Thor#method_options to denote a boolean option.
|
208
|
-
* If loading a thor file fails, don't give up, just print a warning and keep going.
|
209
|
-
* Make sure that we re-raise errors if they happened further down the pipe than we care about.
|
210
|
-
* Only delete the old file on updating when the installation of the new one is a success
|
211
|
-
* Make it Ruby 1.8.5 compatible.
|
212
|
-
* Don't raise an error if a boolean switch is defined multiple times.
|
213
|
-
* Thor::Options now doesn't parse through things that look like options but aren't.
|
214
|
-
* Add URI detection to install task, and make sure we don't append ".thor" to URIs
|
215
|
-
* Add rake2thor to the gem binfiles.
|
216
|
-
* Make sure local Thorfiles override system-wide ones.
|