Capistrano返回错误的release_path [英] Capistrano returning wrong release_path

查看:236
本文介绍了Capistrano返回错误的release_path的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

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

变量release_path没有显示到最新版本文件夹,可以说 201409151420 ,因为它应该指向文件夹 current ,所以输出为:

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

输出应该是:

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

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



感谢您的帮助。 方案

我认为它应该可以工作,如果你评估你的 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_p的默认值ath current_path


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.

解决方案

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.

这篇关于Capistrano返回错误的release_path的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆