Permalink
Browse files

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.
  • Loading branch information...
1 parent 5a815fb commit c87d15880ba5984caf95a6a6264a4f85e4c86fa6 @mislav mislav committed Oct 6, 2015
Showing with 22 additions and 10 deletions.
  1. +7 −0 Gemfile
  2. +5 −0 Gemfile.faraday-0.8
  3. +10 −6 spec/monkey_patches.rb
  4. +0 −4 vcr.gemspec
View
@@ -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
View
@@ -3,3 +3,8 @@ source "https://rubygems.org"
gem "faraday", "~> 0.8.8"
gemspec
+
+platform :mri do
+ gem "typhoeus"
+ gem "patron"
+end
@@ -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)
View
@@ -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"

0 comments on commit c87d158

Please sign in to comment.