Yes, Capistrano has programmatic access to the command-line components. If you want to call them from a rake task, though, you need to do a little extra work task :deploy require 'rubygems' require 'capistrano' require 'capistrano/cli' parameters = "deploy" # this is an array of the strings that come after # cap on the command line. E.g.
, # "deploy", "-S", "revision=1024" gives you local var # revision in your deploy.rb. # The following is required ONLY when you run Capistrano 2+ from Rake, # because Rake adds the methods from FileUtils to Object. FileUtils includes # a method called symlink which interferes with Capistrano's symlink task.
Capistrano::Configuration::Namespaces::Namespace. Class_eval { undef :symlink } Capistrano::CLI. Parse(parameters).
Execute! End.
Yes, Capistrano has programmatic access to the command-line components. If you want to call them from a rake task, though, you need to do a little extra work. Task :deploy require 'rubygems' require 'capistrano' require 'capistrano/cli' parameters = "deploy" # this is an array of the strings that come after # cap on the command line.E.g.
, # "deploy", "-S", "revision=1024" gives you local var # revision in your deploy.rb. # The following is required ONLY when you run Capistrano 2+ from Rake, # because Rake adds the methods from FileUtils to Object. FileUtils includes # a method called symlink which interferes with Capistrano's symlink task.
Capistrano::Configuration::Namespaces::Namespace. Class_eval { undef :symlink } Capistrano::CLI. Parse(parameters).
Execute! End.
Please note my comment above concerning "sh" vs "system". It seems that capistrano executes my command on the remote server via "sh" and the non-zero return value causes my rake task to exit earlier than I'd like. Is there any programatic resolution for my situation?
Thank you for your help; I've gone ahead and marked this question as answered as I think my particular case is an edge case. – Jonathan R. Wallace Jun 9 '09 at 5:52 Capistrano does use sh - both in default tasks and when you call something via run.
You can pass a parameter to the run method, :shell => false, which will run it without the sh. I believe you can also set a global in your deploy. Rb, i.e.
, set :shell, false. – Sarah Mei Jun 9 '09 at 16:50.
Jonathan, your mileage may vary by doing something like set(:shell, false) to stop capistrano running tasks in a sub-sh-shell. Just a thought, feel free to ping me if you need a hand though.
I have a set of rake tasks where I need to invoke capistrano at some point. Edwin Goei's blog suggests shelling out to capistrano via "sh". Is there a simpler way?
It would seem you should be able to call the appropriate tasks programmatically. Thanks in advance.
I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.