Capistrano 3 using the download! in task in lib / capistrano / tasks

I am using Capistrano 3 and I want to create my own task. Therefore, I created the file my_new_thing.rake in lib / capistrano / tasks, and I see the task when I start cap -T. But ... some of the methods are not available. When I try to use the download! I get

cap aborted!
NoMethodError: undefined method `upload!' for main:Object

But if I transfer the same task to config / deploy.rb, then download! method is available.

So what is going on? How to create new Capistrano tasks, put them in a separate file and make them work?

+4
source share
3 answers

, , , ! .

, , :

 namespace :figaro do      
   desc "Transfer Figaro application.yml to shared/config"
   task :upload do
     on roles(:all) do
       upload! "config/application.yml", "#{shared_path}/config/application.yml"
     end
   end
 end
 before "deploy:check", "figaro:upload"

, !

+12

config/recipes capistrano, .

.rb, .

config/deploy.rb

load File.expand_path('../recipes/my_new_thing.rb', __FILE__)
0

, , , . @Sharagoz , .

0
source

Source: https://habr.com/ru/post/1547240/


All Articles