aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoryuuji.yaginuma <yuuji.yaginuma@gmail.com>2017-01-17 14:09:00 +0900
committeryuuji.yaginuma <yuuji.yaginuma@gmail.com>2017-01-17 14:14:59 +0900
commit073f4ecb14927fcb884f8f06fb2a7d0d1a5f3d10 (patch)
tree5230927d881103a9517bbb807d794c609fe26556
parentdc01a40eacfea12140378854b662e79a63dd874a (diff)
downloadrails-073f4ecb14927fcb884f8f06fb2a7d0d1a5f3d10.tar.gz
rails-073f4ecb14927fcb884f8f06fb2a7d0d1a5f3d10.tar.bz2
rails-073f4ecb14927fcb884f8f06fb2a7d0d1a5f3d10.zip
allow to pass describe option to rake
Since `Thor::HELP_MAPPINGS` contains `-D`, so `bin/rails -D` show rails's help. But, in Rails 5.0.1, `bin/rails -D` show the description of rake task. I think that it is better to have the same behavior.
-rw-r--r--guides/source/initialization.md2
-rw-r--r--railties/lib/rails/command.rb4
-rw-r--r--railties/lib/rails/command/base.rb2
3 files changed, 5 insertions, 3 deletions
diff --git a/guides/source/initialization.md b/guides/source/initialization.md
index aa7bbcc19b..3ea156c6fe 100644
--- a/guides/source/initialization.md
+++ b/guides/source/initialization.md
@@ -168,7 +168,7 @@ module Rails::Command
class << self
def invoke(namespace, args = [], **config)
namespace = namespace.to_s
- namespace = "help" if namespace.blank? || Thor::HELP_MAPPINGS.include?(namespace)
+ namespace = "help" if namespace.blank? || HELP_MAPPINGS.include?(namespace)
namespace = "version" if %w( -v --version ).include? namespace
if command = find_by_namespace(namespace)
diff --git a/railties/lib/rails/command.rb b/railties/lib/rails/command.rb
index 9012ceb274..13f3b90b6d 100644
--- a/railties/lib/rails/command.rb
+++ b/railties/lib/rails/command.rb
@@ -15,6 +15,8 @@ module Rails
include Behavior
+ HELP_MAPPINGS = %w(-h -? --help)
+
class << self
def hidden_commands # :nodoc:
@hidden_commands ||= []
@@ -27,7 +29,7 @@ module Rails
# Receives a namespace, arguments and the behavior to invoke the command.
def invoke(namespace, args = [], **config)
namespace = namespace.to_s
- namespace = "help" if namespace.blank? || Thor::HELP_MAPPINGS.include?(namespace)
+ namespace = "help" if namespace.blank? || HELP_MAPPINGS.include?(namespace)
namespace = "version" if %w( -v --version ).include? namespace
if command = find_by_namespace(namespace)
diff --git a/railties/lib/rails/command/base.rb b/railties/lib/rails/command/base.rb
index 7ae190433a..1435792536 100644
--- a/railties/lib/rails/command/base.rb
+++ b/railties/lib/rails/command/base.rb
@@ -56,7 +56,7 @@ module Rails
end
def perform(command, args, config) # :nodoc:
- command = nil if Thor::HELP_MAPPINGS.include?(args.first)
+ command = nil if Rails::Command::HELP_MAPPINGS.include?(args.first)
dispatch(command, args.dup, nil, config)
end