NOTE: This information is outdated, and most links are dead
While acts_as_authenticated installs as a plugin, it really is a generator. This means that you script/plugin install it, run the generator, and then have no further use for the plugin in that app. Now this seemed a bit silly to me. Not that I question Rick’s choice to make AAA a plugin, it is the easiest way of distributing the code, and the least hassle for the user. But I now use AAA for all app’s that need authentication, so I have to install; generate; delete AAA every time…
But wait, acts_as_authenticated IS a generator! (Or rather, 3 generators) So why not install it as a generator? This is exactly what I did, and here is how i did it:
Installing AAA as a generator, the lazy way
cd ~mkdir -p .rails/generatorsrails tempcd tempscript/plugin install acts_as_authenticatedcd vendor/plugins/acts_as_authenticated/generators/mv * ~/.rails/generators/cd ~rm -rf temp
That’s it! You now have acts_as_authenticated installed as a generator for all your apps. This is not very elegant, obviously, and not easy to maintain. So lets try it again, this time slightly more elegant.
Installing AAA as a generator, the subversion way
Right, lets do that again, this time using subversion directly.
# NOTE: these URLs no longer work, just kept here for posteritycd ~mkdir -p .rails/generatorscd .rails/generatorssvn co http://svn.techno-weenie.net/projects/plugins/acts_as_authenticated/generators/authenticated/ authenticatedsvn co http://svn.techno-weenie.net/projects/plugins/acts_as_authenticated/generators/authenticated_mailer/ authenticated_mailersvn co http://svn.techno-weenie.net/projects/plugins/acts_as_authenticated/generators/authenticated_migration/ authenticated_migration
There we go. We now have acts_as_authenticated installed, and it’s version controlled.
You can install all svn controlled generators this way. So here lies the next part! After a while, you might have dozens of generators installed, and you’ll need to cd <generator name>; svn up each and every one separately to keep them up to date.
Installing AAA as a generator, the svn:externals way
Let’s exploit our own subversion server, and svn:externals to get them all in one go!
# NOTE: these URLs no longer work, just kept here for posteritycd ~mkdir -p .rails/generatorscd .rails/generatorsecho "placeholder" > READMEsvn import . https://url.to_your_svn_server.net/repos/somerepo/my_generatorscd ..rm -rf generatorssvn co https://url.to_your_svn_server.net/repos/somerepo/my_generators generatorscd generatorssvn propedit svn:externals .# this opens up your $EDITOR, add the following to it:authenticated http://svn.techno-weenie.net/projects/plugins/acts_as_authenticated/generators/authenticated/authenticated_mailer http://svn.techno-weenie.net/projects/plugins/acts_as_authenticated/generators/authenticated_mailer/authenticated_migration http://svn.techno-weenie.net/projects/plugins/acts_as_authenticated/generators/authenticated_migration/# save and exitsvn ci -m "adding acts_as_authenticated"svn up
And we are done! No matter how many generators you add this way, all you need to do now is cd ~/.rails/generators;svn up, and all your generators are updated!
Windows…
All this is for *nix (OSX, linux, solaris, … any unix like os.), but what about windows? Honestly, I don’t know… I don’t use windows much myself, so if anyone figures out how to get this working on windows, please feel free to contact me with the details, and I will append it here.
EDIT: james2m on #mephisto @ irc.freenode.net noted the windows place to put this is C:\Documents and Settings\username\.rails\generators
In closing, I hope this will be useful to someone. I know it saved me quite some work, and it just feels … “cleaner” somehow :)