I want to make 开发者_JAVA百科it so I can just type script/generate controller
and it will run script/generate rspec_controller
. How can I do this?
Do you mean that you want it:
- to also run
script/generate rspec_controller
, or - 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:
- rename
script/generate
asscript/generate.orig
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
ensure the new
script/generate
is executable etc., e.g.chmod a+rx script/generate
- add
script/generate.orig
to source control and checkin the modifiedscript/generate
script
精彩评论