Capistrano returning wrong release_path

岁酱吖の 提交于 2019-12-08 02:27:24

问题


I have a question about capistrano version 3.2.1. In my deploy.rb file I'm using the following line:

set :theme_path, "#{release_path}/web/app/themes/myproject"

The variable release_path is not showing to latest release folder, lets say 201409151420 as it should, but it is pointing to folder current, so the output is:

DEBUG[68031037] Command: cd /var/www/myproject/current/web/app/themes/myproject && ( WP_ENV=staging /usr/bin/env npm install --silent )

The output should be:

DEBUG[68031037] Command: cd /var/www/myproject/201409151420/web/app/themes/myproject && ( WP_ENV=staging /usr/bin/env npm install --silent )

Does anyone know, why the release_path variable isn't showing to the proper folder?

Thank you for your help.


回答1:


I think it should work if you evaluate your theme_path lazily:

set(:theme_path) { "#{release_path}/web/app/themes/myproject" }

set :theme_path, lambda { "#{release_path}/web/app/themes/myproject" }

The value you are seeing is expected if release_path is not defined (see dsl/paths.rb):

def release_path
  fetch(:release_path, current_path)
end

That is, the default value for release_path is current_path.



来源:https://stackoverflow.com/questions/25850045/capistrano-returning-wrong-release-path

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!