I am learning to love capistrano–it’s a fantastic deployment system for remote server management. I’m even learning enough ruby to be dangerous.
One of the issues I ran into was I wanted to set a variable in one task and use it in another (or, more likely, in more than one other task). I couldn’t find any examples of how to do this online, so here’s how I did it:
task :set_var self[:myvar]= localvar end task :read_var puts self[:myvar] end
Note that myvar and localvar need to be different identifiers–“local variables take precedence”. Also, the variable can be anything, I think. I use this method to create an array in one task, then iterate over it in another.