jacquescrocker / jammit-s3

Extensions so you can use jammit with s3/cloudfront for your Rails app
http://documentcloud.github.com/jammit/
MIT License
125 stars 31 forks source link

Check for existence / modification-status of files before uploading. #11

Closed cameronyule closed 13 years ago

cameronyule commented 13 years ago

Hi, I've made a small modification to S3Uploader#upload_from_glob which checks if a file exists or has been modified before uploading to S3.

Thanks for the useful project :)

Cheers, Cameron

cblavier commented 13 years ago

Works fine, I second this pull request :)

jacquescrocker commented 13 years ago

cool, pulling now. i'll get a new gem released asap

miloops commented 13 years ago

I love the idea, it's pretty unusable to me without it. I've a big app and I can't be uploading everything every time I deploy.

Anyway I did try this patch and it seems to work but rarely... just in a few images, not all of them and it won't work for me on compiled css/js.

cameronyule commented 13 years ago

@miloops - That's interesting. I'm using this on a project with hundreds of assets I'm deploying to S3, including Jammit compiled CSS/JS, and haven't experienced that problem.

Are your compiled CSS/JS files definitely changing (e.g. a diff with a previous version detects changes)? The patch hashes entire files so I'm unsure why the hash wouldn't change if the contents of the file had.

miloops commented 13 years ago

OMG, tried again and images weren't uploaded ("file has not changed"), don't know what happened before, because i did try it many times. Anyway, it's working now.

Although css/js are being uploaded because they are changing, I think this is jammit's issue, since I didn't modify any css/js and they are being rebuilt.

"For speedy builds, jammit will check the modification times of your packages and source files: only the packages that have changed are rebuilt."

cameronyule commented 13 years ago

@miloops Cool, glad it's working :)