addressable 2.2.3 → 2.7.0
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of addressable might be problematic. Click here for more details.
- checksums.yaml +7 -0
- data/CHANGELOG.md +235 -0
- data/Gemfile +32 -0
- data/LICENSE.txt +202 -0
- data/README.md +121 -0
- data/Rakefile +9 -17
- data/data/unicode.data +0 -0
- data/lib/addressable.rb +4 -0
- data/lib/addressable/idna.rb +26 -4870
- data/lib/addressable/idna/native.rb +61 -0
- data/lib/addressable/idna/pure.rb +676 -0
- data/lib/addressable/template.rb +581 -585
- data/lib/addressable/uri.rb +870 -609
- data/lib/addressable/version.rb +16 -20
- data/spec/addressable/idna_spec.rb +170 -64
- data/spec/addressable/net_http_compat_spec.rb +30 -0
- data/spec/addressable/rack_mount_compat_spec.rb +106 -0
- data/spec/addressable/security_spec.rb +59 -0
- data/spec/addressable/template_spec.rb +1346 -2047
- data/spec/addressable/uri_spec.rb +3472 -1198
- data/spec/spec_helper.rb +24 -0
- data/tasks/clobber.rake +2 -0
- data/tasks/gem.rake +28 -19
- data/tasks/git.rake +9 -2
- data/tasks/metrics.rake +2 -0
- data/tasks/rspec.rake +23 -0
- data/tasks/yard.rake +7 -4
- metadata +78 -117
- data/CHANGELOG +0 -101
- data/LICENSE +0 -20
- data/README +0 -60
- data/tasks/rdoc.rake +0 -26
- data/tasks/rubyforge.rake +0 -89
- data/tasks/spec.rake +0 -47
- data/website/index.html +0 -110
data/LICENSE
DELETED
@@ -1,20 +0,0 @@
|
|
1
|
-
Addressable, Copyright (c) 2006-2010 Bob Aman
|
2
|
-
|
3
|
-
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
-
a copy of this software and associated documentation files (the
|
5
|
-
"Software"), to deal in the Software without restriction, including
|
6
|
-
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
-
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
-
permit persons to whom the Software is furnished to do so, subject to
|
9
|
-
the following conditions:
|
10
|
-
|
11
|
-
The above copyright notice and this permission notice shall be
|
12
|
-
included in all copies or substantial portions of the Software.
|
13
|
-
|
14
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
-
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
-
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
-
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
-
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
-
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
-
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README
DELETED
@@ -1,60 +0,0 @@
|
|
1
|
-
== About
|
2
|
-
|
3
|
-
Homepage:: Addressable[http://addressable.rubyforge.org/]
|
4
|
-
Authors:: Bob Aman (mailto:bob@sporkmonger.com)
|
5
|
-
Copyright:: Copyright 2010 Bob Aman
|
6
|
-
License:: MIT
|
7
|
-
|
8
|
-
Addressable is a replacement for the URI implementation that is part of
|
9
|
-
Ruby's standard library. It more closely conforms to the relevant RFCs and
|
10
|
-
adds support for IRIs and URI templates. Additionally, it provides extensive
|
11
|
-
support for URI templates.
|
12
|
-
|
13
|
-
== Classes
|
14
|
-
- {Addressable::URI}
|
15
|
-
- {Addressable::Template}
|
16
|
-
|
17
|
-
== Example usage
|
18
|
-
require "addressable/uri"
|
19
|
-
|
20
|
-
uri = Addressable::URI.parse("http://example.com/path/to/resource/")
|
21
|
-
uri.scheme
|
22
|
-
#=> "http"
|
23
|
-
uri.host
|
24
|
-
#=> "example.com"
|
25
|
-
uri.path
|
26
|
-
#=> "/path/to/resource/"
|
27
|
-
|
28
|
-
uri = Addressable::URI.parse("http://www.詹姆斯.com/")
|
29
|
-
uri.normalize
|
30
|
-
#=> #<Addressable::URI:0xc9a4c8 URI:http://www.xn--8ws00zhy3a.com/>
|
31
|
-
|
32
|
-
require "addressable/template"
|
33
|
-
|
34
|
-
template = Addressable::Template.new("http://example.com/{-list|+|query}/")
|
35
|
-
template.expand({
|
36
|
-
"query" => "an example query".split(" ")
|
37
|
-
})
|
38
|
-
#=> #<Addressable::URI:0xc9d95c URI:http://example.com/an+example+query/>
|
39
|
-
|
40
|
-
template = Addressable::Template.new(
|
41
|
-
"http://example.com/{-join|&|one,two,three}/"
|
42
|
-
)
|
43
|
-
template.partial_expand({"one" => "1", "three" => 3}).pattern
|
44
|
-
#=> "http://example.com/?one=1{-prefix|&two=|two}&three=3"
|
45
|
-
|
46
|
-
template = Addressable::Template.new(
|
47
|
-
"http://{host}/{-suffix|/|segments}?{-join|&|one,two,bogus}\#{fragment}"
|
48
|
-
)
|
49
|
-
uri = Addressable::URI.parse(
|
50
|
-
"http://example.com/a/b/c/?one=1&two=2#foo"
|
51
|
-
)
|
52
|
-
template.extract(uri)
|
53
|
-
#=>
|
54
|
-
# {
|
55
|
-
# "host" => "example.com",
|
56
|
-
# "segments" => ["a", "b", "c"],
|
57
|
-
# "one" => "1",
|
58
|
-
# "two" => "2",
|
59
|
-
# "fragment" => "foo"
|
60
|
-
# }
|
data/tasks/rdoc.rake
DELETED
@@ -1,26 +0,0 @@
|
|
1
|
-
require "rake/rdoctask"
|
2
|
-
|
3
|
-
namespace :doc do
|
4
|
-
desc "Generate RDoc documentation"
|
5
|
-
Rake::RDocTask.new do |rdoc|
|
6
|
-
rdoc.rdoc_dir = "doc"
|
7
|
-
rdoc.title = "#{PKG_NAME}-#{PKG_VERSION} Documentation"
|
8
|
-
rdoc.options << "--line-numbers" << "--inline-source" <<
|
9
|
-
"--accessor" << "cattr_accessor=object" << "--charset" << "utf-8"
|
10
|
-
rdoc.template = "#{ENV["template"]}.rb" if ENV["template"]
|
11
|
-
rdoc.rdoc_files.include("README", "CHANGELOG", "LICENSE")
|
12
|
-
rdoc.rdoc_files.include("lib/**/*.rb")
|
13
|
-
end
|
14
|
-
|
15
|
-
desc "Generate ri locally for testing"
|
16
|
-
task :ri do
|
17
|
-
sh "rdoc --ri -o ri ."
|
18
|
-
end
|
19
|
-
|
20
|
-
desc "Remove ri products"
|
21
|
-
task :clobber_ri do
|
22
|
-
rm_r "ri" rescue nil
|
23
|
-
end
|
24
|
-
end
|
25
|
-
|
26
|
-
task "clobber" => ["doc:clobber_rdoc", "doc:clobber_ri"]
|
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") { |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
|
data/tasks/spec.rake
DELETED
@@ -1,47 +0,0 @@
|
|
1
|
-
namespace :spec do
|
2
|
-
Spec::Rake::SpecTask.new(:rcov) do |t|
|
3
|
-
t.libs = %w[lib spec]
|
4
|
-
t.spec_files = FileList['spec/**/*_spec.rb']
|
5
|
-
t.spec_opts = ['--color', '--format', 'specdoc']
|
6
|
-
|
7
|
-
t.rcov = RCOV_ENABLED
|
8
|
-
t.rcov_opts = [
|
9
|
-
'--exclude', 'spec',
|
10
|
-
'--exclude', '1\\.8\\/gems',
|
11
|
-
'--exclude', '1\\.9\\/gems',
|
12
|
-
'--exclude', 'addressable\\/idna\\.rb', # unicode tables too big
|
13
|
-
]
|
14
|
-
end
|
15
|
-
|
16
|
-
Spec::Rake::SpecTask.new(:normal) do |t|
|
17
|
-
t.libs = %w[lib spec]
|
18
|
-
t.spec_files = FileList['spec/**/*_spec.rb']
|
19
|
-
t.spec_opts = ['--color', '--format', 'specdoc']
|
20
|
-
t.rcov = false
|
21
|
-
end
|
22
|
-
|
23
|
-
desc "Generate HTML Specdocs for all specs"
|
24
|
-
Spec::Rake::SpecTask.new(:specdoc) do |t|
|
25
|
-
specdoc_path = File.expand_path(File.join(File.dirname(__FILE__), '..', 'specdoc'))
|
26
|
-
Dir.mkdir(specdoc_path) if !File.exist?(specdoc_path)
|
27
|
-
|
28
|
-
output_file = File.join(specdoc_path, 'index.html')
|
29
|
-
t.libs = %w[lib spec]
|
30
|
-
t.spec_files = FileList['spec/**/*_spec.rb']
|
31
|
-
t.spec_opts = ["--format", "\"html:#{output_file}\"", "--diff"]
|
32
|
-
t.fail_on_error = false
|
33
|
-
end
|
34
|
-
|
35
|
-
namespace :rcov do
|
36
|
-
desc "Browse the code coverage report."
|
37
|
-
task :browse => "spec:rcov" do
|
38
|
-
require "launchy"
|
39
|
-
Launchy::Browser.run("coverage/index.html")
|
40
|
-
end
|
41
|
-
end
|
42
|
-
end
|
43
|
-
|
44
|
-
desc "Alias to spec:normal"
|
45
|
-
task "spec" => "spec:normal"
|
46
|
-
|
47
|
-
task "clobber" => ["spec:clobber_rcov"]
|
data/website/index.html
DELETED
@@ -1,110 +0,0 @@
|
|
1
|
-
<!DOCTYPE html>
|
2
|
-
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
|
3
|
-
<head>
|
4
|
-
<meta charset="utf-8"/>
|
5
|
-
<title>Addressable</title>
|
6
|
-
<style type="text/css">
|
7
|
-
* {
|
8
|
-
font-size: 100%;
|
9
|
-
margin: 0;
|
10
|
-
padding: 0;
|
11
|
-
}
|
12
|
-
|
13
|
-
body {
|
14
|
-
font-family: lucida grande, verdana, sans-serif;
|
15
|
-
margin: 1em;
|
16
|
-
}
|
17
|
-
|
18
|
-
a {
|
19
|
-
color: #880000;
|
20
|
-
}
|
21
|
-
|
22
|
-
a:visited {
|
23
|
-
color: #333333;
|
24
|
-
}
|
25
|
-
|
26
|
-
h1 {
|
27
|
-
font-size: 2em;
|
28
|
-
margin: 0 0 0.8em 0;
|
29
|
-
text-align: center;
|
30
|
-
}
|
31
|
-
|
32
|
-
h2 {
|
33
|
-
font-size: 1em;
|
34
|
-
margin: 0.8em 0;
|
35
|
-
}
|
36
|
-
|
37
|
-
p {
|
38
|
-
margin: 0.8em 0;
|
39
|
-
}
|
40
|
-
|
41
|
-
ul {
|
42
|
-
font-size: 0.9em;
|
43
|
-
margin: 0 0 0 1.5em;
|
44
|
-
}
|
45
|
-
|
46
|
-
div {
|
47
|
-
width: 50%;
|
48
|
-
margin: 0 auto;
|
49
|
-
padding: 0.8em;
|
50
|
-
background-color: #AA5852;
|
51
|
-
border: 2px solid #C2645D;
|
52
|
-
}
|
53
|
-
|
54
|
-
@media print {
|
55
|
-
body {
|
56
|
-
font-size: 0.9em;
|
57
|
-
}
|
58
|
-
|
59
|
-
a {
|
60
|
-
text-decoration: none;
|
61
|
-
color: #000;
|
62
|
-
}
|
63
|
-
}
|
64
|
-
</style>
|
65
|
-
</head>
|
66
|
-
<body>
|
67
|
-
<h1>Addressable</h1>
|
68
|
-
<div>
|
69
|
-
<p>
|
70
|
-
Addressable is a replacement for the URI implementation that is part
|
71
|
-
of Ruby's standard library. It more closely conforms to the relevant
|
72
|
-
RFCs and adds support for IRIs and URI templates.
|
73
|
-
</p>
|
74
|
-
<ul>
|
75
|
-
<li>
|
76
|
-
<a href="http://rubyforge.org/projects/addressable/">
|
77
|
-
Project Page
|
78
|
-
</a>
|
79
|
-
</li>
|
80
|
-
<li>
|
81
|
-
<a href="http://github.com/sporkmonger/addressable/tree/">
|
82
|
-
GitHub Page
|
83
|
-
</a>
|
84
|
-
</li>
|
85
|
-
<li><a href="/api/">API</a></li>
|
86
|
-
<li><a href="/specdoc/">Specifications</a></li>
|
87
|
-
<li><a href="/coverage/">Code Coverage</a></li>
|
88
|
-
</ul>
|
89
|
-
<p>
|
90
|
-
You know what to do:
|
91
|
-
</p>
|
92
|
-
<p>
|
93
|
-
<code>sudo gem install addressable</code>
|
94
|
-
</p>
|
95
|
-
<p>
|
96
|
-
Alternatively, you can:
|
97
|
-
</p>
|
98
|
-
<p>
|
99
|
-
<code>
|
100
|
-
git submodule add
|
101
|
-
git://github.com/sporkmonger/addressable.git
|
102
|
-
vendor/gems/addressable
|
103
|
-
</code>
|
104
|
-
</p>
|
105
|
-
<p>
|
106
|
-
Addressable works in Ruby 1.8.x, 1.9.x, and JRuby.
|
107
|
-
</p>
|
108
|
-
</div>
|
109
|
-
</body>
|
110
|
-
</html>
|