Merge pull request #208 from spodlecki/removing-httpclient
Remove httpclient due to deprecation warning for #timeout
This commit is contained in:
commit
6e551927ec
|
@ -2,7 +2,7 @@ language: ruby
|
|||
before_script:
|
||||
- cd tests/test_app
|
||||
- bundle exec rails g impressionist -f
|
||||
- bundle exec rake db:migrate
|
||||
- bundle exec rake db:create db:migrate RAILS_ENV=test
|
||||
- cd ..
|
||||
rvm:
|
||||
- 1.9.3
|
||||
|
|
|
@ -22,6 +22,9 @@ group :test do
|
|||
gem 'simplecov'
|
||||
gem 'systemu'
|
||||
gem 'friendly_id', '~> 4.0.9'
|
||||
|
||||
# test/unit has been removed by default in Ruby 2.2.x+
|
||||
gem 'test-unit'
|
||||
end
|
||||
|
||||
gemspec :path => '../'
|
||||
|
|
|
@ -22,6 +22,9 @@ group :test do
|
|||
gem 'simplecov'
|
||||
gem 'systemu'
|
||||
gem 'friendly_id', '~> 5.1.0'
|
||||
|
||||
# test/unit has been removed by default in Ruby 2.2.x+
|
||||
gem 'test-unit'
|
||||
end
|
||||
|
||||
gemspec :path => '../'
|
||||
|
|
|
@ -18,8 +18,6 @@ Gem::Specification.new do |s|
|
|||
s.require_path = 'lib'
|
||||
s.required_rubygems_version = Gem::Requirement.new('>= 1.3.6') if s.respond_to? :required_rubygems_version=
|
||||
|
||||
s.add_dependency 'httpclient', '~> 2.2'
|
||||
s.add_dependency 'nokogiri', '~> 1.6'
|
||||
|
||||
s.add_development_dependency 'bundler', '~> 1.0'
|
||||
end
|
||||
|
|
|
@ -1,11 +1,13 @@
|
|||
require 'httpclient'
|
||||
require 'timeout'
|
||||
require 'net/http'
|
||||
require 'nokogiri'
|
||||
|
||||
module Impressionist
|
||||
module Bots
|
||||
LIST_URL = "http://www.user-agents.org/allagents.xml"
|
||||
def self.consume
|
||||
response = HTTPClient.new.get_content(LIST_URL)
|
||||
Timeout.timeout(4) do
|
||||
response = Net::HTTP.get(URI.parse(LIST_URL))
|
||||
doc = Nokogiri::XML(response)
|
||||
list = []
|
||||
doc.xpath('//user-agent').each do |agent|
|
||||
|
@ -15,4 +17,5 @@ module Impressionist
|
|||
list
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -36,6 +36,9 @@ group :development, :test do
|
|||
gem 'autotest-notification'
|
||||
gem 'rspec-rails', '~> 2.14.0'
|
||||
gem 'spork'
|
||||
|
||||
# test/unit has been removed by default in Ruby 2.2.x+
|
||||
gem 'test-unit'
|
||||
end
|
||||
|
||||
group :test do
|
||||
|
|
Loading…
Reference in New Issue