proxy_tester 0.0.1

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.
Files changed (103) hide show
  1. data/.gitignore +22 -0
  2. data/.rdebugrc +7 -0
  3. data/.rspec +3 -0
  4. data/.simplecov +8 -0
  5. data/Gemfile +37 -0
  6. data/Gemfile.lock +199 -0
  7. data/LICENSE.txt +22 -0
  8. data/Procfile +1 -0
  9. data/README.md +582 -0
  10. data/Rakefile +64 -0
  11. data/bin/proxy_tester +11 -0
  12. data/db/migrate/20140314_create_environment.rb +8 -0
  13. data/files/config.yaml +1 -0
  14. data/files/example-config.erb +12 -0
  15. data/files/example-spec_helper.rb.erb +23 -0
  16. data/files/example-test_case.rb.erb +27 -0
  17. data/files/example-test_cases-gemfile.rb.erb +9 -0
  18. data/files/example-user_file.erb +4 -0
  19. data/lib/proxy_tester/actions/add_examples_to_test_cases_directory.rb +125 -0
  20. data/lib/proxy_tester/actions/clone_repository.rb +39 -0
  21. data/lib/proxy_tester/actions/create_directory.rb +33 -0
  22. data/lib/proxy_tester/actions/create_file.rb +55 -0
  23. data/lib/proxy_tester/actions/create_output.rb +36 -0
  24. data/lib/proxy_tester/actions/handle_error.rb +37 -0
  25. data/lib/proxy_tester/actions/initialize_application.rb +70 -0
  26. data/lib/proxy_tester/actions/show_config.rb +10 -0
  27. data/lib/proxy_tester/capybara_proxy.rb +54 -0
  28. data/lib/proxy_tester/capybara_proxy_pac.rb +62 -0
  29. data/lib/proxy_tester/cli/main.rb +59 -0
  30. data/lib/proxy_tester/config.rb +100 -0
  31. data/lib/proxy_tester/data.rb +23 -0
  32. data/lib/proxy_tester/database_session.rb +15 -0
  33. data/lib/proxy_tester/environment.rb +21 -0
  34. data/lib/proxy_tester/erb_generator.rb +34 -0
  35. data/lib/proxy_tester/error_handler.rb +107 -0
  36. data/lib/proxy_tester/error_messages.rb +82 -0
  37. data/lib/proxy_tester/exceptions.rb +53 -0
  38. data/lib/proxy_tester/git_file.rb +31 -0
  39. data/lib/proxy_tester/git_null_file.rb +32 -0
  40. data/lib/proxy_tester/git_repository.rb +120 -0
  41. data/lib/proxy_tester/handle_error.rb +37 -0
  42. data/lib/proxy_tester/locales/en-rails.yml +205 -0
  43. data/lib/proxy_tester/locales/en.yml +42 -0
  44. data/lib/proxy_tester/main.rb +46 -0
  45. data/lib/proxy_tester/models/user.rb +17 -0
  46. data/lib/proxy_tester/pac_result.rb +50 -0
  47. data/lib/proxy_tester/rspec/helper.rb +211 -0
  48. data/lib/proxy_tester/rspec_runner.rb +43 -0
  49. data/lib/proxy_tester/template_file.rb +19 -0
  50. data/lib/proxy_tester/template_repository.rb +22 -0
  51. data/lib/proxy_tester/ui_logger.rb +30 -0
  52. data/lib/proxy_tester/user_database.rb +24 -0
  53. data/lib/proxy_tester/version.rb +3 -0
  54. data/lib/proxy_tester.rb +54 -0
  55. data/proxy_tester.gemspec +34 -0
  56. data/script/acceptance_test +4 -0
  57. data/script/bootstrap +56 -0
  58. data/script/ci +3 -0
  59. data/script/console +14 -0
  60. data/script/release +3 -0
  61. data/script/test_web +22 -0
  62. data/script/unit_test +3 -0
  63. data/spec/actions/add_examples_to_test_cases_directory_spec.rb +52 -0
  64. data/spec/actions/clone_repository_spec.rb +83 -0
  65. data/spec/actions/create_directory_spec.rb +59 -0
  66. data/spec/actions/create_file_spec.rb +139 -0
  67. data/spec/actions/create_output_spec.rb +46 -0
  68. data/spec/actions/handle_error_spec.rb +74 -0
  69. data/spec/actions/initialize_application_spec.rb +40 -0
  70. data/spec/actions/show_config_spec.rb +22 -0
  71. data/spec/capybara_proxy_pac_spec.rb +42 -0
  72. data/spec/capybara_proxy_spec.rb +76 -0
  73. data/spec/config_spec.rb +86 -0
  74. data/spec/data_spec.rb +34 -0
  75. data/spec/environment_spec.rb +25 -0
  76. data/spec/erb_generator_spec.rb +31 -0
  77. data/spec/examples/proxy.pac +7 -0
  78. data/spec/factories.rb +8 -0
  79. data/spec/features/check_ssl_sites_spec.rb +8 -0
  80. data/spec/git_file_spec.rb +46 -0
  81. data/spec/git_repository_spec.rb +111 -0
  82. data/spec/main_spec.rb +25 -0
  83. data/spec/pac_result_spec.rb +20 -0
  84. data/spec/proxy_tester_spec_helper_spec.rb +137 -0
  85. data/spec/rspec_runner_spec.rb +29 -0
  86. data/spec/spec_helper.rb +15 -0
  87. data/spec/support/capybara.rb +11 -0
  88. data/spec/support/database_cleaner.rb +14 -0
  89. data/spec/support/debugging.rb +3 -0
  90. data/spec/support/environment.rb +33 -0
  91. data/spec/support/example.rb +16 -0
  92. data/spec/support/factory_girl.rb +15 -0
  93. data/spec/support/filesystem.rb +19 -0
  94. data/spec/support/helper_features.rb +31 -0
  95. data/spec/support/matcher.rb +17 -0
  96. data/spec/support/reporting.rb +1 -0
  97. data/spec/support/rspec.rb +5 -0
  98. data/spec/support/string.rb +2 -0
  99. data/spec/template_file_spec.rb +25 -0
  100. data/spec/template_repository_spec.rb +44 -0
  101. data/spec/user_database_spec.rb +63 -0
  102. data/spec/user_spec.rb +62 -0
  103. metadata +398 -0
data/README.md ADDED
@@ -0,0 +1,582 @@
1
+ # ProxyTester - testing with rspec for http and socks proxies
2
+
3
+ The `proxy_tester` helps you maintaining your proxy infrastructure by writing
4
+ tests which can be run automatically. It uses `rspec` in the background to make
5
+ that thing possible and adds some helper methods to make testing proxies
6
+ easier.
7
+
8
+ Today `proxy_tester` supports "HTTP"- and "SOCKS5"-Proxies.
9
+
10
+ ## Installation
11
+
12
+ Add this line to your application's Gemfile:
13
+
14
+ gem 'proxy_tester'
15
+
16
+ And then execute:
17
+
18
+ $ bundle
19
+
20
+ Or install it yourself as:
21
+
22
+ $ gem install proxy_tester
23
+
24
+ ## Usage
25
+
26
+ ### Quick start
27
+
28
+ **Initialize proxy tester**
29
+
30
+ This will create all files and directories needed to run proxy tester. Thanks
31
+ to `--pre-seed` it will also add some example files to your test
32
+ infrastructure, e.g. `spec_helper`, `example_spec.rb`.
33
+
34
+ ```bash
35
+ % proxy_tester init --pre-seed
36
+ ```
37
+
38
+ **Modify example spec**
39
+
40
+ 1. Add your proxy, e.g. `localhost:3128` to the spec
41
+ 2. Add a user + password to `users.csv` and to the `example_spec.rb` if your proxy needs authentication
42
+
43
+ **Run tests**
44
+
45
+ ```bash
46
+ % proxy_tester test
47
+ ```
48
+
49
+ **Getting in touch with the screenshots taken during test**
50
+
51
+ ```bash
52
+ # Please choose your preferred viewer, e.g. feh and the correct date/time for your test
53
+ % feh ~/.local/share/proxy_tester/reports.d/2014-03-19_17:22:00/*.png
54
+ ```
55
+
56
+ ### Getting started (WIP)
57
+
58
+ **Getting help**
59
+
60
+ ```bash
61
+ % proxy_tester help
62
+ % proxy_tester help <cmd>
63
+ ```
64
+
65
+ **Prepare a configuration file for proxy_tester**
66
+
67
+ For more details please see the chapter [Writing Configuration File](#write_config) for
68
+ that.
69
+
70
+ **Initialize proxy tester**
71
+
72
+ This will create all files and directories needed to run proxy tester.
73
+
74
+ ```bash
75
+ % proxy_tester init
76
+ ```
77
+
78
+ By default it creates the following directories/files:
79
+
80
+ * `$HOME/.local/share/proxy_tester`
81
+ * `$HOME/.local/share/proxy_tester/reports.d`
82
+ * `$HOME/.config/proxy_tester`
83
+ * `$HOME/.config/proxy_tester/testcases.d`
84
+ * `$HOME/.config/proxy_tester/config.yaml`
85
+ * `$HOME/.config/proxy_tester/users.csv`
86
+
87
+ `proxy_tester` supports different options for init
88
+
89
+
90
+ ```bash
91
+ % proxy_tester help init
92
+
93
+ # Usage:
94
+ # proxy_tester init
95
+ #
96
+ # Options:
97
+ # [--force] # Overwrite existing files?
98
+ # [--pre-seed] # Add examples to test cases directory
99
+ # [--test-cases-directory=TEST_CASES_DIRECTORY] # Directory with test cases
100
+ # [--user-file=USER_FILE] # Path to user file
101
+ # [--create-config-file] # Create config file
102
+ # # Default: true
103
+ # [--create-user-file] # Create user file
104
+ # # Default: true
105
+ # [--create-test-cases-directory] # Create directory to store test cases
106
+ # # Default: true
107
+ # [--config-file=CONFIG_FILE] # Config file
108
+ # [--log-level=LOG_LEVEL] # Log level for ui logging
109
+ # [--debug-mode] # Run application in debug mode
110
+ ```
111
+
112
+ **Adding users to users.csv**
113
+
114
+ If your proxy needs user authentication you can use the `use_user`-method
115
+ together with the `users.csv`. Make sure you keep the users.csv safe (and out
116
+ of a central vcs) because the passwords need to be stored in plain text.
117
+
118
+
119
+ ```csv
120
+ "name","password","description"
121
+ "user1","password1","test user abc"
122
+ "user2","password2","test user efg"
123
+ ```
124
+
125
+ In your spec you can refer to the users by using the following code snippet.
126
+ There is no need to write the password into the spec file. `proxy_helper` will
127
+ look it up.
128
+
129
+ ```ruby
130
+ it 'blocks www.example.org' do
131
+ use_proxy 'localhost:3128'
132
+ use_user 'user1'
133
+
134
+ use_timeout(100) do
135
+ visit 'http://www.example.org'
136
+ end
137
+
138
+ expect(page).to have_content('Access forbidden')
139
+ expect(page.status_code).to eq 403
140
+ end
141
+ ```
142
+
143
+ **Writing specs**
144
+
145
+ For more details please see the chapter [Writing Specs](#writing_specs) for
146
+ that.
147
+
148
+ **Run the tests**
149
+
150
+ Run the tests on commandline
151
+
152
+ ```bash
153
+ % proxy_tester test
154
+ ```
155
+
156
+ It supports several different options:
157
+
158
+ ```bash
159
+ % proxy_tester help test
160
+
161
+ # Usage:
162
+ # proxy_tester test
163
+ #
164
+ # Options:
165
+ # [--test-cases-directory=TEST_CASES_DIRECTORY] # Directory with test cases
166
+ # [--tags=one two three] # Filter tests based on tags
167
+ # [--config-file=CONFIG_FILE] # Config file
168
+ # [--log-level=LOG_LEVEL] # Log level for ui logging
169
+ # [--debug-mode] # Run application in debug mode
170
+ #
171
+ ```
172
+
173
+ If you want to limit the tests which should be run by `proxy_tester` you can
174
+ use the `--tags`-switch. Make sure you've flagged your examples correctly - see
175
+ [rspec documentation](https://www.relishapp.com/rspec/rspec-core/v/2-4/docs/command-line/tag-option)
176
+ for more about this topic.
177
+
178
+
179
+ ## Writing Specs
180
+ <a name="writing_specs"></a>
181
+
182
+ ### Introduction
183
+
184
+ **Recommended structure for testcases**
185
+
186
+ For my specs I use the following structure. Additionally I use `git` for
187
+ version control.
188
+
189
+ ```
190
+ testcase.d
191
+ infrastructure1
192
+ infrastructure1_abc_spec.rb
193
+ infrastructure1_def_spec.rb
194
+ spec_helper.rb
195
+ support
196
+ rspec.rb
197
+ shared_examples-base.rb
198
+ [...]
199
+ ```
200
+
201
+ **The spec file(s)**
202
+
203
+ I took screenshots for all my tests in an `after`-hook to be able to provide reports after
204
+ testing. For each environment, e.g. `production`, `staging`, I create a diffent
205
+ context adding a flag, e.g `:production`, for easier filterung. For each proxy
206
+ I add a context and set the subject to the proxy hostname/ip address + port.
207
+ The `it_behaves_like`-method is special because it references a shared example.
208
+ More on this can be found later.
209
+
210
+ Name: `infrastructure1_abc_spec.rb`
211
+
212
+ ```ruby
213
+ # encoding: utf-8
214
+ describe 'Infrastructure XY' do
215
+ after :each do
216
+ take_screenshot
217
+ end
218
+
219
+ before :each do
220
+ use_user 'user1'
221
+ end
222
+
223
+ context 'Production', :production do
224
+ context 'proxy1' do
225
+ subject { 'proxy1.localdomain:8080' }
226
+
227
+ it_behaves_like 'a base proxy'
228
+ end
229
+
230
+ context 'proxy2' do
231
+ subject { 'proxy2.localdomain:8080' }
232
+
233
+ it_behaves_like 'a base proxy'
234
+ end
235
+ end
236
+
237
+ context 'Staging', :staging do
238
+ context 'proxy1-int' do
239
+ subject { 'proxy1-int.localdomain:8080' }
240
+
241
+ it_behaves_like 'a base proxy'
242
+ end
243
+
244
+ context 'proxy2-int' do
245
+ subject { 'proxy2-int.localdomain:8080' }
246
+
247
+ it_behaves_like 'a base proxy'
248
+ end
249
+ end
250
+ end
251
+ ```
252
+
253
+ **The spec helper file**
254
+
255
+ In my spec helper file I load all files found in support to make shared
256
+ examples and other files available.
257
+
258
+ Name: `spec_helper.rb`
259
+
260
+ ```
261
+ # encoding: utf-8
262
+
263
+ # Loading support files
264
+ Dir.glob(::File.expand_path('../support/*.rb', __FILE__)).each { |f| require_relative f }
265
+
266
+ begin
267
+ require 'bundler'
268
+ Bundler.require :default
269
+ rescue
270
+ $stderr.puts 'Please install ruby gem "bundler" before using this spec_helper.rb in your proxy_tester-spec files.'
271
+ exit(-1)
272
+ end
273
+
274
+ # *open-uri*
275
+ # Easier use of urls in scripts
276
+ # Please see "http://www.ruby-doc.org/stdlib-2.1.1/libdoc/open-uri/rdoc/OpenURI.html" for further information
277
+ require 'open-uri'
278
+ ```
279
+
280
+ **The spec configuration**
281
+
282
+ I want `rspec` to run only those examples which are flagged with `:focus`. If
283
+ there is no example with a flag `:focus`. It should run all examples. I use the
284
+ `:focus`-flag while developing a test or debugging existing tests.
285
+
286
+ Name: `rspec.rb`
287
+
288
+ ```
289
+ RSpec.configure do |c|
290
+ c.filter_run_including :focus => true
291
+ c.run_all_when_everything_filtered = true
292
+ c.treat_symbols_as_metadata_keys_with_true_values = true
293
+ end
294
+ ```
295
+
296
+ **Shared examples: base**
297
+
298
+ To `DRY` my examples up I use shared examples. Please see [rspec
299
+ documentation](https://www.relishapp.com/rspec/rspec-core/docs/example-groups/shared-examples)
300
+ for more detailed information.
301
+
302
+ Name: `shared_examples-base.rb`
303
+
304
+ ```
305
+ # encoding: utf-8
306
+ require_relative 'shared_examples'
307
+
308
+ shared_examples 'a base proxy' do
309
+ before :each do
310
+ use_proxy subject
311
+ end
312
+
313
+ it 'works with http://www.example.org' do
314
+ visit 'http://www.example.org'
315
+ expect(page).to have_content('Example Domain')
316
+ expect(page.status_code).to eq 200
317
+ end
318
+
319
+ it 'blocks eicar virus' do
320
+ visit 'http://www.eicar.org/download/eicar.com'
321
+ find('div#lk_info').trigger('click')
322
+
323
+ expect(page).to have_content('Access blocked')
324
+ expect(page.status_code).to eq 403
325
+ end
326
+ end
327
+ ```
328
+
329
+ ### Helper methods
330
+
331
+ This gem includes all helper methods provided by
332
+ [`capybara`](https://github.com/jnicklas/capybara) and
333
+ [`poltergeist`](https://github.com/jonleighton/poltergeist) plus those listed
334
+ below. To see the most current list of available methods please look for
335
+ `lib/proxy_tester/rspec/helper.rb`.
336
+
337
+ * `runtime`
338
+
339
+ This method returns the time of `proxy_tester`-run.
340
+
341
+ ```ruby
342
+ # time of run, YYYY-MM-DD_HH:mm:ss
343
+ runtime
344
+ ```
345
+
346
+ * proxy
347
+
348
+ This method returns the proxy set earlier. It holds the proxy-object.
349
+
350
+ ```ruby
351
+ # proxy host
352
+ proxy.host
353
+ proxy.host = 'host'
354
+
355
+ # proxy port
356
+ proxy.port
357
+ proxy.port = 3128
358
+
359
+ # proxy type :none, :http, :socks5
360
+ proxy.type
361
+ proxy.type = :none
362
+
363
+ # is blank?
364
+ proxy.blank?
365
+ ```
366
+
367
+ * proxy_pac
368
+
369
+ This method returns the proxy pac set earlier. It holds the proxy_pac-object.
370
+
371
+ ```ruby
372
+ # proxy host
373
+ proxy_pac.host
374
+
375
+ # proxy port
376
+ proxy_pac.port
377
+
378
+ # client ip
379
+ proxy_pac.client_ip
380
+ proxy_pac.client_ip = '127.0.0.1'
381
+
382
+ # url to proxy pac
383
+ proxy_pac.url
384
+ proxy_pac.url = 'http://www.example.org'
385
+ proxy_pac.url = 'www.example.org' # heuristic parsing via addressable
386
+
387
+ # path/url to proxy pac-file
388
+ proxy_pac.pac_file
389
+ proxy_pac.pac_file = 'http://pac.in.domain.org/proxy.pac'
390
+ proxy_pac.pac_file = '/path/to/file.pac'
391
+
392
+ # is blank? => port + host = blank
393
+ proxy_pac.blank?
394
+
395
+ # direct? => no proxy
396
+ proxy_pac.direct?
397
+
398
+ ```
399
+
400
+ * cleanup_reports
401
+
402
+ The gem supports a method to create a screenshot for a visited website. To
403
+ keep the `reports.d`-directory clean, the last 5 report-directories are kept only.
404
+
405
+ ```ruby
406
+ before :all do
407
+ cleanup_reports
408
+ end
409
+ ```
410
+
411
+ If you want to change this, set the `@__keep_report_directories` to the needed
412
+ value in an `before(:all)`-hook.
413
+
414
+ ```ruby
415
+ before :all do
416
+ # keep the last 10 report directories
417
+ @__keep_report_directories = 10
418
+ cleanup_reports
419
+ end
420
+ ```
421
+
422
+ * take_screenshot
423
+
424
+ If you want to take a screenshot of a visited website, you can use
425
+ `take_screenshot`. By default all screenshots are stored in `reports.d`.
426
+
427
+ ```ruby
428
+ after :each do
429
+ take_screenshot
430
+ end
431
+ ```
432
+
433
+ * view_screenshot (alias: show_screenshot)
434
+
435
+ While debugging an example it might be handy to view the fetched website. This
436
+ can be done using the `view_screenshot`-helper. It opens the screenshot in your
437
+ preferred image viewer.
438
+
439
+ ```ruby
440
+ context 'proxy1' do
441
+ subject { 'proxy1.localdomain:8080' }
442
+
443
+ it 'works with http://www.example.org' do
444
+ use_proxy subject
445
+
446
+ visit 'http://www.example.org'
447
+
448
+ view_screenshot
449
+
450
+ expect(page).to have_content('Example Domain')
451
+ expect(page.status_code).to eq 200
452
+ end
453
+
454
+ end
455
+ ```
456
+
457
+ * use_user_agent
458
+
459
+ Set the user agent used by the driver.
460
+
461
+ ```ruby
462
+ context 'proxy1' do
463
+ subject { 'proxy1.localdomain:8080' }
464
+
465
+ it 'works with http://www.example.org' do
466
+ use_proxy subject
467
+
468
+ use_user_agent 'Mozilla/5.0 (X11; Linux x86_64; rv:27.0) Gecko/20100101 Firefox/27.0'
469
+
470
+ visit 'http://www.example.org'
471
+
472
+ expect(page).to have_content('Example Domain')
473
+ expect(page.status_code).to eq 200
474
+ end
475
+ end
476
+ ```
477
+
478
+ * use_user
479
+
480
+ Set the user used to connect to the proxy.
481
+
482
+
483
+ ```ruby
484
+ it 'blocks www.example.org for user "user1"' do
485
+ use_proxy subject
486
+ use_user 'user1'
487
+
488
+ visit 'http://www.example.org'
489
+
490
+ expect(page).to have_content('Access forbidden')
491
+ expect(page.status_code).to eq 403
492
+ end
493
+ ```
494
+
495
+ * use_client_ip
496
+
497
+ Set the client ip address used during proxy pac evaluation.
498
+
499
+ ```ruby
500
+ it 'blocks www.example.org' do
501
+ use_proxy :pac, 'http://localhost/proxy.pac'
502
+ use_client_ip '127.0.0.1'
503
+
504
+ visit 'http://www.example.org'
505
+
506
+ expect(page).to have_content('Access forbidden')
507
+ expect(page.status_code).to eq 403
508
+ end
509
+ ```
510
+
511
+ * use_time
512
+
513
+ Set the time used during proxy pac evaluation.
514
+
515
+ ```ruby
516
+ it 'blocks www.example.org' do
517
+ use_proxy :pac, 'http://localhost/proxy.pac'
518
+ use_time '2014-03-07 05:12:20'
519
+
520
+ visit 'http://www.example.org'
521
+
522
+ expect(page).to have_content('Access forbidden')
523
+ expect(page.status_code).to eq 403
524
+ end
525
+
526
+ ```
527
+
528
+ * use_proxy
529
+
530
+ Set the proxy host or proxy pac used to forward the traffic.
531
+
532
+ ```ruby
533
+ use_proxy :host, 'localhost:3128'
534
+ use_proxy 'localhost:3128'
535
+ use_proxy :pac, 'http://localhost/proxy.pac'
536
+ ```
537
+
538
+ * use_timeout
539
+
540
+ Set the timeout in seconds for visiting a website.
541
+
542
+ ```ruby
543
+ it 'blocks www.example.org' do
544
+ use_proxy 'localhost:3128'
545
+ use_time '2014-03-07 05:12:20'
546
+
547
+ use_timeout(100) do
548
+ visit 'http://www.example.org'
549
+ end
550
+
551
+ expect(page).to have_content('Access forbidden')
552
+ expect(page.status_code).to eq 403
553
+ end
554
+ ```
555
+
556
+ ## Writing Configuration File
557
+ <a name="write_config"></a>
558
+
559
+ The configuration file of `proxy_tester` is a simple
560
+ [yaml](http://www.yaml.org)-file. Those configuration variables are overwritten
561
+ if you choose a corresponding commandline-switch, e.g. `--config-file`-switch
562
+ for `config_file`-option. If a configuration option is not defined in config
563
+ file and not given on commandline `proxy_tester` uses default hardcoded within
564
+ the application. It supports the following variables.
565
+
566
+ ```yaml
567
+ # configuration options with defaults
568
+ # $HOME = '/home/user'
569
+ :config_file: /home/user/.config/proxy_tester/config.yaml
570
+ :user_file: /home/user/.config/proxy_tester/user.csv
571
+ :test_cases_directory: /home/user/.config/proxy_tester/test_cases.d
572
+ :examples_directory: /home/user/.config/proxy_tester/test_cases.d/examples
573
+ :reports_directory: /home/user/.share/proxy_tester/reports.d
574
+ ```
575
+
576
+ ## Contributing
577
+
578
+ 1. Fork it ( http://github.com/dg-vrnetze/proxy_tester/fork )
579
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
580
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
581
+ 4. Push to the branch (`git push origin my-new-feature`)
582
+ 5. Create new Pull Request
data/Rakefile ADDED
@@ -0,0 +1,64 @@
1
+ #!/usr/bin/env rake
2
+
3
+ require 'fedux_org/stdlib/rake'
4
+
5
+ require 'proxy_tester/version'
6
+
7
+ def software
8
+ 'proxy_tester'
9
+ end
10
+
11
+ def version
12
+ ProxyTester::VERSION
13
+ end
14
+
15
+ def root_directory
16
+ ::File.expand_path('../', __FILE__)
17
+ end
18
+
19
+ def tar_file
20
+ ::File.join(pkg_directory, "#{software}-#{version}.tar.gz")
21
+ end
22
+
23
+ def tmp_directory
24
+ ::File.join(root_directory, 'tmp', "#{software}-#{version}")
25
+ end
26
+
27
+ def gem_file
28
+ ::File.join(root_directory, 'pkg', "#{software}-#{version}.gem")
29
+ end
30
+
31
+ def pkg_directory
32
+ ::File.join(root_directory, 'pkg')
33
+ end
34
+
35
+ def gem_directory
36
+ ::File.join(root_directory, 'vendor', 'cache')
37
+ end
38
+
39
+ task :default => 'gem:build'
40
+
41
+ file gem_file => 'gem:build'
42
+
43
+ file tmp_directory do
44
+ FileUtils.mkdir_p tmp_directory
45
+ end
46
+
47
+ namespace :gem do
48
+ desc 'build tar file'
49
+ task :package => [gem_file, tmp_directory] do
50
+ FileUtils.mv ::File.join(pkg_directory, "#{software}-#{version}.gem"), tmp_directory
51
+
52
+ Dir.chdir('tmp') do
53
+ sh "tar -czf #{tar_file} #{::File.basename tmp_directory}"
54
+ end
55
+ end
56
+ end
57
+
58
+ require 'coveralls/rake/task'
59
+ Coveralls::RakeTask.new
60
+
61
+ namespace :test do
62
+ desc 'Test with coveralls'
63
+ task :coveralls => ['test:rspec', 'test:cucumber', 'coveralls:push']
64
+ end
data/bin/proxy_tester ADDED
@@ -0,0 +1,11 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ $LOAD_PATH << ::File.expand_path('../lib', __FILE__)
4
+
5
+ require 'proxy_tester'
6
+
7
+ begin
8
+ ProxyTester::Cli::Main.start
9
+ rescue StandardError => e
10
+ ProxyTester::Actions::HandleError.new(e).run
11
+ end
@@ -0,0 +1,8 @@
1
+ class CreateEnvironment < ActiveRecord::Migration
2
+ def change
3
+ create_table :users do |t|
4
+ t.string :name
5
+ t.string :password
6
+ end
7
+ end
8
+ end
data/files/config.yaml ADDED
@@ -0,0 +1 @@
1
+ ---
@@ -0,0 +1,12 @@
1
+ ---
2
+ # You might want to copy the following output to one of the allowed config
3
+ # file paths - in the given order. But be aware that at
4
+ # <%= lookup('config_file') -%>, there might be a
5
+ # config file created during initialization.
6
+ <% Array(lookup('allowed_config_file_paths')).each do |p| -%>
7
+ # * <%= p %>
8
+ <% end -%>
9
+
10
+ <% ProxyTester::Config.options.delete_if { |o| [].include? o }.each do |o| -%>
11
+ :<%= o %>: <%= lookup(o) %>
12
+ <% end -%>
@@ -0,0 +1,23 @@
1
+ # encoding: utf-8
2
+
3
+ # Loading support files
4
+ Dir.glob(::File.expand_path('../support/*.rb', __FILE__)).each { |f| require_relative f }
5
+
6
+ begin
7
+ require 'bundler'
8
+ Bundler.require :default
9
+ rescue
10
+ $stderr.puts 'Please install ruby gem "bundler" before using this spec_helper.rb in your proxy_tester-spec files.'
11
+ exit -1
12
+ end
13
+
14
+ <% Array(lookup('libraries')).each do |l| -%>
15
+ # *<%= l[:name] %>*
16
+ # <%= l[:description] %>
17
+ # Please see "<%= l[:url] %>" for further information
18
+ <%- if l[:require] -%>
19
+ require '<%= l[:require] %>'
20
+ <%- else -%>
21
+ require '<%= l[:require] %>'
22
+ <%- end -%>
23
+ <% end -%>