summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPirate Praveen <praveen@debian.org>2020-02-06 12:15:56 +0100
committerPirate Praveen <praveen@debian.org>2020-02-06 12:15:56 +0100
commit6c30664556b498f5fcdbcc00512de6dcee75ef0c (patch)
tree127f540959862c2da716ee4db8784f35075831d5
parent7fc8039f1eda5c53988c09ab7740df9b4fb6483f (diff)
parentb800e4f1bd7311e80c3777d746331ae4315c95a3 (diff)
Update upstream source from tag 'upstream/1.4.0_git.20191003.0c66e4e'
Update to upstream version '1.4.0~git.20191003.0c66e4e' with Debian dir 64bd96ce0d4b2f34882e917be6856a6589f252bf
-rw-r--r--.travis.yml18
-rw-r--r--CHANGELOG.md14
-rw-r--r--CONTRIBUTING.md4
-rw-r--r--README.md2
-rw-r--r--lib/typhoeus.rb7
-rw-r--r--lib/typhoeus/adapters/faraday.rb4
-rw-r--r--lib/typhoeus/cache/dalli.rb4
-rw-r--r--lib/typhoeus/cache/rails.rb6
-rw-r--r--lib/typhoeus/cache/redis.rb4
-rw-r--r--lib/typhoeus/config.rb2
-rw-r--r--lib/typhoeus/easy_factory.rb2
-rw-r--r--lib/typhoeus/version.rb2
-rw-r--r--spec/typhoeus/adapters/faraday_spec.rb2
-rw-r--r--spec/typhoeus/pool_spec.rb6
14 files changed, 53 insertions, 24 deletions
diff --git a/.travis.yml b/.travis.yml
index 8121e3c..dc0c9df 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -1,15 +1,14 @@
language: ruby
script: "bundle exec rake"
-sudo: false
rvm:
- - 1.8.7
- - 1.9.2
- 1.9.3
- 2.0.0
- - 2.1.8
- - 2.2.4
- - 2.3.0
- - 2.4.1
+ - 2.1.10
+ - 2.2.10
+ - 2.3.8
+ - 2.4.7
+ - 2.5.6
+ - 2.6.4
- ruby-head
- jruby-head
- jruby-18mode
@@ -20,3 +19,8 @@ matrix:
- rvm: ruby-head
- rvm: jruby-head
- rvm: ree
+ include:
+ - rvm: 1.8.7
+ dist: precise
+ - rvm: 1.9.2
+ dist: trusty
diff --git a/CHANGELOG.md b/CHANGELOG.md
index cff597b..223e4bc 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -2,7 +2,19 @@
## Master
-[Full Changelog](http://github.com/typhoeus/typhoeus/compare/v1.1.2...master)
+[Full Changelog](http://github.com/typhoeus/typhoeus/compare/v1.4.0...master)
+
+## 1.4.0
+
+[Full Changelog](http://github.com/typhoeus/typhoeus/compare/v1.1.2...v1.4.0)
+
+#### 1 feature
+- Faraday adapter exceptions namespace compatibility with Faraday v1 ([@iMacTia](https://github.com/iMacTia) in [#616](https://github.com/typhoeus/typhoeus/pull/616))
+
+#### 3 Others
+- Yard warning fixes ([@olleolleolle](https://github.com/olleolleolle) in [#622](https://github.com/typhoeus/typhoeus/pull/622))
+- Add more Ruby versions in CI matrix ([@olleolleolle](https://github.com/olleolleolle) in [#623](https://github.com/typhoeus/typhoeus/pull/623))
+- Use of argument passed in function instead of `attr_reader` ([@v-kolesnikov](https://github.com/v-kolesnikov) in [#625](https://github.com/typhoeus/typhoeus/pull/625))
## 1.1.2
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index 6cdf58c..667e8a3 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -14,3 +14,7 @@ a test!
5. Push to your fork and submit a pull request.
And in case we didn't emphasize it enough: we love tests!
+
+## Issue triage [![Open Source Helpers](https://www.codetriage.com/typhoeus/typhoeus/badges/users.svg)](https://www.codetriage.com/typhoeus/typhoeus)
+
+You can contribute by triaging issues which may include reproducing bug reports or asking for vital information, such as version numbers or reproduction instructions. If you would like to start triaging issues, one easy way to get started is to [subscribe to typhoeus on CodeTriage](https://www.codetriage.com/typhoeus/typhoeus).
diff --git a/README.md b/README.md
index 90aed36..f1b4c7a 100644
--- a/README.md
+++ b/README.md
@@ -1,4 +1,4 @@
-# Typhoeus [![Build Status](https://img.shields.io/travis/typhoeus/typhoeus/master.svg)](https://travis-ci.org/typhoeus/typhoeus) [![Code Climate](https://img.shields.io/codeclimate/github/typhoeus/typhoeus.svg)](https://codeclimate.com/github/typhoeus/typhoeus) [![Gem Version](https://img.shields.io/gem/v/typhoeus.svg)](https://rubygems.org/gems/typhoeus)
+# Typhoeus [![Build Status](https://img.shields.io/travis/typhoeus/typhoeus/master.svg)](https://travis-ci.org/typhoeus/typhoeus) [![Code Climate](https://img.shields.io/codeclimate/maintainability/typhoeus/typhoeus.svg)](https://codeclimate.com/github/typhoeus/typhoeus) [![Gem Version](https://img.shields.io/gem/v/typhoeus.svg)](https://rubygems.org/gems/typhoeus)
Like a modern code version of the mythical beast with 100 serpent heads, Typhoeus runs HTTP requests in parallel while cleanly encapsulating handling logic.
diff --git a/lib/typhoeus.rb b/lib/typhoeus.rb
index da43521..1e2226a 100644
--- a/lib/typhoeus.rb
+++ b/lib/typhoeus.rb
@@ -127,11 +127,12 @@ module Typhoeus
# #=> :ok
# end
#
- # @param [ Block ] block The block to execute.
- #
+ # @yield Yields control to the block after disabling block_connection.
+ # Afterwards, the block_connection is set to its original
+ # value.
# @return [ Object ] Returns the return value of the block.
#
- # @see Typhoeus::Config#block_connection
+ # @see Typhoeus::Config.block_connection
def self.with_connection
old = Config.block_connection
Config.block_connection = false
diff --git a/lib/typhoeus/adapters/faraday.rb b/lib/typhoeus/adapters/faraday.rb
index b017118..8452010 100644
--- a/lib/typhoeus/adapters/faraday.rb
+++ b/lib/typhoeus/adapters/faraday.rb
@@ -97,13 +97,13 @@ module Faraday # :nodoc:
if resp.timed_out?
env[:typhoeus_timed_out] = true
unless parallel?(env)
- raise Faraday::Error::TimeoutError, "request timed out"
+ raise Faraday::TimeoutError, "request timed out"
end
elsif (resp.response_code == 0) || ((resp.return_code != :ok) && !resp.mock?)
env[:typhoeus_connection_failed] = true
env[:typhoeus_return_message] = resp.return_message
unless parallel?(env)
- raise Faraday::Error::ConnectionFailed, resp.return_message
+ raise Faraday::ConnectionFailed, resp.return_message
end
end
diff --git a/lib/typhoeus/cache/dalli.rb b/lib/typhoeus/cache/dalli.rb
index 54add28..5a09b10 100644
--- a/lib/typhoeus/cache/dalli.rb
+++ b/lib/typhoeus/cache/dalli.rb
@@ -7,7 +7,9 @@ module Typhoeus
#
# @param [ Dalli::Client ] client
# A connection to the cache server. Defaults to `Dalli::Client.new`
- # @param [ Integer ] default_ttl
+ # @param [ Hash ] options
+ # Options
+ # @option options [ Integer ] :default_ttl
# The default TTL of cached responses in seconds, for requests which do not set a cache_ttl.
def initialize(client = ::Dalli::Client.new, options = {})
@client = client
diff --git a/lib/typhoeus/cache/rails.rb b/lib/typhoeus/cache/rails.rb
index fb6af64..10835e7 100644
--- a/lib/typhoeus/cache/rails.rb
+++ b/lib/typhoeus/cache/rails.rb
@@ -7,7 +7,9 @@ module Typhoeus
#
# @param [ ActiveSupport::Cache::Store ] cache
# A Rails cache backend. Defaults to Rails.cache.
- # @param [ Integer ] default_ttl
+ # @param [ Hash ] options
+ # Options
+ # @option options [ Integer ] :default_ttl
# The default TTL of cached responses in seconds, for requests which do not set a cache_ttl.
def initialize(cache = ::Rails.cache, options = {})
@cache = cache
@@ -19,7 +21,7 @@ module Typhoeus
end
def set(request, response)
- @cache.write(request, response, :expires_in => request.cache_ttl || @default_ttl)
+ @cache.write(request.cache_key, response, :expires_in => request.cache_ttl || @default_ttl)
end
end
end
diff --git a/lib/typhoeus/cache/redis.rb b/lib/typhoeus/cache/redis.rb
index fd222e7..e54ca4e 100644
--- a/lib/typhoeus/cache/redis.rb
+++ b/lib/typhoeus/cache/redis.rb
@@ -8,7 +8,9 @@ module Typhoeus
# @param [ Redis ] redis
# A connection to Redis. Defaults to `Redis.new`, which uses the
# `REDIS_URL` environment variable to connect
- # @param [ Integer ] default_ttl
+ # @param [ Hash ] options
+ # Options
+ # @option options [ Integer ] :default_ttl
# The default TTL of cached responses in seconds, for requests which do not set a cache_ttl.
def initialize(redis = ::Redis.new, options = {})
@redis = redis
diff --git a/lib/typhoeus/config.rb b/lib/typhoeus/config.rb
index 32beff2..f05491c 100644
--- a/lib/typhoeus/config.rb
+++ b/lib/typhoeus/config.rb
@@ -18,7 +18,7 @@ module Typhoeus
# {Typhoeus::Errors::NoStub} error is raised,
# when trying to do a real request. It's possible
# to work around inside
- # {Typhoeus#with_connection}.
+ # {Typhoeus.with_connection}.
#
# @return [ Boolean ]
#
diff --git a/lib/typhoeus/easy_factory.rb b/lib/typhoeus/easy_factory.rb
index 45b06f1..84c7131 100644
--- a/lib/typhoeus/easy_factory.rb
+++ b/lib/typhoeus/easy_factory.rb
@@ -97,7 +97,7 @@ module Typhoeus
# set nosignal to true by default
# this improves thread safety and timeout behavior
sanitized = {:nosignal => true}
- request.options.each do |k,v|
+ options.each do |k,v|
s = k.to_sym
next if SANITIZE_IGNORE.include?(s)
if new_option = RENAMED_OPTIONS[k.to_sym]
diff --git a/lib/typhoeus/version.rb b/lib/typhoeus/version.rb
index c67d0f8..048f091 100644
--- a/lib/typhoeus/version.rb
+++ b/lib/typhoeus/version.rb
@@ -1,5 +1,5 @@
module Typhoeus
# The current Typhoeus version.
- VERSION = '1.3.1'
+ VERSION = '1.4.0'
end
diff --git a/spec/typhoeus/adapters/faraday_spec.rb b/spec/typhoeus/adapters/faraday_spec.rb
index 29de6dd..716fb76 100644
--- a/spec/typhoeus/adapters/faraday_spec.rb
+++ b/spec/typhoeus/adapters/faraday_spec.rb
@@ -163,7 +163,7 @@ if Gem::Version.new(RUBY_VERSION) >= Gem::Version.new("1.9.0")
context "when not parallel" do
it "raises an error" do
- expect { conn.get("/") }.to raise_error(Faraday::Error::ConnectionFailed, "No error")
+ expect { conn.get("/") }.to raise_error(Faraday::ConnectionFailed, "No error")
end
end
end
diff --git a/spec/typhoeus/pool_spec.rb b/spec/typhoeus/pool_spec.rb
index 596d996..b04f433 100644
--- a/spec/typhoeus/pool_spec.rb
+++ b/spec/typhoeus/pool_spec.rb
@@ -88,12 +88,14 @@ describe Typhoeus::Pool do
context "when threaded access" do
it "creates correct number of easies" do
- array = []
+ queue = Queue.new
(0..9).map do |n|
Thread.new do
- array << Typhoeus::Pool.get
+ queue.enq(Typhoeus::Pool.get)
end
end.map(&:join)
+
+ array = Array.new(queue.size) { queue.pop }
expect(array.uniq.size).to eq(10)
end
end