Capistrano返回错误的release_path

时间:2014-09-15 14:10:20

标签: ruby gruntjs capistrano bower capistrano3

我对capistrano版本3.2.1有疑问。在我的deploy.rb文件中,我使用以下行:

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

变量release_path没有显示到最新版本文件夹,假设它应该是 201409151420 ,但它指向文件夹当前,因此输出为:

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

输出应为:

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

有谁知道,为什么release_path变量没有显示到正确的文件夹?

感谢您的帮助。

1 个答案:

答案 0 :(得分:6)

我认为如果你懒惰地评估theme_path

,它应该会有效

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

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

如果未定义release_path,则会看到您看到的值(请参阅dsl/paths.rb):

def release_path
  fetch(:release_path, current_path)
end

也就是说,release_path的默认值为current_path