ruby-on-rails – Capistrano 3 Sprockets 3 Rails 4.2.1将不会部署?

前端之家收集整理的这篇文章主要介绍了ruby-on-rails – Capistrano 3 Sprockets 3 Rails 4.2.1将不会部署?前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我将捆绑更新和更新的链轮运行到3.0.0.

当我尝试通过Capistrano 3部署我得到以下错误

INFO [e54ac5ca] Running /usr/bin/env cp /var/www/testapp/releases/20150414002210/public/assets/manifest* /var/www/testapp/releases/20150414002210/assets_manifest_backup as deploy@xx.xxx.xxx.xx
DEBUG [e54ac5ca] Command: cd /var/www/testapp/releases/20150414002210 && /usr/bin/env cp /var/www/testapp/releases/20150414002210/public/assets/manifest* /var/www/testapp/releases/20150414002210/assets_manifest_backup
DEBUG [e54ac5ca]    cp: cannot stat ‘/var/www/testapp/releases/20150414002210/public/assets/manifest*’
DEBUG [e54ac5ca]    : No such file or directory
DEBUG [d2c5a990]    cp: cannot stat ‘/var/www/testapp/releases/20150414002210/public/assets/manifest*’
DEBUG [d2c5a990]    : No such file or directory
cap aborted!
SSHKit::Runner::ExecuteError: Exception while executing as deploy@xx.xxx.xxx.xxx: cp exit status: 1
cp stdout: Nothing written
cp stderr: cp: cannot stat ‘/var/www/testapp/releases/20150414002210/public/assets/manifest*’: No such file or directory
/Users/HomeHome/.rvm/gems/ruby-2.1.3/gems/sshkit-1.7.1/lib/sshkit/runners/parallel.rb:16:in `rescue in block (2 levels) in execute'
/Users/HomeHome/.rvm/gems/ruby-2.1.3/gems/sshkit-1.7.1/lib/sshkit/runners/parallel.rb:12:in `block (2 levels) in execute'
SSHKit::Command::Failed: cp exit status: 1
cp stdout: Nothing written
cp stderr: cp: cannot stat ‘/var/www/testapp/releases/20150414002210/public/assets/manifest*’: No such file or directory
/Users/HomeHome/.rvm/gems/ruby-2.1.3/gems/sshkit-1.7.1/lib/sshkit/command.rb:95:in `exit_status='
/Users/HomeHome/.rvm/gems/ruby-2.1.3/gems/sshkit-1.7.1/lib/sshkit/backends/netssh.rb:179:in `block in _execute'
/Users/HomeHome/.rvm/gems/ruby-2.1.3/gems/sshkit-1.7.1/lib/sshkit/backends/netssh.rb:133:in `tap'
/Users/HomeHome/.rvm/gems/ruby-2.1.3/gems/sshkit-1.7.1/lib/sshkit/backends/netssh.rb:133:in `_execute'
/Users/HomeHome/.rvm/gems/ruby-2.1.3/gems/sshkit-1.7.1/lib/sshkit/backends/netssh.rb:66:in `execute'
/Users/HomeHome/.rvm/gems/ruby-2.1.3/gems/capistrano-rails-1.1.2/lib/capistrano/tasks/assets.rake:68:in `block (5 levels) in <top (required)>'
/Users/HomeHome/.rvm/gems/ruby-2.1.3/gems/sshkit-1.7.1/lib/sshkit/backends/abstract.rb:77:in `within'
/Users/HomeHome/.rvm/gems/ruby-2.1.3/gems/capistrano-rails-1.1.2/lib/capistrano/tasks/assets.rake:67:in `block (4 levels) in <top (required)>'
/Users/HomeHome/.rvm/gems/ruby-2.1.3/gems/sshkit-1.7.1/lib/sshkit/backends/netssh.rb:54:in `instance_exec'
/Users/HomeHome/.rvm/gems/ruby-2.1.3/gems/sshkit-1.7.1/lib/sshkit/backends/netssh.rb:54:in `run'
/Users/HomeHome/.rvm/gems/ruby-2.1.3/gems/sshkit-1.7.1/lib/sshkit/runners/parallel.rb:13:in `block (2 levels) in execute'
Tasks: TOP => deploy:assets:backup_manifest
(See full trace by running task with --trace)
The deploy has Failed with an error: #<SSHKit::Runner::ExecuteError: Exception while executing as deploy@xx.xxx.xxx.xxx: cp exit status: 1
cp stdout: Nothing written
cp stderr: cp: cannot stat ‘/var/www/testapp/releases/20150414002210/public/assets/manifest*’: No such file or directory

我已经看到周围的人可能有同样的问题,似乎没有任何问题或意见在任何地方…

老实说,我甚至不知道链轮,链轮 – 轨道与轨道相关.这对我来说都很混乱…例如,默认的Gemfile附带了一个新的Rails 4.2.1应用程序,表示链轮3.0.0是允许在Gemfile.lock,但当你去链轮2-> 3升级指南,它显示// = include已被删除,但它是在application.js文件中.

所以,也许我错过了一些东西,但我不太清楚如何解决这个问题.

解决方法

问题很容易解决,但我认为首先我们应该解决其他一些问题.

链轮是一个自动管理Web前端资产(CSS,JS,图像等)的红宝书库.

它是基于将资产文件逻辑组织在开发中的想法,然后在部署到生产之前将其链接和缩小.链轮使自动进行此过程.

Rails 3.1(很久以前,现在)发布了一个名为“资产管道”的新功能,可以自动管理网络资产. Rails的资产管道仍然由链轮提供动力.

两个链轮和导轨都是积极维护和开发的库.新版本发布,具有新功能和突破性更改.
我相信Rails在默认情况下不使用最新版本的链轮.没关系,我们正在谈论在这里编译CSS和JS,而不是与一些外部API进行交互;即使是旧版本的链轮也可以做到这一点.
这意味着更新链轮不是一个好主意.每个版本的Rails声明一个特定的(最小 – 最大)版本的链轮,这是很好的理由:它是当前资产管道所依赖的版本.更新它可能会破坏事情.

然后,我们转到清单文件.
默认情况下,在编译资产(将参考文件(包括某些文件,包括其他文件链接到其中并链接到其中)后,编译后的资源将复制到RAILS_ROOT / public / assets中.使用它们,Rails生成一个清单文件,其中包含所有预编译资源的列表.在您的Rails版本中,它应该是manifest.json,但它以前是manifest.yml.

现在,最后一块谜题是capistrano,我想象你知道如何使用.

行:

cp: cannot stat ‘/var/www/testapp/releases/20150414002210/public/assets/manifest*’

意味着capistrano试图在您的RAILS_ROOT / public / assets目录中找到清单文件.通配符在那里,因为它可能是manifest.json或manifest.yml,具体取决于Rails的版本.
此外,stat意味着capistrano正在尝试从文件获取一些信息,可能是为了弄清楚最近是如何.

问题是文件不存在.
您应该precompile the assets,然后提交生成文件,并尝试重新部署.

原文链接:https://www.f2er.com/ruby/273177.html

猜你在找的Ruby相关文章