Apparently the new Rails 3 generators do not support looking up custom
generators in ~/.rails/generators
anymore. Here is a bash function
that copies a generator from ~/.rails/generators/GENERATOR
into
your rails app so that it can be used without having to turn it into a plugin /
gem.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Source this in your bashrc | |
function cpgen { | |
if [ ! -d "./lib/generators" ]; then | |
mkdir './lib/generators' | |
fi | |
cp -r ~/.rails/generators/$1 lib/generators | |
} |
Note that Rails 3 does not support older 2.x style generators so you have have to re-write those using the new Thor syntax. Here are some helpful links: