addressable 2.8.7 → 2.8.9
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/CHANGELOG.md +64 -46
- data/README.md +6 -6
- data/lib/addressable/idna/pure.rb +4235 -30
- data/lib/addressable/uri.rb +1 -1
- data/lib/addressable/version.rb +1 -1
- metadata +6 -46
- data/Gemfile +0 -31
- data/Rakefile +0 -37
- data/addressable.gemspec +0 -28
- data/data/unicode.data +0 -0
- data/spec/addressable/idna_spec.rb +0 -302
- data/spec/addressable/net_http_compat_spec.rb +0 -29
- data/spec/addressable/security_spec.rb +0 -58
- data/spec/addressable/template_spec.rb +0 -1264
- data/spec/addressable/uri_spec.rb +0 -6840
- data/spec/spec_helper.rb +0 -33
- data/tasks/clobber.rake +0 -4
- data/tasks/gem.rake +0 -95
- data/tasks/git.rake +0 -47
- data/tasks/metrics.rake +0 -24
- data/tasks/profile.rake +0 -72
- data/tasks/rspec.rake +0 -23
- data/tasks/yard.rake +0 -29
data/spec/spec_helper.rb
DELETED
|
@@ -1,33 +0,0 @@
|
|
|
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
DELETED
data/tasks/gem.rake
DELETED
|
@@ -1,95 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
require "rubygems/package_task"
|
|
4
|
-
|
|
5
|
-
namespace :gem do
|
|
6
|
-
GEM_SPEC = Gem::Specification.new do |s|
|
|
7
|
-
s.name = PKG_NAME
|
|
8
|
-
s.version = PKG_VERSION
|
|
9
|
-
s.summary = PKG_SUMMARY
|
|
10
|
-
s.description = PKG_DESCRIPTION
|
|
11
|
-
|
|
12
|
-
s.files = PKG_FILES.to_a
|
|
13
|
-
|
|
14
|
-
s.extra_rdoc_files = %w( README.md )
|
|
15
|
-
s.rdoc_options.concat ["--main", "README.md"]
|
|
16
|
-
|
|
17
|
-
if !s.respond_to?(:add_development_dependency)
|
|
18
|
-
puts "Cannot build Gem with this version of RubyGems."
|
|
19
|
-
exit(1)
|
|
20
|
-
end
|
|
21
|
-
|
|
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"
|
|
26
|
-
|
|
27
|
-
s.require_path = "lib"
|
|
28
|
-
|
|
29
|
-
s.author = "Bob Aman"
|
|
30
|
-
s.email = "bob@sporkmonger.com"
|
|
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
|
-
}
|
|
36
|
-
end
|
|
37
|
-
|
|
38
|
-
Gem::PackageTask.new(GEM_SPEC) do |p|
|
|
39
|
-
p.gem_spec = GEM_SPEC
|
|
40
|
-
p.need_tar = true
|
|
41
|
-
p.need_zip = true
|
|
42
|
-
end
|
|
43
|
-
|
|
44
|
-
desc "Generates .gemspec file"
|
|
45
|
-
task :gemspec do
|
|
46
|
-
spec_string = GEM_SPEC.to_ruby
|
|
47
|
-
File.open("#{GEM_SPEC.name}.gemspec", "w") do |file|
|
|
48
|
-
file.write spec_string
|
|
49
|
-
end
|
|
50
|
-
end
|
|
51
|
-
|
|
52
|
-
desc "Show information about the gem"
|
|
53
|
-
task :debug do
|
|
54
|
-
puts GEM_SPEC.to_ruby
|
|
55
|
-
end
|
|
56
|
-
|
|
57
|
-
desc "Install the gem"
|
|
58
|
-
task :install => ["clobber", "gem:package"] do
|
|
59
|
-
sh "gem install --local ./pkg/#{GEM_SPEC.full_name}.gem"
|
|
60
|
-
end
|
|
61
|
-
|
|
62
|
-
desc "Uninstall the gem"
|
|
63
|
-
task :uninstall do
|
|
64
|
-
installed_list = Gem.source_index.find_name(PKG_NAME)
|
|
65
|
-
if installed_list &&
|
|
66
|
-
(installed_list.collect { |s| s.version.to_s}.include?(PKG_VERSION))
|
|
67
|
-
sh(
|
|
68
|
-
"gem uninstall --version '#{PKG_VERSION}' " +
|
|
69
|
-
"--ignore-dependencies --executables #{PKG_NAME}"
|
|
70
|
-
)
|
|
71
|
-
end
|
|
72
|
-
end
|
|
73
|
-
|
|
74
|
-
desc "Reinstall the gem"
|
|
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
|
|
88
|
-
end
|
|
89
|
-
|
|
90
|
-
desc "Alias to gem:package"
|
|
91
|
-
task "gem" => "gem:package"
|
|
92
|
-
|
|
93
|
-
task "gem:release" => "gem:gemspec"
|
|
94
|
-
|
|
95
|
-
task "clobber" => ["gem:clobber_package"]
|
data/tasks/git.rake
DELETED
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
namespace :git do
|
|
4
|
-
namespace :tag do
|
|
5
|
-
desc "List tags from the Git repository"
|
|
6
|
-
task :list do
|
|
7
|
-
tags = `git tag -l`
|
|
8
|
-
tags.gsub!("\r", "")
|
|
9
|
-
tags = tags.split("\n").sort {|a, b| b <=> a }
|
|
10
|
-
puts tags.join("\n")
|
|
11
|
-
end
|
|
12
|
-
|
|
13
|
-
desc "Create a new tag in the Git repository"
|
|
14
|
-
task :create do
|
|
15
|
-
changelog = File.open("CHANGELOG.md", "r") { |file| file.read }
|
|
16
|
-
puts "-" * 80
|
|
17
|
-
puts changelog
|
|
18
|
-
puts "-" * 80
|
|
19
|
-
puts
|
|
20
|
-
|
|
21
|
-
v = ENV["VERSION"] or abort "Must supply VERSION=x.y.z"
|
|
22
|
-
abort "Versions don't match #{v} vs #{PKG_VERSION}" if v != PKG_VERSION
|
|
23
|
-
|
|
24
|
-
git_status = `git status`
|
|
25
|
-
if git_status !~ /^nothing to commit/
|
|
26
|
-
abort "Working directory isn't clean."
|
|
27
|
-
end
|
|
28
|
-
|
|
29
|
-
tag = "#{PKG_NAME}-#{PKG_VERSION}"
|
|
30
|
-
msg = "Release #{PKG_NAME}-#{PKG_VERSION}"
|
|
31
|
-
|
|
32
|
-
existing_tags = `git tag -l #{PKG_NAME}-*`.split('\n')
|
|
33
|
-
if existing_tags.include?(tag)
|
|
34
|
-
warn("Tag already exists, deleting...")
|
|
35
|
-
unless system "git tag -d #{tag}"
|
|
36
|
-
abort "Tag deletion failed."
|
|
37
|
-
end
|
|
38
|
-
end
|
|
39
|
-
puts "Creating git tag '#{tag}'..."
|
|
40
|
-
unless system "git tag -a -m \"#{msg}\" #{tag}"
|
|
41
|
-
abort "Tag creation failed."
|
|
42
|
-
end
|
|
43
|
-
end
|
|
44
|
-
end
|
|
45
|
-
end
|
|
46
|
-
|
|
47
|
-
task "gem:release" => "git:tag:create"
|
data/tasks/metrics.rake
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
namespace :metrics do
|
|
4
|
-
task :lines do
|
|
5
|
-
lines, codelines, total_lines, total_codelines = 0, 0, 0, 0
|
|
6
|
-
for file_name in FileList["lib/**/*.rb"]
|
|
7
|
-
f = File.open(file_name)
|
|
8
|
-
while line = f.gets
|
|
9
|
-
lines += 1
|
|
10
|
-
next if line =~ /^\s*$/
|
|
11
|
-
next if line =~ /^\s*#/
|
|
12
|
-
codelines += 1
|
|
13
|
-
end
|
|
14
|
-
puts "L: #{sprintf("%4d", lines)}, " +
|
|
15
|
-
"LOC #{sprintf("%4d", codelines)} | #{file_name}"
|
|
16
|
-
total_lines += lines
|
|
17
|
-
total_codelines += codelines
|
|
18
|
-
|
|
19
|
-
lines, codelines = 0, 0
|
|
20
|
-
end
|
|
21
|
-
|
|
22
|
-
puts "Total: Lines #{total_lines}, LOC #{total_codelines}"
|
|
23
|
-
end
|
|
24
|
-
end
|
data/tasks/profile.rake
DELETED
|
@@ -1,72 +0,0 @@
|
|
|
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¶ms=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
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
require "rspec/core/rake_task"
|
|
4
|
-
|
|
5
|
-
namespace :spec do
|
|
6
|
-
RSpec::Core::RakeTask.new(:simplecov) do |t|
|
|
7
|
-
t.pattern = FileList['spec/**/*_spec.rb']
|
|
8
|
-
t.rspec_opts = %w[--color --format documentation] unless ENV["CI"]
|
|
9
|
-
end
|
|
10
|
-
|
|
11
|
-
namespace :simplecov do
|
|
12
|
-
desc "Browse the code coverage report."
|
|
13
|
-
task :browse => "spec:simplecov" do
|
|
14
|
-
require "launchy"
|
|
15
|
-
Launchy.open("coverage/index.html")
|
|
16
|
-
end
|
|
17
|
-
end
|
|
18
|
-
end
|
|
19
|
-
|
|
20
|
-
desc "Alias to spec:simplecov"
|
|
21
|
-
task "spec" => "spec:simplecov"
|
|
22
|
-
|
|
23
|
-
task "clobber" => ["spec:clobber_simplecov"]
|
data/tasks/yard.rake
DELETED
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
require "rake"
|
|
4
|
-
|
|
5
|
-
begin
|
|
6
|
-
require "yard"
|
|
7
|
-
require "yard/rake/yardoc_task"
|
|
8
|
-
|
|
9
|
-
namespace :doc do
|
|
10
|
-
desc "Generate Yardoc documentation"
|
|
11
|
-
YARD::Rake::YardocTask.new do |yardoc|
|
|
12
|
-
yardoc.name = "yard"
|
|
13
|
-
yardoc.options = ["--verbose", "--markup", "markdown"]
|
|
14
|
-
yardoc.files = FileList[
|
|
15
|
-
"lib/**/*.rb", "ext/**/*.c",
|
|
16
|
-
"README.md", "CHANGELOG.md", "LICENSE.txt"
|
|
17
|
-
].exclude(/idna/)
|
|
18
|
-
end
|
|
19
|
-
end
|
|
20
|
-
|
|
21
|
-
task "clobber" => ["doc:clobber_yard"]
|
|
22
|
-
|
|
23
|
-
desc "Alias to doc:yard"
|
|
24
|
-
task "doc" => "doc:yard"
|
|
25
|
-
rescue LoadError
|
|
26
|
-
# If yard isn't available, it's not the end of the world
|
|
27
|
-
desc "Alias to doc:rdoc"
|
|
28
|
-
task "doc" => "doc:rdoc"
|
|
29
|
-
end
|