Skip to content

Commit

Permalink
Merge pull request #756 from travis-ci/ha-typhoeus-optional
Browse files Browse the repository at this point in the history
Drop Typhoeus requirement
  • Loading branch information
BanzaiMan authored Sep 21, 2020
2 parents f0355f2 + 295dd54 commit f764d8c
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
16 changes: 11 additions & 5 deletions lib/travis/cli/api_command.rb
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,17 @@ class ApiCommand < Command
c.enterprise_name = name || 'default'
end

on('--adapter ADAPTER', 'Faraday adapter to use for HTTP requests') do |c, adapter|
adapter.gsub! '-', '_'
require "faraday/adapter/#{adapter}"
require 'typhoeus/adapters/faraday' if adapter == 'typhoeus'
c.session.faraday_adapter = adapter.to_sym
on('--adapter ADAPTER', 'Faraday adapter to use for HTTP requests. If omitted, use Typhoeus if it is installed, ' \
'and Net::HTTP otherwise. See https://lostisland.github.io/faraday/adapters/ for more info') do |c, adapter|
begin
adapter.gsub! '-', '_'
require "faraday/adapter/#{adapter}"
require 'typhoeus/adapters/faraday' if adapter == 'typhoeus'
c.session.faraday_adapter = adapter.to_sym
rescue LoadError => e
warn "\`--adapter #{adapter}\` is given, but it is not installed. Run \`gem install #{adapter}\` and try again"
exit 1
end
end

def initialize(*)
Expand Down
1 change: 0 additions & 1 deletion travis.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -412,7 +412,6 @@ Gem::Specification.new do |s|
s.add_dependency "highline", "~> 2.0"
s.add_dependency "gh", "~> 0.13"
s.add_dependency "launchy", "~> 2.1", "< 2.5.0"
s.add_dependency "typhoeus", "~> 0.6", ">= 0.6.8"
s.add_dependency "json", "~> 2.3"
s.add_dependency "pusher-client", "~> 0.4"
s.add_development_dependency "rspec", "~> 2.12"
Expand Down

0 comments on commit f764d8c

Please sign in to comment.