A
A
Anton Misyagin2015-12-17 19:59:07
Ruby on Rails
Anton Misyagin, 2015-12-17 19:59:07

How to get rid of dependence on filenames when deploying via capistrano?

There are a bunch of tasks in the /lib/capistrano/tasks folder.
For example, there are two files there:
db.rake and nginx.rake
db is located alphabetically higher than nginx
Now if I write in db.rake:

...
before :reset, 'nginx:stop'
after :reset, 'nginx:start'
...

then when I run cap staging db:reset
I get dont know how build nginx:stop
now I rename db.rake to z_db:rake
and run cap staging db:reset , everything works. This happens, I believe, because of the line in the Capfile:
Dir.glob('lib/capistrano/tasks/*.rb').each { |r| import r }

Which loads all tasks in alphabetical order. This makes me feel uncomfortable. How can I make sure this behavior doesn't happen.
PS
require 'nginx'
require 'lib/capistrano/tasks/nginx'

in the beginning db does not rescue. gives cannot load such file

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
alfss, 2015-12-18
@alfss

as a simple option - add 00_, 01_, etc. to the beginning of the priority task files.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question