Permalink
Browse files

*IMPORTANT*: DomainName has been renamed to PublicSuffixService. This…

… Gem is no longer maintained.
  • Loading branch information...
1 parent 47458ca commit 67ad5fcdf7e905f0c161bd8283a10e530f078473 @weppos committed May 31, 2010
Showing with 55 additions and 46 deletions.
  1. +2 −0 CHANGELOG.rdoc
  2. +4 −1 README.rdoc
  3. +2 −2 Rakefile
  4. +12 −8 test/domain_name/rule_list_test.rb
  5. +35 −35 test/domain_name/rule_test.rb
View
@@ -1,5 +1,7 @@
= Changelog
+*IMPORTANT*: DomainName has been renamed to PublicSuffixService. This Gem is no longer maintained.
+
== Release 0.3.0
View
@@ -1,5 +1,8 @@
= Domain Name Parser
+*IMPORTANT*: DomainName has been renamed to PublicSuffixService. This Gem is no longer maintained.
+
+
DomainName is a Ruby domain name parser based on the Public Suffix List available at http://publicsuffix.org.
@@ -35,7 +38,7 @@ Successfully tested against
== Installation
-Via RubyGems/Gemcutter
+Via RubyGems
$ gem install domain_name
View
@@ -9,7 +9,7 @@ require 'domain_name'
# Common package properties
PKG_NAME = ENV['PKG_NAME'] || DomainName::GEM
PKG_VERSION = ENV['PKG_VERSION'] || DomainName::VERSION
-RUBYFORGE_PROJECT = 'domain_name'
+RUBYFORGE_PROJECT = nil
if ENV['SNAPSHOT'].to_i == 1
PKG_VERSION << "." << Time.now.utc.strftime("%Y%m%d%H%M%S")
@@ -20,7 +20,7 @@ Echoe.new(PKG_NAME, PKG_VERSION) do |p|
p.author = "Simone Carletti"
p.email = "weppos@weppos.net"
p.summary = "Domain Name parser based on the Public Suffix List"
- p.url = "http://code.simonecarletti.com/domain-name"
+ p.url = "http://www.simonecarletti.com/code/public-suffix-service"
p.project = RUBYFORGE_PROJECT
p.description = <<-EOD
Intelligent Domain Name parser based in the Public Suffic List. \
@@ -6,6 +6,10 @@ def setup
@list = DomainName::RuleList.new
end
+ def teardown
+ DomainName::RuleList.clear
+ end
+
def test_initialize
assert_instance_of DomainName::RuleList, @list
@@ -62,13 +66,13 @@ def test_find
!bl.uk
!british-library.uk
EOS
- assert_equal DomainName::Rule.factory("com"), @list.find(domain_name("google.com"))
- assert_equal DomainName::Rule.factory("com"), @list.find(domain_name("foo.google.com"))
- assert_equal DomainName::Rule.factory("*.uk"), @list.find(domain_name("google.uk"))
- assert_equal DomainName::Rule.factory("*.uk"), @list.find(domain_name("google.co.uk"))
- assert_equal DomainName::Rule.factory("*.uk"), @list.find(domain_name("foo.google.co.uk"))
- assert_equal DomainName::Rule.factory("!british-library.uk"), @list.find(domain_name("british-library.uk"))
- assert_equal DomainName::Rule.factory("!british-library.uk"), @list.find(domain_name("foo.british-library.uk"))
+ assert_equal DomainName::Rule.factory("com"), @list.find("google.com")
+ assert_equal DomainName::Rule.factory("com"), @list.find("foo.google.com")
+ assert_equal DomainName::Rule.factory("*.uk"), @list.find("google.uk")
+ assert_equal DomainName::Rule.factory("*.uk"), @list.find("google.co.uk")
+ assert_equal DomainName::Rule.factory("*.uk"), @list.find("foo.google.co.uk")
+ assert_equal DomainName::Rule.factory("!british-library.uk"), @list.find("british-library.uk")
+ assert_equal DomainName::Rule.factory("!british-library.uk"), @list.find("foo.british-library.uk")
end
def test_select
@@ -82,7 +86,7 @@ def test_select
!bl.uk
!british-library.uk
EOS
- assert_equal 2, @list.select(domain_name("british-library.uk")).size
+ assert_equal 2, @list.select("british-library.uk").size
end
@@ -54,15 +54,15 @@ def test_equality_with_internals
def test_match
- assert @klass.new("uk").match?(domain_name("google.uk"))
- assert !@klass.new("gk").match?(domain_name("google.uk"))
- assert !@klass.new("google").match?(domain_name("google.uk"))
- assert @klass.new("uk").match?(domain_name("google.co.uk"))
- assert !@klass.new("gk").match?(domain_name("google.co.uk"))
- assert !@klass.new("co").match?(domain_name("google.co.uk"))
- assert @klass.new("co.uk").match?(domain_name("google.co.uk"))
- assert !@klass.new("uk.co").match?(domain_name("google.co.uk"))
- assert !@klass.new("go.uk").match?(domain_name("google.co.uk"))
+ assert @klass.new("uk").match?("google.uk")
+ assert !@klass.new("gk").match?("google.uk")
+ assert !@klass.new("google").match?("google.uk")
+ assert @klass.new("uk").match?("google.co.uk")
+ assert !@klass.new("gk").match?("google.co.uk")
+ assert !@klass.new("co").match?("google.co.uk")
+ assert @klass.new("co.uk").match?("google.co.uk")
+ assert !@klass.new("uk.co").match?("google.co.uk")
+ assert !@klass.new("go.uk").match?("google.co.uk")
end
def test_length
@@ -74,7 +74,7 @@ def test_parts
end
def test_decompose
- assert_raise(NotImplementedError) { @klass.new("com").decompose(DomainName.new("google.com")) }
+ assert_raise(NotImplementedError) { @klass.new("com").decompose("google.com") }
end
end
@@ -98,15 +98,15 @@ def test_initialize
def test_match
- assert @klass.new("uk").match?(domain_name("google.uk"))
- assert !@klass.new("gk").match?(domain_name("google.uk"))
- assert !@klass.new("google").match?(domain_name("google.uk"))
- assert @klass.new("uk").match?(domain_name("google.co.uk"))
- assert !@klass.new("gk").match?(domain_name("google.co.uk"))
- assert !@klass.new("co").match?(domain_name("google.co.uk"))
- assert @klass.new("co.uk").match?(domain_name("google.co.uk"))
- assert !@klass.new("uk.co").match?(domain_name("google.co.uk"))
- assert !@klass.new("go.uk").match?(domain_name("google.co.uk"))
+ assert @klass.new("uk").match?("google.uk")
+ assert !@klass.new("gk").match?("google.uk")
+ assert !@klass.new("google").match?("google.uk")
+ assert @klass.new("uk").match?("google.co.uk")
+ assert !@klass.new("gk").match?("google.co.uk")
+ assert !@klass.new("co").match?("google.co.uk")
+ assert @klass.new("co.uk").match?("google.co.uk")
+ assert !@klass.new("uk.co").match?("google.co.uk")
+ assert !@klass.new("go.uk").match?("google.co.uk")
end
def test_length
@@ -122,8 +122,8 @@ def test_parts
end
def test_decompose
- assert_equal %w(google com), @klass.new("com").decompose(DomainName.new("google.com"))
- assert_equal %w(foo.google com), @klass.new("com").decompose(DomainName.new("foo.google.com"))
+ assert_equal %w(google com), @klass.new("com").decompose("google.com")
+ assert_equal %w(foo.google com), @klass.new("com").decompose("foo.google.com")
end
end
@@ -147,12 +147,12 @@ def test_initialize
def test_match
- assert @klass.new("!uk").match?(domain_name("google.co.uk"))
- assert !@klass.new("!gk").match?(domain_name("google.co.uk"))
- assert @klass.new("!co.uk").match?(domain_name("google.co.uk"))
- assert !@klass.new("!go.uk").match?(domain_name("google.co.uk"))
- assert @klass.new("!british-library.uk").match?(domain_name("british-library.uk"))
- assert !@klass.new("!british-library.uk").match?(domain_name("google.co.uk"))
+ assert @klass.new("!uk").match?("google.co.uk")
+ assert !@klass.new("!gk").match?("google.co.uk")
+ assert @klass.new("!co.uk").match?("google.co.uk")
+ assert !@klass.new("!go.uk").match?("google.co.uk")
+ assert @klass.new("!british-library.uk").match?("british-library.uk")
+ assert !@klass.new("!british-library.uk").match?("google.co.uk")
end
def test_length
@@ -166,8 +166,8 @@ def test_parts
end
def test_decompose
- assert_equal %w(british-library uk), @klass.new("!british-library.uk").decompose(DomainName.new("british-library.uk"))
- assert_equal %w(foo.british-library uk), @klass.new("!british-library.uk").decompose(DomainName.new("foo.british-library.uk"))
+ assert_equal %w(british-library uk), @klass.new("!british-library.uk").decompose("british-library.uk")
+ assert_equal %w(foo.british-library uk), @klass.new("!british-library.uk").decompose("foo.british-library.uk")
end
end
@@ -191,10 +191,10 @@ def test_initialize
def test_match
- assert @klass.new("*.uk").match?(domain_name("google.uk"))
- assert @klass.new("*.uk").match?(domain_name("google.co.uk"))
- assert @klass.new("*.co.uk").match?(domain_name("google.co.uk"))
- assert !@klass.new("*.go.uk").match?(domain_name("google.co.uk"))
+ assert @klass.new("*.uk").match?("google.uk")
+ assert @klass.new("*.uk").match?("google.co.uk")
+ assert @klass.new("*.co.uk").match?("google.co.uk")
+ assert !@klass.new("*.go.uk").match?("google.co.uk")
end
def test_length
@@ -208,8 +208,8 @@ def test_parts
end
def test_decompose
- assert_equal %w(google co.uk), @klass.new("*.uk").decompose(DomainName.new("google.co.uk"))
- assert_equal %w(foo.google co.uk), @klass.new("*.uk").decompose(DomainName.new("foo.google.co.uk"))
+ assert_equal %w(google co.uk), @klass.new("*.uk").decompose("google.co.uk")
+ assert_equal %w(foo.google co.uk), @klass.new("*.uk").decompose("foo.google.co.uk")
end
end

0 comments on commit 67ad5fc

Please sign in to comment.