I am attempting to write the following code for Capistrano 3 on a rails app that I am working on. The error I receive is the message that is pasted on the title of the post.
196 namespace :swconfig do
197 desc "Install Bazaar xmllog plugin."
198 task :install_bzr_xmllog do
199 puts "Installing Bazaar xmllog..."
200 execute "rm -rf /home/deployer/.bazaar/plugins/xmloutput"
201 execute "mkdir -p /home/deployer/.bazaar/plugins && cd /home/deployer/.bazaar /plugins && bzr branch lp:~amujumdar/bzr-xmloutput/emit_authors xmloutput"
202 end
203
204 desc "Upgrade rack"
205 task :upgrade_rack do
206 puts "Upgrading rack to 1.5.2"
207 execute "gem install rack -v1.5.2"
208 end
209
210 end
I've read a plentiful amount of research regarding upgrading Capistrano from 2, Capistrano in general from its official website, and stack overflow, but I am not sure what the problem is.
Because the syntax was from Capistrano 2, the 'execute' key word was previously labeled 'run'which of course gave me the error Undefined method 'run' for main:Object. However, substituting run into execute did not fix the error. I've also tried this variation of the execute syntax.
196 namespace :swconfig do
197 desc "Install Bazaar xmllog plugin."
198 task :install_bzr_xmllog do
199 puts "Installing Bazaar xmllog..."
200 execute :rm, " -rf /home/deployer/.bazaar/plugins/xmloutput"
This still produces the same error. According to Capistrano's official website Capistrano the correct syntax should be the variation immediately above. However, in this article that I found, Writing Capistrano Tasks, the execute syntax is not written in symbol format.
Lastly, because finding standard, consistent, and reliable Capistrano syntax is such an ordeal, I've run out of options/leads to try to trouble shoot this. Does anyone have any ideas what the problem could be? Thanks for any help.
Seems like capistrano could have set up a more helpful error message. Here's what worked for me:
for cap2:
namespace :deploy do
desc "Generate static error pages"
task :generate_static_error_pages do
run "cd #{current_path}; RAILS_ENV=production rake app:generate_static_error_pages"
end
end
for cap3:
namespace :deploy do
desc "Generate static error pages"
task :generate_static_error_pages do
on roles(:web) do
execute "cd #{current_path}; RAILS_ENV=production rake app:generate_static_error_pages"
end
end
end
The two changes:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With