Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

Prompt to run rake when accidentally typed rails #7891

Merged
merged 1 commit into from Oct 13, 2012
Commits on Oct 12, 2012
  1. Prompt to run rake when accidentally typed rails

    schneems committed Oct 9, 2012
    Developers from all levels will accidentally run rake tasks using the `rails` keyword when they meant to use `rake`. Often times beginners struggle with the difference between the tools. The most common example would be `$ rails db:migrate`
    
    Rather than telling the developer simply that they did not use a valid rails command, we can see if it was a valid rake command first. If it is a valid rake command we can auto execute it giving the user a period of time to cancel if that isn't what they intended.
    
    Here is what `rake db:migrate` would look like if you cancel the command:
    
    
    ```sh
    $ rails db:migrate
    Assuming you meant: $ rake db:migrate 
    press any key to cancel in 3 seconds
    > 
    command terminated ...
    ```
    
    Here is what it looks like if you don't cancel the command:
    
    ```sh
    $ rails db:migrate
    Assuming you meant: $ rake db:migrate 
    press any key to cancel in 3 seconds
    > 
    Running: $ rake db:migrate 
    ==  Foo: migrating ============================================================
    ==  Foo: migrated (0.0000s) ===================================================
    ```