一些 gem(例如 mongrel 或 hpricot)具有用 C 编写的本机扩展。这意味着当您安装它们时,会下载 .c 源代码,并且 gcc< /code> 运行专门为您的系统编译它。 如果您在 ubuntu 上安装了本机 C 扩展,然后将其放入供应商文件夹中,然后尝试在 OS X(甚至可能是不同版本的 ubuntu)上运行该扩展,则很可能会导致您的 ruby 进程崩溃并导致您的应用程序崩溃下来。 如果您的所有 gem 都是纯 ruby 的,那么这不是问题,但这只是需要注意的事情。
For plugins, I'd personally recommend just sticking them in the vendor folder and add them to SVN as if you'd written the code yourself. Piston was also a great solution, but switched away from it when all the common plugins started moving to github (piston has been unreliable since then)
What this means is that if you add a new gem, the next time your co-worker updates, his rails app won't boot until he's got the neccessary gems. He can then install them in one step using sudo rake gems:install
You can take this one step further, and put your gems in the vendor directory. This is commonly known as "vendor everything." The easiest way to do this is to list all the gems you use in environment.rb as above, and then run rake gems:unpack. There are 2 problems with this approach however, so I prefer not to use it myself.
If you have 10 apps and they each vendor their gems, you end up keeping 10 copies of common gems in subversion, which makes updating all your sites a whole lot slower. This may not be an issue for you, or may be worth putting up with, it's just a personal preference.
Some gems (such as mongrel or hpricot) have native extensions written in C. What this means is that when you install them, the .c source code is downloaded, and gcc gets run to compile it specifically for your system. If you installed a native C extension on ubuntu, then put it in the vendor folder, and later on tried to run that on OS X (or even possibly a different version of ubuntu) it would most likely crash your ruby process and bring your app down. If all your gems are pure-ruby ones, then this is not a problem, but it's just something to be aware of.
I use SVN from the command line but if you were more comfortable with TortiseSVN you might want to try IDEs that have SVN nicely integrated like RadRails and NetBeans. The IDEs have very similar graphical SVN managers similar to Tortise, if you want to work on the cmd line just find a simple 10 minute SVN tutorial and you should be good to go.
I have never heard of rapid SVN and the normal SVN tool has always worked just find with me, hardly ever causing the locking folders issue.
Orion mentioned having to rebuild gems that have been vendored when sharing them between different OS's - you can use the gems:build rake task to rebuild them automatically.
#!/bin/bash
# reinstall the plugin in an svn friendly way
plugin="some_plugin"
plugin_url="http://some_server/some_plugin/trunk"
for f in site1 site2 site3
do
echo $f
cd ~/rails/$f
svn delete vendor/plugins/$plugin
rm -rf vendor/plugins/$plugin
svn -m "remove $plugin" commit
script/plugin install $plugin_url
svn add vendor/plugins/$plugin
svn -m "add $plugin" commit
done
First, figure out svn from the command line. The svn-book is on line. It's not too hard to do svn status or svn commit -m "blah". Most problems come if you use OS functions to delete or rename files. Use the svn commands for that.
Next, if rapidsvn is not working out for you, try svn-workbench. Hate to say it, but none of the linux svn GUI tools that I have seen are as good as tortoisesvn.
Plugins and svn are an issue. There is a tool called piston that aims to clear that up, though I don't use it. I check out the plugins into my vendor/plugins directory. If a new version comes out that I really want, I use my trusty update_plugin bash script to update the plugin:
#!/bin/bash
# reinstall the plugin in an svn friendly way
plugin="some_plugin"
plugin_url="http://some_server/some_plugin/trunk"
for f in site1 site2 site3
do
echo $f
cd ~/rails/$f
svn delete vendor/plugins/$plugin
rm -rf vendor/plugins/$plugin
svn -m "remove $plugin" commit
script/plugin install $plugin_url
svn add vendor/plugins/$plugin
svn -m "add $plugin" commit
done
发布评论
评论(4)
对于插件,我个人建议将它们粘贴到供应商文件夹中并将它们添加到 SVN,就像您自己编写代码一样。 Piston 也是一个很好的解决方案,但当所有常见插件开始迁移到 github 时,就放弃了它(从那时起,piston 就不再可靠)
对于 gems,希望您使用的是 Rails 2 或更高版本。 您应该使用
config.gem
在config/environment.rb
中列出所需的 gem。 这里有很多关于该功能这意味着,如果您添加新的 gem,下次您的同事更新时,他的 Rails 应用程序将不会启动,直到他获得必要的 gem。 然后,他可以使用 sudo rake gems:install 一步安装它们。
您可以更进一步,将您的 gem 放入供应商目录中。 这通常称为“供应一切”。 最简单的方法是在
environment.rb
中列出您使用的所有 gem,如上所示,然后运行 rake gems:unpack
。 然而,这种方法有两个问题,所以我自己不想使用它。如果您有 10 个应用程序,并且每个应用程序都供应自己的 gem,那么您最终会在 subversion 中保留 10 个常见 gem 的副本,这会使更新所有网站的速度变慢。
这对您来说可能不是问题,或者可能值得忍受,这只是个人喜好。
一些 gem(例如 mongrel 或 hpricot)具有用 C 编写的本机扩展。这意味着当您安装它们时,会下载
.c
源代码,并且gcc< /code> 运行专门为您的系统编译它。
如果您在 ubuntu 上安装了本机 C 扩展,然后将其放入供应商文件夹中,然后尝试在 OS X(甚至可能是不同版本的 ubuntu)上运行该扩展,则很可能会导致您的 ruby 进程崩溃并导致您的应用程序崩溃下来。
如果您的所有 gem 都是纯 ruby 的,那么这不是问题,但这只是需要注意的事情。
For plugins, I'd personally recommend just sticking them in the vendor folder and add them to SVN as if you'd written the code yourself. Piston was also a great solution, but switched away from it when all the common plugins started moving to github (piston has been unreliable since then)
For gems, hopefully you're using rails 2 or higher. You should be listing the gems you require in your
config/environment.rb
usingconfig.gem
. Here's a bunch of information about that featureWhat this means is that if you add a new gem, the next time your co-worker updates, his rails app won't boot until he's got the neccessary gems. He can then install them in one step using
sudo rake gems:install
You can take this one step further, and put your gems in the vendor directory. This is commonly known as "vendor everything." The easiest way to do this is to list all the gems you use in
environment.rb
as above, and then runrake gems:unpack
. There are 2 problems with this approach however, so I prefer not to use it myself.If you have 10 apps and they each vendor their gems, you end up keeping 10 copies of common gems in subversion, which makes updating all your sites a whole lot slower.
This may not be an issue for you, or may be worth putting up with, it's just a personal preference.
Some gems (such as mongrel or hpricot) have native extensions written in C. What this means is that when you install them, the
.c
source code is downloaded, andgcc
gets run to compile it specifically for your system.If you installed a native C extension on ubuntu, then put it in the vendor folder, and later on tried to run that on OS X (or even possibly a different version of ubuntu) it would most likely crash your ruby process and bring your app down.
If all your gems are pure-ruby ones, then this is not a problem, but it's just something to be aware of.
许多人使用活塞或沙漠来管理插件并将gems安装到Rail本地供应商文件夹(存储在SVN下)。
http://www.rubyinside.com/advent2006/12-piston.html
http:// patchallabs.com/users/brian/blog/articles/459-build-your-own-rails-plugin-platform-with-desert
我还建议使用 geminstaller,它将帮助您安装所有相同的 gems 和它们的相同版本
http://geminstaller.rubyforge.org/
我从命令行使用 SVN 但如果如果您对 TortiseSVN 更熟悉,您可能想尝试一下与 SVN 完美集成的 IDE,例如 RadRails 和 NetBeans。 这些 IDE 具有与 Tortise 非常相似的图形 SVN 管理器,如果您想在命令行上工作,只需找到一个简单的 10 分钟 SVN 教程就可以了。
我从来没有听说过快速 SVN,普通的 SVN 工具总是可以用我找到的,几乎不会导致锁定文件夹问题。
Many people use piston or desert to manage plugins and install gems into Rail local vendor folder (stored under SVN).
http://www.rubyinside.com/advent2006/12-piston.html
http://pivotallabs.com/users/brian/blog/articles/459-build-your-own-rails-plugin-platform-with-desert
I also recommend using geminstaller which will help you both install all the same gems and the same versions of them
http://geminstaller.rubyforge.org/
I use SVN from the command line but if you were more comfortable with TortiseSVN you might want to try IDEs that have SVN nicely integrated like RadRails and NetBeans. The IDEs have very similar graphical SVN managers similar to Tortise, if you want to work on the cmd line just find a simple 10 minute SVN tutorial and you should be good to go.
I have never heard of rapid SVN and the normal SVN tool has always worked just find with me, hardly ever causing the locking folders issue.
Orion 提到在不同操作系统之间共享时必须重建已供应的 gem - 您可以使用 gems:build rake 任务自动重建它们。
Orion mentioned having to rebuild gems that have been vendored when sharing them between different OS's - you can use the gems:build rake task to rebuild them automatically.
首先,从命令行找出 svn。 svn-book已上线。 执行 svn status 或 svn commit -m "blah" 并不太难。 如果您使用操作系统功能删除或重命名文件,大多数问题都会出现。 为此,请使用 svn 命令。
接下来,如果 Rapidsvn 不适合您,请尝试 svn-workbench。 不想这么说,但我见过的 linux svn GUI 工具没有一个比 tortoisesvn 更好。
插件和 svn 是一个问题。 有一个名为 piston 的工具旨在解决这个问题,尽管我不使用它。 我将插件签入我的供应商/插件目录中。 如果出现我真正想要的新版本,我会使用我值得信赖的 update_plugin bash 脚本来更新插件:
First, figure out svn from the command line. The svn-book is on line. It's not too hard to do svn status or svn commit -m "blah". Most problems come if you use OS functions to delete or rename files. Use the svn commands for that.
Next, if rapidsvn is not working out for you, try svn-workbench. Hate to say it, but none of the linux svn GUI tools that I have seen are as good as tortoisesvn.
Plugins and svn are an issue. There is a tool called piston that aims to clear that up, though I don't use it. I check out the plugins into my vendor/plugins directory. If a new version comes out that I really want, I use my trusty update_plugin bash script to update the plugin: