public_suffix 1.2.1 → 1.3.0

Sign up to get free protection for your applications and to get access to all the features.
data/.travis.yml CHANGED
@@ -3,10 +3,15 @@ rvm:
3
3
  - 1.8.7
4
4
  - 1.9.2
5
5
  - 1.9.3
6
+ - 2.0.0
6
7
  - jruby-18mode
7
- # - jruby-19mode
8
+ - jruby-19mode
8
9
  - rbx-18mode
10
+ - rbx-19mode
9
11
  - ree
10
12
  notifications:
11
13
  recipients:
12
- - weppos@weppos.net
14
+ - weppos@weppos.net
15
+ matrix:
16
+ allow_failures:
17
+ - rvm: rbx-19mode
data/CHANGELOG.md CHANGED
@@ -1,6 +1,13 @@
1
1
  # Changelog
2
2
 
3
3
 
4
+ ## Release 1.3.0
5
+
6
+ - NEW: Ability to skip Private Domains (GH-28). [Thanks @rb2k]
7
+
8
+ - CHANGED: Updated definitions.
9
+
10
+
4
11
  ## Release 1.2.1
5
12
 
6
13
  - CHANGED: Updated definitions.
data/README.md CHANGED
@@ -108,6 +108,23 @@ This library automatically recognizes Fully Qualified Domain Names. A FQDN is a
108
108
  domain.tld
109
109
  # => "com"
110
110
 
111
+ ## Private domains
112
+
113
+ This library has support for switching off support for private (non-ICANN) domains
114
+
115
+ # Parse a domain on a private TLD
116
+ domain = PublicSuffix.parse("something.blogspot.com")
117
+ # => #<PublicSuffix::Domain>
118
+ domain.tld
119
+ # => "blogspot.com"
120
+
121
+ # Disable support for private TLDs
122
+ PublicSuffix::List.private_domains = false
123
+ # => #<PublicSuffix::List>
124
+ domain = PublicSuffix.parse("something.blogspot.com")
125
+ # => #<PublicSuffix::Domain>
126
+ domain.tld
127
+ # => "com"
111
128
 
112
129
  ## Feedback and bug reports
113
130
 
@@ -691,6 +691,14 @@ inf.cu
691
691
  // cv : http://en.wikipedia.org/wiki/.cv
692
692
  cv
693
693
 
694
+ // cw : http://www.una.cw/cw_registry/
695
+ // Confirmed by registry <registry@una.net> 2013-03-26
696
+ cw
697
+ com.cw
698
+ edu.cw
699
+ net.cw
700
+ org.cw
701
+
694
702
  // cx : http://en.wikipedia.org/wiki/.cx
695
703
  // list of other 2nd level tlds ?
696
704
  cx
@@ -5308,6 +5316,9 @@ org.pn
5308
5316
  edu.pn
5309
5317
  net.pn
5310
5318
 
5319
+ // post : http://en.wikipedia.org/wiki/.post
5320
+ post
5321
+
5311
5322
  // pr : http://www.nic.pr/index.asp?f=1
5312
5323
  pr
5313
5324
  com.pr
@@ -6950,4 +6961,38 @@ betainabox.com
6950
6961
  // Requested by Tim Kramer <tkramer@rhcloud.com> 2012-10-24
6951
6962
  rhcloud.com
6952
6963
 
6964
+ // Amazon Elastic Load Balancing : https://aws.amazon.com/elasticloadbalancing/
6965
+ // Requested by Scott Vidmar <svidmar@amazon.com> 2013-03-27
6966
+ elb.amazonaws.com
6967
+
6968
+ // Amazon S3 : https://aws.amazon.com/s3/
6969
+ // Requested by Courtney Eckhardt <coec@amazon.com> 2013-03-22
6970
+ s3.amazonaws.com
6971
+ s3-us-west-2.amazonaws.com
6972
+ s3-us-west-1.amazonaws.com
6973
+ s3-eu-west-1.amazonaws.com
6974
+ s3-ap-southeast-1.amazonaws.com
6975
+ s3-ap-southeast-2.amazonaws.com
6976
+ s3-ap-northeast-1.amazonaws.com
6977
+ s3-sa-east-1.amazonaws.com
6978
+ s3-us-gov-west-1.amazonaws.com
6979
+ s3-fips-us-gov-west-1.amazonaws.com
6980
+ s3-website-us-east-1.amazonaws.com
6981
+ s3-website-us-west-2.amazonaws.com
6982
+ s3-website-us-west-1.amazonaws.com
6983
+ s3-website-eu-west-1.amazonaws.com
6984
+ s3-website-ap-southeast-1.amazonaws.com
6985
+ s3-website-ap-southeast-2.amazonaws.com
6986
+ s3-website-ap-northeast-1.amazonaws.com
6987
+ s3-website-sa-east-1.amazonaws.com
6988
+ s3-website-us-gov-west-1.amazonaws.com
6989
+
6990
+ // Amazon CloudFront : https://aws.amazon.com/cloudfront/
6991
+ // Requested by Donavan Miller <donavanm@amazon.com> 2013-03-22
6992
+ cloudfront.net
6993
+
6994
+ // NYC.mn : http://www.information.nyc.mn
6995
+ // Requested by Matthew Brown <mattbrown@nyc.mn> 2013-03-11
6996
+ nyc.mn
6997
+
6953
6998
  // ===END PRIVATE DOMAINS===
@@ -67,6 +67,23 @@ module PublicSuffix
67
67
  @default = value
68
68
  end
69
69
 
70
+ # Shows if support for private (non-ICANN) domains is enabled or not
71
+ #
72
+ # @return [Boolean]
73
+ def self.private_domains?
74
+ @private_domains != false
75
+ end
76
+
77
+ # Enables/disables support for private (non-ICANN) domains
78
+ # Implicitly reloads the list
79
+ # @param [Boolean] enable/disable support
80
+ #
81
+ # @return [PublicSuffix::List]
82
+ def self.private_domains=(value)
83
+ @private_domains = !!value
84
+ self.clear
85
+ end
86
+
70
87
  # Sets the default rule list to +nil+.
71
88
  #
72
89
  # @return [self]
@@ -104,7 +121,7 @@ module PublicSuffix
104
121
  new do |list|
105
122
  input.each_line do |line|
106
123
  line.strip!
107
-
124
+ break if !private_domains? && line.include?('===BEGIN PRIVATE DOMAINS===')
108
125
  # strip blank lines
109
126
  if line.empty?
110
127
  next
@@ -11,8 +11,8 @@ module PublicSuffix
11
11
 
12
12
  module Version
13
13
  MAJOR = 1
14
- MINOR = 2
15
- PATCH = 1
14
+ MINOR = 3
15
+ PATCH = 0
16
16
  BUILD = nil
17
17
 
18
18
  STRING = [MAJOR, MINOR, PATCH, BUILD].compact.join(".")
@@ -2,15 +2,15 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = "public_suffix"
5
- s.version = "1.2.0"
5
+ s.version = "1.2.1"
6
6
 
7
7
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
8
8
  s.authors = ["Simone Carletti"]
9
- s.date = "2012-12-24"
9
+ s.date = "2013-03-26"
10
10
  s.description = "PublicSuffix can parse and decompose a domain name into top level domain, domain and subdomains."
11
11
  s.email = "weppos@weppos.net"
12
12
  s.files = [".gemtest", ".gitignore", ".travis.yml", ".yardopts", "CHANGELOG.md", "Gemfile", "LICENSE.txt", "README.md", "Rakefile", "lib/public_suffix.rb", "lib/public_suffix/definitions.txt", "lib/public_suffix/domain.rb", "lib/public_suffix/errors.rb", "lib/public_suffix/list.rb", "lib/public_suffix/rule.rb", "lib/public_suffix/version.rb", "public_suffix.gemspec", "test/acceptance_test.rb", "test/test_helper.rb", "test/unit/domain_test.rb", "test/unit/errors_test.rb", "test/unit/list_test.rb", "test/unit/public_suffix_test.rb", "test/unit/rule_test.rb"]
13
- s.homepage = "http://www.simonecarletti.com/code/public_suffix"
13
+ s.homepage = "http://www.simonecarletti.com/code/publicsuffix"
14
14
  s.require_paths = ["lib"]
15
15
  s.required_ruby_version = Gem::Requirement.new(">= 1.8.7")
16
16
  s.rubygems_version = "1.8.24"
@@ -38,7 +38,6 @@ class PublicSuffix::ListTest < Test::Unit::TestCase
38
38
  assert_equal PublicSuffix::List.new.add(rule), PublicSuffix::List.new.add(rule)
39
39
  end
40
40
 
41
-
42
41
  def test_add
43
42
  assert_equal @list, @list.add(PublicSuffix::Rule.factory(""))
44
43
  assert_equal @list, @list << PublicSuffix::Rule.factory("")
@@ -133,7 +132,6 @@ class PublicSuffix::ListTest < Test::Unit::TestCase
133
132
  assert_equal PublicSuffix::List.new, PublicSuffix::List.default
134
133
  end
135
134
 
136
-
137
135
  def test_self_parse
138
136
  list = PublicSuffix::List.parse(<<EOS)
139
137
  // ***** BEGIN LICENSE BLOCK *****
@@ -51,6 +51,21 @@ class PublicSuffixTest < Test::Unit::TestCase
51
51
  assert_equal "example", domain.sld
52
52
  assert_equal "www", domain.trd
53
53
  end
54
+
55
+ def test_private_domains_are_enabled_by_default
56
+ domain = PublicSuffix.parse("www.example.blogspot.com")
57
+ assert_equal "blogspot.com", domain.tld
58
+ end
59
+
60
+ def test_disable_support_for_private_domains
61
+ begin
62
+ PublicSuffix::List.private_domains = false
63
+ domain = PublicSuffix.parse("www.example.blogspot.com")
64
+ assert_equal "com", domain.tld
65
+ ensure
66
+ PublicSuffix::List.private_domains = true
67
+ end
68
+ end
54
69
 
55
70
  def test_self_parse_a_domain_with_custom_list
56
71
  list = PublicSuffix::List.new
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: public_suffix
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.1
4
+ version: 1.3.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-03-26 00:00:00.000000000 Z
12
+ date: 2013-04-03 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rake