From c87d15880ba5984caf95a6a6264a4f85e4c86fa6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mislav=20Marohni=C4=87?= Date: Wed, 7 Oct 2015 00:07:44 +0200 Subject: [PATCH] Avoid installing HTTP libraries with native extensions for non-MRI In JRuby they don't work, and in Rubinius they have some problems as well so we already skip testing a bunch of them in code. --- Gemfile | 7 +++++++ Gemfile.faraday-0.8 | 5 +++++ spec/monkey_patches.rb | 16 ++++++++++------ vcr.gemspec | 4 ---- 4 files changed, 22 insertions(+), 10 deletions(-) diff --git a/Gemfile b/Gemfile index 1abdef2b..393b6951 100644 --- a/Gemfile +++ b/Gemfile @@ -5,3 +5,10 @@ gem "faraday", ">= 0.9.2" gemspec gem 'jruby-openssl', :platforms => :jruby + +platform :mri do + gem "typhoeus" + gem "patron" + gem "em-http-request" + gem "curb" +end diff --git a/Gemfile.faraday-0.8 b/Gemfile.faraday-0.8 index b394047b..25fb5b8f 100644 --- a/Gemfile.faraday-0.8 +++ b/Gemfile.faraday-0.8 @@ -3,3 +3,8 @@ source "https://rubygems.org" gem "faraday", "~> 0.8.8" gemspec + +platform :mri do + gem "typhoeus" + gem "patron" +end diff --git a/spec/monkey_patches.rb b/spec/monkey_patches.rb index f6cfaf9c..7c8248ab 100644 --- a/spec/monkey_patches.rb +++ b/spec/monkey_patches.rb @@ -1,5 +1,3 @@ -require 'typhoeus' - module MonkeyPatches extend self @@ -134,10 +132,16 @@ def realias_net_http(alias_extension) # for WebMock to work with them. require 'httpclient' -unless RUBY_INTERPRETER == :jruby - require 'patron' - require 'em-http-request' - require 'curb' +if RUBY_INTERPRETER == :mri + require 'typhoeus' + begin + require 'patron' + require 'em-http-request' + require 'curb' + rescue LoadError + # these are not always available, depending on the Gemfile used + warn $!.message + end end if defined?(::Typhoeus.before) diff --git a/vcr.gemspec b/vcr.gemspec index 871f45df..6e0f8706 100644 --- a/vcr.gemspec +++ b/vcr.gemspec @@ -39,10 +39,6 @@ Gem::Specification.new do |spec| spec.add_development_dependency "timecop" spec.add_development_dependency "multi_json" spec.add_development_dependency "json" - spec.add_development_dependency "typhoeus" - spec.add_development_dependency "patron" - spec.add_development_dependency "em-http-request" - spec.add_development_dependency "curb" spec.add_development_dependency "yajl-ruby" spec.add_development_dependency "relish" spec.add_development_dependency "mime-types"