Can the rails tmp/cache/assets files be safely deleted?
Yep! You can delete the whole tmp directory and it will get recreated.
files in /tmp/cache/ of a new rails application (258 directories, 1404 files)
Short answer: You are safe to delete the /tmp/cache/bootsnap-compile-cache.
Long answer: Bootsnap, as I'm sure you're aware, is a Ruby library that optimizes and caches expensive computations, meaning you can boot Ruby/Rails applications faster.
One of the strategies Bootsnap employs to speed up your application is known as Compilation Caching.
Ruby has to translate ruby source into internal bytecode, which the VM then executes. What Bootsnap does is cleverly cache a bunch of these translations in cache files that consist of headers and cache contents (these are the files stored under the directory in question). This is done so that when your application performs its various operations, it can simply to do a lookup on the already-translated bytecode cached by Bootsnap, instead of performing the relatively-expensive compilation step, thus making the code execute faster.
A readable implementation of this concept can be found here
As you might have guessed by now, deleting those files will simply mean your application runs a little slower locally, until the operations are subsequently cached once more.
Unfortunately, to the best of my knowledge, there is currently no automatic purging mechanism for Bootsnap's cache. The library leaves cleaning up the cache up to the user (a la assets:clean
or container pruning).
Hope that helps!
Clear the cache from the Rails asset pipeline
I'm assuming we're talking about the production environment.
When you change any of your javascripts or stylesheets in the production environment, you need to run rake assets:precompile
; this task compiles and compresses the various .js and .css files and creates the application.js and application.css files that is loaded by your views.
It's possible that if you replaced jquery.autoresize.js
with a version with an older timestamp, the precompile step might skip it, thinking the compiled version is up-to-date. You can avoid that by running rake assets:clean
first, forcing it to rebuild everything in the public/assets
directory from scratch.
Rake assets:clobber and precompile causes git merge conflicts
Compiled assets aren't something you would normally want to have in your git repository. I would just add an entry for /public/assets
to a .gitignore
file in the root directory of your application.
Since you've already committed the compiled assets, you will want to remove them from the repo:
git rm --cached -r /public/assets
Related Topics
How to Convert 270921Sec into Days + Hours + Minutes + Sec ? - Ruby
How to Handle Method Order in Ruby
In Ruby/Rails, How to Sort on a Date Value Where the Date Can Sometimes Be Null
How to Merge Consecutive Repeating Elements in an Array
Writing an Activerecord Adapter
How to Convert Ppt to Images in Ruby
Rails Server Cannot Start; Getaddrinfo: Nodename Nor Servname Provided, or Not Known (Socketerror)
How to Mark a Cucumber Scenario as Pending
How to Strip Leading and Trailing Quote from String, in Ruby
Rspec: Should Be (This or That)
How to Convert Boolean Values to Integers
Ruby Inside JavaScript Block [Slim Template]
What Is Difference Between "P" and "Pp"
Issues Installing Ruby and Rails and Devkit on Windows 7 X64 - Fix Needed