proxy_rb 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.gitignore +5 -0
- data/.rspec +3 -0
- data/.rubocop.yml +40 -0
- data/.simplecov +8 -0
- data/.travis.yml +8 -0
- data/.yardopts +5 -0
- data/CONTRIBUTING.md +61 -0
- data/Gemfile +59 -0
- data/Gemfile.lock +263 -0
- data/README.md +115 -0
- data/Rakefile +50 -0
- data/lib/proxy_rb/main.rb +27 -0
- data/lib/proxy_rb/rspec/helpers/.keep +0 -0
- data/lib/proxy_rb/rspec/helpers/http_proxy.rb +12 -0
- data/lib/proxy_rb/rspec/matchers/.keep +0 -0
- data/lib/proxy_rb/rspec/shared_contexts/.keep +0 -0
- data/lib/proxy_rb/rspec/shared_examples/.keep +0 -0
- data/lib/proxy_rb/rspec.rb +21 -0
- data/lib/proxy_rb/version.rb +4 -0
- data/lib/proxy_rb.rb +6 -0
- data/proxy_rb.gemspec +31 -0
- data/script/bootstrap +7 -0
- data/script/console +10 -0
- metadata +165 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 504810e2b43ff35a50377363f2cd74b22caadf70
|
4
|
+
data.tar.gz: 54c59c88935fc8bd1195e26b25c0340a748c14ec
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 634c2663282ea5804be8dacb98be87ffe0292390db532b537b41373919dea5327b33ec13fc5b08e21061bb9ca966040ea2034af7d6ebaade2ec511d2c6b21b35
|
7
|
+
data.tar.gz: 582664775a075dfd4ca583e645568a879b46f5436519dde04110460b6138e44191368da6785d927064c7abb0bdc78d499dc9d7e98dddc03dc39e42aa70b5cf0b
|
data/.rspec
ADDED
data/.rubocop.yml
ADDED
@@ -0,0 +1,40 @@
|
|
1
|
+
AllCops:
|
2
|
+
Exclude:
|
3
|
+
- 'tmp/**/*'
|
4
|
+
DisplayCopNames: true
|
5
|
+
|
6
|
+
Metrics/AbcSize:
|
7
|
+
Max: 38
|
8
|
+
|
9
|
+
# Configuration parameters: AllowURI.
|
10
|
+
Metrics/LineLength:
|
11
|
+
Max: 225
|
12
|
+
|
13
|
+
# Configuration parameters: CountKeywordArgs.
|
14
|
+
Metrics/ParameterLists:
|
15
|
+
Max: 6
|
16
|
+
|
17
|
+
Style/CaseEquality:
|
18
|
+
Enabled: false
|
19
|
+
|
20
|
+
Metrics/BlockNesting:
|
21
|
+
Max: 4
|
22
|
+
|
23
|
+
# Configuration parameters: CountComments.
|
24
|
+
Metrics/ClassLength:
|
25
|
+
Max: 174
|
26
|
+
|
27
|
+
Metrics/CyclomaticComplexity:
|
28
|
+
Max: 7
|
29
|
+
|
30
|
+
# Configuration parameters: CountComments.
|
31
|
+
Metrics/MethodLength:
|
32
|
+
Max: 76
|
33
|
+
|
34
|
+
Metrics/PerceivedComplexity:
|
35
|
+
Max: 8
|
36
|
+
|
37
|
+
# Configuration parameters: EnforcedStyle, SupportedStyles.
|
38
|
+
Style/MethodName:
|
39
|
+
Exclude:
|
40
|
+
- lib/proxy_pac_rb/environment.rb
|
data/.simplecov
ADDED
data/.travis.yml
ADDED
data/.yardopts
ADDED
data/CONTRIBUTING.md
ADDED
@@ -0,0 +1,61 @@
|
|
1
|
+
# Contributing
|
2
|
+
|
3
|
+
In the spirit of [free software][free-sw], **everyone** is encouraged to help
|
4
|
+
improve this project.
|
5
|
+
|
6
|
+
[free-sw]: http://www.fsf.org/licensing/essays/free-sw.html
|
7
|
+
|
8
|
+
Here are some ways *you* can contribute:
|
9
|
+
|
10
|
+
* by using alpha, beta, and prerelease versions
|
11
|
+
* by reporting bugs
|
12
|
+
* by suggesting new features
|
13
|
+
* by writing or editing documentation
|
14
|
+
* by writing specifications
|
15
|
+
* by writing code ( **no patch is too small** : fix typos, add comments, clean up inconsistent whitespace )
|
16
|
+
* by refactoring code
|
17
|
+
* by closing [issues][]
|
18
|
+
* by reviewing patches
|
19
|
+
|
20
|
+
[issues]: https://github.com/fedux-org/proxy_pac_rb/issues
|
21
|
+
|
22
|
+
## Submitting an Issue
|
23
|
+
|
24
|
+
We use the [GitHub issue tracker][issues] to track bugs and features. Before
|
25
|
+
submitting a bug report or feature request, check to make sure it hasn't
|
26
|
+
already been submitted.
|
27
|
+
|
28
|
+
When submitting a bug report, please include a [Gist][] that includes a *stack
|
29
|
+
trace* and any details that may be necessary to reproduce the bug, including
|
30
|
+
your *gem version*, *Ruby version*, and *operating system*. Ideally, a bug report
|
31
|
+
should include a pull request with failing specs.
|
32
|
+
|
33
|
+
[gist]: https://gist.github.com/
|
34
|
+
|
35
|
+
## Submitting a Pull Request
|
36
|
+
|
37
|
+
1. [Fork the repository.][fork]
|
38
|
+
2. Create a topic [branch]. `git checkout -b local_topic_branch`
|
39
|
+
3. Add specs for your unimplemented feature or bug fix.
|
40
|
+
4. Run `bundle exec rake test`. If your specs pass, return to step 3.
|
41
|
+
5. Implement your feature or bug fix.
|
42
|
+
6. Run `bundle exec rake test`. If your specs fail, return to step 5.
|
43
|
+
7. Add, commit, and push your changes. To push your topic branch use `git push -u origin local_topic_branch`.
|
44
|
+
8. [Submit a pull request.][pr]
|
45
|
+
|
46
|
+
Here are some reasons why a pull request may not be merged:
|
47
|
+
|
48
|
+
1. It hasn’t been reviewed.
|
49
|
+
2. It doesn’t include specs for new functionality.
|
50
|
+
3. It doesn’t include documentation for new functionality.
|
51
|
+
4. It changes behavior without changing the relevant documentation, comments, or specs.
|
52
|
+
5. It changes behavior of an existing public API, breaking backward compatibility.
|
53
|
+
6. It breaks the tests on a supported platform.
|
54
|
+
7. It doesn’t merge cleanly (requiring Git rebasing and conflict resolution).
|
55
|
+
|
56
|
+
Include this emoji in the top of your ticket to signal to us that you read this
|
57
|
+
file: :memo:
|
58
|
+
|
59
|
+
[fork]: http://help.github.com/fork-a-repo/
|
60
|
+
[branch]: https://help.github.com/articles/fork-a-repo#create-branches
|
61
|
+
[pr]: http://help.github.com/send-pull-requests/
|
data/Gemfile
ADDED
@@ -0,0 +1,59 @@
|
|
1
|
+
source 'https://rubygems.org'
|
2
|
+
|
3
|
+
# Specify your gem's dependencies in local_pac.gemspec
|
4
|
+
gemspec
|
5
|
+
|
6
|
+
group :debug do
|
7
|
+
gem 'pry'
|
8
|
+
gem 'byebug'
|
9
|
+
|
10
|
+
gem 'pry-doc', require: false
|
11
|
+
gem 'pry-stack_explorer', require: false
|
12
|
+
gem 'pry-byebug', require: false
|
13
|
+
end
|
14
|
+
|
15
|
+
group :development, :test do
|
16
|
+
gem 'activesupport', '~> 4.2.0', require: false
|
17
|
+
gem 'aruba', require: false
|
18
|
+
gem 'awesome_print', require: 'ap'
|
19
|
+
gem 'bundler', '~> 1.3', require: false
|
20
|
+
gem 'command_exec', require: false
|
21
|
+
gem 'coveralls', require: false
|
22
|
+
gem 'cucumber', require: false
|
23
|
+
gem 'erubis'
|
24
|
+
gem 'fedux_org-stdlib', '~>0.7.25', require: false
|
25
|
+
gem 'filegen'
|
26
|
+
gem 'foreman', require: false
|
27
|
+
gem 'fuubar', require: false
|
28
|
+
gem 'github-markup'
|
29
|
+
gem 'inch', require: false
|
30
|
+
gem 'launchy', require: false
|
31
|
+
gem 'license_finder'
|
32
|
+
gem 'rack'
|
33
|
+
gem 'rake', require: false
|
34
|
+
gem 'redcarpet', require: false
|
35
|
+
gem 'rubocop', require: false
|
36
|
+
gem 'simplecov', require: false
|
37
|
+
gem 'sinatra', require: 'sinatra/base'
|
38
|
+
gem 'tmrb', require: false
|
39
|
+
gem 'travis-lint', require: false
|
40
|
+
gem 'versionomy', require: false
|
41
|
+
gem 'yard', require: false
|
42
|
+
gem 'rspec', require: false
|
43
|
+
gem 'webmock', require: false
|
44
|
+
gem 'rack-test', require: false
|
45
|
+
end
|
46
|
+
|
47
|
+
group :profile do
|
48
|
+
gem 'ruby-prof'
|
49
|
+
end
|
50
|
+
|
51
|
+
group :runtimes do
|
52
|
+
group :therubyracer do
|
53
|
+
gem 'therubyracer', require: 'v8'
|
54
|
+
end
|
55
|
+
|
56
|
+
group :therubyrhino do
|
57
|
+
gem 'therubyrhino', require: 'rhino'
|
58
|
+
end
|
59
|
+
end
|
data/Gemfile.lock
ADDED
@@ -0,0 +1,263 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
proxy_rb (0.1.0)
|
5
|
+
activesupport
|
6
|
+
addressable
|
7
|
+
capybara
|
8
|
+
poltergeist
|
9
|
+
uglifier
|
10
|
+
|
11
|
+
GEM
|
12
|
+
remote: https://rubygems.org/
|
13
|
+
specs:
|
14
|
+
activesupport (4.2.1)
|
15
|
+
i18n (~> 0.7)
|
16
|
+
json (~> 1.7, >= 1.7.7)
|
17
|
+
minitest (~> 5.1)
|
18
|
+
thread_safe (~> 0.3, >= 0.3.4)
|
19
|
+
tzinfo (~> 1.1)
|
20
|
+
addressable (2.3.8)
|
21
|
+
aruba (0.6.2)
|
22
|
+
childprocess (>= 0.3.6)
|
23
|
+
cucumber (>= 1.1.1)
|
24
|
+
rspec-expectations (>= 2.7.0)
|
25
|
+
ast (2.0.0)
|
26
|
+
astrolabe (1.3.0)
|
27
|
+
parser (>= 2.2.0.pre.3, < 3.0)
|
28
|
+
awesome_print (1.6.1)
|
29
|
+
binding_of_caller (0.7.2)
|
30
|
+
debug_inspector (>= 0.0.1)
|
31
|
+
blockenspiel (0.4.5)
|
32
|
+
builder (3.2.2)
|
33
|
+
byebug (4.0.5)
|
34
|
+
columnize (= 0.9.0)
|
35
|
+
capybara (2.4.4)
|
36
|
+
mime-types (>= 1.16)
|
37
|
+
nokogiri (>= 1.3.3)
|
38
|
+
rack (>= 1.0.0)
|
39
|
+
rack-test (>= 0.5.4)
|
40
|
+
xpath (~> 2.0)
|
41
|
+
childprocess (0.5.6)
|
42
|
+
ffi (~> 1.0, >= 1.0.11)
|
43
|
+
cliver (0.3.2)
|
44
|
+
coderay (1.1.0)
|
45
|
+
columnize (0.9.0)
|
46
|
+
command_exec (0.2.0)
|
47
|
+
activesupport
|
48
|
+
smart_colored
|
49
|
+
xml-simple
|
50
|
+
coveralls (0.8.0)
|
51
|
+
multi_json (~> 1.10)
|
52
|
+
rest-client (>= 1.6.8, < 2)
|
53
|
+
simplecov (~> 0.9.1)
|
54
|
+
term-ansicolor (~> 1.3)
|
55
|
+
thor (~> 0.19.1)
|
56
|
+
crack (0.4.2)
|
57
|
+
safe_yaml (~> 1.0.0)
|
58
|
+
cucumber (2.0.0)
|
59
|
+
builder (>= 2.1.2)
|
60
|
+
cucumber-core (~> 1.1.3)
|
61
|
+
diff-lcs (>= 1.1.3)
|
62
|
+
gherkin (~> 2.12)
|
63
|
+
multi_json (>= 1.7.5, < 2.0)
|
64
|
+
multi_test (>= 0.1.2)
|
65
|
+
cucumber-core (1.1.3)
|
66
|
+
gherkin (~> 2.12.0)
|
67
|
+
debug_inspector (0.0.2)
|
68
|
+
diff-lcs (1.2.5)
|
69
|
+
docile (1.1.5)
|
70
|
+
domain_name (0.5.23)
|
71
|
+
unf (>= 0.0.5, < 1.0.0)
|
72
|
+
erubis (2.7.0)
|
73
|
+
execjs (2.5.0)
|
74
|
+
fedux_org-stdlib (0.7.33)
|
75
|
+
activesupport
|
76
|
+
ffi (1.9.8)
|
77
|
+
filegen (0.4.3)
|
78
|
+
activesupport
|
79
|
+
foreman (0.78.0)
|
80
|
+
thor (~> 0.19.1)
|
81
|
+
fuubar (2.0.0)
|
82
|
+
rspec (~> 3.0)
|
83
|
+
ruby-progressbar (~> 1.4)
|
84
|
+
gherkin (2.12.2)
|
85
|
+
multi_json (~> 1.3)
|
86
|
+
github-markup (1.3.3)
|
87
|
+
http-cookie (1.0.2)
|
88
|
+
domain_name (~> 0.5)
|
89
|
+
httparty (0.13.3)
|
90
|
+
json (~> 1.8)
|
91
|
+
multi_xml (>= 0.5.2)
|
92
|
+
i18n (0.7.0)
|
93
|
+
inch (0.5.10)
|
94
|
+
pry
|
95
|
+
sparkr (>= 0.2.0)
|
96
|
+
term-ansicolor
|
97
|
+
yard (~> 0.8.7.5)
|
98
|
+
json (1.8.2)
|
99
|
+
launchy (2.4.3)
|
100
|
+
addressable (~> 2.3)
|
101
|
+
libv8 (3.16.14.7)
|
102
|
+
license_finder (2.0.3)
|
103
|
+
bundler
|
104
|
+
httparty
|
105
|
+
thor
|
106
|
+
xml-simple
|
107
|
+
method_source (0.8.2)
|
108
|
+
mime-types (2.4.3)
|
109
|
+
mini_portile (0.6.2)
|
110
|
+
minitest (5.5.1)
|
111
|
+
multi_json (1.11.0)
|
112
|
+
multi_test (0.1.2)
|
113
|
+
multi_xml (0.5.5)
|
114
|
+
netrc (0.10.3)
|
115
|
+
nokogiri (1.6.6.2)
|
116
|
+
mini_portile (~> 0.6.0)
|
117
|
+
parser (2.2.0.3)
|
118
|
+
ast (>= 1.1, < 3.0)
|
119
|
+
poltergeist (1.6.0)
|
120
|
+
capybara (~> 2.1)
|
121
|
+
cliver (~> 0.3.1)
|
122
|
+
multi_json (~> 1.0)
|
123
|
+
websocket-driver (>= 0.2.0)
|
124
|
+
powerpack (0.1.0)
|
125
|
+
pry (0.10.1)
|
126
|
+
coderay (~> 1.1.0)
|
127
|
+
method_source (~> 0.8.1)
|
128
|
+
slop (~> 3.4)
|
129
|
+
pry-byebug (3.1.0)
|
130
|
+
byebug (~> 4.0)
|
131
|
+
pry (~> 0.10)
|
132
|
+
pry-doc (0.6.0)
|
133
|
+
pry (~> 0.9)
|
134
|
+
yard (~> 0.8)
|
135
|
+
pry-stack_explorer (0.4.9.2)
|
136
|
+
binding_of_caller (>= 0.7)
|
137
|
+
pry (>= 0.9.11)
|
138
|
+
rack (1.6.0)
|
139
|
+
rack-protection (1.5.3)
|
140
|
+
rack
|
141
|
+
rack-test (0.6.3)
|
142
|
+
rack (>= 1.0)
|
143
|
+
rainbow (2.0.0)
|
144
|
+
rake (10.4.2)
|
145
|
+
redcarpet (3.2.3)
|
146
|
+
ref (1.0.5)
|
147
|
+
rest-client (1.8.0)
|
148
|
+
http-cookie (>= 1.0.2, < 2.0)
|
149
|
+
mime-types (>= 1.16, < 3.0)
|
150
|
+
netrc (~> 0.7)
|
151
|
+
rspec (3.2.0)
|
152
|
+
rspec-core (~> 3.2.0)
|
153
|
+
rspec-expectations (~> 3.2.0)
|
154
|
+
rspec-mocks (~> 3.2.0)
|
155
|
+
rspec-core (3.2.3)
|
156
|
+
rspec-support (~> 3.2.0)
|
157
|
+
rspec-expectations (3.2.1)
|
158
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
159
|
+
rspec-support (~> 3.2.0)
|
160
|
+
rspec-mocks (3.2.1)
|
161
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
162
|
+
rspec-support (~> 3.2.0)
|
163
|
+
rspec-support (3.2.2)
|
164
|
+
rubocop (0.30.0)
|
165
|
+
astrolabe (~> 1.3)
|
166
|
+
parser (>= 2.2.0.1, < 3.0)
|
167
|
+
powerpack (~> 0.1)
|
168
|
+
rainbow (>= 1.99.1, < 3.0)
|
169
|
+
ruby-progressbar (~> 1.4)
|
170
|
+
ruby-prof (0.15.6)
|
171
|
+
ruby-progressbar (1.7.5)
|
172
|
+
safe_yaml (1.0.4)
|
173
|
+
simplecov (0.9.2)
|
174
|
+
docile (~> 1.1.0)
|
175
|
+
multi_json (~> 1.0)
|
176
|
+
simplecov-html (~> 0.9.0)
|
177
|
+
simplecov-html (0.9.0)
|
178
|
+
sinatra (1.4.6)
|
179
|
+
rack (~> 1.4)
|
180
|
+
rack-protection (~> 1.4)
|
181
|
+
tilt (>= 1.3, < 3)
|
182
|
+
slop (3.6.0)
|
183
|
+
smart_colored (1.1.1)
|
184
|
+
sparkr (0.4.1)
|
185
|
+
term-ansicolor (1.3.0)
|
186
|
+
tins (~> 1.0)
|
187
|
+
therubyracer (0.12.2)
|
188
|
+
libv8 (~> 3.16.14.0)
|
189
|
+
ref
|
190
|
+
therubyrhino (2.0.4)
|
191
|
+
therubyrhino_jar (>= 1.7.3)
|
192
|
+
therubyrhino_jar (1.7.4)
|
193
|
+
thor (0.19.1)
|
194
|
+
thread_safe (0.3.5)
|
195
|
+
tilt (2.0.1)
|
196
|
+
tins (1.3.5)
|
197
|
+
tmrb (1.2.7)
|
198
|
+
thor
|
199
|
+
travis-lint (2.0.0)
|
200
|
+
json
|
201
|
+
tzinfo (1.2.2)
|
202
|
+
thread_safe (~> 0.1)
|
203
|
+
uglifier (2.7.1)
|
204
|
+
execjs (>= 0.3.0)
|
205
|
+
json (>= 1.8.0)
|
206
|
+
unf (0.1.4)
|
207
|
+
unf_ext
|
208
|
+
unf_ext (0.0.6)
|
209
|
+
versionomy (0.4.4)
|
210
|
+
blockenspiel (>= 0.4.5)
|
211
|
+
webmock (1.21.0)
|
212
|
+
addressable (>= 2.3.6)
|
213
|
+
crack (>= 0.3.2)
|
214
|
+
websocket-driver (0.5.4)
|
215
|
+
websocket-extensions (>= 0.1.0)
|
216
|
+
websocket-extensions (0.1.2)
|
217
|
+
xml-simple (1.1.5)
|
218
|
+
xpath (2.0.0)
|
219
|
+
nokogiri (~> 1.3)
|
220
|
+
yard (0.8.7.6)
|
221
|
+
|
222
|
+
PLATFORMS
|
223
|
+
ruby
|
224
|
+
|
225
|
+
DEPENDENCIES
|
226
|
+
activesupport (~> 4.2.0)
|
227
|
+
aruba
|
228
|
+
awesome_print
|
229
|
+
bundler (~> 1.3)
|
230
|
+
byebug
|
231
|
+
command_exec
|
232
|
+
coveralls
|
233
|
+
cucumber
|
234
|
+
erubis
|
235
|
+
fedux_org-stdlib (~> 0.7.25)
|
236
|
+
filegen
|
237
|
+
foreman
|
238
|
+
fuubar
|
239
|
+
github-markup
|
240
|
+
inch
|
241
|
+
launchy
|
242
|
+
license_finder
|
243
|
+
proxy_rb!
|
244
|
+
pry
|
245
|
+
pry-byebug
|
246
|
+
pry-doc
|
247
|
+
pry-stack_explorer
|
248
|
+
rack
|
249
|
+
rack-test
|
250
|
+
rake
|
251
|
+
redcarpet
|
252
|
+
rspec
|
253
|
+
rubocop
|
254
|
+
ruby-prof
|
255
|
+
simplecov
|
256
|
+
sinatra
|
257
|
+
therubyracer
|
258
|
+
therubyrhino
|
259
|
+
tmrb
|
260
|
+
travis-lint
|
261
|
+
versionomy
|
262
|
+
webmock
|
263
|
+
yard
|
data/README.md
ADDED
@@ -0,0 +1,115 @@
|
|
1
|
+
# ProxyRb
|
2
|
+
|
3
|
+
Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/proxy_rb`. To experiment with that code, run `bin/console` for an interactive prompt.
|
4
|
+
|
5
|
+
TODO: Delete this and the text above, and describe your gem
|
6
|
+
|
7
|
+
## Installation
|
8
|
+
|
9
|
+
Add this line to your application's Gemfile:
|
10
|
+
|
11
|
+
```ruby
|
12
|
+
gem 'proxy_rb'
|
13
|
+
```
|
14
|
+
|
15
|
+
And then execute:
|
16
|
+
|
17
|
+
$ bundle
|
18
|
+
|
19
|
+
Or install it yourself as:
|
20
|
+
|
21
|
+
$ gem install proxy_rb
|
22
|
+
|
23
|
+
## Usage
|
24
|
+
|
25
|
+
```ruby
|
26
|
+
RSpec.describe 'Intfrastructure A' do
|
27
|
+
describe 'proxy1' do
|
28
|
+
subject { 'proxy1.example.com' }
|
29
|
+
|
30
|
+
context 'request resource via http' do
|
31
|
+
let(:resource) { Resource.new('http://example.com') }
|
32
|
+
|
33
|
+
context 'when url is readable' do
|
34
|
+
it { expect(proxy).to forward_url(resource) }
|
35
|
+
end
|
36
|
+
|
37
|
+
context 'when website needs to be browsed' do
|
38
|
+
before(:each) { download(resource) }
|
39
|
+
it { expect(resource).to have_content('Example') }
|
40
|
+
end
|
41
|
+
|
42
|
+
context 'when proxy authentication is needed' do
|
43
|
+
let(:user) { ProxyUser.new(name: 'user1') }
|
44
|
+
before(:each) { download(resource) }
|
45
|
+
|
46
|
+
it { expect(resource).to have_content('Example') }
|
47
|
+
end
|
48
|
+
|
49
|
+
context 'when upload uses post http method' do
|
50
|
+
let(:data) { 'data' }
|
51
|
+
before(:each) { upload(resource, data) }
|
52
|
+
|
53
|
+
it { expect(resource).to have_content('Example') }
|
54
|
+
end
|
55
|
+
|
56
|
+
context 'when upload uses put http method' do
|
57
|
+
let(:data) { 'data' }
|
58
|
+
before(:each) { upload(resource, data, method: 'put') }
|
59
|
+
|
60
|
+
it { expect(resource).to have_content('Example') }
|
61
|
+
end
|
62
|
+
end
|
63
|
+
|
64
|
+
context 'request resource via https' do
|
65
|
+
let(:resource) { Resource.new('https://example.com') }
|
66
|
+
end
|
67
|
+
|
68
|
+
context 'request resource via ftp' do
|
69
|
+
let(:resource) { Resource.new('ftp://example.com/file.txt') }
|
70
|
+
|
71
|
+
context 'when website needs to be browsed' do
|
72
|
+
before(:each) { download(resource) }
|
73
|
+
it { expect(resource).to have_content('Example') }
|
74
|
+
end
|
75
|
+
|
76
|
+
context 'when url is readable' do
|
77
|
+
it { expect(proxy).to forward_url(resource) }
|
78
|
+
end
|
79
|
+
|
80
|
+
context 'when authentication is needed' do
|
81
|
+
let(:user) { ProxyUser.new(name: 'user1') }
|
82
|
+
before(:each) { download(resource) }
|
83
|
+
|
84
|
+
it { expect(resource).to have_content('Example') }
|
85
|
+
end
|
86
|
+
|
87
|
+
context 'when upload' do
|
88
|
+
let(:data) { File.open('file.txt') }
|
89
|
+
before(:each) { upload(resource, data) }
|
90
|
+
|
91
|
+
it { expect(resource).to have_content('Example') }
|
92
|
+
end
|
93
|
+
end
|
94
|
+
end
|
95
|
+
end
|
96
|
+
```
|
97
|
+
|
98
|
+
## Development
|
99
|
+
|
100
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run
|
101
|
+
`bin/console` for an interactive prompt that will allow you to experiment.
|
102
|
+
|
103
|
+
To install this gem onto your local machine, run `bundle exec rake install`. To
|
104
|
+
release a new version, update the version number in `version.rb`, and then run
|
105
|
+
`bundle exec rake release` to create a git tag for the version, push git
|
106
|
+
commits and tags, and push the `.gem` file to
|
107
|
+
[rubygems.org](https://rubygems.org).
|
108
|
+
|
109
|
+
## Contributing
|
110
|
+
|
111
|
+
1. Fork it ( https://github.com/[my-github-username]/proxy_rb/fork )
|
112
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
113
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
114
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
115
|
+
5. Create a new Pull Request
|
data/Rakefile
ADDED
@@ -0,0 +1,50 @@
|
|
1
|
+
#!/usr/bin/env rake
|
2
|
+
|
3
|
+
# require 'bundler'
|
4
|
+
# Bundler.require :default, :test, :development
|
5
|
+
|
6
|
+
require 'filegen'
|
7
|
+
require 'fedux_org_stdlib/rake_tasks'
|
8
|
+
|
9
|
+
require 'coveralls/rake/task'
|
10
|
+
Coveralls::RakeTask.new
|
11
|
+
|
12
|
+
desc 'Run test suite'
|
13
|
+
task :test do
|
14
|
+
Rake::Task['test:before'].execute
|
15
|
+
|
16
|
+
begin
|
17
|
+
#%w(test:rubocop test:rspec test:cucumber test:after).each { |t| Rake::Task[t].execute }
|
18
|
+
%w(test:rubocop test:rspec test:after).each { |t| Rake::Task[t].execute }
|
19
|
+
ensure
|
20
|
+
Rake::Task['test:after'].execute
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
namespace :test do
|
25
|
+
desc 'Test with coveralls'
|
26
|
+
task coveralls: %w(test coveralls:push)
|
27
|
+
|
28
|
+
require 'rubocop/rake_task'
|
29
|
+
RuboCop::RakeTask.new
|
30
|
+
|
31
|
+
desc 'Run rspec'
|
32
|
+
task :rspec do
|
33
|
+
sh 'bundle exec rspec'
|
34
|
+
end
|
35
|
+
|
36
|
+
desc 'Run cucumber'
|
37
|
+
task :cucumber do
|
38
|
+
sh 'bundle exec cucumber -p all'
|
39
|
+
end
|
40
|
+
|
41
|
+
desc 'Setup test environment'
|
42
|
+
task :before do
|
43
|
+
@web_server = Process.spawn 'rackup -p 65535 script/config.ru'
|
44
|
+
end
|
45
|
+
|
46
|
+
desc 'Teardown test environment'
|
47
|
+
task :after do
|
48
|
+
sh "kill -9 #{@web_server}"
|
49
|
+
end
|
50
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
# Main
|
2
|
+
module ProxyRb
|
3
|
+
@debug_mode = false
|
4
|
+
|
5
|
+
class << self
|
6
|
+
private
|
7
|
+
|
8
|
+
attr_accessor :debug_mode
|
9
|
+
|
10
|
+
public
|
11
|
+
|
12
|
+
def debug_mode_enabled?
|
13
|
+
debug_mode == true
|
14
|
+
end
|
15
|
+
|
16
|
+
def enable_debug_mode
|
17
|
+
self.debug_mode = true
|
18
|
+
%w(pry byebug).each { |l| require l }
|
19
|
+
end
|
20
|
+
|
21
|
+
def require_file_matching_pattern(pattern)
|
22
|
+
root = File.expand_path('../', __FILE__)
|
23
|
+
path = File.join(root, pattern)
|
24
|
+
Dir.glob(path).each { |f| require_relative f }
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
@@ -0,0 +1,21 @@
|
|
1
|
+
require 'rspec'
|
2
|
+
require 'capybara/poltergeist'
|
3
|
+
require 'capybara/rspec'
|
4
|
+
|
5
|
+
require 'proxy_rb/rspec'
|
6
|
+
|
7
|
+
ProxyRb.require_file_matching_pattern('rspec/helpers/*.rb')
|
8
|
+
ProxyRb.require_file_matching_pattern('rspec/matchers/*.rb')
|
9
|
+
ProxyRb.require_file_matching_pattern('rspec/shared_examples/*.rb')
|
10
|
+
ProxyRb.require_file_matching_pattern('rspec/shared_contexts/*.rb')
|
11
|
+
|
12
|
+
# Main Module
|
13
|
+
module ProxyRb
|
14
|
+
# Main Module
|
15
|
+
module Rspec
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
RSpec.configure do |config|
|
20
|
+
config.include ProxyRb::Rspec::Helpers::HttpProxy, type: :http_proxy
|
21
|
+
end
|
data/lib/proxy_rb.rb
ADDED
data/proxy_rb.gemspec
ADDED
@@ -0,0 +1,31 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'proxy_rb/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = 'proxy_rb'
|
8
|
+
spec.version = ProxyRb::VERSION
|
9
|
+
spec.authors = ['Max Meyer']
|
10
|
+
spec.email = ['dev@fedux.org']
|
11
|
+
|
12
|
+
spec.summary = 'This gem makes testing your proxy easy.'
|
13
|
+
spec.homepage = 'https://github.com/fedux-org/proxy_rb'
|
14
|
+
|
15
|
+
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
16
|
+
spec.bindir = 'exe'
|
17
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
18
|
+
spec.require_paths = ['lib']
|
19
|
+
|
20
|
+
spec.add_development_dependency 'bundler', '~> 1.9'
|
21
|
+
spec.add_development_dependency 'rake', '~> 10.0'
|
22
|
+
|
23
|
+
spec.add_runtime_dependency 'capybara'
|
24
|
+
spec.add_runtime_dependency 'poltergeist'
|
25
|
+
|
26
|
+
spec.add_runtime_dependency 'addressable'
|
27
|
+
spec.add_runtime_dependency 'activesupport'
|
28
|
+
spec.add_runtime_dependency 'uglifier'
|
29
|
+
|
30
|
+
spec.required_ruby_version = '~> 2.0'
|
31
|
+
end
|
data/script/bootstrap
ADDED
data/script/console
ADDED
metadata
ADDED
@@ -0,0 +1,165 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: proxy_rb
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Max Meyer
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2015-04-08 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.9'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
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
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: capybara
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: poltergeist
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :runtime
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: addressable
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
type: :runtime
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: activesupport
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - ">="
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0'
|
90
|
+
type: :runtime
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - ">="
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: uglifier
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - ">="
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '0'
|
104
|
+
type: :runtime
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - ">="
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '0'
|
111
|
+
description:
|
112
|
+
email:
|
113
|
+
- dev@fedux.org
|
114
|
+
executables: []
|
115
|
+
extensions: []
|
116
|
+
extra_rdoc_files: []
|
117
|
+
files:
|
118
|
+
- ".gitignore"
|
119
|
+
- ".rspec"
|
120
|
+
- ".rubocop.yml"
|
121
|
+
- ".simplecov"
|
122
|
+
- ".travis.yml"
|
123
|
+
- ".yardopts"
|
124
|
+
- CONTRIBUTING.md
|
125
|
+
- Gemfile
|
126
|
+
- Gemfile.lock
|
127
|
+
- README.md
|
128
|
+
- Rakefile
|
129
|
+
- lib/proxy_rb.rb
|
130
|
+
- lib/proxy_rb/main.rb
|
131
|
+
- lib/proxy_rb/rspec.rb
|
132
|
+
- lib/proxy_rb/rspec/helpers/.keep
|
133
|
+
- lib/proxy_rb/rspec/helpers/http_proxy.rb
|
134
|
+
- lib/proxy_rb/rspec/matchers/.keep
|
135
|
+
- lib/proxy_rb/rspec/shared_contexts/.keep
|
136
|
+
- lib/proxy_rb/rspec/shared_examples/.keep
|
137
|
+
- lib/proxy_rb/version.rb
|
138
|
+
- proxy_rb.gemspec
|
139
|
+
- script/bootstrap
|
140
|
+
- script/console
|
141
|
+
homepage: https://github.com/fedux-org/proxy_rb
|
142
|
+
licenses: []
|
143
|
+
metadata: {}
|
144
|
+
post_install_message:
|
145
|
+
rdoc_options: []
|
146
|
+
require_paths:
|
147
|
+
- lib
|
148
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
149
|
+
requirements:
|
150
|
+
- - "~>"
|
151
|
+
- !ruby/object:Gem::Version
|
152
|
+
version: '2.0'
|
153
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
154
|
+
requirements:
|
155
|
+
- - ">="
|
156
|
+
- !ruby/object:Gem::Version
|
157
|
+
version: '0'
|
158
|
+
requirements: []
|
159
|
+
rubyforge_project:
|
160
|
+
rubygems_version: 2.4.5
|
161
|
+
signing_key:
|
162
|
+
specification_version: 4
|
163
|
+
summary: This gem makes testing your proxy easy.
|
164
|
+
test_files: []
|
165
|
+
has_rdoc:
|