Skip to content

Commit

Permalink
Merge pull request #27 from nbulaj/remove-proxy-docker
Browse files Browse the repository at this point in the history
Remove ProxyDocker provider, bump version
  • Loading branch information
nbulaj authored Mar 15, 2019
2 parents 4c7c023 + 903231e commit b44e33d
Show file tree
Hide file tree
Showing 10 changed files with 18 additions and 131 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ Reverse Chronological Order:

* Add your description here

## `0.10.2` (2019-03-15)

* Remove ProxyDocker provider (no longer workable)

## `0.10.1` (2019-03-07)

* Fix broken ProxyDocker provider.
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ If you need to filter proxy list, for example, by country or response time and *
with GET params, then you can just pass your filters like a simple Ruby hash to the Manager instance:

```ruby
ProxyFetcher.config.providers = :proxy_docker
ProxyFetcher.config.providers = :xroxy

manager = ProxyFetcher::Manager.new(filters: { country: 'PL', maxtime: '500' })
manager.proxies
Expand Down Expand Up @@ -199,7 +199,7 @@ proxy_fetcher >> proxies.txt # Will download proxies from the default provider,
If you need a list of proxies from some specific provider, then you need to pass it's name with `-p` option:

```bash
proxy_fetcher -p proxy_docker >> proxies.txt # Will download proxies from the default provider, validate them and write to file
proxy_fetcher -p xroxy >> proxies.txt # Will download proxies from the default provider, validate them and write to file
```

If you need a list of proxies in JSON format just pass a `--json` option to the command:
Expand Down
1 change: 0 additions & 1 deletion lib/proxy_fetcher.rb
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ module Providers
require File.dirname(__FILE__) + '/proxy_fetcher/providers/free_proxy_list_ssl'
require File.dirname(__FILE__) + '/proxy_fetcher/providers/gather_proxy'
require File.dirname(__FILE__) + '/proxy_fetcher/providers/http_tunnel'
require File.dirname(__FILE__) + '/proxy_fetcher/providers/proxy_docker'
require File.dirname(__FILE__) + '/proxy_fetcher/providers/proxy_list'
require File.dirname(__FILE__) + '/proxy_fetcher/providers/xroxy'
end
Expand Down
6 changes: 6 additions & 0 deletions lib/proxy_fetcher/configuration.rb
Original file line number Diff line number Diff line change
Expand Up @@ -124,11 +124,17 @@ def reset!
self.providers = self.class.registered_providers
end

def adapter=(value)
remove_instance_variable(:@adapter_class) if defined?(@adapter_class)
@adapter = value
end

def adapter_class
return @adapter_class if defined?(@adapter_class)

@adapter_class = ProxyFetcher::Document::Adapters.lookup(adapter)
@adapter_class.setup!
@adapter_class
end

# Setups collection of providers that will be used to fetch proxies.
Expand Down
2 changes: 1 addition & 1 deletion lib/proxy_fetcher/configuration/providers_registry.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ def providers
end

# Add custom provider to common registry.
# Requires proxy provider name ('proxy_docker' for example) and a class
# Requires proxy provider name ('xroxy' for example) and a class
# that implements the parsing logic.
#
# @param name [String, Symbol]
Expand Down
2 changes: 1 addition & 1 deletion lib/proxy_fetcher/document/adapters/abstract_adapter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ def proxy_node
def self.setup!(*args)
install_requirements!(*args)
self
rescue LoadError => error
rescue LoadError, StandardError => error
raise Exceptions::AdapterSetupError.new(name, error.message)
end
end
Expand Down
111 changes: 0 additions & 111 deletions lib/proxy_fetcher/providers/proxy_docker.rb

This file was deleted.

2 changes: 1 addition & 1 deletion lib/proxy_fetcher/version.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ module VERSION
# Minor version number
MINOR = 10
# Smallest version number
TINY = 1
TINY = 2

# Full version number
STRING = [MAJOR, MINOR, TINY].compact.join('.')
Expand Down
6 changes: 3 additions & 3 deletions spec/proxy_fetcher/configuration_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ def self.connectable?(*)

context 'custom HTML parsing adapter' do
it "fails if adapter can't be installed" do
old_config = ProxyFetcher.config.dup
old_adapter = ProxyFetcher.config.adapter.dup

class CustomAdapter < ProxyFetcher::Document::AbstractAdapter
def self.install_requirements!
Expand All @@ -70,10 +70,10 @@ def self.install_requirements!

ProxyFetcher.config.adapter = CustomAdapter

expect { ProxyFetcher::Manager.new }
expect { ProxyFetcher.config.adapter_class }
.to raise_error(ProxyFetcher::Exceptions::AdapterSetupError)

ProxyFetcher.instance_variable_set('@config', old_config)
ProxyFetcher.config.adapter = old_adapter
end
end
end
11 changes: 0 additions & 11 deletions spec/proxy_fetcher/providers/proxy_docker_spec.rb

This file was deleted.

0 comments on commit b44e33d

Please sign in to comment.