proxy_fetcher 0.6.0 → 0.6.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 6a8a3fe3140e235a3b46ecdb64322c77c8ce69d4
4
- data.tar.gz: 9ace00e654e55832242e050ee42d01642b26338c
3
+ metadata.gz: db8683f8d34f01ebb03c71753999649cdcbeba61
4
+ data.tar.gz: 480d289e2fe9bb038b04f080d005492fdfee7f7a
5
5
  SHA512:
6
- metadata.gz: 961dd103ae502f947a7417b248ba7cbfe8e5907880bbe2b2b123b568de6f703f39ba6a2da281dbb139a62703d9f2a26f4bb02be6128df6b09457542aa7235ba3
7
- data.tar.gz: d80b53cdfb9f67c76edf4176ab6bd3daa8151d814f67e82405b53495ecab4be0d963232e010efe333a5ef1dfd177251367b9d620d9cc78306fccfc2ef137b837
6
+ metadata.gz: 29129bcd201af8e5f8cf003331b5abeda3a590cf6a4d2cc91c95fa23622f513d66d5867bfcb6a5278f6dd706041c95b0d07d71e6173c8dd10c82fab7955fd550
7
+ data.tar.gz: e84e36c60f0a22018677c1896dffa51b45b76f9518e7edc8b62d3aeb4908525cfae12d3a8b60c9d547e7ef8217f75ed27fd8ac9d5ae149f5ef2b4b3d82346a51
data/CHANGELOG.md CHANGED
@@ -2,6 +2,17 @@
2
2
 
3
3
  Reverse Chronological Order:
4
4
 
5
+ ## `0.6.1` (2017-12-11)
6
+
7
+ * Fix gem executable to check dependencies for adapters
8
+ * Code clean
9
+ * Some new specs
10
+
11
+ ## `0.6.0` (2017-12-08)
12
+
13
+ * Make HTML parser configurable (Nokogiri, Oga, custom one)
14
+ * Documentation
15
+
5
16
  ## `0.5.1` (2017-11-13)
6
17
 
7
18
  * Fix ProxyFetcher CLI
data/bin/proxy_fetcher CHANGED
@@ -1,5 +1,14 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
+ begin
4
+ require 'nokogiri'
5
+ rescue LoadError
6
+ puts "Seems like you haven't installed 'nokogiri' gem that is used by ProxyFetcher for HTML parsing.\n" \
7
+ "Install it with the command: `gem install nokogiri` or check out it's documentation:\n" \
8
+ 'http://www.nokogiri.org/tutorials/installing_nokogiri.html'
9
+ exit(1)
10
+ end
11
+
3
12
  require 'optparse'
4
13
  require 'proxy_fetcher'
5
14
 
@@ -38,6 +47,11 @@ OptionParser.new do |opts|
38
47
  opts.on('-j', '--json', '# Dump proxies to the JSON format') do
39
48
  options[:json] = true
40
49
  end
50
+
51
+ opts.on('-v', '--version', '# Shows gem version') do
52
+ puts ProxyFetcher.gem_version.to_s
53
+ exit(0)
54
+ end
41
55
  end.parse!
42
56
 
43
57
  ProxyFetcher.config.providers = options[:providers] if options[:providers]
data/lib/proxy_fetcher.rb CHANGED
@@ -1,6 +1,8 @@
1
1
  require 'uri'
2
2
  require 'net/https'
3
3
 
4
+ require File.dirname(__FILE__) + '/proxy_fetcher/version'
5
+
4
6
  require File.dirname(__FILE__) + '/proxy_fetcher/exceptions'
5
7
  require File.dirname(__FILE__) + '/proxy_fetcher/configuration'
6
8
  require File.dirname(__FILE__) + '/proxy_fetcher/configuration/providers_registry'
@@ -10,14 +10,6 @@ module ProxyFetcher
10
10
  end
11
11
 
12
12
  class Node < ProxyFetcher::Document::Node
13
- def at_xpath(*args)
14
- self.class.new(node.at_xpath(*args))
15
- end
16
-
17
- def at_css(*args)
18
- self.class.new(node.at_css(*args))
19
- end
20
-
21
13
  def attr(*args)
22
14
  clear(node.attr(*args))
23
15
  end
@@ -10,14 +10,6 @@ module ProxyFetcher
10
10
  end
11
11
 
12
12
  class Node < ProxyFetcher::Document::Node
13
- def at_xpath(*args)
14
- self.class.new(node.at_xpath(*args))
15
- end
16
-
17
- def at_css(*args)
18
- self.class.new(node.at_css(*args))
19
- end
20
-
21
13
  def attr(*args)
22
14
  clear(node.attribute(*args).value)
23
15
  end
@@ -11,16 +11,24 @@ module ProxyFetcher
11
11
  self.class.new(node.public_send(method, selector))
12
12
  end
13
13
 
14
+ def at_xpath(*args)
15
+ self.class.new(node.at_xpath(*args))
16
+ end
17
+
18
+ def at_css(*args)
19
+ self.class.new(node.at_css(*args))
20
+ end
21
+
14
22
  def content_at(*args)
15
23
  clear(find(*args).content)
16
24
  end
17
25
 
18
26
  def content
19
- raise "#{__method__} must be implemented in descendant class!"
27
+ raise "`#{__method__}` must be implemented for specific adapter class!"
20
28
  end
21
29
 
22
30
  def html
23
- raise "#{__method__} must be implemented in descendant class!"
31
+ raise "`#{__method__}` must be implemented for specific adapter class!"
24
32
  end
25
33
 
26
34
  protected
@@ -9,7 +9,7 @@ module ProxyFetcher
9
9
  # Minor version number
10
10
  MINOR = 6
11
11
  # Smallest version number
12
- TINY = 0
12
+ TINY = 1
13
13
 
14
14
  # Full version number
15
15
  STRING = [MAJOR, MINOR, TINY].compact.join('.')
@@ -5,7 +5,7 @@ require 'proxy_fetcher/version'
5
5
  Gem::Specification.new do |gem|
6
6
  gem.name = 'proxy_fetcher'
7
7
  gem.version = ProxyFetcher.gem_version
8
- gem.date = '2017-12-08'
8
+ gem.date = '2017-12-11'
9
9
  gem.summary = 'Ruby gem for dealing with proxy lists from different providers'
10
10
  gem.description = 'This gem can help your Ruby application to make HTTP(S) requests ' \
11
11
  'using proxies by fetching and validating proxy lists from the different providers.'
@@ -0,0 +1,15 @@
1
+ require 'spec_helper'
2
+
3
+ describe ProxyFetcher::Document::Node do
4
+ context 'overridable methods' do
5
+ it 'raises an error' do
6
+ node = ProxyFetcher::Document::Node.new('')
7
+
8
+ %w[content html].each do |method|
9
+ expect { node.public_send(method) }.to raise_error do |error|
10
+ expect(error.message).to include("`#{method}` must be implemented")
11
+ end
12
+ end
13
+ end
14
+ end
15
+ end
data/spec/spec_helper.rb CHANGED
@@ -1,5 +1,6 @@
1
1
  require 'simplecov'
2
2
  SimpleCov.add_filter 'spec'
3
+ SimpleCov.add_filter 'version'
3
4
 
4
5
  if ENV['CI'] || ENV['TRAVIS'] || ENV['COVERALLS'] || ENV['JENKINS_URL']
5
6
  require 'coveralls'
@@ -15,7 +16,7 @@ require 'proxy_fetcher'
15
16
 
16
17
  Dir['./spec/support/**/*.rb'].sort.each { |f| require f }
17
18
 
18
- adapter = ENV['BUNDLE_GEMFILE'][/.+\/(.+)\.gemfile/i, 1]
19
+ adapter = ENV['BUNDLE_GEMFILE'][/.+\/(.+)\.gemfile/i, 1] || :nokogiri
19
20
  puts "Configured adapter: '#{adapter}'"
20
21
 
21
22
  ProxyFetcher.configure do |config|
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: proxy_fetcher
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.0
4
+ version: 0.6.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nikita Bulai
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-12-08 00:00:00.000000000 Z
11
+ date: 2017-12-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec
@@ -74,6 +74,7 @@ files:
74
74
  - spec/proxy_fetcher/client_spec.rb
75
75
  - spec/proxy_fetcher/configuration_spec.rb
76
76
  - spec/proxy_fetcher/document/adapters_spec.rb
77
+ - spec/proxy_fetcher/document/node_spec.rb
77
78
  - spec/proxy_fetcher/providers/base_spec.rb
78
79
  - spec/proxy_fetcher/providers/free_proxy_list_spec.rb
79
80
  - spec/proxy_fetcher/providers/free_proxy_list_ssl_spec.rb
@@ -106,7 +107,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
106
107
  version: '0'
107
108
  requirements: []
108
109
  rubyforge_project:
109
- rubygems_version: 2.6.11
110
+ rubygems_version: 2.5.1
110
111
  signing_key:
111
112
  specification_version: 4
112
113
  summary: Ruby gem for dealing with proxy lists from different providers