carlhuda/bundler — pull request #1641 by osheroff (2012-01-22 23:01:30+00:00)
Title: RFC: A new approach to working with gems under development

This somewhat references issue #396. Note that the code is functional (and still has a couple of development-process warts), but likely still buggy and not ready for a pull. I wanted to see if the main bundler devs had any feedback on the approach I'm taking. It adds functions to the Gemfile DSL that look like:

```
gem "mygem", :git => "...", :ref => "v1.0"
local "mygem", "~/src/mygem"
```

At my job, we have a big monolith, and a bunch of supporting gems. Our current process for working on one of our component gems is:

1. checkout the source locally
1. edit Gemfile, point the gem at a :path source
1. bundle install
1. hack hack hack
1. tag the gem
1. edit Gemfile, point the gem at the new tag
1. bundle install
1. push

I wanted to be able to get a few of these steps. To that end, the features I wanted:

* Be able to easily swap between the upstream source and my local copy of the gem, without having to edit Gemfile or re-bundle. This seems to be working in the current branch. It handles preferring local-source over either git or rubygems specs.

* Have bundler detect when my local copy is too out-of-date to use, and warn me that it's going back to the original source. This works in this branch when explicitly specifying gem versions (even for git sources), but it's not currently smart enough to know when your locally checked out copy is behind the upstream ref specified in the Gemfile.

The patch is more invasive to the current source base than I'd like, but I couldn't come up with a clean way to do this at the Bundler::Source level (see my other branches for failed attempts at that).

I'm also not sure about the syntax. I was thinking one could also do:

```
gem 'mygem', :git => '...', :ref => 'v1.0', :local => "~/src/mygem"
```

or even have a Gemfile.local with some syntax? I dunno.

Anyway, I digress. Would love any and all comments.