thor 1.0.1 → 1.2.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2c23d1fdac6ea485b4cbfe91abad33a46e03c00baf2e7e0068c9f8d4ce41e607
4
- data.tar.gz: 368fe9c87e8a426eaf38278acaba2b7a3171c96c99298ca5e2eddf3b1b466ff6
3
+ metadata.gz: 30e79d2b0a96e87c8e6348467db577c6ad1e9acbbbac5d375417bc3e5a2b7698
4
+ data.tar.gz: 701f1ab842da90e599b96bd00d90481d716eb29e39e0283b5ff527c2033fc742
5
5
  SHA512:
6
- metadata.gz: 6f2e3b52a657bc5318fed8a5e3f15368d734f62e7b8039a296add626ff6bdc415e6c8a85cea31bdd591a629960854f0d34e47ef81161c63acf4ef140457a7bdb
7
- data.tar.gz: 8086cd52e16a12fb63dad7df484f0c079feed33d7aa6078d8683f895ddcd92da21be58d26a3b33f89e44d822ae9b01e73ef36672aa77a7befcfa3198523df253
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/erikhuda/thor/wiki
32
+ [wiki]: https://github.com/rails/thor/wiki
39
33
  [homepage]: http://whatisthor.com/
40
34
 
41
35
  Contributing
@@ -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
@@ -28,6 +28,12 @@ class Thor
28
28
  super(convert_key(key))
29
29
  end
30
30
 
31
+ def except(*keys)
32
+ dup.tap do |hash|
33
+ keys.each { |key| hash.delete(convert_key(key)) }
34
+ end
35
+ end
36
+
31
37
  def fetch(key, *args)
32
38
  super(convert_key(key), *args)
33
39
  end
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::SPELL_CHECKERS.merge!(
106
- 'Thor::UndefinedCommandError' => UndefinedCommandError::SpellChecker,
107
- 'Thor::UnknownArgumentError' => UnknownArgumentError::SpellChecker
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
- @assigns[argument.human_name] = argument.default
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
@@ -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, SHORT_NUM
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
- def assign_result!(option, result)
137
- if option.repeatable && option.type == :hash
138
- (@assigns[option.human_name] ||= {}).merge!(result)
139
- elsif option.repeatable
140
- (@assigns[option.human_name] ||= []) << result
141
- else
142
- @assigns[option.human_name] = result
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
- end
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
 
@@ -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
- buffer = "#{status}#{spaces}#{message}"
118
- buffer = "#{buffer}\n" unless buffer.end_with?("\n")
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
- counter = 0
234
- unwrapped.split(" ").inject do |memo, word|
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
@@ -97,7 +97,11 @@ class Thor
97
97
  protected
98
98
 
99
99
  def can_display_colors?
100
- stdout.tty? && !are_colors_disabled?
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/*.thor"]
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
@@ -1,3 +1,3 @@
1
1
  class Thor
2
- VERSION = "1.0.1"
2
+ VERSION = "1.2.1"
3
3
  end
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.merge(command_names)
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,7 +337,7 @@ 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.merge(command_names)
340
+ @disable_required_check = disable_required_check | command_names
341
341
  end
342
342
 
343
343
  def disable_required_check?(command) #:nodoc:
@@ -347,12 +347,12 @@ class Thor
347
347
  protected
348
348
 
349
349
  def stop_on_unknown_option #:nodoc:
350
- @stop_on_unknown_option ||= Set.new
350
+ @stop_on_unknown_option ||= []
351
351
  end
352
352
 
353
353
  # help command has the required check disabled by default.
354
354
  def disable_required_check #:nodoc:
355
- @disable_required_check ||= Set.new([:help])
355
+ @disable_required_check ||= [:help]
356
356
  end
357
357
 
358
358
  # The method responsible for dispatching given the args.
@@ -398,7 +398,6 @@ class Thor
398
398
  # the namespace should be displayed as arguments.
399
399
  #
400
400
  def banner(command, namespace = nil, subcommand = false)
401
- $thor_runner ||= false
402
401
  command.formatted_usage(self, $thor_runner, subcommand).split("\n").map do |formatted_usage|
403
402
  "#{basename} #{formatted_usage}"
404
403
  end.join("\n")
data/thor.gemspec CHANGED
@@ -14,11 +14,12 @@ Gem::Specification.new do |spec|
14
14
  spec.licenses = %w(MIT)
15
15
  spec.name = "thor"
16
16
  spec.metadata = {
17
- "bug_tracker_uri" => "https://github.com/erikhuda/thor/issues",
18
- "changelog_uri" => "https://github.com/erikhuda/thor/blob/master/CHANGELOG.md",
17
+ "bug_tracker_uri" => "https://github.com/rails/thor/issues",
18
+ "changelog_uri" => "https://github.com/rails/thor/releases/tag/v#{Thor::VERSION}",
19
19
  "documentation_uri" => "http://whatisthor.com/",
20
- "source_code_uri" => "https://github.com/erikhuda/thor/tree/v#{Thor::VERSION}",
21
- "wiki_uri" => "https://github.com/erikhuda/thor/wiki"
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",
22
23
  }
23
24
  spec.require_paths = %w(lib)
24
25
  spec.required_ruby_version = ">= 2.0.0"
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.0.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: 2019-12-17 00:00:00.000000000 Z
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
@@ -80,11 +79,12 @@ homepage: http://whatisthor.com/
80
79
  licenses:
81
80
  - MIT
82
81
  metadata:
83
- bug_tracker_uri: https://github.com/erikhuda/thor/issues
84
- changelog_uri: https://github.com/erikhuda/thor/blob/master/CHANGELOG.md
82
+ bug_tracker_uri: https://github.com/rails/thor/issues
83
+ changelog_uri: https://github.com/rails/thor/releases/tag/v1.2.1
85
84
  documentation_uri: http://whatisthor.com/
86
- source_code_uri: https://github.com/erikhuda/thor/tree/v1.0.1
87
- wiki_uri: https://github.com/erikhuda/thor/wiki
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'
88
88
  post_install_message:
89
89
  rdoc_options: []
90
90
  require_paths:
@@ -100,7 +100,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
100
100
  - !ruby/object:Gem::Version
101
101
  version: 1.3.5
102
102
  requirements: []
103
- rubygems_version: 3.0.3
103
+ rubygems_version: 3.2.32
104
104
  signing_key:
105
105
  specification_version: 4
106
106
  summary: Thor is a toolkit for building powerful command-line interfaces.
data/CHANGELOG.md DELETED
@@ -1,220 +0,0 @@
1
- # 1.0.1
2
- * Fix thor when `thor/base` and `thor/group` are required without `thor.rb`.
3
- * Handle relative source path in `create_link`.
4
-
5
- # 1.0.0
6
- * Drop support to Ruby 1.8 and 1.9.
7
- * Deprecate relying on default `exit_on_failure?`.
8
- In preparation to make Thor commands exit when there is a failure we are deprecating
9
- defining a command without defining what behavior is expected when there is a failure.
10
-
11
- To fix the deprecation you need to define a class method called `exit_on_failure?` returning
12
-
13
- `false` if you want the current behavior or `true` if you want the new behavior.
14
- * Deprecate defining an option with the default value using a different type as defined in the option.
15
- * Allow options to be repeatable. See #674.
16
-
17
- # 0.20.3
18
- * Support old versions of `did_you_mean`.
19
-
20
- # 0.20.2
21
- * Fix `did_you_mean` support.
22
-
23
- # 0.20.1
24
- * Support new versions of ERB.
25
- * 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!`
26
- * Add `did_you_mean` support.
27
-
28
- ## 0.20.0
29
- * Add `check_default_type!` to check if the default value of an option matches the defined type.
30
- It removes the warning on usage and gives the command authors the possibility to check for programming errors.
31
-
32
- * Add `disable_required_check!` to disable check for required options in some commands.
33
- It is a substitute of `disable_class_options` that was not working as intended.
34
-
35
- * Add `inject_into_module`.
36
-
37
- ## 0.19.4, release 2016-11-28
38
- * Rename `Thor::Base#thor_reserved_word?` to `#is_thor_reserved_word?`
39
-
40
- ## 0.19.3, release 2016-11-27
41
- * Output a warning instead of raising an exception when a default option value doesn't match its specified type
42
-
43
- ## 0.19.2, release 2016-11-26
44
- * Fix bug with handling of colors passed to `ask` (and methods like `yes?` and `no?` which it underpins)
45
- * Allow numeric arguments to be negative
46
- * 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
47
- * Add `Thor::Shell::Basic#indent` method for intending output
48
- * Fix `remove_command` for an inherited command (see #451)
49
- * Allow hash arguments to only have each key provided once (see #455)
50
- * Allow commands to disable class options, for instance for "help" commands (see #363)
51
- * Do not generate a negative option (`--no-no-foo`) for already negative boolean options (`--no-foo`)
52
- * Improve compatibility of `Thor::CoreExt::HashWithIndifferentAccess` with Ruby standard library `Hash`
53
- * Allow specifying a custom binding for template evaluation (e.g. `#key?` and `#fetch`)
54
- * Fix support for subcommand-specific "help"s
55
- * Use a string buffer when handling ERB for Ruby 2.3 compatibility
56
- * Update dependencies
57
-
58
- ## 0.19.1, release 2014-03-24
59
- * Fix `say` non-String break regression
60
-
61
- ## 0.19.0, release 2014-03-22
62
- * Add support for a default to #ask
63
- * Avoid @namespace not initialized warning
64
- * Avoid private attribute? warning
65
- * Fix initializing with unknown options
66
- * Loosen required_rubygems_version for compatibility with Ubuntu 10.04
67
- * Shell#ask: support a noecho option for stdin
68
- * Shell#ask: change API to be :echo => false
69
- * Display a message without a stack trace for ambiguous commands
70
- * Make say and say_status thread safe
71
- * Dependency for console io version check
72
- * Alias --help to help on subcommands
73
- * Use mime-types 1.x for Ruby 1.8.7 compatibility for Ruby 1.8 only
74
- * Accept .tt files as templates
75
- * Check if numeric value is in enum
76
- * Use Readline for user input
77
- * Fix dispatching of subcommands (concerning :help and *args)
78
- * Fix warnings when running specs with `$VERBOSE = true`
79
- * Make subcommand help more consistent
80
- * Make the current command chain accessible in command
81
-
82
- ## 0.18.1, release 2013-03-30
83
- * Revert regressions found in 0.18.0
84
-
85
- ## 0.18.0, release 2013-03-26
86
- * Remove rake2thor
87
- * Only display colors if output medium supports colors
88
- * Pass parent_options to subcommands
89
- * Fix non-dash-prefixed aliases
90
- * Make error messages more helpful
91
- * Rename "task" to "command"
92
- * Add the method to allow for custom package name
93
-
94
- ## 0.17.0, release 2013-01-24
95
- * Add better support for tasks that accept arbitrary additional arguments (e.g. things like `bundle exec`)
96
- * Add #stop_on_unknown_option!
97
- * Only strip from stdin.gets if it wasn't ended with EOF
98
- * Allow "send" as a task name
99
- * Allow passing options as arguments after "--"
100
- * Autoload Thor::Group
101
-
102
- ## 0.16.0, release 2012-08-14
103
- * Add enum to string arguments
104
-
105
- ## 0.15.4, release 2012-06-29
106
- * Fix regression when destination root contains reserved regexp characters
107
-
108
- ## 0.15.3, release 2012-06-18
109
- * Support strict_args_position! for backwards compatibility
110
- * Escape Dir glob characters in paths
111
-
112
- ## 0.15.2, released 2012-05-07
113
- * Added print_in_columns
114
- * Exposed terminal_width as a public API
115
-
116
- ## 0.15.1, release 2012-05-06
117
- * Fix Ruby 1.8 truncation bug with unicode chars
118
- * Fix shell delegate methods to pass their block
119
- * Don't output trailing spaces when printing the last column in a table
120
-
121
- ## 0.15, released 2012-04-29
122
- * Alias method_options to options
123
- * Refactor say to allow multiple colors
124
- * Exposed error as a public API
125
- * Exposed file_collision as a public API
126
- * Exposed print_wrapped as a public API
127
- * Exposed set_color as a public API
128
- * Fix number-formatting bugs in print_table
129
- * Fix "indent" typo in print_table
130
- * Fix Errno::EPIPE when piping tasks to `head`
131
- * More friendly error messages
132
-
133
- ## 0.14, released 2010-07-25
134
- * Added CreateLink class and #link_file method
135
- * Made Thor::Actions#run use system as default method for system calls
136
- * Allow use of private methods from superclass as tasks
137
- * Added mute(&block) method which allows to run block without any output
138
- * Removed config[:pretend]
139
- * Enabled underscores for command line switches
140
- * Added Thor::Base.basename which is used by both Thor.banner and Thor::Group.banner
141
- * Deprecated invoke() without arguments
142
- * Added :only and :except to check_unknown_options
143
-
144
- ## 0.13, released 2010-02-03
145
- * Added :lazy_default which is only triggered if a switch is given
146
- * Added Thor::Shell::HTML
147
- * Added subcommands
148
- * Decoupled Thor::Group and Thor, so it's easier to vendor
149
- * Added check_unknown_options! in case you want error messages to be raised in valid switches
150
- * run(command) should return the results of command
151
-
152
- ## 0.12, released 2010-01-02
153
- * Methods generated by attr_* are automatically not marked as tasks
154
- * inject_into_file does not add the same content twice, unless :force is set
155
- * Removed rr in favor to rspec mock framework
156
- * Improved output for thor -T
157
- * [#7] Do not force white color on status
158
- * [#8] Yield a block with the filename on directory
159
-
160
- ## 0.11, released 2009-07-01
161
- * Added a rake compatibility layer. It allows you to use spec and rdoc tasks on
162
- Thor classes.
163
- * BACKWARDS INCOMPATIBLE: aliases are not generated automatically anymore
164
- since it may cause wrong behavior in the invocation system.
165
- * thor help now show information about any class/task. All those calls are
166
- possible:
167
-
168
- thor help describe
169
- thor help describe:amazing
170
- Or even with default namespaces:
171
-
172
- thor help :spec
173
- * Thor::Runner now invokes the default task if none is supplied:
174
-
175
- thor describe # invokes the default task, usually help
176
- * Thor::Runner now works with mappings:
177
-
178
- thor describe -h
179
- * Added some documentation and code refactoring.
180
-
181
- ## 0.9.8, released 2008-10-20
182
- * Fixed some tiny issues that were introduced lately.
183
-
184
- ## 0.9.7, released 2008-10-13
185
- * Setting global method options on the initialize method works as expected:
186
- All other tasks will accept these global options in addition to their own.
187
- * Added 'group' notion to Thor task sets (class Thor); by default all tasks
188
- are in the 'standard' group. Running 'thor -T' will only show the standard
189
- tasks - adding --all will show all tasks. You can also filter on a specific
190
- group using the --group option: thor -T --group advanced
191
-
192
- ## 0.9.6, released 2008-09-13
193
- * Generic improvements
194
-
195
- ## 0.9.5, released 2008-08-27
196
- * Improve Windows compatibility
197
- * Update (incorrect) README and task.thor sample file
198
- * Options hash is now frozen (once returned)
199
- * Allow magic predicates on options object. For instance: `options.force?`
200
- * Add support for :numeric type
201
- * BACKWARDS INCOMPATIBLE: Refactor Thor::Options. You cannot access shorthand forms in options hash anymore (for instance, options[:f])
202
- * Allow specifying optional args with default values: method_options(:user => "mislav")
203
- * Don't write options for nil or false values. This allows, for example, turning color off when running specs.
204
- * Exit with the status of the spec command to help CI stuff out some.
205
-
206
- ## 0.9.4, released 2008-08-13
207
- * Try to add Windows compatibility.
208
- * BACKWARDS INCOMPATIBLE: options hash is now accessed as a property in your class and is not passed as last argument anymore
209
- * Allow options at the beginning of the argument list as well as the end.
210
- * Make options available with symbol keys in addition to string keys.
211
- * Allow true to be passed to Thor#method_options to denote a boolean option.
212
- * If loading a thor file fails, don't give up, just print a warning and keep going.
213
- * Make sure that we re-raise errors if they happened further down the pipe than we care about.
214
- * Only delete the old file on updating when the installation of the new one is a success
215
- * Make it Ruby 1.8.5 compatible.
216
- * Don't raise an error if a boolean switch is defined multiple times.
217
- * Thor::Options now doesn't parse through things that look like options but aren't.
218
- * Add URI detection to install task, and make sure we don't append ".thor" to URIs
219
- * Add rake2thor to the gem binfiles.
220
- * Make sure local Thorfiles override system-wide ones.