bundle exec rake assets没有匹配的主机:precompile

时间:2014-01-11 16:47:08

标签: capistrano3

我正在使用capistrano 3.0.1和capistrano-rails 1.1.0进行部署。部署工作到目前为止,只有assets:precompile没有执行。每次都会跳过这个消息:

WARN [SKIPPING] No Matching Host for /usr/bin/env if test ! -d /var/www/versioneye/releases/20140111161403; then echo "Directory does not exist '/var/www/versioneye/releases/20140111161403'" 1>&2; false; fi
 WARN [SKIPPING] No Matching Host for bundle exec rake assets:precompile
 WARN [SKIPPING] No Matching Host for /usr/bin/env if test ! -d /var/www/versioneye/releases/20140111161403; then echo "Directory does not exist '/var/www/versioneye/releases/20140111161403'" 1>&2; false; fi
 WARN [SKIPPING] No Matching Host for /usr/bin/env cp /var/www/versioneye/releases/20140111161403/public/assets/manifest* /var/www/versioneye/releases/20140111161403/assets_manifest_backup
 WARN [SKIPPING] No Matching Host for /usr/bin/env if test ! -d /var/www/versioneye/releases/20140111161403; then echo "Directory does not exist '/var/www/versioneye/releases/20140111161403'" 1>&2; false; fi
 WARN [SKIPPING] No Matching Host for /usr/bin/env find public/images public/javascripts public/stylesheets -exec touch -t 201401111614.03 {} ';'; true

我在config/deploy/stagging中只定义了一个角色。

role :app, %w{cap@aws-7}

config/deploy.rb中我设置了asset_roles,如下所示:

set :assets_roles, [:app]   # Defaults to [:web]

知道为什么assets:precompile没有被执行?

3 个答案:

答案 0 :(得分:7)

无匹配主机可能意味着您没有为该角色设置主机。我也采用了一个快捷方式,只填写了role :app,然后遇到了这个问题,填写了role :web,仍有问题,并填写role :db,我可以成功部署,包括写入crontab的时候。

role :app %w{cap@aws-7}
role :web %w{cap@aws-7}
role :db  %w{cap@aws-7}

cap @ aws-7是您的deployuser@hostname.com

答案 1 :(得分:1)

不知何故,asset_roles对我的情况没有任何影响。在config/deploy/stagging中明确设置了Web角色之后,它才起作用。

role :web, %w{cap@aws-7}

答案 2 :(得分:0)

更新为capistrano-rails 1.1.1

capistrano-rails 1.1.0 没有'set:assets_roles ..'功能。