chuckremes/ffi-rzmq-core — pull request #5 by chadrem (2014-03-09 02:04:44+00:00)
Title: Fix "Could not find ffi-1.9.3 in any of the sources" error

This pull request fixes the following error message when requiring ffi-rzmq (or ffi-rzmq-core):

/Users/chad/.rvm/gems/ruby-2.1.1/gems/bundler-1.3.6/lib/bundler/spec_set.rb:92:in `materialize': Could not find ffi-1.9.3 in any of the sources (Bundler::GemNotFound)
from /Users/chad/.rvm/gems/ruby-2.1.1/gems/bundler-1.3.6/lib/bundler/spec_set.rb:85:in `map!'
from /Users/chad/.rvm/gems/ruby-2.1.1/gems/bundler-1.3.6/lib/bundler/spec_set.rb:85:in `materialize'
from /Users/chad/.rvm/gems/ruby-2.1.1/gems/bundler-1.3.6/lib/bundler/definition.rb:114:in `specs'
from /Users/chad/.rvm/gems/ruby-2.1.1/gems/bundler-1.3.6/lib/bundler/definition.rb:159:in `specs_for'
from /Users/chad/.rvm/gems/ruby-2.1.1/gems/bundler-1.3.6/lib/bundler/definition.rb:148:in `requested_specs'
from /Users/chad/.rvm/gems/ruby-2.1.1/gems/bundler-1.3.6/lib/bundler/environment.rb:18:in `requested_specs'
from /Users/chad/.rvm/gems/ruby-2.1.1/gems/bundler-1.3.6/lib/bundler/runtime.rb:13:in `setup'
from /Users/chad/.rvm/gems/ruby-2.1.1/gems/bundler-1.3.6/lib/bundler.rb:119:in `setup'
from /Users/chad/.rvm/gems/ruby-2.1.1/gems/bundler-1.3.6/lib/bundler/setup.rb:17

The error is 100% reproducible for me with the following simple Gemfile and script:

Gemfile:

source 'http://rubygems.org'
gem 'ffi-rzmq', '2.0.1'

Script:

require 'rubygems'
require 'bundler/setup'
require 'ffi-rzmq'
puts "Hello World"

The error occurs in the "brew --prefix" subprocess because of the RUBYOPT environment. variable. These commits unset this variable before executing the subprocess and restores it after. The commits also capture stderr so that if it were to print other errors then they won't get displayed to the user and cause confusion.