Rails3:更改temp(tmp)目录的位置 [英] Rails3: Change location of temp (tmp) directory

查看:168
本文介绍了Rails3:更改temp(tmp)目录的位置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我通常在我的本地Dropbox文件夹中开发。 tmp文件夹中的一些文件被浏览器锁定(并保持Dropbox忙),Growl抛出异常等。

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.

因此,我正在寻找一个配置设置将tmp文件夹放在Rails应用程序包之外。这是可能的吗?

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

推荐答案

不是你想要的答案 - 但我可以肯定地说,没有配置选项更改其中Rails认为tmp文件夹是。该位置在Rails代码库的许多不同位置都是硬编码的。

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.

如果你,那么你可以使用符号链接反过来解决你的问题,ie 。创建您的项目外部您的保管箱,并将除 tmp 之外的一切符号链接到保管箱中的文件夹中。

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.

所以你可能在你的Rails应用程序在〜/ work / rails_project /<所有rails dirs包括tmp> 然后你会有一个相应的dir在您的保管箱中,如〜/ dropbox / rails_project ,然后该目录中,您将手动创建一串符号链接,然后删除 tmp 一个,使用bash你可以这样做:

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.

这篇关于Rails3:更改temp(tmp)目录的位置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆