public_suffix 5.0.3 → 5.0.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -9,6 +9,6 @@
9
9
  module PublicSuffix
10
10
 
11
11
  # @return [String] the current library version
12
- VERSION = "5.0.3"
12
+ VERSION = "5.0.4"
13
13
 
14
14
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: public_suffix
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.0.3
4
+ version: 5.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Simone Carletti
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-07-11 00:00:00.000000000 Z
11
+ date: 2023-11-17 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: PublicSuffix can parse and decompose a domain name into top level domain,
14
14
  domain and subdomains.
@@ -19,23 +19,12 @@ extensions: []
19
19
  extra_rdoc_files:
20
20
  - LICENSE.txt
21
21
  files:
22
- - ".github/FUNDING.yml"
23
- - ".github/dependabot.yml"
24
- - ".github/workflows/psl-update.yml"
25
- - ".github/workflows/release.yml"
26
- - ".github/workflows/tests.yml"
27
- - ".gitignore"
28
- - ".rubocop.yml"
29
- - ".rubocop_opinionated.yml"
30
22
  - ".yardopts"
31
23
  - 2.0-Upgrade.md
32
24
  - CHANGELOG.md
33
- - Gemfile
34
25
  - LICENSE.txt
35
26
  - README.md
36
- - Rakefile
37
27
  - SECURITY.md
38
- - bin/console
39
28
  - data/list.txt
40
29
  - lib/public_suffix.rb
41
30
  - lib/public_suffix/domain.rb
@@ -43,38 +32,15 @@ files:
43
32
  - lib/public_suffix/list.rb
44
33
  - lib/public_suffix/rule.rb
45
34
  - lib/public_suffix/version.rb
46
- - public_suffix.gemspec
47
- - test/.empty
48
- - test/acceptance_test.rb
49
- - test/benchmarks/bm_find.rb
50
- - test/benchmarks/bm_find_all.rb
51
- - test/benchmarks/bm_names.rb
52
- - test/benchmarks/bm_select.rb
53
- - test/benchmarks/bm_select_incremental.rb
54
- - test/benchmarks/bm_valid.rb
55
- - test/profilers/domain_profiler.rb
56
- - test/profilers/find_profiler.rb
57
- - test/profilers/find_profiler_jp.rb
58
- - test/profilers/initialization_profiler.rb
59
- - test/profilers/list_profsize.rb
60
- - test/profilers/object_binsize.rb
61
- - test/psl_test.rb
62
- - test/test_helper.rb
63
- - test/tests.txt
64
- - test/unit/domain_test.rb
65
- - test/unit/errors_test.rb
66
- - test/unit/list_test.rb
67
- - test/unit/public_suffix_test.rb
68
- - test/unit/rule_test.rb
69
35
  homepage: https://simonecarletti.com/code/publicsuffix-ruby
70
36
  licenses:
71
37
  - MIT
72
38
  metadata:
73
39
  bug_tracker_uri: https://github.com/weppos/publicsuffix-ruby/issues
74
40
  changelog_uri: https://github.com/weppos/publicsuffix-ruby/blob/master/CHANGELOG.md
75
- documentation_uri: https://rubydoc.info/gems/public_suffix/5.0.3
41
+ documentation_uri: https://rubydoc.info/gems/public_suffix/5.0.4
76
42
  homepage_uri: https://simonecarletti.com/code/publicsuffix-ruby
77
- source_code_uri: https://github.com/weppos/publicsuffix-ruby/tree/v5.0.3
43
+ source_code_uri: https://github.com/weppos/publicsuffix-ruby/tree/v5.0.4
78
44
  post_install_message:
79
45
  rdoc_options: []
80
46
  require_paths:
data/.github/FUNDING.yml DELETED
@@ -1,12 +0,0 @@
1
- # These are supported funding model platforms
2
-
3
- github: # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2]
4
- patreon: # Replace with a single Patreon username
5
- open_collective: # Replace with a single Open Collective username
6
- ko_fi: # Replace with a single Ko-fi username
7
- tidelift: "rubygems/public_suffix"
8
- community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
9
- liberapay: # Replace with a single Liberapay username
10
- issuehunt: # Replace with a single IssueHunt username
11
- otechie: # Replace with a single Otechie username
12
- custom: # Replace with a single custom sponsorship URL
@@ -1,19 +0,0 @@
1
- version: 2
2
- updates:
3
- - package-ecosystem: bundler
4
- directory: "/"
5
- schedule:
6
- interval: daily
7
- time: "04:00"
8
- open-pull-requests-limit: 10
9
- labels:
10
- - dependencies
11
-
12
- - package-ecosystem: "github-actions"
13
- directory: "/"
14
- schedule:
15
- interval: "daily"
16
- time: "04:00"
17
- open-pull-requests-limit: 10
18
- labels:
19
- - dependencies
@@ -1,38 +0,0 @@
1
- name: PSL Update
2
-
3
- on:
4
- workflow_dispatch:
5
- schedule:
6
- - cron: '40 6 * * *'
7
-
8
- jobs:
9
- update:
10
- runs-on: ubuntu-latest
11
- steps:
12
-
13
- - name: Checkout
14
- uses: actions/checkout@v3
15
-
16
- - name: Set up Ruby
17
- uses: ruby/setup-ruby@v1
18
- with:
19
- ruby-version: "3.1"
20
- bundler-cache: true
21
-
22
- - name: Update PSL
23
- run: bundle exec rake update-list
24
-
25
- - name: Create Pull Request
26
- uses: peter-evans/create-pull-request@v5
27
- with:
28
- title: PSL auto-update
29
- commit-message: Updated list from source
30
- reviewers: weppos
31
- add-paths: |
32
- data/list.txt
33
-
34
- - name: Check Pull Request
35
- if: ${{ steps.cpr.outputs.pull-request-number }}
36
- run: |
37
- echo "Pull Request Number - ${{ steps.cpr.outputs.pull-request-number }}"
38
- echo "Pull Request URL - ${{ steps.cpr.outputs.pull-request-url }}"
@@ -1,18 +0,0 @@
1
- name: Release
2
-
3
- on:
4
- push:
5
- tags:
6
- - v*.*.*
7
-
8
- jobs:
9
- release:
10
- runs-on: ubuntu-latest
11
- steps:
12
- - name: Checkout
13
- uses: actions/checkout@v3
14
- - name: Release Gem
15
- uses: cadwallion/publish-rubygems-action@94a6f4cd5350581749c569b5001eecc864e3ad0b
16
- env:
17
- RUBYGEMS_API_KEY: ${{ secrets.RUBYGEMS_API_KEY }}
18
- RELEASE_COMMAND: rake release
@@ -1,30 +0,0 @@
1
- name: Tests
2
-
3
- on:
4
- push:
5
- pull_request:
6
- workflow_dispatch:
7
-
8
- jobs:
9
- test:
10
- strategy:
11
- matrix:
12
- ruby-version:
13
- - "2.6"
14
- - "2.7"
15
- - "3.0"
16
- - "3.1"
17
- - "3.2"
18
- runs-on: ubuntu-latest
19
- steps:
20
- - name: Checkout
21
- uses: actions/checkout@v3
22
- - name: Set up Ruby
23
- uses: ruby/setup-ruby@v1
24
- with:
25
- ruby-version: ${{ matrix.ruby-version }}
26
- bundler-cache: true
27
- - name: Rubocop
28
- run: bundle exec rake rubocop
29
- - name: Run tests
30
- run: bundle exec rake test
data/.gitignore DELETED
@@ -1,8 +0,0 @@
1
- # Bundler
2
- /.bundle
3
- /Gemfile.lock
4
- /pkg/*
5
-
6
- # YARD
7
- /.yardoc
8
- /yardoc/
data/.rubocop.yml DELETED
@@ -1,37 +0,0 @@
1
- inherit_from:
2
- - .rubocop_opinionated.yml
3
-
4
- AllCops:
5
- Exclude:
6
- # Exclude .gemspec files because they are generally auto-generated
7
- - '*.gemspec'
8
- # Exclude vendored folders
9
- - 'tmp/**/*'
10
- - 'vendor/**/*'
11
- # Exclude artifacts
12
- - 'pkg/**/*'
13
- # Other
14
- - 'test/benchmarks/**/*'
15
- - 'test/profilers/**/*'
16
- TargetRubyVersion: 2.6
17
-
18
- # I often use @_variable to avoid clashing.
19
- Naming/MemoizedInstanceVariableName:
20
- Enabled: false
21
-
22
- Style/ClassAndModuleChildren:
23
- Exclude:
24
- - 'spec/**/*_spec.rb'
25
- - 'test/**/*_test.rb'
26
-
27
- # Dear Rubocop, I don't want to use String#strip_heredoc
28
- Layout/HeredocIndentation:
29
- Enabled: false
30
-
31
- Style/WordArray:
32
- Enabled: false
33
- MinSize: 3
34
-
35
- Style/SymbolArray:
36
- Enabled: false
37
- MinSize: 3
@@ -1,135 +0,0 @@
1
- AllCops:
2
- Exclude:
3
- # Exclude .gemspec files because they are generally auto-generated
4
- - '*.gemspec'
5
- # Exclude vendored folders
6
- - 'tmp/**/*'
7
- - 'vendor/**/*'
8
- NewCops: enable
9
-
10
- # [codesmell]
11
- Layout/LineLength:
12
- Enabled: false
13
- Exclude:
14
- - 'spec/**/*_spec.rb'
15
- - 'test/**/*_test.rb'
16
- Max: 100
17
-
18
- # [codesmell]
19
- Metrics/AbcSize:
20
- Enabled: false
21
- Exclude:
22
- - 'spec/**/*_spec.rb'
23
- - 'test/**/*_test.rb'
24
-
25
- # [codesmell]
26
- Metrics/BlockLength:
27
- Enabled: false
28
-
29
- # [codesmell]
30
- Metrics/CyclomaticComplexity:
31
- Enabled: false
32
- Exclude:
33
- - 'spec/**/*_spec.rb'
34
- - 'test/**/*_test.rb'
35
-
36
- # [codesmell]
37
- Metrics/ClassLength:
38
- Enabled: false
39
- Exclude:
40
- - 'spec/**/*_spec.rb'
41
- - 'test/**/*_test.rb'
42
-
43
- # [codesmell]
44
- Metrics/MethodLength:
45
- Enabled: false
46
- Exclude:
47
- - 'spec/**/*_spec.rb'
48
- - 'test/**/*_test.rb'
49
- Max: 10
50
-
51
- # [codesmell]
52
- Metrics/ModuleLength:
53
- Enabled: false
54
- Exclude:
55
- - 'spec/**/*_spec.rb'
56
- - 'test/**/*_test.rb'
57
-
58
- # [codesmell]
59
- Metrics/ParameterLists:
60
- Enabled: false
61
- Max: 5
62
-
63
- # [codesmell]
64
- Metrics/PerceivedComplexity:
65
- Enabled: false
66
-
67
- # Do not use "and" or "or" in conditionals, but for readability we can use it
68
- # to chain executions. Just beware of operator order.
69
- Style/AndOr:
70
- EnforcedStyle: conditionals
71
-
72
- Style/Documentation:
73
- Exclude:
74
- - 'spec/**/*'
75
- - 'test/**/*'
76
-
77
- # Double empty lines are useful to separate conceptually different methods
78
- # in the same class or module.
79
- Layout/EmptyLines:
80
- Enabled: false
81
-
82
- # In most cases, a space is nice. Sometimes, it's not.
83
- # Just be consistent with the rest of the surrounding code.
84
- Layout/EmptyLinesAroundClassBody:
85
- Enabled: false
86
-
87
- # In most cases, a space is nice. Sometimes, it's not.
88
- # Just be consistent with the rest of the surrounding code.
89
- Layout/EmptyLinesAroundModuleBody:
90
- Enabled: false
91
-
92
- # This is quite buggy, as it doesn't recognize double lines.
93
- # Double empty lines are useful to separate conceptually different methods
94
- # in the same class or module.
95
- Layout/EmptyLineBetweenDefs:
96
- Enabled: false
97
-
98
- # Annotated tokens (like %<foo>s) are a good thing, but in most cases we don't need them.
99
- # %s is a simpler and straightforward version that works in almost all cases. So don't complain.
100
- Style/FormatStringToken:
101
- Enabled: false
102
-
103
- # unless is not always cool.
104
- Style/NegatedIf:
105
- Enabled: false
106
-
107
- # There are cases were the inline rescue is ok. We can either downgrade the severity,
108
- # or rely on the developer judgement on a case-by-case basis.
109
- Style/RescueModifier:
110
- Enabled: false
111
-
112
- Style/SymbolArray:
113
- EnforcedStyle: brackets
114
-
115
- # Hate It or Love It, I prefer double quotes as this is more consistent
116
- # with several other programming languages and the output of puts and inspect.
117
- Style/StringLiterals:
118
- EnforcedStyle: double_quotes
119
-
120
- # It's nice to be consistent. The trailing comma also allows easy reordering,
121
- # and doesn't cause a diff in Git when you add a line to the bottom.
122
- Style/TrailingCommaInArrayLiteral:
123
- EnforcedStyleForMultiline: consistent_comma
124
- Style/TrailingCommaInHashLiteral:
125
- EnforcedStyleForMultiline: consistent_comma
126
-
127
- Style/TrivialAccessors:
128
- # IgnoreClassMethods because I want to be able to define class-level accessors
129
- # that sets an instance variable on the metaclass, such as:
130
- #
131
- # def self.default=(value)
132
- # @default = value
133
- # end
134
- #
135
- IgnoreClassMethods: true
data/Gemfile DELETED
@@ -1,14 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- source "https://rubygems.org"
4
-
5
- gemspec
6
-
7
- gem "rake"
8
-
9
- gem "memory_profiler", require: false
10
- gem "minitest"
11
- gem "minitest-reporters"
12
- gem "mocha", "~> 2.0.1"
13
- gem "rubocop", require: false
14
- gem "yard"
data/Rakefile DELETED
@@ -1,52 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require "bundler/gem_tasks"
4
-
5
- # By default, run tests and linter.
6
- task default: [:test, :rubocop]
7
-
8
-
9
- require "rake/testtask"
10
-
11
- Rake::TestTask.new do |t|
12
- t.libs = %w[lib test]
13
- t.pattern = "test/**/*_test.rb"
14
- t.verbose = !ENV["VERBOSE"].nil?
15
- t.warning = !ENV["WARNING"].nil?
16
- end
17
-
18
- require "rubocop/rake_task"
19
-
20
- RuboCop::RakeTask.new
21
-
22
-
23
- require "yard"
24
- require "yard/rake/yardoc_task"
25
-
26
- YARD::Rake::YardocTask.new(:yardoc) do |y|
27
- y.options = ["--output-dir", "yardoc"]
28
- end
29
-
30
- CLOBBER.include "yardoc"
31
-
32
-
33
- task :benchmarks do
34
- Dir["benchmarks/bm_*.rb"].each do |file|
35
- sh "ruby #{file}"
36
- end
37
- end
38
- task default: [:benchmarks] if ENV["BENCHMARKS"] == "1"
39
-
40
-
41
- desc "Downloads the Public Suffix List file from the repository and stores it locally."
42
- task :"update-list" do
43
- require "net/http"
44
-
45
- definition_url = "https://raw.githubusercontent.com/publicsuffix/list/master/public_suffix_list.dat"
46
-
47
- File.open("data/list.txt", "w+") do |f|
48
- response = Net::HTTP.get_response(URI.parse(definition_url))
49
- response.body
50
- f.write(response.body)
51
- end
52
- end
data/bin/console DELETED
@@ -1,15 +0,0 @@
1
- #!/usr/bin/env ruby
2
- # frozen_string_literal: true
3
-
4
- require "bundler/setup"
5
- require "public_suffix"
6
-
7
- # You can add fixtures and/or initialization code here to make experimenting
8
- # with your gem easier. You can also use a different console, if you like.
9
-
10
- # (If you use this, don't forget to add pry to your Gemfile!)
11
- # require "pry"
12
- # Pry.start
13
-
14
- require "irb"
15
- IRB.start
@@ -1,29 +0,0 @@
1
- # -*- encoding: utf-8 -*-
2
- $LOAD_PATH.push File.expand_path("../lib", __FILE__)
3
- require "public_suffix/version"
4
-
5
- Gem::Specification.new do |s|
6
- s.name = "public_suffix"
7
- s.version = PublicSuffix::VERSION
8
- s.authors = ["Simone Carletti"]
9
- s.email = ["weppos@weppos.net"]
10
- s.homepage = "https://simonecarletti.com/code/publicsuffix-ruby"
11
- s.summary = "Domain name parser based on the Public Suffix List."
12
- s.description = "PublicSuffix can parse and decompose a domain name into top level domain, domain and subdomains."
13
- s.licenses = ["MIT"]
14
-
15
- s.metadata = {
16
- "bug_tracker_uri" => "https://github.com/weppos/publicsuffix-ruby/issues",
17
- "changelog_uri" => "https://github.com/weppos/publicsuffix-ruby/blob/master/CHANGELOG.md",
18
- "documentation_uri" => "https://rubydoc.info/gems/#{s.name}/#{s.version}",
19
- "homepage_uri" => s.homepage,
20
- "source_code_uri" => "https://github.com/weppos/publicsuffix-ruby/tree/v#{s.version}",
21
- }
22
-
23
- s.required_ruby_version = ">= 2.6"
24
-
25
- s.require_paths = ["lib"]
26
- s.files = `git ls-files`.split("\n")
27
- s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
28
- s.extra_rdoc_files = %w( LICENSE.txt )
29
- end
data/test/.empty DELETED
@@ -1,2 +0,0 @@
1
- # This is an empty file I use to force a non-empty commit when I only need to store notes
2
- ..
@@ -1,131 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require "test_helper"
4
-
5
- class AcceptanceTest < Minitest::Test
6
-
7
- VALID_CASES = [
8
- ["example.com", "example.com", [nil, "example", "com"]],
9
- ["foo.example.com", "example.com", ["foo", "example", "com"]],
10
-
11
- ["verybritish.co.uk", "verybritish.co.uk", [nil, "verybritish", "co.uk"]],
12
- ["foo.verybritish.co.uk", "verybritish.co.uk", ["foo", "verybritish", "co.uk"]],
13
-
14
- ["parliament.uk", "parliament.uk", [nil, "parliament", "uk"]],
15
- ["foo.parliament.uk", "parliament.uk", ["foo", "parliament", "uk"]],
16
- ].freeze
17
-
18
- def test_valid
19
- VALID_CASES.each do |input, domain, results|
20
- parsed = PublicSuffix.parse(input)
21
- trd, sld, tld = results
22
- assert_equal tld, parsed.tld, "Invalid tld for `#{name}`"
23
- assert_equal sld, parsed.sld, "Invalid sld for `#{name}`"
24
- if trd.nil?
25
- assert_nil parsed.trd, "Invalid trd for `#{name}`"
26
- else
27
- assert_equal trd, parsed.trd, "Invalid trd for `#{name}`"
28
- end
29
-
30
- assert_equal domain, PublicSuffix.domain(input)
31
- assert PublicSuffix.valid?(input)
32
- end
33
- end
34
-
35
-
36
- INVALID_CASES = [
37
- ["nic.bd", PublicSuffix::DomainNotAllowed],
38
- [nil, PublicSuffix::DomainInvalid],
39
- ["", PublicSuffix::DomainInvalid],
40
- [" ", PublicSuffix::DomainInvalid],
41
- ].freeze
42
-
43
- def test_invalid
44
- INVALID_CASES.each do |(name, error)|
45
- assert_raises(error) { PublicSuffix.parse(name) }
46
- assert !PublicSuffix.valid?(name)
47
- end
48
- end
49
-
50
-
51
- REJECTED_CASES = [
52
- ["www. .com", true],
53
- ["foo.co..uk", true],
54
- ["goo,gle.com", true],
55
- ["-google.com", true],
56
- ["google-.com", true],
57
-
58
- # This case was covered in GH-15.
59
- # I decided to cover this case because it's not easily reproducible with URI.parse
60
- # and can lead to several false positives.
61
- ["http://google.com", false],
62
- ].freeze
63
-
64
- def test_rejected
65
- REJECTED_CASES.each do |name, expected|
66
- assert_equal expected, PublicSuffix.valid?(name),
67
- format("Expected %s to be %s", name.inspect, expected.inspect)
68
- assert !valid_domain?(name),
69
- "#{name} expected to be invalid"
70
- end
71
- end
72
-
73
-
74
- CASE_CASES = [
75
- ["Www.google.com", %w[www google com]],
76
- ["www.Google.com", %w[www google com]],
77
- ["www.google.Com", %w[www google com]],
78
- ].freeze
79
-
80
- def test_ignore_case
81
- CASE_CASES.each do |name, results|
82
- domain = PublicSuffix.parse(name)
83
- trd, sld, tld = results
84
- assert_equal tld, domain.tld, "Invalid tld for `#{name}'"
85
- assert_equal sld, domain.sld, "Invalid sld for `#{name}'"
86
- assert_equal trd, domain.trd, "Invalid trd for `#{name}'"
87
- assert PublicSuffix.valid?(name)
88
- end
89
- end
90
-
91
-
92
- INCLUDE_PRIVATE_CASES = [
93
- ["blogspot.com", true, "blogspot.com"],
94
- ["blogspot.com", false, nil],
95
- ["subdomain.blogspot.com", true, "blogspot.com"],
96
- ["subdomain.blogspot.com", false, "subdomain.blogspot.com"],
97
- ].freeze
98
-
99
- # rubocop:disable Style/CombinableLoops
100
- def test_ignore_private
101
- # test domain and parse
102
- INCLUDE_PRIVATE_CASES.each do |given, ignore_private, expected|
103
- if expected.nil?
104
- assert_nil PublicSuffix.domain(given, ignore_private: ignore_private)
105
- else
106
- assert_equal expected, PublicSuffix.domain(given, ignore_private: ignore_private)
107
- end
108
- end
109
- # test valid?
110
- INCLUDE_PRIVATE_CASES.each do |given, ignore_private, expected|
111
- assert_equal !expected.nil?, PublicSuffix.valid?(given, ignore_private: ignore_private)
112
- end
113
- end
114
- # rubocop:enable Style/CombinableLoops
115
-
116
-
117
- def valid_uri?(name)
118
- uri = URI.parse(name)
119
- !uri.host.nil?
120
- rescue StandardError
121
- false
122
- end
123
-
124
- def valid_domain?(name)
125
- uri = URI.parse(name)
126
- !uri.host.nil? && uri.scheme.nil?
127
- rescue StandardError
128
- false
129
- end
130
-
131
- end