proxy_rb 0.4.0 → 0.5.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 +9 -4
- data/Gemfile +2 -2
- data/History.md +17 -0
- data/LICENSE.txt +22 -0
- data/README.md +15 -4
- data/Rakefile +8 -2
- data/exe/proxy_rb +8 -0
- data/fixtures/empty/README.md +18 -0
- data/fixtures/empty/Rakefile +10 -0
- data/lib/proxy_rb/announcer.rb +162 -0
- data/lib/proxy_rb/{rspec/helpers → api}/.keep +0 -0
- data/lib/proxy_rb/api/core.rb +25 -0
- data/lib/proxy_rb/api/http_proxy.rb +94 -0
- data/lib/proxy_rb/api/passwords.rb +26 -0
- data/lib/proxy_rb/api.rb +19 -0
- data/lib/proxy_rb/basic_configuration/{in_config_wrapper.rb → in_configuration_wrapper.rb} +1 -1
- data/lib/proxy_rb/basic_configuration.rb +2 -2
- data/lib/proxy_rb/cli.rb +27 -0
- data/lib/proxy_rb/colorizer.rb +113 -0
- data/lib/proxy_rb/configuration.rb +1 -1
- data/lib/proxy_rb/configuration_wrapper.rb +59 -0
- data/lib/proxy_rb/console/help.rb +29 -0
- data/lib/proxy_rb/console.rb +62 -0
- data/lib/proxy_rb/credentials.rb +11 -0
- data/lib/proxy_rb/drivers/poltergeist_driver.rb +8 -2
- data/lib/proxy_rb/drivers/selenium_driver.rb +7 -1
- data/lib/proxy_rb/drivers/webkit_driver.rb +10 -1
- data/lib/proxy_rb/errors.rb +12 -0
- data/lib/proxy_rb/event_bus/name_resolver.rb +163 -0
- data/lib/proxy_rb/event_bus.rb +60 -0
- data/lib/proxy_rb/events.rb +34 -0
- data/lib/proxy_rb/http_proxy.rb +8 -0
- data/lib/proxy_rb/initializer.rb +132 -0
- data/lib/proxy_rb/{rspec/matchers → matchers}/.keep +0 -0
- data/lib/proxy_rb/matchers/be_forbidden.rb +14 -0
- data/lib/proxy_rb/matchers/be_successful.rb +14 -0
- data/lib/proxy_rb/matchers/have_mime_type.rb +9 -0
- data/lib/proxy_rb/password_fetchers/basic_password_fetcher.rb +25 -0
- data/lib/proxy_rb/password_fetchers/chaining_password_fetcher.rb +54 -0
- data/lib/proxy_rb/password_fetchers/environment_password_fetcher.rb +7 -1
- data/lib/proxy_rb/password_fetchers/vault_password_fetcher.rb +7 -1
- data/lib/proxy_rb/proxy_url.rb +8 -0
- data/lib/proxy_rb/request.rb +5 -21
- data/lib/proxy_rb/resource.rb +11 -7
- data/lib/proxy_rb/response.rb +5 -13
- data/lib/proxy_rb/rspec.rb +32 -13
- data/lib/proxy_rb/runtime.rb +49 -0
- data/lib/proxy_rb/setup.rb +60 -0
- data/lib/proxy_rb/version.rb +1 -1
- data/proxy_rb.gemspec +2 -2
- metadata +38 -29
- data/lib/proxy_rb/rspec/helpers/http_proxy.rb +0 -83
- data/lib/proxy_rb/rspec/helpers/passwords.rb +0 -29
- data/lib/proxy_rb/rspec/shared_contexts/.keep +0 -0
- data/lib/proxy_rb/rspec/shared_examples/.keep +0 -0
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.5.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-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -24,20 +24,6 @@ dependencies:
|
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '1.9'
|
27
|
-
- !ruby/object:Gem::Dependency
|
28
|
-
name: rake
|
29
|
-
requirement: !ruby/object:Gem::Requirement
|
30
|
-
requirements:
|
31
|
-
- - "~>"
|
32
|
-
- !ruby/object:Gem::Version
|
33
|
-
version: '10.0'
|
34
|
-
type: :development
|
35
|
-
prerelease: false
|
36
|
-
version_requirements: !ruby/object:Gem::Requirement
|
37
|
-
requirements:
|
38
|
-
- - "~>"
|
39
|
-
- !ruby/object:Gem::Version
|
40
|
-
version: '10.0'
|
41
27
|
- !ruby/object:Gem::Dependency
|
42
28
|
name: capybara
|
43
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -112,20 +98,21 @@ dependencies:
|
|
112
98
|
name: rspec
|
113
99
|
requirement: !ruby/object:Gem::Requirement
|
114
100
|
requirements:
|
115
|
-
- - "
|
101
|
+
- - "~>"
|
116
102
|
- !ruby/object:Gem::Version
|
117
|
-
version: '
|
103
|
+
version: '3.3'
|
118
104
|
type: :runtime
|
119
105
|
prerelease: false
|
120
106
|
version_requirements: !ruby/object:Gem::Requirement
|
121
107
|
requirements:
|
122
|
-
- - "
|
108
|
+
- - "~>"
|
123
109
|
- !ruby/object:Gem::Version
|
124
|
-
version: '
|
110
|
+
version: '3.3'
|
125
111
|
description:
|
126
112
|
email:
|
127
113
|
- dev@fedux.org
|
128
|
-
executables:
|
114
|
+
executables:
|
115
|
+
- proxy_rb
|
129
116
|
extensions: []
|
130
117
|
extra_rdoc_files: []
|
131
118
|
files:
|
@@ -138,12 +125,17 @@ files:
|
|
138
125
|
- ".yardopts"
|
139
126
|
- CONTRIBUTING.md
|
140
127
|
- Gemfile
|
128
|
+
- History.md
|
129
|
+
- LICENSE.txt
|
141
130
|
- README.md
|
142
131
|
- Rakefile
|
143
132
|
- bin/bootstrap
|
144
133
|
- bin/console
|
145
134
|
- bin/test
|
146
135
|
- cucumber.yml
|
136
|
+
- exe/proxy_rb
|
137
|
+
- fixtures/empty/README.md
|
138
|
+
- fixtures/empty/Rakefile
|
147
139
|
- fixtures/proxy-config/.rspec
|
148
140
|
- fixtures/proxy-config/README.md
|
149
141
|
- fixtures/proxy-config/Rakefile
|
@@ -151,22 +143,42 @@ files:
|
|
151
143
|
- fixtures/proxy-config/spec/support/aruba.rb
|
152
144
|
- fixtures/proxy-config/spec/support/proxy_rb.rb
|
153
145
|
- lib/proxy_rb.rb
|
146
|
+
- lib/proxy_rb/announcer.rb
|
147
|
+
- lib/proxy_rb/api.rb
|
148
|
+
- lib/proxy_rb/api/.keep
|
149
|
+
- lib/proxy_rb/api/core.rb
|
150
|
+
- lib/proxy_rb/api/http_proxy.rb
|
151
|
+
- lib/proxy_rb/api/passwords.rb
|
154
152
|
- lib/proxy_rb/basic_configuration.rb
|
155
|
-
- lib/proxy_rb/basic_configuration/
|
153
|
+
- lib/proxy_rb/basic_configuration/in_configuration_wrapper.rb
|
156
154
|
- lib/proxy_rb/basic_configuration/option.rb
|
155
|
+
- lib/proxy_rb/cli.rb
|
156
|
+
- lib/proxy_rb/colorizer.rb
|
157
157
|
- lib/proxy_rb/configuration.rb
|
158
|
+
- lib/proxy_rb/configuration_wrapper.rb
|
159
|
+
- lib/proxy_rb/console.rb
|
160
|
+
- lib/proxy_rb/console/help.rb
|
158
161
|
- lib/proxy_rb/credentials.rb
|
159
162
|
- lib/proxy_rb/drivers/basic_driver.rb
|
160
163
|
- lib/proxy_rb/drivers/poltergeist_driver.rb
|
161
164
|
- lib/proxy_rb/drivers/selenium_driver.rb
|
162
165
|
- lib/proxy_rb/drivers/webkit_driver.rb
|
163
166
|
- lib/proxy_rb/errors.rb
|
167
|
+
- lib/proxy_rb/event_bus.rb
|
168
|
+
- lib/proxy_rb/event_bus/name_resolver.rb
|
169
|
+
- lib/proxy_rb/events.rb
|
164
170
|
- lib/proxy_rb/http_downloader.rb
|
165
171
|
- lib/proxy_rb/http_proxy.rb
|
172
|
+
- lib/proxy_rb/initializer.rb
|
166
173
|
- lib/proxy_rb/main.rb
|
174
|
+
- lib/proxy_rb/matchers/.keep
|
175
|
+
- lib/proxy_rb/matchers/be_forbidden.rb
|
176
|
+
- lib/proxy_rb/matchers/be_successful.rb
|
177
|
+
- lib/proxy_rb/matchers/have_mime_type.rb
|
167
178
|
- lib/proxy_rb/no_proxy.rb
|
168
179
|
- lib/proxy_rb/password_fetchers.rb
|
169
180
|
- lib/proxy_rb/password_fetchers/basic_password_fetcher.rb
|
181
|
+
- lib/proxy_rb/password_fetchers/chaining_password_fetcher.rb
|
170
182
|
- lib/proxy_rb/password_fetchers/environment_password_fetcher.rb
|
171
183
|
- lib/proxy_rb/password_fetchers/vault_password_fetcher.rb
|
172
184
|
- lib/proxy_rb/proxy_url.rb
|
@@ -175,19 +187,16 @@ files:
|
|
175
187
|
- lib/proxy_rb/resource.rb
|
176
188
|
- lib/proxy_rb/response.rb
|
177
189
|
- lib/proxy_rb/rspec.rb
|
178
|
-
- lib/proxy_rb/
|
179
|
-
- lib/proxy_rb/
|
180
|
-
- lib/proxy_rb/rspec/helpers/passwords.rb
|
181
|
-
- lib/proxy_rb/rspec/matchers/.keep
|
182
|
-
- lib/proxy_rb/rspec/shared_contexts/.keep
|
183
|
-
- lib/proxy_rb/rspec/shared_examples/.keep
|
190
|
+
- lib/proxy_rb/runtime.rb
|
191
|
+
- lib/proxy_rb/setup.rb
|
184
192
|
- lib/proxy_rb/user_passwords.rb
|
185
193
|
- lib/proxy_rb/user_passwords/environment_user_password.rb
|
186
194
|
- lib/proxy_rb/user_passwords/vault_user_password.rb
|
187
195
|
- lib/proxy_rb/version.rb
|
188
196
|
- proxy_rb.gemspec
|
189
197
|
homepage: https://github.com/fedux-org/proxy_rb
|
190
|
-
licenses:
|
198
|
+
licenses:
|
199
|
+
- MIT
|
191
200
|
metadata: {}
|
192
201
|
post_install_message:
|
193
202
|
rdoc_options: []
|
@@ -1,83 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'proxy_rb'
|
4
|
-
require 'proxy_rb/resource'
|
5
|
-
require 'proxy_rb/http_downloader'
|
6
|
-
require 'proxy_rb/http_proxy'
|
7
|
-
require 'proxy_rb/request'
|
8
|
-
require 'proxy_rb/response'
|
9
|
-
|
10
|
-
# Main Module
|
11
|
-
module ProxyRb
|
12
|
-
# Main Module
|
13
|
-
module Rspec
|
14
|
-
# Helpers
|
15
|
-
module Helpers
|
16
|
-
# Non includable internal helper methods
|
17
|
-
#
|
18
|
-
# Not for use by normal users
|
19
|
-
module NonIncludes
|
20
|
-
class << self
|
21
|
-
def clear_environment
|
22
|
-
%w(
|
23
|
-
http_proxy
|
24
|
-
https_proxy
|
25
|
-
HTTP_PROXY
|
26
|
-
HTTPS_PROXY
|
27
|
-
).each { |v| ENV.delete v }
|
28
|
-
end
|
29
|
-
|
30
|
-
def configure_driver
|
31
|
-
ProxyRb.config.driver.configure_driver
|
32
|
-
end
|
33
|
-
|
34
|
-
def register_capybara_driver_for_proxy(proxy)
|
35
|
-
ProxyRb.config.driver.register proxy
|
36
|
-
end
|
37
|
-
end
|
38
|
-
end
|
39
|
-
|
40
|
-
# For http proxy
|
41
|
-
module HttpProxy
|
42
|
-
include ::Capybara::DSL
|
43
|
-
|
44
|
-
# The proxy based on subject
|
45
|
-
def proxy
|
46
|
-
ProxyRb::HttpProxy.new(ProxyUrlParser.new(subject))
|
47
|
-
end
|
48
|
-
|
49
|
-
# Visit an URL
|
50
|
-
#
|
51
|
-
# @param [String] url
|
52
|
-
def visit(url)
|
53
|
-
resource = Resource.new(url)
|
54
|
-
|
55
|
-
NonIncludes.clear_environment
|
56
|
-
NonIncludes.configure_driver
|
57
|
-
NonIncludes.register_capybara_driver_for_proxy(proxy)
|
58
|
-
|
59
|
-
begin
|
60
|
-
super(resource.to_url)
|
61
|
-
rescue *ProxyRb.config.driver.rescuable_errors
|
62
|
-
raise ProxyRb::UrlTimeoutError, "Failed to fetch #{resource.to_url}: Timeout occured."
|
63
|
-
end
|
64
|
-
end
|
65
|
-
|
66
|
-
# !@method download
|
67
|
-
#
|
68
|
-
# @see #visit
|
69
|
-
alias download visit
|
70
|
-
|
71
|
-
# Get access to the request made
|
72
|
-
def request
|
73
|
-
Request.new(page)
|
74
|
-
end
|
75
|
-
|
76
|
-
# Get access to the response get
|
77
|
-
def response
|
78
|
-
Response.new(page)
|
79
|
-
end
|
80
|
-
end
|
81
|
-
end
|
82
|
-
end
|
83
|
-
end
|
@@ -1,29 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
require 'contracts'
|
3
|
-
|
4
|
-
# ProxyRb
|
5
|
-
module ProxyRb
|
6
|
-
# Rspec
|
7
|
-
module Rspec
|
8
|
-
# Helpers
|
9
|
-
module Helpers
|
10
|
-
# Helpers to access passwords
|
11
|
-
module Passwords
|
12
|
-
include Contracts::Core
|
13
|
-
include Contracts::Builtin
|
14
|
-
|
15
|
-
Contract Or[String, Symbol] => Maybe[String]
|
16
|
-
# Get password for user
|
17
|
-
#
|
18
|
-
# @param [String] user_name
|
19
|
-
# The user name
|
20
|
-
#
|
21
|
-
# @return [String]
|
22
|
-
# The password
|
23
|
-
def password(user_name)
|
24
|
-
ProxyRb.config.password_fetcher.call(user_name.to_s)
|
25
|
-
end
|
26
|
-
end
|
27
|
-
end
|
28
|
-
end
|
29
|
-
end
|
File without changes
|
File without changes
|