[Ruby] [Vlad::Patch] Allow Vlad to load shared tasks, or be used with non-rails deployments

Corey Jewett ml at syntheticplayground.com
Thu Aug 23 11:02:52 PDT 2007


I have a couple non-Rails project I'm using Cap2 for. Trumping cap2's  
behavior sucked. I was hoping Vlad didn't marry Rails. I like the  
framework though. I quickly found that I can use Kernel.load instead  
of Vlad.load, but thought it'd be more fun to make extending  
replacing the core tasks feel like it's an intentional part of Vlad.

I was tempted to call this something other than recipes, but nothing  
came to mind. Docu (included in patch) goes like this:

== Extending Vlad

By default Vlad operates on Rails apps. Injecting your own tasks is  
simple, just add them in your Rakefile.


=== Sharing Customizations

What if you want to share those customizations across multiple  
projects? Create a separate file and put it somewhere that ruby can  
load it (see RUBYLIB or $:).

Now tweak your Rakefile to include your custom tasks:

     require 'vlad'
     Vlad.recipes << 'custom_remote_tasks'
     Vlad.load 'config/deploy.rb'


=== Overriding the Default

Suppose you want to use Vlad to deploy non-rails apps. You can  
prevent the autoloading of the default tasks with a Rakefile like this:

     require 'vlad'
     Vlad.recipes.replace []
     Vlad.load 'config/deploy.rb'

That's pretty useless however, so you'll probably end up with  
something like:

     require 'vlad'
     Vlad.recipes.replace %w{custom_app_deploy_style}
     Vlad.load 'config/deploy.rb'


Corey

-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: textmate stdin 6aOvCf.txt
Url: http://www.zenspider.com/pipermail/ruby/attachments/20070823/824cb1ab/textmatestdin6aOvCf.txt


More information about the Ruby mailing list