Merge pull request #19778 from thenickcox/commands_docs

[ci skip] Document running a rake command as a rails command
This commit is contained in:
Richard Schneeman 2015-04-16 00:00:34 -05:00
commit e263923573

@ -151,6 +151,17 @@ def write_help_message
puts HELP_MESSAGE
end
# Output an error message stating that the attempted command is not a valid rails command.
# Run the attempted command as a rake command with the --dry-run flag. If successful, suggest
# to the user that they possibly meant to run the given rails command as a rake command.
# Append the help message.
#
# Example:
# $ rails db:migrate
# Error: Command 'db:migrate' not recognized
# Did you mean: `$ rake db:migrate` ?
# (Help message output)
#
def write_error_message(command)
puts "Error: Command '#{command}' not recognized"
if %x{rake #{command} --dry-run 2>&1 } && $?.success?