sr/mg — pull request #8 by MarkDBlackwell (2013-07-30 21:56:38+00:00)
Title: Pull request to install gems using clean Bundler environment

This pull request (under special circumstances) restores (problematic) user-gem installation to proper working order, as explained below.

Also (with this pull request), if user gem installation fails, an exception will be raised.

In certain circumstances, doing `rake gem:install` (for a user gem) somehow silently and consistently fails. This failure may be happening because of the following circumstances. (Or, so I suspect—at minimum, these are unusual features.):

1. In the user gem, a development dependency (activerecord 3.2.14) is older than the latest released version (activerecord: the latest is 4.0.0).
1. In RVM, the current Ruby version is 1.9.3, although Ruby 2.0.0 has been installed.

In these circumstances, not using a clean Bundler environment seems sufficient to cause the problem.

The observed problematic behavior of the command is that it silently forgets to install the user's gem, as follows:

```
$ cd {cloned-gem-directory}
$ bundle update activesupport
$ rvm list gemsets
rvm gemsets
ruby-1.9.3-p392 [ i686 ]
ruby-1.9.3-p392@beamtous [ i686 ]
ruby-1.9.3-p392@global [ i686 ]
=> ruby-1.9.3-p392@rails_apps_composer [ i686 ]
ruby-2.0.0-p0 [ i686 ]
ruby-2.0.0-p0@global [ i686 ]
ruby-2.0.0-p0@rails_apps_composer [ i686 ]
ruby-2.0.0-p195 [ i686 ]
ruby-2.0.0-p195@global [ i686 ]
ruby-2.0.0-p195@rails_apps_composer [ i686 ]
ruby-2.0.0-p247 [ i686 ]
ruby-2.0.0-p247@global [ i686 ]
ruby-2.0.0-p247@rails_apps_composer [ i686 ]
$ bundle exec rake gem:install
gem install dist/{user-gem-name-and-version}.gem
Successfully installed minitest-4.7.5
Building native extensions. This could take a while...
Successfully installed atomic-1.1.10
Successfully installed thread_safe-0.1.2
3 gems installed
$ gem list {user-gem-name} --all
*** LOCAL GEMS ***
```

Note that gem {user-gem-name} has mysteriously and silently failed installation!

[Gemspec](https://gist.github.com/MarkDBlackwell/6116501) and [Gemfile.lock](https://gist.github.com/MarkDBlackwell/6117023) files for the problem are available if desired. My versions:

```
$ rvm --version
rvm 1.21.15 (stable) by Wayne E. Seguin , Michal Papis [https://rvm.io/]
$ bundle exec rake --version
rake, version 10.1.0
$ bundle --version
Bundler version 1.3.5
$ cat /proc/version
Linux version 3.2.0-4-686-pae (debian-kernel@lists.debian.org) (gcc version 4.6.3 (Debian 4.6.3-14) ) #1 SMP Debian 3.2.46-1
```