proxy_pac_rb 0.8.2 → 0.9.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.
- checksums.yaml +4 -4
- data/.travis.yml +3 -2
- data/Gemfile +1 -1
- data/History.md +2 -0
- data/Rakefile +2 -0
- data/features/compress_proxy_pac.feature +5 -5
- data/features/support/aruba.rb +2 -9
- data/lib/proxy_pac_rb/cli/find_proxy.rb +0 -1
- data/lib/proxy_pac_rb/proxy_pac_compressor.rb +4 -9
- data/lib/proxy_pac_rb/proxy_pac_loader.rb +1 -1
- data/lib/proxy_pac_rb/rack/proxy_pac_compressor.rb +0 -2
- data/lib/proxy_pac_rb/rack/proxy_pac_linter.rb +0 -2
- data/lib/proxy_pac_rb/rspec/helpers.rb +1 -1
- data/lib/proxy_pac_rb/version.rb +1 -1
- data/proxy_pac_rb.gemspec +1 -1
- data/spec/api/proxy_pac_compressor_spec.rb +1 -1
- data/spec/api/proxy_pac_dumper_spec.rb +4 -4
- data/spec/api/proxy_pac_linter_spec.rb +1 -1
- data/spec/api/proxy_pac_loader_spec.rb +1 -1
- data/spec/code_configuration_spec.rb +1 -1
- data/spec/parser_spec.rb +1 -1
- data/spec/rack/proxy_pac_compressor_spec.rb +1 -1
- data/spec/rspec/readability_spec.rb +2 -2
- data/spec/support/aruba.rb +3 -20
- metadata +7 -12
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9c609f5450ae3c5d31bde4b270ab0a72c53f7ab9
|
4
|
+
data.tar.gz: 33697253051d84fcdafbeffbd5fcdba85e1314f9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b2cff58a27319e27abe84babaa3248d616ce823e56603ddc7ec4021f68ed95affa495b3e83de04387e0b9372f02e2c99e0604322bac95b03b22e1802d4abc4c1
|
7
|
+
data.tar.gz: a5cf9842df03b58684e6da48dbf6f697602a1043a242c02b1da8f7e2c9ddace76e12ae80ae5cae0e4a794cd28e81571dfee809417e570cdee0b6f6cbcaa96afd
|
data/.travis.yml
CHANGED
data/Gemfile
CHANGED
@@ -15,7 +15,7 @@ group :debug do
|
|
15
15
|
end
|
16
16
|
|
17
17
|
group :development, :test do
|
18
|
-
gem 'aruba', require: false
|
18
|
+
gem 'aruba', '~>0.10.0', require: false
|
19
19
|
gem 'awesome_print', require: 'ap'
|
20
20
|
gem 'bundler', '~> 1.3', require: false
|
21
21
|
gem 'command_exec', require: false
|
data/History.md
ADDED
data/Rakefile
CHANGED
@@ -42,10 +42,12 @@ namespace :test do
|
|
42
42
|
desc 'Setup test environment'
|
43
43
|
task :before do
|
44
44
|
@web_server = Process.spawn 'rackup -p 65535 script/config.ru'
|
45
|
+
puts "Started webserver with PID #{@web_server}."
|
45
46
|
end
|
46
47
|
|
47
48
|
desc 'Teardown test environment'
|
48
49
|
task :after do
|
50
|
+
puts "Stopping webserver with PID #{@web_server}."
|
49
51
|
sh "kill -9 #{@web_server}"
|
50
52
|
end
|
51
53
|
end
|
@@ -15,7 +15,7 @@ Feature: Compress proxy pac
|
|
15
15
|
When I successfully run `pprb compress pac_file -p proxy.pac.in`
|
16
16
|
Then the file "proxy.pac" should contain:
|
17
17
|
"""
|
18
|
-
function FindProxyForURL() {
|
18
|
+
function FindProxyForURL(url, host) {
|
19
19
|
return "PROXY localhost:3128";
|
20
20
|
}
|
21
21
|
"""
|
@@ -31,7 +31,7 @@ Feature: Compress proxy pac
|
|
31
31
|
When I successfully run `pprb compress pac_file -p proxy.pac`
|
32
32
|
Then the file "proxy.pac.out" should contain:
|
33
33
|
"""
|
34
|
-
function FindProxyForURL() {
|
34
|
+
function FindProxyForURL(url, host) {
|
35
35
|
return "PROXY localhost:3128";
|
36
36
|
}
|
37
37
|
"""
|
@@ -75,19 +75,19 @@ Feature: Compress proxy pac
|
|
75
75
|
When I successfully run `pprb compress pac_file -p proxy1.pac.in proxy2.pac.in proxy3.pac`
|
76
76
|
Then the file "proxy1.pac" should contain:
|
77
77
|
"""
|
78
|
-
function FindProxyForURL() {
|
78
|
+
function FindProxyForURL(url, host) {
|
79
79
|
return "PROXY localhost:3128";
|
80
80
|
}
|
81
81
|
"""
|
82
82
|
And the file "proxy2.pac" should contain:
|
83
83
|
"""
|
84
|
-
function FindProxyForURL() {
|
84
|
+
function FindProxyForURL(url, host) {
|
85
85
|
return "PROXY localhost:3128";
|
86
86
|
}
|
87
87
|
"""
|
88
88
|
And the file "proxy3.pac.out" should contain:
|
89
89
|
"""
|
90
|
-
function FindProxyForURL() {
|
90
|
+
function FindProxyForURL(url, host) {
|
91
91
|
return "PROXY localhost:3128";
|
92
92
|
}
|
93
93
|
"""
|
data/features/support/aruba.rb
CHANGED
@@ -1,13 +1,6 @@
|
|
1
1
|
# encoding: utf-8
|
2
2
|
require 'aruba/cucumber'
|
3
3
|
|
4
|
-
|
5
|
-
|
6
|
-
module Aruba
|
7
|
-
def dirs
|
8
|
-
@dirs ||= %w(tmp cucumber)
|
9
|
-
end
|
10
|
-
end
|
4
|
+
Aruba.configure do |config|
|
5
|
+
config.working_directory = 'tmp/cucumber'
|
11
6
|
end
|
12
|
-
|
13
|
-
World(FeatureHelper::Aruba)
|
@@ -16,24 +16,19 @@ module ProxyPacRb
|
|
16
16
|
# inline_script: false, # Escape occurrences of </script in strings
|
17
17
|
# quote_keys: false, # Quote keys in object literals
|
18
18
|
# max_line_len: 32 * 1024, # Maximum line length in minified code
|
19
|
-
max_line_len: 1024,
|
19
|
+
max_line_len: 1024, # Maximum line length in minified code
|
20
20
|
# bracketize: true, # Bracketize if, for, do, while or with statements, even if their body is a single statement
|
21
21
|
# semicolons: true, # Separate statements with semicolons
|
22
22
|
# preserve_line: false, # Preserve line numbers in outputs
|
23
23
|
# beautify: false, # Beautify output
|
24
|
-
beautify: true,
|
24
|
+
beautify: true, # Beautify output
|
25
25
|
# indent_level: 4, # Indent level in spaces
|
26
26
|
# indent_start: 0, # Starting indent level
|
27
27
|
# space_colon: false, # Insert space before colons (only with beautifier)
|
28
28
|
# width: 80, # Specify line width when beautifier is used (only with beautifier)
|
29
29
|
# preamble: nil # Preamble for the generated JS file. Can be used to insert any code or comment.
|
30
30
|
},
|
31
|
-
mangle:
|
32
|
-
# eval: false, # Mangle names when eval of when is used in scope
|
33
|
-
# except: ["$super"], # Argument names to be excluded from mangling
|
34
|
-
# sort: false, # Assign shorter names to most frequently used variables. Often results in bigger output after gzip.
|
35
|
-
# toplevel: false # Mangle names declared in the toplevel scope
|
36
|
-
},
|
31
|
+
mangle: false,
|
37
32
|
compress: {
|
38
33
|
# sequences: false, # Allow statements to be joined by commas
|
39
34
|
# properties: true, # Rewrite property access using the dot notation
|
@@ -50,7 +45,7 @@ module ProxyPacRb
|
|
50
45
|
# hoist_vars: false, # Hoist var declarations
|
51
46
|
# if_return: true, # Optimizations for if/return and if/continue
|
52
47
|
# join_vars: true, # Join consecutive var statements
|
53
|
-
join_vars: false,
|
48
|
+
join_vars: false, # Join consecutive var statements
|
54
49
|
# cascade: true, # Cascade sequences
|
55
50
|
# negate_iife: true, # Negate immediately invoked function expressions to avoid extra parens
|
56
51
|
# pure_getters: false, # Assume that object property access does not have any side-effects
|
@@ -45,10 +45,8 @@ module ProxyPacRb
|
|
45
45
|
status, headers, body = @app.call(env)
|
46
46
|
|
47
47
|
return [status, headers, body] if enabled == false
|
48
|
-
# rubocop:disable Style/SpaceAroundOperators
|
49
48
|
return [status, headers, body] unless headers.key?('Content-Type') \
|
50
49
|
&& %r{application/x-ns-proxy-autoconfig} === headers['Content-Type']
|
51
|
-
# rubocop:enabled Style/SpaceAroundOperators
|
52
50
|
|
53
51
|
content = ''
|
54
52
|
body.each { |part| content << part }
|
@@ -37,10 +37,8 @@ module ProxyPacRb
|
|
37
37
|
status, headers, body = @app.call(env)
|
38
38
|
|
39
39
|
return [status, headers, body] if enabled == false
|
40
|
-
# rubocop:disable Style/SpaceAroundOperators
|
41
40
|
return [status, headers, body] unless headers.key?('Content-Type') \
|
42
41
|
&& %r{application/x-ns-proxy-autoconfig} === headers['Content-Type']
|
43
|
-
# rubocop:enabled Style/SpaceAroundOperators
|
44
42
|
|
45
43
|
content = ''
|
46
44
|
body.each { |part| content << part }
|
data/lib/proxy_pac_rb/version.rb
CHANGED
data/proxy_pac_rb.gemspec
CHANGED
@@ -4,7 +4,7 @@ RSpec.describe ProxyPacCompressor do
|
|
4
4
|
subject(:proxy_pac) { instance_double('ProxyPac::ProxyPacFile') }
|
5
5
|
|
6
6
|
let(:compressor) { described_class.new }
|
7
|
-
let(:modified_content) { %(function FindProxyForURL() {\n return \"DIRECT\";\n}) }
|
7
|
+
let(:modified_content) { %(function FindProxyForURL(url, host) {\n return \"DIRECT\";\n}) }
|
8
8
|
|
9
9
|
let(:content) do
|
10
10
|
<<-EOS.strip_heredoc.chomp
|
@@ -1,6 +1,6 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
|
-
RSpec.describe ProxyPacDumper do
|
3
|
+
RSpec.describe ProxyPacDumper, type: :aruba do
|
4
4
|
subject(:proxy_pac) { instance_double('ProxyPac::ProxyPacFile') }
|
5
5
|
|
6
6
|
let(:content) do
|
@@ -34,7 +34,7 @@ RSpec.describe ProxyPacDumper do
|
|
34
34
|
|
35
35
|
context 'when proxy pac is string' do
|
36
36
|
before :each do
|
37
|
-
|
37
|
+
cd('.') do
|
38
38
|
dumper.dump(proxy_pac, type: :string)
|
39
39
|
end
|
40
40
|
end
|
@@ -51,13 +51,13 @@ RSpec.describe ProxyPacDumper do
|
|
51
51
|
end
|
52
52
|
|
53
53
|
before :each do
|
54
|
-
|
54
|
+
cd('.') do
|
55
55
|
dumper.dump(proxy_pac, type: :template)
|
56
56
|
end
|
57
57
|
end
|
58
58
|
|
59
59
|
around :example do |example|
|
60
|
-
|
60
|
+
cd('.') { example.call }
|
61
61
|
end
|
62
62
|
|
63
63
|
it { expect(destination).to be_existing_file }
|
data/spec/parser_spec.rb
CHANGED
@@ -3,7 +3,7 @@ require 'proxy_pac_rb/rack/proxy_pac_compressor'
|
|
3
3
|
require 'rack/lint'
|
4
4
|
|
5
5
|
RSpec.describe ProxyPacRb::Rack::ProxyPacCompressor, type: :rack_test do
|
6
|
-
let(:compressed_content) { %(function FindProxyForURL() {\n return \"DIRECT\";\n}) }
|
6
|
+
let(:compressed_content) { %(function FindProxyForURL(url, host) {\n return \"DIRECT\";\n}) }
|
7
7
|
|
8
8
|
before(:each) { get '/' }
|
9
9
|
subject(:body) { last_response.body }
|
@@ -1,7 +1,7 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
require 'proxy_pac_rb/rspec'
|
3
3
|
|
4
|
-
RSpec.describe 'Readability', type: :proxy_pac do
|
4
|
+
RSpec.describe 'Readability', type: [:proxy_pac, :aruba] do
|
5
5
|
let(:content) do
|
6
6
|
<<-EOS.strip_heredoc.chomp
|
7
7
|
function FindProxyForURL(url, host) {
|
@@ -11,7 +11,7 @@ RSpec.describe 'Readability', type: :proxy_pac do
|
|
11
11
|
end
|
12
12
|
|
13
13
|
context 'when is file' do
|
14
|
-
let(:root_path) {
|
14
|
+
let(:root_path) { expand_path('.') }
|
15
15
|
|
16
16
|
subject { 'proxy.pac' }
|
17
17
|
|
data/spec/support/aruba.rb
CHANGED
@@ -1,23 +1,6 @@
|
|
1
1
|
# encoding: utf-8
|
2
|
-
require 'aruba/
|
3
|
-
require 'aruba/reporting'
|
2
|
+
require 'aruba/rspec'
|
4
3
|
|
5
|
-
|
6
|
-
|
7
|
-
# Helpers for aruba
|
8
|
-
module Aruba
|
9
|
-
include ::Aruba::Api
|
10
|
-
|
11
|
-
def dirs
|
12
|
-
@dirs ||= %w(tmp rspec)
|
13
|
-
end
|
14
|
-
end
|
15
|
-
end
|
16
|
-
|
17
|
-
RSpec.configure do |c|
|
18
|
-
c.include SpecHelper::Aruba
|
19
|
-
c.before :each do
|
20
|
-
clean_current_directory
|
21
|
-
restore_env
|
22
|
-
end
|
4
|
+
Aruba.configure do |config|
|
5
|
+
config.working_directory = 'tmp/rspec'
|
23
6
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: proxy_pac_rb
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.9.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dennis Günnewig
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-11-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: addressable
|
@@ -94,14 +94,8 @@ dependencies:
|
|
94
94
|
- - "~>"
|
95
95
|
- !ruby/object:Gem::Version
|
96
96
|
version: '0.19'
|
97
|
-
description:
|
98
|
-
files. It comes with a cli program, some rack middlewares and can be used from within
|
99
|
-
ruby scripts as well. "proxy_pac_rb" uses a JavaScript runtime to evaulate a proxy
|
100
|
-
auto-config file the same way a browser does to determine what proxy (if any at
|
101
|
-
all) should a program use to connect to a server. You must install on of the supported
|
102
|
-
JavaScript runtimes: therubyracer or therubyrhino
|
103
|
-
|
104
|
-
'
|
97
|
+
description: |
|
98
|
+
"proxy_pac_rb" is a gem to compress, lint and parse proxy auto-config files. It comes with a cli program, some rack middlewares and can be used from within ruby scripts as well. "proxy_pac_rb" uses a JavaScript runtime to evaulate a proxy auto-config file the same way a browser does to determine what proxy (if any at all) should a program use to connect to a server. You must install on of the supported JavaScript runtimes: therubyracer or therubyrhino
|
105
99
|
email:
|
106
100
|
- dg1@vrnetze.de
|
107
101
|
executables:
|
@@ -118,6 +112,7 @@ files:
|
|
118
112
|
- ".yardopts"
|
119
113
|
- CONTRIBUTING.md
|
120
114
|
- Gemfile
|
115
|
+
- History.md
|
121
116
|
- LICENSE.md
|
122
117
|
- README.md
|
123
118
|
- Rakefile
|
@@ -251,7 +246,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
251
246
|
requirements:
|
252
247
|
- - "~>"
|
253
248
|
- !ruby/object:Gem::Version
|
254
|
-
version: '2.
|
249
|
+
version: '2.1'
|
255
250
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
256
251
|
requirements:
|
257
252
|
- - ">="
|
@@ -259,7 +254,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
259
254
|
version: '0'
|
260
255
|
requirements: []
|
261
256
|
rubyforge_project:
|
262
|
-
rubygems_version: 2.4.5
|
257
|
+
rubygems_version: 2.4.5.1
|
263
258
|
signing_key:
|
264
259
|
specification_version: 4
|
265
260
|
summary: Compress, lint and parse proxy auto-config files from commandline, rack-compatible
|