-
Notifications
You must be signed in to change notification settings - Fork 792
Description
Continuing one thread of a discussion started on my weblog. I'll start with a description of the problem (as I see it), and an outline of a possible approach...
rbenv is optimized for enforcing a precisely specified Ruby revision for each application on your system, ensuring your apps have the same environment in development and production
The current *-dev recipies don't do that, instead they build whatever the latest is on the specified branch. Run the same command at a different time, and you could very well get a different revision.
Builds of Ruby from the trunk (or another branch) are identified by their svn revision number. The latest revision can be found by going to the svn repository.
Builds will generally identify the date, branch, and revision number, for example:
$ ruby -v
ruby 2.1.0dev (2013-03-22 trunk 39876) [x86_64-darwin12.3.0]
Having a separate recipe for each revision is clearly impractical. Instead, ruby-build should accept a -r or --revision= argument which provides this information. Perhaps latest would be a reasonable default, or perhaps this argument should be required when dealing with recipes that build from git. Either way, the resulting version shouldn't be named with a generic name, such as 2.1.0-dev, but instead with a specific revision like 2.1.0-r39876.
The only thing that ruby-build needs to do to make this happen is to checkout the corresponding git commit, and to name the output directory differently. Once built, rbenv doesn't care how the version was created, and will happily use revisions named 2.1.0-r39876 and the like.
Unfortunately, checking out the corresponding commit would require a non-shallow git clone, and would be made easier if git-svn were a prereq. git-svn appears to already be installed on my Mac OS X machine without my knowingly requesting it, and is readily available on Linux.
An optimization that can be pursued separately: if the user opts to keep the git clone around, subsequent rbenv-build calls could issue git pull requests to fetch only the updates since the previous build. I do this today with rvm. One thing I chose to do is to copy that directory before running the build ensuring that I have a pristine copy for my next build.
Some numbers for discussion. I'll indicate what OS I obtained each on, but it shouldn't matter:
rbenv/sources/2.1.0-devis 180Meg on OS X. If was cloned with --depth=1, and built.rvm/src/ruby-headis 55Meg on Ubuntu. It is a full clone, pristine.rvm/src/ruby-head-n39875is 235Meg on Ubuntu. It is a copy of a full clone, and built.
Hopefully that should be enough to start a discussion. :-)