“heroku运行耙资产:干净”不会清理任何东西

时间:2012-09-02 12:40:39

标签: ruby-on-rails heroku asset-pipeline

我执行

$ heroku run rake assets:clean
Running `rake assets:clean` attached to terminal... up, run.2
/usr/local/bin/ruby /app/vendor/bundle/ruby/1.9.1/bin/rake assets:clean:all RAILS_ENV=production RAILS_GROUPS=assets
rm -rf /app/public/assets

但由于我可以通过http请求访问资产,并且如果我打开 heroku控制台,我看起来可以看到这些文件,但它看起来并不起作用:

$ heroku run console
irb(main):013:0> Dir.glob "./public/assets/*"
=> ["./public/assets/img", "./public/assets/application.js.gz", "./public/assets/application.js", "./public/assets/rails.png", "./public/assets/manifest.yml", "./public/assets/application.css", "./public/assets/assets", "./public/assets/application.css.gz"]

我需要删除资产,因为它们与我的新配置产生冲突。

2 个答案:

答案 0 :(得分:22)

佣金资产:清洁功能已被替换为

rake assets:clobber

在最新版本的Rails中。

https://github.com/rails/sprockets-rails/blob/master/README.md

答案 1 :(得分:3)

我必须这样做:

heroku repo:purge_cache
等等一下。 rake assets:clobber对我来说不起作用,即使它打印出来了:

INFO -- : Removed /app/public/assets
rm -rf /app/tmp/cache/assets]

如果您运行heroku命令并获取:

 !    `repo:purge_cache` is not a heroku command.
 !    See `heroku help` for a list of available commands.

使用以下命令在heroku工具箱中安装命令:

heroku plugins:install https://github.com/heroku/heroku-repo.git

然后重新运行。