It’s easy to create your own recipe gem. I’m giving a talk at the Melbourne Ruby Users Group tonight about how to do it.
https://github.com/mbailey/demrec is a demo gem I threw together to illustrate.
There’s not much to it!
mbailey@island:~/demrec (master)$ tree . |-- demrec.gemspec |-- Gemfile |-- Gemfile.lock |-- lib | |-- demrec | | |-- recipes | | | |-- db.rake | | | `-- db.rb | | `-- version.rb | `-- demrec.rb |-- pkg |-- Rakefile `-- README.md 4 directories, 9 files
To make the Capistano and Rake tasks available to your project just run:
$ echo "gem 'demrec'" >> Gemfile $ echo "require 'demrec'" >> Rakefile $ echo "require 'demrec'" >> Capfile
You should now have these Rake tasks available to your project:
$ rake -T rake demrec:db:backup # Backup the database
As well as these Capistrano tasks:
$ cap -T cap demrec:db:backup # Backup the database cap invoke # Invoke a single command on the remote servers. cap shell # Begin an interactive Capistrano session. Some tasks were not listed, either because they have no description, or because they are only used internally by other tasks. To see all tasks, type `cap -vT'. Extended help may be available for these tasks. Type `cap -e taskname' to view it.
(Does anyone else think ‘cap -T’ is too noisy?)