Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Rails3: Change location of temp (tmp) directory

I usually develop in my local Dropbox folder. Some files in the tmp-folder get locked by the browsers (and keep Dropbox busy), Growl throws exceptions and so on.

Therefore I am looking for a configuration setting to put the tmp-folder outside the Rails-app bundle. Is that possible?

like image 809
Markus Proske Avatar asked Apr 18 '11 20:04

Markus Proske


1 Answers

Not the answer you're looking for - but I can definitively say that there's no configuration option to change where Rails thinks the tmp folder is. The location is hard coded in many different places in the Rails codebase.

Looks like the symlink will sync the original file, so you'll probably have the same locking problems.

If you do, then you can just use the symlinks the other way around to solve your problem, ie. create your project outside your dropbox, and symlink everything other than tmp into a folder in your dropbox.

So you might have your Rails app in ~/work/rails_project/<all the rails dirs including tmp> and then you'll have a corresponding dir in your dropbox, like ~/dropbox/rails_project and then inside that dir you'll manually create a bunch of symlinks and then delete the tmp one, using bash you'd do this:

$ for f in ~/work/rails_project/*; do ln -s $f; done
$ rm tmp

You'd need to remember to run that again if you ever added a new file/directory to the root of your app.

like image 187
smathy Avatar answered Oct 13 '22 09:10

smathy