Rails3:更改临时(tmp)目录的位置
我通常在本地 Dropbox 文件夹中进行开发。 tmp 文件夹中的某些文件会被浏览器锁定(并使 Dropbox 保持忙碌),Growl 会引发异常等等。
因此,我正在寻找一个配置设置,将 tmp 文件夹放在 Rails-app 包之外。这可能吗?
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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
这不是您正在寻找的答案 - 但我可以明确地说,没有配置选项可以更改 Rails 认为 tmp 文件夹所在的位置。该位置被硬编码在 Rails 代码库的许多不同位置。
看起来符号链接将同步原始文件,因此您可能会遇到相同的锁定问题。
如果您这样做,那么您可以相反地使用符号链接来解决您的问题,即。在您的保管箱外部创建您的项目,并将除
tmp
之外的所有内容符号链接到您的保管箱中的文件夹中。因此,您的 Rails 应用程序可能位于
~/work/rails_project/<所有 Rails 目录,包括 tmp>
,然后您的保管箱中将有一个相应的目录,例如~/dropbox /rails_project
然后内部该目录,您将手动创建一堆符号链接,然后删除tmp
一个,使用 bash 您可以这样做:如果您向应用程序的根目录添加了新文件/目录,则需要记住再次运行该命令。
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 thetmp
one, using bash you'd do this:You'd need to remember to run that again if you ever added a new file/directory to the root of your app.
您无法更改 tmp 目录,但可以配置 tmp 缓存目录。
您可以在 configuration.rb 阅读更多信息
you can't change tmp directory, but you can configure tmp cache directory.
you can read more at configuration.rb
您可以使用选择性同步在 Dropbox 中排除某个目录的同步:http ://www.dropbox.com/help/175/en
基本上选择 Dropbox 首选项并进入“高级”。然后选择“选择性同步”并查找要从同步中排除的文件夹[如果您必须进入比第一级目录深度更深的位置,还有一个高级视图]
You can exclude a directory from being synced in Dropbox by using Selective Sync: http://www.dropbox.com/help/175/en
Basically select the Dropbox preferences and go in Advanced. Select then Selective Sync and look for the folder that you want to exclude from syncing [there is also an advanced view if you have to go in a deeper than 1st level dir depth]