proxy_rb 0.3.0 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +4 -3
- data/Gemfile +1 -0
- data/README.md +6 -0
- data/Rakefile +6 -6
- data/bin/test +1 -1
- data/lib/proxy_rb/drivers/poltergeist_driver.rb +2 -2
- data/lib/proxy_rb/drivers/selenium_driver.rb +39 -0
- data/lib/proxy_rb/drivers/webkit_driver.rb +2 -2
- data/lib/proxy_rb/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6bc945043463fe4b3e69c8bdf8e125ef58aa8dce
|
4
|
+
data.tar.gz: 35765821a441b1d9bbc016bd2c6672cf4c122ee6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a9af5d4ece8df28ee2551e2dde1a2f3501081bdf5efcfc394201955528046adcbcfea9a4f39baa17bc0d4a032980b3e61aa44dee3191bccbb75717b8b06477e5
|
7
|
+
data.tar.gz: 17309f5b430978403dcd7bd3fedeb86a25d2d4bfff0a873c6c0a42abe357b2c1d295861c8d48a235e2d047111e2a26014cf56032486dc76931d019ff4a7e176c
|
data/.travis.yml
CHANGED
@@ -4,10 +4,11 @@ env:
|
|
4
4
|
language: ruby
|
5
5
|
bundler_args: --without development debug profile
|
6
6
|
rvm:
|
7
|
-
- 2.1.
|
8
|
-
- 2.2.
|
7
|
+
- 2.1.8
|
8
|
+
- 2.2.4
|
9
9
|
- 2.3.0
|
10
|
-
|
10
|
+
- ruby-head
|
11
|
+
script: bin/test
|
11
12
|
before_install:
|
12
13
|
- curl -o /tmp/vault.zip https://releases.hashicorp.com/vault/0.5.1/vault_0.5.1_linux_amd64.zip
|
13
14
|
- unzip /tmp/vault.zip
|
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -1,5 +1,11 @@
|
|
1
1
|
# ProxyRb
|
2
2
|
|
3
|
+
[![Build Status](https://travis-ci.org/fedux-org/proxy_rb.png?branch=master)](https://travis-ci.org/fedux-org/proxy_rb)
|
4
|
+
[![Code Climate](https://codeclimate.com/github/fedux-org/proxy_rb.png)](https://codeclimate.com/github/fedux-org/proxy_rb)
|
5
|
+
[![Coverage Status](https://coveralls.io/repos/fedux-org/proxy_rb/badge.png?branch=master)](https://coveralls.io/r/fedux-org/proxy_rb?branch=master)
|
6
|
+
[![Gem Version](https://badge.fury.io/rb/proxy_rb.png)](http://badge.fury.io/rb/proxy_rb)
|
7
|
+
[![Downloads](http://img.shields.io/gem/dt/proxy_rb.svg?style=flat)](http://rubygems.org/gems/proxy_rb)
|
8
|
+
|
3
9
|
`proxy_rb` makes it easier for you to test your proxy infrastructre.
|
4
10
|
|
5
11
|
## Installation
|
data/Rakefile
CHANGED
@@ -8,18 +8,18 @@ end
|
|
8
8
|
# require 'bundler'
|
9
9
|
# Bundler.require :default, :test, :development
|
10
10
|
|
11
|
-
require 'coveralls/rake/task'
|
12
|
-
Coveralls::RakeTask.new
|
13
|
-
|
14
11
|
task default: :test
|
15
12
|
|
16
13
|
desc 'Run test suite'
|
17
14
|
task test: %w(test:rubocop test:rspec test:cucumber)
|
18
15
|
|
19
|
-
|
20
|
-
|
21
|
-
task coveralls: %w(test coveralls:push)
|
16
|
+
require 'coveralls/rake/task'
|
17
|
+
Coveralls::RakeTask.new
|
22
18
|
|
19
|
+
desc 'Test with coveralls'
|
20
|
+
task coveralls: %w(test coveralls:push)
|
21
|
+
|
22
|
+
namespace :test do
|
23
23
|
require 'rubocop/rake_task'
|
24
24
|
RuboCop::RakeTask.new
|
25
25
|
|
data/bin/test
CHANGED
@@ -4,8 +4,8 @@ require 'capybara'
|
|
4
4
|
|
5
5
|
begin
|
6
6
|
require 'capybara/poltergeist'
|
7
|
-
rescue LoadError
|
8
|
-
ProxyRb.logger.error %(Error loading `poltergeist`-gem. Please add `gem poltergeist` to your `Gemfile`)
|
7
|
+
rescue LoadError => e
|
8
|
+
ProxyRb.logger.error %(Error loading `poltergeist`-gem: #{e.message}. Please add `gem poltergeist` to your `Gemfile`)
|
9
9
|
exit 1
|
10
10
|
end
|
11
11
|
|
@@ -0,0 +1,39 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
require 'proxy_rb/drivers/basic_driver'
|
3
|
+
require 'capybara'
|
4
|
+
require 'selenium-webdriver'
|
5
|
+
|
6
|
+
# ProxyRb
|
7
|
+
module ProxyRb
|
8
|
+
# Drivers
|
9
|
+
module Drivers
|
10
|
+
# Driver for Selenium
|
11
|
+
class SeleniumDriver < BasicDriver
|
12
|
+
# Register proxy
|
13
|
+
#
|
14
|
+
# @param [HttpProxy] proxy
|
15
|
+
# The HTTP proxy which should be used for fetching content
|
16
|
+
def register(proxy)
|
17
|
+
if proxy.empty?
|
18
|
+
::Capybara.current_driver = :selenium
|
19
|
+
return
|
20
|
+
end
|
21
|
+
|
22
|
+
profile = Selenium::WebDriver::Firefox::Profile.new
|
23
|
+
profile.proxy = Selenium::WebDriver::Proxy.new(http: format('%s:%s', proxy.host, proxy.port))
|
24
|
+
|
25
|
+
unless ::Capybara.drivers.key? proxy.to_ref
|
26
|
+
::Capybara.register_driver proxy.to_ref do |app|
|
27
|
+
::Capybara::Selenium::Driver.new(app, profile: profile)
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
::Capybara.current_driver = proxy.to_ref
|
32
|
+
end
|
33
|
+
|
34
|
+
def rescuable_errors
|
35
|
+
[]
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
@@ -3,8 +3,8 @@ require 'proxy_rb/drivers/basic_driver'
|
|
3
3
|
|
4
4
|
begin
|
5
5
|
require 'capybara/webkit'
|
6
|
-
rescue LoadError
|
7
|
-
ProxyRb.logger.error %(Error loading `capybara-webkit`-gem. Please add `gem capybara-webkit` to your `Gemfile`)
|
6
|
+
rescue LoadError => e
|
7
|
+
ProxyRb.logger.error %(Error loading `capybara-webkit`-gem: #{e.message}. Please add `gem capybara-webkit` to your `Gemfile`)
|
8
8
|
exit 1
|
9
9
|
end
|
10
10
|
|
data/lib/proxy_rb/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: proxy_rb
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Max Meyer
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-03-
|
11
|
+
date: 2016-03-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -158,6 +158,7 @@ files:
|
|
158
158
|
- lib/proxy_rb/credentials.rb
|
159
159
|
- lib/proxy_rb/drivers/basic_driver.rb
|
160
160
|
- lib/proxy_rb/drivers/poltergeist_driver.rb
|
161
|
+
- lib/proxy_rb/drivers/selenium_driver.rb
|
161
162
|
- lib/proxy_rb/drivers/webkit_driver.rb
|
162
163
|
- lib/proxy_rb/errors.rb
|
163
164
|
- lib/proxy_rb/http_downloader.rb
|