addressable 2.5.0 → 2.8.8

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.
data/spec/spec_helper.rb CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'bundler/setup'
2
4
  require 'rspec/its'
3
5
 
@@ -14,8 +16,18 @@ rescue LoadError
14
16
  add_filter "spec/"
15
17
  add_filter "vendor/"
16
18
  end
19
+ end if Gem.loaded_specs.key?("simplecov")
20
+
21
+ class TestHelper
22
+ def self.native_supported?
23
+ mri = RUBY_ENGINE == "ruby"
24
+ windows = RUBY_PLATFORM.include?("mingw")
25
+
26
+ mri && !windows
27
+ end
17
28
  end
18
29
 
19
30
  RSpec.configure do |config|
20
31
  config.warnings = true
32
+ config.filter_run_when_matching :focus
21
33
  end
data/tasks/clobber.rake CHANGED
@@ -1,2 +1,4 @@
1
+ # frozen_string_literal: true
2
+
1
3
  desc "Remove all build products"
2
4
  task "clobber"
data/tasks/gem.rake CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require "rubygems/package_task"
2
4
 
3
5
  namespace :gem do
@@ -9,7 +11,6 @@ namespace :gem do
9
11
 
10
12
  s.files = PKG_FILES.to_a
11
13
 
12
- s.has_rdoc = true
13
14
  s.extra_rdoc_files = %w( README.md )
14
15
  s.rdoc_options.concat ["--main", "README.md"]
15
16
 
@@ -18,10 +19,10 @@ namespace :gem do
18
19
  exit(1)
19
20
  end
20
21
 
21
- s.required_ruby_version = '>= 2.0'
22
+ s.required_ruby_version = ">= 2.2"
22
23
 
23
- s.add_runtime_dependency 'public_suffix', '~> 2.0', '>= 2.0.2'
24
- s.add_development_dependency 'bundler', '~> 1.0'
24
+ s.add_runtime_dependency "public_suffix", ">= 2.0.2", "< 8.0"
25
+ s.add_development_dependency "bundler", ">= 1.0", "< 3.0"
25
26
 
26
27
  s.require_path = "lib"
27
28
 
@@ -29,6 +30,9 @@ namespace :gem do
29
30
  s.email = "bob@sporkmonger.com"
30
31
  s.homepage = "https://github.com/sporkmonger/addressable"
31
32
  s.license = "Apache-2.0"
33
+ s.metadata = {
34
+ "changelog_uri" => "https://github.com/sporkmonger/addressable/blob/main/CHANGELOG.md#v#{PKG_VERSION}"
35
+ }
32
36
  end
33
37
 
34
38
  Gem::PackageTask.new(GEM_SPEC) do |p|
@@ -39,8 +43,13 @@ namespace :gem do
39
43
 
40
44
  desc "Generates .gemspec file"
41
45
  task :gemspec do
46
+ # ensure correct date in gemspec
47
+ # https://github.com/ruby/rubygems/pull/8568
48
+ # https://github.com/ruby/rubygems/issues/8679
49
+ ENV["SOURCE_DATE_EPOCH"] ||= Time.now.to_i.to_s
50
+
42
51
  spec_string = GEM_SPEC.to_ruby
43
- File.open("#{GEM_SPEC.name}.gemspec", 'w') do |file|
52
+ File.open("#{GEM_SPEC.name}.gemspec", "w") do |file|
44
53
  file.write spec_string
45
54
  end
46
55
  end
@@ -52,7 +61,7 @@ namespace :gem do
52
61
 
53
62
  desc "Install the gem"
54
63
  task :install => ["clobber", "gem:package"] do
55
- sh "#{SUDO} gem install --local pkg/#{GEM_SPEC.full_name}"
64
+ sh "gem install --local ./pkg/#{GEM_SPEC.full_name}.gem"
56
65
  end
57
66
 
58
67
  desc "Uninstall the gem"
@@ -61,7 +70,7 @@ namespace :gem do
61
70
  if installed_list &&
62
71
  (installed_list.collect { |s| s.version.to_s}.include?(PKG_VERSION))
63
72
  sh(
64
- "#{SUDO} gem uninstall --version '#{PKG_VERSION}' " +
73
+ "gem uninstall --version '#{PKG_VERSION}' " +
65
74
  "--ignore-dependencies --executables #{PKG_NAME}"
66
75
  )
67
76
  end
@@ -70,9 +79,9 @@ namespace :gem do
70
79
  desc "Reinstall the gem"
71
80
  task :reinstall => [:uninstall, :install]
72
81
 
73
- desc 'Package for release'
82
+ desc "Package for release"
74
83
  task :release => ["gem:package", "gem:gemspec"] do |t|
75
- v = ENV['VERSION'] or abort 'Must supply VERSION=x.y.z'
84
+ v = ENV["VERSION"] or abort "Must supply VERSION=x.y.z"
76
85
  abort "Versions don't match #{v} vs #{PROJ.version}" if v != PKG_VERSION
77
86
  pkg = "pkg/#{GEM_SPEC.full_name}"
78
87
 
data/tasks/git.rake CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  namespace :git do
2
4
  namespace :tag do
3
5
  desc "List tags from the Git repository"
data/tasks/metrics.rake CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  namespace :metrics do
2
4
  task :lines do
3
5
  lines, codelines, total_lines, total_codelines = 0, 0, 0, 0
@@ -0,0 +1,72 @@
1
+ # frozen_string_literal: true
2
+
3
+ namespace :profile do
4
+ desc "Profile Template match memory allocations"
5
+ task :template_match_memory do
6
+ require "memory_profiler"
7
+ require "addressable/template"
8
+
9
+ start_at = Time.now.to_f
10
+ template = Addressable::Template.new("http://example.com/{?one,two,three}")
11
+ report = MemoryProfiler.report do
12
+ 30_000.times do
13
+ template.match(
14
+ "http://example.com/?one=one&two=floo&three=me"
15
+ )
16
+ end
17
+ end
18
+ end_at = Time.now.to_f
19
+ print_options = { scale_bytes: true, normalize_paths: true }
20
+ puts "\n\n"
21
+
22
+ if ENV["CI"]
23
+ report.pretty_print(**print_options)
24
+ else
25
+ t_allocated = report.scale_bytes(report.total_allocated_memsize)
26
+ t_retained = report.scale_bytes(report.total_retained_memsize)
27
+
28
+ puts "Total allocated: #{t_allocated} (#{report.total_allocated} objects)"
29
+ puts "Total retained: #{t_retained} (#{report.total_retained} objects)"
30
+ puts "Took #{end_at - start_at} seconds"
31
+
32
+ FileUtils.mkdir_p("tmp")
33
+ report.pretty_print(to_file: "tmp/memprof.txt", **print_options)
34
+ end
35
+ end
36
+
37
+ desc "Profile URI parse memory allocations"
38
+ task :memory do
39
+ require "memory_profiler"
40
+ require "addressable/uri"
41
+ if ENV["IDNA_MODE"] == "pure"
42
+ Addressable.send(:remove_const, :IDNA)
43
+ load "addressable/idna/pure.rb"
44
+ end
45
+
46
+ start_at = Time.now.to_f
47
+ report = MemoryProfiler.report do
48
+ 30_000.times do
49
+ Addressable::URI.parse(
50
+ "http://google.com/stuff/../?with_lots=of&params=asdff#!stuff"
51
+ ).normalize
52
+ end
53
+ end
54
+ end_at = Time.now.to_f
55
+ print_options = { scale_bytes: true, normalize_paths: true }
56
+ puts "\n\n"
57
+
58
+ if ENV["CI"]
59
+ report.pretty_print(**print_options)
60
+ else
61
+ t_allocated = report.scale_bytes(report.total_allocated_memsize)
62
+ t_retained = report.scale_bytes(report.total_retained_memsize)
63
+
64
+ puts "Total allocated: #{t_allocated} (#{report.total_allocated} objects)"
65
+ puts "Total retained: #{t_retained} (#{report.total_retained} objects)"
66
+ puts "Took #{end_at - start_at} seconds"
67
+
68
+ FileUtils.mkdir_p("tmp")
69
+ report.pretty_print(to_file: "tmp/memprof.txt", **print_options)
70
+ end
71
+ end
72
+ end
data/tasks/rspec.rake CHANGED
@@ -1,9 +1,11 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require "rspec/core/rake_task"
2
4
 
3
5
  namespace :spec do
4
6
  RSpec::Core::RakeTask.new(:simplecov) do |t|
5
7
  t.pattern = FileList['spec/**/*_spec.rb']
6
- t.rspec_opts = ['--color', '--format', 'documentation']
8
+ t.rspec_opts = %w[--color --format documentation] unless ENV["CI"]
7
9
  end
8
10
 
9
11
  namespace :simplecov do
data/tasks/yard.rake CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require "rake"
2
4
 
3
5
  begin
metadata CHANGED
@@ -1,53 +1,58 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: addressable
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.5.0
4
+ version: 2.8.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Bob Aman
8
- autorequire:
9
8
  bindir: bin
10
9
  cert_chain: []
11
- date: 2016-11-04 00:00:00.000000000 Z
10
+ date: 1980-01-02 00:00:00.000000000 Z
12
11
  dependencies:
13
12
  - !ruby/object:Gem::Dependency
14
13
  name: public_suffix
15
14
  requirement: !ruby/object:Gem::Requirement
16
15
  requirements:
17
- - - "~>"
18
- - !ruby/object:Gem::Version
19
- version: '2.0'
20
16
  - - ">="
21
17
  - !ruby/object:Gem::Version
22
18
  version: 2.0.2
19
+ - - "<"
20
+ - !ruby/object:Gem::Version
21
+ version: '8.0'
23
22
  type: :runtime
24
23
  prerelease: false
25
24
  version_requirements: !ruby/object:Gem::Requirement
26
25
  requirements:
27
- - - "~>"
28
- - !ruby/object:Gem::Version
29
- version: '2.0'
30
26
  - - ">="
31
27
  - !ruby/object:Gem::Version
32
28
  version: 2.0.2
29
+ - - "<"
30
+ - !ruby/object:Gem::Version
31
+ version: '8.0'
33
32
  - !ruby/object:Gem::Dependency
34
33
  name: bundler
35
34
  requirement: !ruby/object:Gem::Requirement
36
35
  requirements:
37
- - - "~>"
36
+ - - ">="
38
37
  - !ruby/object:Gem::Version
39
38
  version: '1.0'
39
+ - - "<"
40
+ - !ruby/object:Gem::Version
41
+ version: '3.0'
40
42
  type: :development
41
43
  prerelease: false
42
44
  version_requirements: !ruby/object:Gem::Requirement
43
45
  requirements:
44
- - - "~>"
46
+ - - ">="
45
47
  - !ruby/object:Gem::Version
46
48
  version: '1.0'
49
+ - - "<"
50
+ - !ruby/object:Gem::Version
51
+ version: '3.0'
47
52
  description: |
48
- Addressable is a replacement for the URI implementation that is part of
49
- Ruby's standard library. It more closely conforms to the relevant RFCs and
50
- adds support for IRIs and URI templates.
53
+ Addressable is an alternative implementation to the URI implementation that is
54
+ part of Ruby's standard library. It is flexible, offers heuristic parsing, and
55
+ additionally provides extensive support for IRIs and URI templates.
51
56
  email: bob@sporkmonger.com
52
57
  executables: []
53
58
  extensions: []
@@ -59,7 +64,7 @@ files:
59
64
  - LICENSE.txt
60
65
  - README.md
61
66
  - Rakefile
62
- - data/unicode.data
67
+ - addressable.gemspec
63
68
  - lib/addressable.rb
64
69
  - lib/addressable/idna.rb
65
70
  - lib/addressable/idna/native.rb
@@ -69,7 +74,6 @@ files:
69
74
  - lib/addressable/version.rb
70
75
  - spec/addressable/idna_spec.rb
71
76
  - spec/addressable/net_http_compat_spec.rb
72
- - spec/addressable/rack_mount_compat_spec.rb
73
77
  - spec/addressable/security_spec.rb
74
78
  - spec/addressable/template_spec.rb
75
79
  - spec/addressable/uri_spec.rb
@@ -78,13 +82,14 @@ files:
78
82
  - tasks/gem.rake
79
83
  - tasks/git.rake
80
84
  - tasks/metrics.rake
85
+ - tasks/profile.rake
81
86
  - tasks/rspec.rake
82
87
  - tasks/yard.rake
83
88
  homepage: https://github.com/sporkmonger/addressable
84
89
  licenses:
85
90
  - Apache-2.0
86
- metadata: {}
87
- post_install_message:
91
+ metadata:
92
+ changelog_uri: https://github.com/sporkmonger/addressable/blob/main/CHANGELOG.md#v2.8.8
88
93
  rdoc_options:
89
94
  - "--main"
90
95
  - README.md
@@ -94,16 +99,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
94
99
  requirements:
95
100
  - - ">="
96
101
  - !ruby/object:Gem::Version
97
- version: '2.0'
102
+ version: '2.2'
98
103
  required_rubygems_version: !ruby/object:Gem::Requirement
99
104
  requirements:
100
105
  - - ">="
101
106
  - !ruby/object:Gem::Version
102
107
  version: '0'
103
108
  requirements: []
104
- rubyforge_project:
105
- rubygems_version: 2.5.1
106
- signing_key:
109
+ rubygems_version: 3.6.9
107
110
  specification_version: 4
108
111
  summary: URI Implementation
109
112
  test_files: []
data/data/unicode.data DELETED
Binary file
@@ -1,104 +0,0 @@
1
- # coding: utf-8
2
- # Copyright (C) Bob Aman
3
- #
4
- # Licensed under the Apache License, Version 2.0 (the "License");
5
- # you may not use this file except in compliance with the License.
6
- # You may obtain a copy of the License at
7
- #
8
- # http://www.apache.org/licenses/LICENSE-2.0
9
- #
10
- # Unless required by applicable law or agreed to in writing, software
11
- # distributed under the License is distributed on an "AS IS" BASIS,
12
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
- # See the License for the specific language governing permissions and
14
- # limitations under the License.
15
-
16
-
17
- require "spec_helper"
18
-
19
- require "addressable/uri"
20
- require "addressable/template"
21
- require "rack/mount"
22
-
23
- describe Rack::Mount do
24
- let(:app_one) do
25
- proc { |env| [200, {'Content-Type' => 'text/plain'}, 'Route 1'] }
26
- end
27
- let(:app_two) do
28
- proc { |env| [200, {'Content-Type' => 'text/plain'}, 'Route 2'] }
29
- end
30
- let(:app_three) do
31
- proc { |env| [200, {'Content-Type' => 'text/plain'}, 'Route 3'] }
32
- end
33
- let(:routes) do
34
- s = Rack::Mount::RouteSet.new do |set|
35
- set.add_route(app_one, {
36
- :request_method => 'GET',
37
- :path_info => Addressable::Template.new('/one/{id}/')
38
- }, {:id => 'unidentified'}, :one)
39
- set.add_route(app_two, {
40
- :request_method => 'GET',
41
- :path_info => Addressable::Template.new('/two/')
42
- }, {:id => 'unidentified'}, :two)
43
- set.add_route(app_three, {
44
- :request_method => 'GET',
45
- :path_info => Addressable::Template.new('/three/{id}/').to_regexp
46
- }, {:id => 'unidentified'}, :three)
47
- end
48
- s.rehash
49
- s
50
- end
51
-
52
- it "should generate from routes with Addressable::Template" do
53
- path, _ = routes.generate(:path_info, :one, {:id => '123'})
54
- expect(path).to eq '/one/123/'
55
- end
56
-
57
- it "should generate from routes with Addressable::Template using defaults" do
58
- path, _ = routes.generate(:path_info, :one, {})
59
- expect(path).to eq '/one/unidentified/'
60
- end
61
-
62
- it "should recognize routes with Addressable::Template" do
63
- request = Rack::Request.new(
64
- 'REQUEST_METHOD' => 'GET',
65
- 'PATH_INFO' => '/one/123/'
66
- )
67
- route, _, params = routes.recognize(request)
68
- expect(route).not_to be_nil
69
- expect(route.app).to eq app_one
70
- expect(params).to eq({id: '123'})
71
- end
72
-
73
- it "should generate from routes with Addressable::Template" do
74
- path, _ = routes.generate(:path_info, :two, {:id => '654'})
75
- expect(path).to eq '/two/'
76
- end
77
-
78
- it "should generate from routes with Addressable::Template using defaults" do
79
- path, _ = routes.generate(:path_info, :two, {})
80
- expect(path).to eq '/two/'
81
- end
82
-
83
- it "should recognize routes with Addressable::Template" do
84
- request = Rack::Request.new(
85
- 'REQUEST_METHOD' => 'GET',
86
- 'PATH_INFO' => '/two/'
87
- )
88
- route, _, params = routes.recognize(request)
89
- expect(route).not_to be_nil
90
- expect(route.app).to eq app_two
91
- expect(params).to eq({id: 'unidentified'})
92
- end
93
-
94
- it "should recognize routes with derived Regexp" do
95
- request = Rack::Request.new(
96
- 'REQUEST_METHOD' => 'GET',
97
- 'PATH_INFO' => '/three/789/'
98
- )
99
- route, _, params = routes.recognize(request)
100
- expect(route).not_to be_nil
101
- expect(route.app).to eq app_three
102
- expect(params).to eq({id: '789'})
103
- end
104
- end