bin/proxy_fetcher in proxy_fetcher-0.6.0 vs bin/proxy_fetcher in proxy_fetcher-0.6.1
- old
+ new
@@ -1,7 +1,16 @@
#!/usr/bin/env ruby
+begin
+ require 'nokogiri'
+rescue LoadError
+ puts "Seems like you haven't installed 'nokogiri' gem that is used by ProxyFetcher for HTML parsing.\n" \
+ "Install it with the command: `gem install nokogiri` or check out it's documentation:\n" \
+ 'http://www.nokogiri.org/tutorials/installing_nokogiri.html'
+ exit(1)
+end
+
require 'optparse'
require 'proxy_fetcher'
options = {
filters: {},
@@ -35,9 +44,14 @@
options[:timeout] = value
end
opts.on('-j', '--json', '# Dump proxies to the JSON format') do
options[:json] = true
+ end
+
+ opts.on('-v', '--version', '# Shows gem version') do
+ puts ProxyFetcher.gem_version.to_s
+ exit(0)
end
end.parse!
ProxyFetcher.config.providers = options[:providers] if options[:providers]
ProxyFetcher.config.timeout = options[:timeout] if options[:timeout]