Skip to content

Commit

Permalink
Depend on Faraday 2.0 (#7)
Browse files Browse the repository at this point in the history
* Depend on Faraday 2.0

* CI: Testing with Ruby 3.2 & 3.3

* Rubocop: Layout/EmptyLineAfterMagicComment
  • Loading branch information
Shimokuni authored Jan 7, 2024
1 parent 4e6610a commit b4c91b1
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 20 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
ruby: ['2.5', '2.6', '2.7', '3.0']
ruby: ['2.6', '2.7', '3.0', '3.1', '3.2', '3.3']

steps:
- uses: actions/checkout@v2
Expand Down
5 changes: 2 additions & 3 deletions faraday-em_http.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,8 @@ Gem::Specification.new do |spec|
spec.files = Dir.glob('lib/**/*') + %w[README.md LICENSE.md]
spec.require_paths = ['lib']

# TODO: make these normal dependencies when releasing v2.0 together with Faraday v2.0
spec.add_development_dependency 'em-http-request', '>= 1.1'
spec.add_development_dependency 'faraday', '~> 1.0'
spec.add_runtime_dependency 'em-http-request', '>= 1.1'
spec.add_runtime_dependency 'faraday', '~> 2.0'

spec.add_development_dependency 'bundler', '~> 2.0'
spec.add_development_dependency 'rake', '~> 13.0'
Expand Down
30 changes: 14 additions & 16 deletions lib/faraday/adapter/em_http.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,19 @@
# frozen_string_literal: true

require 'em-http'

begin
require 'openssl'
rescue LoadError
warn 'Warning: no such file to load -- openssl. ' \
'Make sure it is installed if you want HTTPS support'
else
require 'em-http/version'
if EventMachine::HttpRequest::VERSION < '1.1.6'
require 'faraday/adapter/em_http_ssl_patch'
end
end

module Faraday
class Adapter
# EventMachine adapter. This adapter is useful for either asynchronous
Expand Down Expand Up @@ -90,22 +104,6 @@ def request_options(env)

include Options

dependency do
require 'em-http'

begin
require 'openssl'
rescue LoadError
warn 'Warning: no such file to load -- openssl. ' \
'Make sure it is installed if you want HTTPS support'
else
require 'em-http/version'
if EventMachine::HttpRequest::VERSION < '1.1.6'
require 'faraday/adapter/em_http_ssl_patch'
end
end
end

self.supports_parallel = true

# @return [Manager]
Expand Down
1 change: 1 addition & 0 deletions lib/faraday/em_http.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# frozen_string_literal: true

require 'faraday'
require_relative 'adapter/em_http'
require_relative 'em_http/version'

Expand Down

0 comments on commit b4c91b1

Please sign in to comment.