Permalink
Browse files

Add RVM known issues and workaround #32

  • Loading branch information...
1 parent 90ba1b0 commit 7aca9efe5bbdd51585dc68857f5d65b9d8b066a6 @boxofrad boxofrad committed Jan 13, 2013
Showing with 55 additions and 0 deletions.
  1. +2 −0 README.md
  2. +53 −0 RVM.md
View
@@ -13,6 +13,8 @@ install
$ gem install git-up
+RVM user? [read this](https://github.com/aanand/git-up/blob/master/RVM.md).
+
use
---
View
53 RVM.md
@@ -0,0 +1,53 @@
+Known RVM issues
+================
+
+Under RVM some users have [reported](https://github.com/aanand/git-up/issues/32) that running `git-up` works fine, but
+running `git up` results in one of many issues, the most common being:
+
+ spawn.rb:187:in `_pspawn': Invalid command name (ArgumentError)
+
+cause
+-----
+
+The underlying cause is a combination of the way RVM sets the correct
+ruby interpreter in the environment, and the way git interprets and
+executes `git up`.
+
+When you run `git [some command]` git will first look internally to see
+if it can fulfil the command, then it will attempt to "shell out" and run
+whatever `git-[some command]` executable it can find in your $PATH.
+
+When git "shells out" all of the environmental variables will be
+exposed, and it will be able to find our `git-up` executable in the $PATH.
+However because of the way RVM magically sets your ruby interpreter,
+when `git-up` is ran `ruby` still points to the non-RVM system default.
+
+workaround
+----------
+
+To fix this we need to make sure that RVM gets to do it's business
+before `git-up` is ran.
+
+RVM provides a handy way of doing this called "wrappers", so let's
+generate a wrapper for git-up like so:
+
+ rvm wrapper [ruby-version]@[gemset-name] --no-prefix git-up
+
+Next we need to make sure that git finds our wrapper first, to do this
+we can make use of the `/usr/libexec/git-core` directory that git uses
+for some of it's own commands.
+
+ sudo ln -s $HOME/.rvm/bin/git-up /usr/libexec/git-core/git-up
+
+Finally we need to modify our wrapper to prevent bundler issues when we
+are working on ruby projects, so open that file in your favourite
+editor, find this line:
+
+ exec git-up "$@"
+
+and change it to:
+
+ ruby `which git-up` "$@"
+
+This may seem strange, but it bypasses `ruby_noexec_wrapper` which
+may cause issues if you are working in a project with a Gemfile.

0 comments on commit 7aca9ef

Please sign in to comment.