proxy_pac_rb 0.8.2 → 0.9.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ecdd75967c91ea19b1ceba679284915f6cb3a0bb
4
- data.tar.gz: b132a3f2b7a92c68c68dab8d0a432fcb26481532
3
+ metadata.gz: 9c609f5450ae3c5d31bde4b270ab0a72c53f7ab9
4
+ data.tar.gz: 33697253051d84fcdafbeffbd5fcdba85e1314f9
5
5
  SHA512:
6
- metadata.gz: 1a032ec25c9f63e82d97abf66aaccb3d6251d00fde0eafc0d9d1f3c10cdef9ad5a2af2e6b61ed439c803503b7e5d37fc13fd0ba8e061d47155a91526393b57fd
7
- data.tar.gz: 504bdf54c11c337171b2a8dc457e9f1719096d4ad2facf99b91086e691e6e284da0f28840d41866b442576a93cfb0d0b91843de9b119cc735b7882e7db0c6ab7
6
+ metadata.gz: b2cff58a27319e27abe84babaa3248d616ce823e56603ddc7ec4021f68ed95affa495b3e83de04387e0b9372f02e2c99e0604322bac95b03b22e1802d4abc4c1
7
+ data.tar.gz: a5cf9842df03b58684e6da48dbf6f697602a1043a242c02b1da8f7e2c9ddace76e12ae80ae5cae0e4a794cd28e81571dfee809417e570cdee0b6f6cbcaa96afd
data/.travis.yml CHANGED
@@ -1,8 +1,9 @@
1
+ sudo: false
1
2
  env:
2
3
  - CI=1
3
4
  language: ruby
4
5
  bundler_args: --without development debug profile
5
6
  rvm:
6
- - 2.1.5
7
- - 2.2.1
7
+ - 2.1.7
8
+ - 2.2.3
8
9
  script: script/test
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, git: 'https://github.com/cucumber/aruba'
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
@@ -0,0 +1,2 @@
1
+ 0.9.0:
2
+ * Don't mangle the variable names to make testing reproducible
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
  """
@@ -1,13 +1,6 @@
1
1
  # encoding: utf-8
2
2
  require 'aruba/cucumber'
3
3
 
4
- module FeatureHelper
5
- # Helpers for aruba
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)
@@ -26,7 +26,6 @@ module ProxyPacRb
26
26
  remove_proxy_environment_variables unless options[:use_proxy]
27
27
 
28
28
  file = ProxyPacRb::Parser.new(environment: environment).parse(options[:proxy_pac])
29
-
30
29
  return if file.blank?
31
30
 
32
31
  $stderr.printf("%30s: %-s\n", 'url', 'result')
@@ -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, # Maximum line length in minified code
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, # Beautify output
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, # Join consecutive var statements
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
@@ -53,7 +53,7 @@ module ProxyPacRb
53
53
  # Handle proxy pac == nil
54
54
  class ProxyPacNullLoader
55
55
  def load(proxy_pac)
56
- proxy_pac.type = :null
56
+ proxy_pac.type = :null
57
57
 
58
58
  fail StandardError
59
59
  end
@@ -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 }
@@ -27,7 +27,7 @@ module ProxyPacRb
27
27
  private
28
28
 
29
29
  def _proxy_pac_source
30
- url_host = begin
30
+ url_host = begin
31
31
  Addressable::URI.parse(subject).host
32
32
  rescue
33
33
  nil
@@ -1,5 +1,5 @@
1
1
  # encoding: utf-8
2
2
  # ProxyPacRb
3
3
  module ProxyPacRb
4
- VERSION = '0.8.2'
4
+ VERSION = '0.9.1'
5
5
  end
data/proxy_pac_rb.gemspec CHANGED
@@ -29,5 +29,5 @@ DESC
29
29
  spec.add_runtime_dependency 'contracts', '~> 0.9'
30
30
  spec.add_runtime_dependency 'thor', '~> 0.19'
31
31
 
32
- spec.required_ruby_version = '~> 2.0'
32
+ spec.required_ruby_version = '~> 2.1'
33
33
  end
@@ -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
- in_current_directory do
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
- in_current_directory do
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
- in_current_directory { example.call }
60
+ cd('.') { example.call }
61
61
  end
62
62
 
63
63
  it { expect(destination).to be_existing_file }
@@ -28,7 +28,7 @@ RSpec.describe ProxyPacLinter do
28
28
  end
29
29
 
30
30
  describe '#lint' do
31
- let(:linter) { ProxyPacLinter.new(silent: true) }
31
+ let(:linter) { ProxyPacLinter.new(silent: true) }
32
32
  let(:result) { true }
33
33
 
34
34
  before(:each) do
@@ -1,6 +1,6 @@
1
1
  require 'spec_helper'
2
2
 
3
- RSpec.describe ProxyPacLoader do
3
+ RSpec.describe ProxyPacLoader, type: :aruba do
4
4
  subject(:proxy_pac) { instance_double('ProxyPac::ProxyPacFile') }
5
5
 
6
6
  let(:content) do
@@ -17,7 +17,7 @@ RSpec.describe ProxyPacRb::CodeConfiguration do
17
17
  end
18
18
 
19
19
  context 'when invalid value' do
20
- it { expect { config.use_proxy = '' }.to raise_error ArgumentError }
20
+ it { expect { config.use_proxy = '' }.to raise_error ArgumentError }
21
21
  end
22
22
  end
23
23
  end
data/spec/parser_spec.rb CHANGED
@@ -1,7 +1,7 @@
1
1
  # encoding: utf-8
2
2
  require 'spec_helper'
3
3
 
4
- RSpec.describe ProxyPacRb::Parser do
4
+ RSpec.describe ProxyPacRb::Parser, type: :aruba do
5
5
  subject(:proxy_pac) { Parser.new(environment: environment).parse(source) }
6
6
 
7
7
  let(:environment) { Environment.new }
@@ -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) { current_directory }
14
+ let(:root_path) { expand_path('.') }
15
15
 
16
16
  subject { 'proxy.pac' }
17
17
 
@@ -1,23 +1,6 @@
1
1
  # encoding: utf-8
2
- require 'aruba/api'
3
- require 'aruba/reporting'
2
+ require 'aruba/rspec'
4
3
 
5
- # Spec Helpers
6
- module SpecHelper
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.8.2
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-07-31 00:00:00.000000000 Z
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: '"proxy_pac_rb" is a gem to compress, lint and parse proxy auto-config
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.0'
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