views:

4045

answers:

6

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.

A: 

You should just be able to navigate to the plugin's directory and hit: git pull . I'm pretty sure that script/install plugin just checks the code out from the git repo.

Greg Borenstein
doesn't work - I get: fatal: Not a git repository
jcoby
well, what do you mean they were "installed through git". If they're not git repos then what do you mean by that?
Greg Borenstein
they were installed from a git repo, but are housed in my app's svn repo. if that makes sense. see http://www.activemerchant.org/ and look at the plugiin/install instructions.
jcoby
+1  A: 

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 install again, passing in --force if you need to. For example:

script/plugin install --force git://github.com/dchelimsky/rspec.git
Matt
that sort of works, but it puts the directory in an unknown state in terms of svn since it actually just deletes the vendor/plugin/active_merchant dir and reinstalls it.
jcoby
A: 

In order for Git to be able to recognise the repository as a Git repository, you will need to add the .git subdirectory 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".

Greg Hewgill
A: 

Anyone have a definite solution to this or could someone please explain more about the .git subdirectory requirement?

I have the Paperclip plugin for Rails and I'd like to update it without screwing up my working copy, which happens when I run "script/plugin install --force".

MediaJunkie
A: 

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.

Chris
+1  A: 

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:

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 .git and 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.

nertzy