views:

60

answers:

1

I want to make it so I can just type script/generate controller and it will run script/generate rspec_controller. How can I do this?

A: 

Do you mean that you want it:

  1. to also run script/generate rspec_controller, or
  2. to only run script/generate rspec_controller?

If 1 then you have multiple options. The simplest and less intrusive would probably be to simply wrap script/generate as follows:

  1. rename script/generate as script/generate.orig
  2. create script/generate anew with the following contents:

    #!/bin/sh
    "`dirname \"$0\"`/generate.orig" "$@"
    if [ "$1" == "controller" ] ; then
      shift
      "`dirname \"$0\"`/generate.orig" rspec_controller "$@"
    fi
    
  3. ensure the new script/generate is executable etc., e.g. chmod a+rx script/generate

  4. add script/generate.orig to source control and checkin the modified script/generate script

Cheers, V.

vladr