1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

[ci skip] Document running a rake command as a rails command

This commit is contained in:
Nick Cox 2015-04-15 20:41:54 -07:00
parent 5256ada75d
commit 7937c6aa00

View file

@ -151,6 +151,17 @@ EOT
puts HELP_MESSAGE puts HELP_MESSAGE
end 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) def write_error_message(command)
puts "Error: Command '#{command}' not recognized" puts "Error: Command '#{command}' not recognized"
if %x{rake #{command} --dry-run 2>&1 } && $?.success? if %x{rake #{command} --dry-run 2>&1 } && $?.success?