Open ari opened 15 years ago
This is already handled by the fact that asset_packager checks to see if the packaged files exist, and then rebuilts if they're absent.
Can you elaborate on why you're deploying your packaged assets as part of your deployment?
What causes the previously built files to be deleted when you deploy again?
Ah, there be your problem then. Your deployment strategy, whatever it is, shouldn't be copying files over your old deployment... at the very least you should be using "rsync --delete-after" or a proper deployment framework such as Capistrano.
In that case, asset_packager would work as intended.
In you're just copying files over your old deployment, you'll end up with inconsistencies if any of your files are ever renamed or deleted.
Many people (including me) use git for deployment. A deployment branch and then deployment by "git pull". Since the original email a year ago, I've added a rake task to always delete all combined assets.
All other (not Rails) frameworks I've used had timestamp checking on application restart so these issues were automatically solved. Hence my feature request here: a simple (?) built-in safeguard to ensure we aren't serving stale assets.
Hey ari,
Git deployment is fine, I wasn't trying to disparage your choice of deployment methodologies, but the original point still stands - the reason asset_packager doesn't (shouldn't?) be handling this is that your deployed code should be consistent with your deployed revision. A.k.a. there shouldn't be files left around that weren't specifically deployed. So for example, when deploying with git, that should always be followed with a "git reset --hard HEAD".
Does that make sense?
As for Rails checking timestamps, not sure what you mean? What would it check the timestamps against, specifically? Rails does use timestamps, but that's used for cache-busting goodness on the client-side. As for checking other timestamps, as I wrote above, your deployed code should be only your deployed code, so I can't see that being a problem.
I would not want to do a hard reset since sometimes there are files which need to be modified within the deployment environment. git pull does everything which I'd want, except for dealing with cached assets.
By timestamps I mean what I set out in the first feature request at the top of this thread. Packaged assets should never have an older datestamp than any of the assets which are being combined. That introduces extra disk read accesses, but I assume your plugin is already checking for whether the packaged asset exists on every page request.
The problem:
A solution: