addressable 2.3.2 → 2.8.7

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.
@@ -0,0 +1,33 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'bundler/setup'
4
+ require 'rspec/its'
5
+
6
+ begin
7
+ require 'coveralls'
8
+ Coveralls.wear! do
9
+ add_filter "spec/"
10
+ add_filter "vendor/"
11
+ end
12
+ rescue LoadError
13
+ warn "warning: coveralls gem not found; skipping Coveralls"
14
+ require 'simplecov'
15
+ SimpleCov.start do
16
+ add_filter "spec/"
17
+ add_filter "vendor/"
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
28
+ end
29
+
30
+ RSpec.configure do |config|
31
+ config.warnings = true
32
+ config.filter_run_when_matching :focus
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,16 +19,20 @@ namespace :gem do
18
19
  exit(1)
19
20
  end
20
21
 
21
- s.add_development_dependency("rake", ">= 0.7.3")
22
- s.add_development_dependency("rspec", ">= 2.9.0")
23
- s.add_development_dependency("launchy", ">= 0.3.2")
22
+ s.required_ruby_version = ">= 2.2"
23
+
24
+ s.add_runtime_dependency "public_suffix", ">= 2.0.2", "< 7.0"
25
+ s.add_development_dependency "bundler", ">= 1.0", "< 3.0"
24
26
 
25
27
  s.require_path = "lib"
26
28
 
27
29
  s.author = "Bob Aman"
28
30
  s.email = "bob@sporkmonger.com"
29
- s.homepage = RUBY_FORGE_URL
30
- s.rubyforge_project = RUBY_FORGE_PROJECT
31
+ s.homepage = "https://github.com/sporkmonger/addressable"
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
+ }
31
36
  end
32
37
 
33
38
  Gem::PackageTask.new(GEM_SPEC) do |p|
@@ -39,15 +44,8 @@ namespace :gem do
39
44
  desc "Generates .gemspec file"
40
45
  task :gemspec do
41
46
  spec_string = GEM_SPEC.to_ruby
42
-
43
- begin
44
- Thread.new { eval("$SAFE = 3\n#{spec_string}", binding) }.join
45
- rescue
46
- abort "unsafe gemspec: #{$!}"
47
- else
48
- File.open("#{GEM_SPEC.name}.gemspec", 'w') do |file|
49
- file.write spec_string
50
- end
47
+ File.open("#{GEM_SPEC.name}.gemspec", "w") do |file|
48
+ file.write spec_string
51
49
  end
52
50
  end
53
51
 
@@ -58,7 +56,7 @@ namespace :gem do
58
56
 
59
57
  desc "Install the gem"
60
58
  task :install => ["clobber", "gem:package"] do
61
- sh "#{SUDO} gem install --local pkg/#{GEM_SPEC.full_name}"
59
+ sh "gem install --local ./pkg/#{GEM_SPEC.full_name}.gem"
62
60
  end
63
61
 
64
62
  desc "Uninstall the gem"
@@ -67,7 +65,7 @@ namespace :gem do
67
65
  if installed_list &&
68
66
  (installed_list.collect { |s| s.version.to_s}.include?(PKG_VERSION))
69
67
  sh(
70
- "#{SUDO} gem uninstall --version '#{PKG_VERSION}' " +
68
+ "gem uninstall --version '#{PKG_VERSION}' " +
71
69
  "--ignore-dependencies --executables #{PKG_NAME}"
72
70
  )
73
71
  end
@@ -75,6 +73,18 @@ namespace :gem do
75
73
 
76
74
  desc "Reinstall the gem"
77
75
  task :reinstall => [:uninstall, :install]
76
+
77
+ desc "Package for release"
78
+ task :release => ["gem:package", "gem:gemspec"] do |t|
79
+ v = ENV["VERSION"] or abort "Must supply VERSION=x.y.z"
80
+ abort "Versions don't match #{v} vs #{PROJ.version}" if v != PKG_VERSION
81
+ pkg = "pkg/#{GEM_SPEC.full_name}"
82
+
83
+ changelog = File.open("CHANGELOG.md") { |file| file.read }
84
+
85
+ puts "Releasing #{PKG_NAME} v. #{PKG_VERSION}"
86
+ Rake::Task["git:tag:create"].invoke
87
+ end
78
88
  end
79
89
 
80
90
  desc "Alias to gem:package"
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"
@@ -20,7 +22,7 @@ namespace :git do
20
22
  abort "Versions don't match #{v} vs #{PKG_VERSION}" if v != PKG_VERSION
21
23
 
22
24
  git_status = `git status`
23
- if git_status !~ /nothing to commit \(working directory clean\)/
25
+ if git_status !~ /^nothing to commit/
24
26
  abort "Working directory isn't clean."
25
27
  end
26
28
 
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,58 +1,23 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require "rspec/core/rake_task"
2
4
 
3
5
  namespace :spec do
4
- RSpec::Core::RakeTask.new(:rcov) do |t|
5
- t.pattern = FileList['spec/**/*_spec.rb']
6
- t.rspec_opts = ['--color', '--format', 'documentation']
7
-
8
- t.rcov = RCOV_ENABLED
9
- t.rcov_opts = [
10
- '--exclude', 'lib\\/compat',
11
- '--exclude', 'spec',
12
- '--exclude', '\\.rvm\\/gems',
13
- '--exclude', '1\\.8\\/gems',
14
- '--exclude', '1\\.9\\/gems',
15
- '--exclude', '\\.rvm',
16
- '--exclude', '\\/Library\\/Ruby',
17
- '--exclude', 'addressable\\/idna' # environment dependant
18
- ]
19
- end
20
-
21
- RSpec::Core::RakeTask.new(:normal) do |t|
22
- t.pattern = FileList['spec/**/*_spec.rb'].exclude(/compat/)
23
- t.rspec_opts = ['--color', '--format', 'documentation']
24
- t.rcov = false
25
- end
26
-
27
- RSpec::Core::RakeTask.new(:all) do |t|
28
- t.pattern = FileList['spec/**/*_spec.rb']
29
- t.rspec_opts = ['--color', '--format', 'documentation']
30
- t.rcov = false
31
- end
32
-
33
- desc "Generate HTML Specdocs for all specs"
34
- RSpec::Core::RakeTask.new(:specdoc) do |t|
35
- specdoc_path = File.expand_path(
36
- File.join(File.dirname(__FILE__), '..', 'documentation')
37
- )
38
- Dir.mkdir(specdoc_path) if !File.exist?(specdoc_path)
39
-
40
- output_file = File.join(specdoc_path, 'index.html')
6
+ RSpec::Core::RakeTask.new(:simplecov) do |t|
41
7
  t.pattern = FileList['spec/**/*_spec.rb']
42
- t.rspec_opts = ["--format", "\"html:#{output_file}\"", "--diff"]
43
- t.fail_on_error = false
8
+ t.rspec_opts = %w[--color --format documentation] unless ENV["CI"]
44
9
  end
45
10
 
46
- namespace :rcov do
11
+ namespace :simplecov do
47
12
  desc "Browse the code coverage report."
48
- task :browse => "spec:rcov" do
13
+ task :browse => "spec:simplecov" do
49
14
  require "launchy"
50
- Launchy::Browser.run("coverage/index.html")
15
+ Launchy.open("coverage/index.html")
51
16
  end
52
17
  end
53
18
  end
54
19
 
55
- desc "Alias to spec:normal"
56
- task "spec" => "spec:normal"
20
+ desc "Alias to spec:simplecov"
21
+ task "spec" => "spec:simplecov"
57
22
 
58
- task "clobber" => ["spec:clobber_rcov"]
23
+ task "clobber" => ["spec:clobber_simplecov"]
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,114 +1,116 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: addressable
3
- version: !ruby/object:Gem::Version
4
- prerelease:
5
- version: 2.3.2
3
+ version: !ruby/object:Gem::Version
4
+ version: 2.8.7
6
5
  platform: ruby
7
- authors:
6
+ authors:
8
7
  - Bob Aman
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
-
13
- date: 2012-07-27 00:00:00 Z
14
- dependencies:
15
- - !ruby/object:Gem::Dependency
16
- name: rake
17
- prerelease: false
18
- requirement: &id001 !ruby/object:Gem::Requirement
19
- none: false
20
- requirements:
11
+ date: 2024-06-21 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: public_suffix
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
21
17
  - - ">="
22
- - !ruby/object:Gem::Version
23
- version: 0.7.3
24
- type: :development
25
- version_requirements: *id001
26
- - !ruby/object:Gem::Dependency
27
- name: rspec
18
+ - !ruby/object:Gem::Version
19
+ version: 2.0.2
20
+ - - "<"
21
+ - !ruby/object:Gem::Version
22
+ version: '7.0'
23
+ type: :runtime
28
24
  prerelease: false
29
- requirement: &id002 !ruby/object:Gem::Requirement
30
- none: false
31
- requirements:
25
+ version_requirements: !ruby/object:Gem::Requirement
26
+ requirements:
27
+ - - ">="
28
+ - !ruby/object:Gem::Version
29
+ version: 2.0.2
30
+ - - "<"
31
+ - !ruby/object:Gem::Version
32
+ version: '7.0'
33
+ - !ruby/object:Gem::Dependency
34
+ name: bundler
35
+ requirement: !ruby/object:Gem::Requirement
36
+ requirements:
32
37
  - - ">="
33
- - !ruby/object:Gem::Version
34
- version: 2.9.0
38
+ - !ruby/object:Gem::Version
39
+ version: '1.0'
40
+ - - "<"
41
+ - !ruby/object:Gem::Version
42
+ version: '3.0'
35
43
  type: :development
36
- version_requirements: *id002
37
- - !ruby/object:Gem::Dependency
38
- name: launchy
39
44
  prerelease: false
40
- requirement: &id003 !ruby/object:Gem::Requirement
41
- none: false
42
- requirements:
45
+ version_requirements: !ruby/object:Gem::Requirement
46
+ requirements:
43
47
  - - ">="
44
- - !ruby/object:Gem::Version
45
- version: 0.3.2
46
- type: :development
47
- version_requirements: *id003
48
+ - !ruby/object:Gem::Version
49
+ version: '1.0'
50
+ - - "<"
51
+ - !ruby/object:Gem::Version
52
+ version: '3.0'
48
53
  description: |
49
- Addressable is a replacement for the URI implementation that is part of
50
- Ruby's standard library. It more closely conforms to the relevant RFCs and
51
- adds support for IRIs and URI templates.
52
-
54
+ Addressable is an alternative implementation to the URI implementation that is
55
+ part of Ruby's standard library. It is flexible, offers heuristic parsing, and
56
+ additionally provides extensive support for IRIs and URI templates.
53
57
  email: bob@sporkmonger.com
54
58
  executables: []
55
-
56
59
  extensions: []
57
-
58
- extra_rdoc_files:
60
+ extra_rdoc_files:
59
61
  - README.md
60
- files:
62
+ files:
63
+ - CHANGELOG.md
64
+ - Gemfile
65
+ - LICENSE.txt
66
+ - README.md
67
+ - Rakefile
68
+ - addressable.gemspec
69
+ - data/unicode.data
70
+ - lib/addressable.rb
71
+ - lib/addressable/idna.rb
61
72
  - lib/addressable/idna/native.rb
62
73
  - lib/addressable/idna/pure.rb
63
- - lib/addressable/idna.rb
64
74
  - lib/addressable/template.rb
65
75
  - lib/addressable/uri.rb
66
76
  - lib/addressable/version.rb
67
77
  - spec/addressable/idna_spec.rb
68
78
  - spec/addressable/net_http_compat_spec.rb
79
+ - spec/addressable/security_spec.rb
69
80
  - spec/addressable/template_spec.rb
70
81
  - spec/addressable/uri_spec.rb
71
- - data/unicode.data
82
+ - spec/spec_helper.rb
72
83
  - tasks/clobber.rake
73
84
  - tasks/gem.rake
74
85
  - tasks/git.rake
75
86
  - tasks/metrics.rake
87
+ - tasks/profile.rake
76
88
  - tasks/rspec.rake
77
- - tasks/rubyforge.rake
78
89
  - tasks/yard.rake
79
- - website/index.html
80
- - CHANGELOG.md
81
- - Gemfile
82
- - LICENSE.txt
83
- - Rakefile
84
- - README.md
85
- homepage: http://addressable.rubyforge.org/
86
- licenses: []
87
-
90
+ homepage: https://github.com/sporkmonger/addressable
91
+ licenses:
92
+ - Apache-2.0
93
+ metadata:
94
+ changelog_uri: https://github.com/sporkmonger/addressable/blob/main/CHANGELOG.md#v2.8.7
88
95
  post_install_message:
89
- rdoc_options:
90
- - --main
96
+ rdoc_options:
97
+ - "--main"
91
98
  - README.md
92
- require_paths:
99
+ require_paths:
93
100
  - lib
94
- required_ruby_version: !ruby/object:Gem::Requirement
95
- none: false
96
- requirements:
101
+ required_ruby_version: !ruby/object:Gem::Requirement
102
+ requirements:
97
103
  - - ">="
98
- - !ruby/object:Gem::Version
99
- version: "0"
100
- required_rubygems_version: !ruby/object:Gem::Requirement
101
- none: false
102
- requirements:
104
+ - !ruby/object:Gem::Version
105
+ version: '2.2'
106
+ required_rubygems_version: !ruby/object:Gem::Requirement
107
+ requirements:
103
108
  - - ">="
104
- - !ruby/object:Gem::Version
105
- version: "0"
109
+ - !ruby/object:Gem::Version
110
+ version: '0'
106
111
  requirements: []
107
-
108
- rubyforge_project: addressable
109
- rubygems_version: 1.8.15
112
+ rubygems_version: 3.5.11
110
113
  signing_key:
111
- specification_version: 3
114
+ specification_version: 4
112
115
  summary: URI Implementation
113
116
  test_files: []
114
-
data/tasks/rubyforge.rake DELETED
@@ -1,89 +0,0 @@
1
- namespace :gem do
2
- desc 'Package and upload to RubyForge'
3
- task :release => ["gem:package", "gem:gemspec"] do |t|
4
- require 'rubyforge'
5
-
6
- v = ENV['VERSION'] or abort 'Must supply VERSION=x.y.z'
7
- abort "Versions don't match #{v} vs #{PROJ.version}" if v != PKG_VERSION
8
- pkg = "pkg/#{GEM_SPEC.full_name}"
9
-
10
- rf = RubyForge.new
11
- rf.configure
12
- puts 'Logging in...'
13
- rf.login
14
-
15
- c = rf.userconfig
16
- changelog = File.open("CHANGELOG.md") { |file| file.read }
17
- c['release_changes'] = changelog
18
- c['preformatted'] = true
19
-
20
- files = ["#{pkg}.tgz", "#{pkg}.zip", "#{pkg}.gem"]
21
-
22
- puts "Releasing #{PKG_NAME} v. #{PKG_VERSION}"
23
- rf.add_release RUBY_FORGE_PROJECT, PKG_NAME, PKG_VERSION, *files
24
- end
25
- end
26
-
27
- namespace :doc do
28
- desc "Publish RDoc to RubyForge"
29
- task :release => ["doc"] do
30
- require "rake/contrib/sshpublisher"
31
- require "yaml"
32
-
33
- config = YAML.load(
34
- File.read(File.expand_path('~/.rubyforge/user-config.yml'))
35
- )
36
- host = "#{config['username']}@rubyforge.org"
37
- remote_dir = RUBY_FORGE_PATH + "/api"
38
- local_dir = "doc"
39
- Rake::SshDirPublisher.new(host, remote_dir, local_dir).upload
40
- end
41
- end
42
-
43
- namespace :spec do
44
- desc "Publish specdoc to RubyForge"
45
- task :release => ["spec:specdoc"] do
46
- require "rake/contrib/sshpublisher"
47
- require "yaml"
48
-
49
- config = YAML.load(
50
- File.read(File.expand_path('~/.rubyforge/user-config.yml'))
51
- )
52
- host = "#{config['username']}@rubyforge.org"
53
- remote_dir = RUBY_FORGE_PATH + "/specdoc"
54
- local_dir = "specdoc"
55
- Rake::SshDirPublisher.new(host, remote_dir, local_dir).upload
56
- end
57
-
58
- namespace :rcov do
59
- desc "Publish coverage report to RubyForge"
60
- task :release => ["spec:rcov"] do
61
- require "rake/contrib/sshpublisher"
62
- require "yaml"
63
-
64
- config = YAML.load(
65
- File.read(File.expand_path('~/.rubyforge/user-config.yml'))
66
- )
67
- host = "#{config['username']}@rubyforge.org"
68
- remote_dir = RUBY_FORGE_PATH + "/coverage"
69
- local_dir = "coverage"
70
- Rake::SshDirPublisher.new(host, remote_dir, local_dir).upload
71
- end
72
- end
73
- end
74
-
75
- namespace :website do
76
- desc "Publish website to RubyForge"
77
- task :release => ["doc:release", "spec:release", "spec:rcov:release"] do
78
- require "rake/contrib/sshpublisher"
79
- require "yaml"
80
-
81
- config = YAML.load(
82
- File.read(File.expand_path('~/.rubyforge/user-config.yml'))
83
- )
84
- host = "#{config['username']}@rubyforge.org"
85
- remote_dir = RUBY_FORGE_PATH
86
- local_dir = "website"
87
- Rake::SshDirPublisher.new(host, remote_dir, local_dir).upload
88
- end
89
- end