Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade to faraday 2 #50

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open

Conversation

djberg96
Copy link

@djberg96 djberg96 commented Mar 5, 2024

Using https://github.com/lostisland/faraday/blob/main/UPGRADING.md as a guide, update this gem to use faraday 2.x.

# rack 2.x requires ruby 2.2.x
if RUBY_VERSION < '2.2'
gem 'rack', '~> 1.6.0', group: :test
end
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The minimum was already set to 2.6, this is pointless, removed.

lib = File.expand_path('../lib', __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require 'cover_my_meds/version'
require_relative 'lib/cover_my_meds/version'
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Quit messing with $LOAD_PATH.

spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
spec.bindir = "exe"
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
spec.require_paths = ["lib"]
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are no executables, and lib is already the default require path. No idea why the default name was even changed.

spec.add_development_dependency "webmock", "~> 2.0"
spec.add_development_dependency "rspec"
spec.add_development_dependency "rspec-junklet"
spec.add_development_dependency "webmock"
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we can forego versioning on dev dependencies unless we're really locked into a version.

spec.add_runtime_dependency "faraday", "~> 2.9.0"
spec.add_runtime_dependency "faraday-follow_redirects", "~> 0.3.0"
spec.add_runtime_dependency "faraday-multipart", "~> 1.0.4"
spec.add_runtime_dependency "faraday-typhoeus", "~> 1.1.0"
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The extra faraday-xxx dependencies here were required because of the updated faraday gem, i.e. multipart and redirect are no longer baked into it, but require separate gems.

require 'typhoeus/adapters/faraday'
require 'faraday/typhoeus'
require 'faraday/multipart'
require 'faraday/follow_redirects'
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See above.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant