How to use edge/nightlies with Bundler?

194 views
Skip to first unread message

John Labovitz

unread,
Aug 10, 2011, 7:00:21 PM8/10/11
to nokogi...@googlegroups.com
I know this has come up a few times, but I'm still at a loss of how to handle this.

There is a recently-fixed bug in Nokogiri's master branch on GitHub. I have code in a Rails app that will benefit from this fix. I'm using Bundler, and have Nokogiri listed in the normal way (gem "nokogiri"). In order to get the latest version, I've tried to reference the GitHub master according to the docs at http://gembundler.com/gemfile.html, like so (leaving out the :branch specifier):

gem "nokogiri", :git => "git://github.com/tenderlove/nokogiri.git"

This doesn't work, as there's no .gemspec (yes, I understand this is intentional), so dependencies fail. So then I try this:

gem "nokogiri", '1.5', :git => "git://github.com/tenderlove/nokogiri.git"

That works better, but because there's no .gemspec, it doesn't build the C extensions, and so Nokogiri never loads entirely.

I've seen a few references to some Nokogiri nighties, apparently hosted at http://tenderlovemaking.com, by adding a gem source to the Gemfile:

source 'http://tenderlovemaking.com'
...
gem 'nokogiri', '>= 1.5.1'

But this is the result:

$ bundle update nokogiri
Fetching source index for http://rubygems.org/
Fetching source index for http://tenderlovemaking.com/
Could not reach rubygems repository http://rubygems.org/, http://tenderlovemaking.com/
Could not find gem 'nokogiri (>= 1.5.1)' in any of the gem sources listed in your Gemfile.

Thinking I could get to the nightly in the non-Bundler way, I see this:

$ gem sources -a http://tenderlovemaking.com
Error fetching http://tenderlovemaking.com:
bad response Not Found 404 (http://tenderlovemaking.com/specs.4.8.gz)

So... now what? Are there nighties at all? Should I avoid this all by simply making my own .gem and checking that into my project? Or should I wait for a 1.5.1 release, and if so, how long might that wait be?

--John

Tim Elliott

unread,
Aug 10, 2011, 7:29:31 PM8/10/11
to nokogi...@googlegroups.com
On Wed, Aug 10, 2011 at 4:00 PM, John Labovitz <jo...@johnlabovitz.com> wrote:
>        gem "nokogiri", :git => "git://github.com/tenderlove/nokogiri.git"
>
> This doesn't work, as there's no .gemspec (yes, I understand this is intentional), so dependencies fail.  So then I try this:

You can create your own fork and drop the generated gemspec in there.
I tried this in my github nokogiri fork and it seems to work:

$ cat Gemfile
gem "nokogiri", :git => "git://github.com/ender672/nokogiri.git",
:branch => "with_gemspec"

$ bundle update
Updating git://github.com/ender672/nokogiri.git
Using nokogiri (1.5.0) from git://github.com/ender672/nokogiri.git
(at with_gemspec) with native extensions
Using bundler (1.0.17)
Your bundle is updated! Use `bundle show [gemname]` to see where a
bundled gem is installed.

I had to drop two CSS parser files into the repository as well.

Please fork my repository rather than referencing mine.

Hope this helps,
Tim

Reply all
Reply to author
Forward
0 new messages