“heroku run rake assets:clean” doesn't clean a

2020-06-03 04:14发布

问题:

I execute

$ 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

But it doesn't look like it is working due I can access to the assets by http request and also if I open a heroku console I can see the files:

$ 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"]

I need to remove the assets because they are producing conflicts with my new configuration.

回答1:

The rake assets:clean functionality has been replaced with

rake assets:clobber

in the latest version of Rails.

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



回答2:

I had to do:

heroku repo:purge_cache

and wait a bit. rake assets:clobber did not work for me, even though it printed:

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

if you run the heroku command and get:

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

install the command in your heroku toolbelt with:

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

and rerun.