如何更新通过 git 但在 svn repo 中安装的 rails 插件?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/199044/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to update rails plugins installed through git but in a svn repo?
提问by jcoby
My rails app is in a svn repository, but several of the plugins are installed through git and later added to the svn repo. How can I update these plugins? I can't seem to get script/plugin update to do anything. I'd really like to update activemerchant to get rid of the Inflector warnings.
我的 rails 应用程序在 svn 存储库中,但其中一些插件是通过 git 安装的,后来添加到 svn 存储库中。如何更新这些插件?我似乎无法让脚本/插件更新来做任何事情。我真的很想更新 activemerchant 以摆脱 Inflector 警告。
回答by Matt
If you haven't made any local changes to the plugin and you don't need to track what changes to it the update will bring, you can just run script/plugin installagain, passing in --forceif you need to. For example:
如果您没有对插件进行任何本地更改,并且您不需要跟踪更新将带来的更改,您可以script/plugin install再次运行,--force如果需要,请传入。例如:
script/plugin install --force git://github.com/dchelimsky/rspec.git
回答by Grant Hutchins
If you already have a static copy of a plugin checked into Subversion, it can be a pain to update it via script/plugin, so here's what I end up doing in order to switch it from a static install to a Git checkout all within one Subversion commit:
如果您已经将插件的静态副本签入 Subversion,则通过 更新它可能会很痛苦script/plugin,因此我最终会这样做,以便在一次 Subversion 提交中将其从静态安装切换到 Git 检出:
git clone git://github.com/foo/bar.git ~/foobar
mv ~/foobar/.git rails_app/vendor/plugins/foobar/.git
rm -rf ~/foobar
cd rails_app/vendor/plugins
git reset --hard
Then make sure to add .gitand everything else that has changed to the Subversion project and you will be all up-to-date. You can use other git commands to pull down updates, move to a different branch, etc. Then just check things in again once they are at the state that you want.
然后确保将.git已更改的所有其他内容添加到 Subversion 项目,您将保持最新状态。您可以使用其他 git 命令来下拉更新、移动到不同的分支等。然后,一旦它们处于您想要的状态,就再次检查它们。
回答by Yves L
One thing I do in this case, I remove the plugin directory then I commit to SVN, this will remove the old plugin in the repo. (I usually moved it in a tmp directory, just in case and delate it later once the new one is working fine) I then reinstall the new version of the plugin, and commit again. Easy.
在这种情况下,我要做的一件事是删除插件目录,然后提交给 SVN,这将删除 repo 中的旧插件。(我通常将它移动到一个 tmp 目录中,以防万一,一旦新的工作正常,稍后再将其删除)然后我重新安装新版本的插件,并再次提交。简单。
回答by Greg Hewgill
In order for Git to be able to recognise the repository as a Git repository, you will need to add the .gitsubdirectory and everything under it to Subversion as well. Otherwise, the plugin will just look like another pile of source code and Git will say it's "Not a Git repository".
为了让 Git 能够将存储库识别为 Git 存储库,您还需要将.git子目录及其下的所有内容添加到 Subversion。否则,插件看起来就像另一堆源代码,Git 会说它“不是 Git 存储库”。
回答by Greg Hewgill
Ran into the same situation and used this solution: had paperclip installed as a plugin sitting in an svn repo as part of my app. Now I wanted to use the latest version instead and didnt change a bit of the paperclip plugin so I could easyly remove it from the app/svn and install it as a gem instead. done.
遇到了同样的情况并使用了这个解决方案:将回形针作为插件安装在 svn 存储库中作为我的应用程序的一部分。现在我想改用最新版本并且没有更改任何回形针插件,因此我可以轻松地从应用程序/svn 中删除它并将其安装为 gem。完毕。
回答by Greg Borenstein
You should just be able to navigate to the plugin's directory and hit:
git pull
. I'm pretty sure that script/install pluginjust checks the code out from the git repo.
您应该能够导航到插件的目录并点击:
git pull
。我很确定script/install plugin只是从 git repo 中检查代码。

