sxg_checker 0.1.0
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 +7 -0
- data/.rspec +3 -0
- data/.standard.yml +3 -0
- data/CHANGELOG.md +5 -0
- data/CODE_OF_CONDUCT.md +84 -0
- data/LICENSE.txt +21 -0
- data/README.md +108 -0
- data/Rakefile +16 -0
- data/exe/sxg-checker +7 -0
- data/lib/basic_loader.rb +9 -0
- data/lib/sxg_checker/checker.rb +118 -0
- data/lib/sxg_checker/cli.rb +49 -0
- data/lib/sxg_checker/document.rb +13 -0
- data/lib/sxg_checker/formatter.rb +23 -0
- data/lib/sxg_checker/subresource.rb +22 -0
- data/lib/sxg_checker/version.rb +5 -0
- data/lib/sxg_checker.rb +19 -0
- metadata +91 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 36798f6fd5461309de602122e726814a47c484bcf798260796f2b74726d158d4
|
4
|
+
data.tar.gz: 6ececedef77191f20b4b15d9b32faf84837af6e8f3c03ab87f87cfde1a6d2229
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: f33f3769f4f2a2671d10434800e0b6d247d7088f98535ab8bda5175f78ab3f1a411f3669f32a95a490254fffb835b791d49691311d3769b51cca607e2fe97e10
|
7
|
+
data.tar.gz: 7ace8929013bf4681de47150ec6ea9f5e92b535eca33da5aac72293339ddbb64fbcaca477a798ba6af14e344c25193c494182348e1d9f2255dd617cd4d4e8668
|
data/.rspec
ADDED
data/.standard.yml
ADDED
data/CHANGELOG.md
ADDED
data/CODE_OF_CONDUCT.md
ADDED
@@ -0,0 +1,84 @@
|
|
1
|
+
# Contributor Covenant Code of Conduct
|
2
|
+
|
3
|
+
## Our Pledge
|
4
|
+
|
5
|
+
We as members, contributors, and leaders pledge to make participation in our community a harassment-free experience for everyone, regardless of age, body size, visible or invisible disability, ethnicity, sex characteristics, gender identity and expression, level of experience, education, socio-economic status, nationality, personal appearance, race, religion, or sexual identity and orientation.
|
6
|
+
|
7
|
+
We pledge to act and interact in ways that contribute to an open, welcoming, diverse, inclusive, and healthy community.
|
8
|
+
|
9
|
+
## Our Standards
|
10
|
+
|
11
|
+
Examples of behavior that contributes to a positive environment for our community include:
|
12
|
+
|
13
|
+
* Demonstrating empathy and kindness toward other people
|
14
|
+
* Being respectful of differing opinions, viewpoints, and experiences
|
15
|
+
* Giving and gracefully accepting constructive feedback
|
16
|
+
* Accepting responsibility and apologizing to those affected by our mistakes, and learning from the experience
|
17
|
+
* Focusing on what is best not just for us as individuals, but for the overall community
|
18
|
+
|
19
|
+
Examples of unacceptable behavior include:
|
20
|
+
|
21
|
+
* The use of sexualized language or imagery, and sexual attention or
|
22
|
+
advances of any kind
|
23
|
+
* Trolling, insulting or derogatory comments, and personal or political attacks
|
24
|
+
* Public or private harassment
|
25
|
+
* Publishing others' private information, such as a physical or email
|
26
|
+
address, without their explicit permission
|
27
|
+
* Other conduct which could reasonably be considered inappropriate in a
|
28
|
+
professional setting
|
29
|
+
|
30
|
+
## Enforcement Responsibilities
|
31
|
+
|
32
|
+
Community leaders are responsible for clarifying and enforcing our standards of acceptable behavior and will take appropriate and fair corrective action in response to any behavior that they deem inappropriate, threatening, offensive, or harmful.
|
33
|
+
|
34
|
+
Community leaders have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, and will communicate reasons for moderation decisions when appropriate.
|
35
|
+
|
36
|
+
## Scope
|
37
|
+
|
38
|
+
This Code of Conduct applies within all community spaces, and also applies when an individual is officially representing the community in public spaces. Examples of representing our community include using an official e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event.
|
39
|
+
|
40
|
+
## Enforcement
|
41
|
+
|
42
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported to the community leaders responsible for enforcement. All complaints will be reviewed and investigated promptly and fairly.
|
43
|
+
|
44
|
+
All community leaders are obligated to respect the privacy and security of the reporter of any incident.
|
45
|
+
|
46
|
+
## Enforcement Guidelines
|
47
|
+
|
48
|
+
Community leaders will follow these Community Impact Guidelines in determining the consequences for any action they deem in violation of this Code of Conduct:
|
49
|
+
|
50
|
+
### 1. Correction
|
51
|
+
|
52
|
+
**Community Impact**: Use of inappropriate language or other behavior deemed unprofessional or unwelcome in the community.
|
53
|
+
|
54
|
+
**Consequence**: A private, written warning from community leaders, providing clarity around the nature of the violation and an explanation of why the behavior was inappropriate. A public apology may be requested.
|
55
|
+
|
56
|
+
### 2. Warning
|
57
|
+
|
58
|
+
**Community Impact**: A violation through a single incident or series of actions.
|
59
|
+
|
60
|
+
**Consequence**: A warning with consequences for continued behavior. No interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, for a specified period of time. This includes avoiding interactions in community spaces as well as external channels like social media. Violating these terms may lead to a temporary or permanent ban.
|
61
|
+
|
62
|
+
### 3. Temporary Ban
|
63
|
+
|
64
|
+
**Community Impact**: A serious violation of community standards, including sustained inappropriate behavior.
|
65
|
+
|
66
|
+
**Consequence**: A temporary ban from any sort of interaction or public communication with the community for a specified period of time. No public or private interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, is allowed during this period. Violating these terms may lead to a permanent ban.
|
67
|
+
|
68
|
+
### 4. Permanent Ban
|
69
|
+
|
70
|
+
**Community Impact**: Demonstrating a pattern of violation of community standards, including sustained inappropriate behavior, harassment of an individual, or aggression toward or disparagement of classes of individuals.
|
71
|
+
|
72
|
+
**Consequence**: A permanent ban from any sort of public interaction within the community.
|
73
|
+
|
74
|
+
## Attribution
|
75
|
+
|
76
|
+
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 2.0,
|
77
|
+
available at https://www.contributor-covenant.org/version/2/0/code_of_conduct.html.
|
78
|
+
|
79
|
+
Community Impact Guidelines were inspired by [Mozilla's code of conduct enforcement ladder](https://github.com/mozilla/diversity).
|
80
|
+
|
81
|
+
[homepage]: https://www.contributor-covenant.org
|
82
|
+
|
83
|
+
For answers to common questions about this code of conduct, see the FAQ at
|
84
|
+
https://www.contributor-covenant.org/faq. Translations are available at https://www.contributor-covenant.org/translations.
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2023 Paweł Pokrywka
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,108 @@
|
|
1
|
+
# SXG Checker
|
2
|
+
|
3
|
+
[](https://badge.fury.io/rb/sxg_checker)
|
4
|
+
|
5
|
+
A library and command-line tool for checking the Google SXG cache for the presence of a document and its subresources.
|
6
|
+
|
7
|
+
It verifies if your web page and its resources are properly available in Google's Signed Exchanges (SXG) cache,
|
8
|
+
helping you troubleshoot SXG implementation issues with detailed status reporting for each resource.
|
9
|
+
|
10
|
+
## Status indicators
|
11
|
+
|
12
|
+
| Symbol | Status | Description |
|
13
|
+
|--------|---------|-------------|
|
14
|
+
| ✓ | ok | Resource exists and is valid |
|
15
|
+
| ? | missing | Resource not found in SXG cache |
|
16
|
+
| x | invalid | Resource exists but its signature is invalid |
|
17
|
+
| ! | parsing_error | Unable to parse the SXG resource |
|
18
|
+
| ~ | links_mismatch | The subresources specified in SXG don't match subresources to be prefetched from SXG cache |
|
19
|
+
| ≠ | integrity_mismatch | Subresource integrity hash mismatch |
|
20
|
+
|
21
|
+
## Installation
|
22
|
+
|
23
|
+
Make sure to install [dump-signedexchange](https://github.com/WICG/webpackage/blob/main/go/signedexchange/README.md).
|
24
|
+
|
25
|
+
If you intend to use it as a library for your app, add to your `Gemfile`:
|
26
|
+
```ruby
|
27
|
+
gem "sxg_checker"
|
28
|
+
```
|
29
|
+
|
30
|
+
Otherwise, to make the command-line tool available to all users in the system, run:
|
31
|
+
```shell
|
32
|
+
sudo gem install sxg_checker
|
33
|
+
```
|
34
|
+
|
35
|
+
If you prefer to make it available to yourself only, execute instead:
|
36
|
+
```shell
|
37
|
+
gem install --user-install sxg_checker
|
38
|
+
```
|
39
|
+
|
40
|
+
In case of user-specific installation, make sure to add the directory containing the executable to your `$PATH`.
|
41
|
+
You can find the executable location by running:
|
42
|
+
|
43
|
+
```shell
|
44
|
+
gem contents sxg_checker | grep sxg-checker
|
45
|
+
```
|
46
|
+
|
47
|
+
## Usage
|
48
|
+
|
49
|
+
### Command line
|
50
|
+
|
51
|
+
To check a URL in Google's SXG cache:
|
52
|
+
|
53
|
+
```shell
|
54
|
+
sxg-checker https://www.yourwebsite.com/your-page
|
55
|
+
```
|
56
|
+
|
57
|
+
If you installed the `dump-signedexchange` binary somewhere other than `~/go/bin/dump-signedexchange`, specify the
|
58
|
+
path in the `DSXG_PATH` environment variable:
|
59
|
+
|
60
|
+
```shell
|
61
|
+
DSXG_PATH=/usr/local/bin/dump-signedexchange sxg-checker https://www.yourwebsite.com/your-page
|
62
|
+
```
|
63
|
+
|
64
|
+
### In Ruby applications
|
65
|
+
|
66
|
+
You can also use SXG Checker as a library in your Ruby applications:
|
67
|
+
|
68
|
+
```ruby
|
69
|
+
require 'sxg_checker'
|
70
|
+
|
71
|
+
checker = SxgChecker::Checker.new(tool: '/usr/local/bin/dump-signedexchange') # The `tool` parameter is optional
|
72
|
+
result = checker.call(url)
|
73
|
+
|
74
|
+
# Access the results
|
75
|
+
puts result.url # The URL of the cached document
|
76
|
+
puts result.status # The status symbol (:ok, :missing, etc.)
|
77
|
+
|
78
|
+
# Iterate through subresources
|
79
|
+
result.subresources.each do |subresource|
|
80
|
+
puts "#{subresource.url}: #{subresource.status}"
|
81
|
+
end
|
82
|
+
```
|
83
|
+
|
84
|
+
## Development
|
85
|
+
|
86
|
+
After checking out the repo, run `bundle install` to install dependencies. Then, run `bundle exec rake spec` to run the tests.
|
87
|
+
You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
88
|
+
|
89
|
+
To build the gem, run `bundle exec rake build`. To release a new version, update the version number in `version.rb`,
|
90
|
+
and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and the created tag,
|
91
|
+
and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
92
|
+
|
93
|
+
## Contributing
|
94
|
+
|
95
|
+
Bug reports and pull requests are welcome on GitHub at [https://github.com/pepawel/sxg_checker].
|
96
|
+
This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere
|
97
|
+
to the code of conduct.
|
98
|
+
|
99
|
+
## Author
|
100
|
+
|
101
|
+
My name is Paweł Pokrywka and I'm the author of SXG Checker.
|
102
|
+
|
103
|
+
If you want to contact me or get to know me better, check out
|
104
|
+
[my blog](https://www.pawelpokrywka.com).
|
105
|
+
|
106
|
+
## License
|
107
|
+
|
108
|
+
The software is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
data/Rakefile
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "bundler/gem_tasks"
|
4
|
+
require "rspec/core/rake_task"
|
5
|
+
|
6
|
+
RSpec::Core::RakeTask.new(:spec)
|
7
|
+
|
8
|
+
require "standard/rake"
|
9
|
+
|
10
|
+
task default: %i[spec standard]
|
11
|
+
|
12
|
+
Rake::Task.define_task :validate_loader do
|
13
|
+
abort "Basic loader is stale, run `bin/loader generate` to fix" unless system("bin/loader validate")
|
14
|
+
end
|
15
|
+
|
16
|
+
Rake::Task[:build].enhance [:validate_loader]
|
data/exe/sxg-checker
ADDED
data/lib/basic_loader.rb
ADDED
@@ -0,0 +1,118 @@
|
|
1
|
+
require "uri"
|
2
|
+
require "http"
|
3
|
+
require "parallel"
|
4
|
+
|
5
|
+
module SxgChecker
|
6
|
+
class Checker
|
7
|
+
def call(document_url)
|
8
|
+
raise ToolNotFound.new("executable not found: #{tool}") unless File.executable?(tool)
|
9
|
+
|
10
|
+
url = cacheify_document_url(document_url)
|
11
|
+
response = fetch_sxg(url)
|
12
|
+
return Document.new(url, :missing) unless response
|
13
|
+
|
14
|
+
sxg = extract_sxg(response.body)
|
15
|
+
return Document.new(url, :parsing_error) unless sxg
|
16
|
+
|
17
|
+
return Document.new(url, :invalid) unless sxg.fetch("Valid") == true
|
18
|
+
|
19
|
+
fresh_cached = extract_links(response.headers["Link"])
|
20
|
+
fresh_integrity = extract_integrity(sxg.fetch("ResponseHeaders").fetch("Link", [""]))
|
21
|
+
return Document.new(url, :links_mismatch) if fresh_cached.keys.sort != fresh_integrity.keys.sort
|
22
|
+
|
23
|
+
cached_integrity = fresh_integrity.map do |fresh, integrity|
|
24
|
+
cached = fresh_cached.fetch(fresh)
|
25
|
+
[cached, integrity]
|
26
|
+
end.to_h
|
27
|
+
|
28
|
+
subresources = mapper.call(cached_integrity, in_threads: [cached_integrity.size, 20].min) do |cached, integrity|
|
29
|
+
status = check_subresource(cached, integrity)
|
30
|
+
Subresource.new(cached, status)
|
31
|
+
end
|
32
|
+
|
33
|
+
Document.new(url, :ok, subresources)
|
34
|
+
end
|
35
|
+
|
36
|
+
attr_reader :default_tool
|
37
|
+
|
38
|
+
private
|
39
|
+
|
40
|
+
def check_subresource(url, expected_integrity)
|
41
|
+
response = fetch_sxg(url)
|
42
|
+
return :missing unless response
|
43
|
+
|
44
|
+
sxg = extract_sxg(response.body)
|
45
|
+
return :parsing_error unless sxg
|
46
|
+
|
47
|
+
actual_integrity = sxg.fetch("HeaderIntegrity")
|
48
|
+
return :integrity_mismatch unless actual_integrity == expected_integrity
|
49
|
+
|
50
|
+
return :invalid unless sxg.fetch("Valid") == true
|
51
|
+
|
52
|
+
:ok
|
53
|
+
end
|
54
|
+
|
55
|
+
def fetch_sxg(url)
|
56
|
+
response = HTTP.headers(accept: "application/signed-exchange;v=b3").get(url)
|
57
|
+
return nil unless response.content_type.mime_type == "application/signed-exchange"
|
58
|
+
|
59
|
+
response
|
60
|
+
end
|
61
|
+
|
62
|
+
def extract_links(link_header)
|
63
|
+
link_header.to_s.split(",")
|
64
|
+
.select { _1 =~ /application\/signed-exchange;v=b3/ }
|
65
|
+
.map do
|
66
|
+
_1 =~ /^<(.+)>.+anchor="(.+)"/
|
67
|
+
[$2, $1]
|
68
|
+
end.to_h
|
69
|
+
end
|
70
|
+
|
71
|
+
def extract_integrity(link_headers)
|
72
|
+
link_headers
|
73
|
+
.map { _1.to_s.split(",") }
|
74
|
+
.flatten
|
75
|
+
.select { _1 =~ /rel=allowed-alt-sxg/ }
|
76
|
+
.map do
|
77
|
+
_1 =~ /^<(.+)>.+header-integrity="(.+)"/
|
78
|
+
[$1, $2]
|
79
|
+
end
|
80
|
+
.to_h
|
81
|
+
end
|
82
|
+
|
83
|
+
def extract_sxg(body)
|
84
|
+
Tempfile.open("sxg", encoding: "ascii-8bit") do |file|
|
85
|
+
file.write body
|
86
|
+
file.flush
|
87
|
+
parse_sxg_file file.path
|
88
|
+
end
|
89
|
+
end
|
90
|
+
|
91
|
+
def parse_sxg_file(path)
|
92
|
+
command = "#{tool} -json -verify -i #{path}"
|
93
|
+
result = `#{command} 2> /dev/null`
|
94
|
+
return nil if result.empty?
|
95
|
+
JSON.parse(result)
|
96
|
+
end
|
97
|
+
|
98
|
+
def cacheify_document_url(url)
|
99
|
+
uri = URI.parse(url)
|
100
|
+
raise InvalidUrl.new("invalid URL") unless uri.scheme == "https" && uri.host && uri.fragment.nil?
|
101
|
+
|
102
|
+
host = uri.host.to_s.tr(".", "-")
|
103
|
+
"https://#{host}.webpkgcache.com/doc/-/s/#{url.sub("https://", "")}"
|
104
|
+
rescue URI::InvalidURIError
|
105
|
+
raise InvalidUrl.new("can't parse URL")
|
106
|
+
end
|
107
|
+
|
108
|
+
attr_reader :tool, :mapper
|
109
|
+
|
110
|
+
def initialize(mapper: Parallel.method(:map),
|
111
|
+
default_tool: "#{ENV["HOME"]}/go/bin/dump-signedexchange",
|
112
|
+
tool: ENV["DSXG_PATH"] || default_tool)
|
113
|
+
@mapper = mapper
|
114
|
+
@default_tool = default_tool
|
115
|
+
@tool = tool
|
116
|
+
end
|
117
|
+
end
|
118
|
+
end
|
@@ -0,0 +1,49 @@
|
|
1
|
+
module SxgChecker
|
2
|
+
class Cli
|
3
|
+
def call(url)
|
4
|
+
return show_usage if url.nil? || url == "-h" || url == "--help"
|
5
|
+
|
6
|
+
document = checker.call(url)
|
7
|
+
resources = [document] + document.subresources.sort
|
8
|
+
resources.each do |resource|
|
9
|
+
puts formatter.resource(resource)
|
10
|
+
end
|
11
|
+
rescue Error => e
|
12
|
+
puts "#{exe_name}: error: #{e.message}"
|
13
|
+
exit 1
|
14
|
+
end
|
15
|
+
|
16
|
+
private
|
17
|
+
|
18
|
+
def show_usage
|
19
|
+
puts "SXG Checker v#{VERSION}"
|
20
|
+
puts " Checks the Google SXG cache for the presence of a document and its subresources."
|
21
|
+
puts
|
22
|
+
puts "Usage:"
|
23
|
+
puts " #{exe_name} <URL>"
|
24
|
+
puts
|
25
|
+
puts "Example:"
|
26
|
+
puts " #{exe_name} https://www.yourwebsite.com/your-page"
|
27
|
+
puts
|
28
|
+
puts "Environment variables:"
|
29
|
+
puts " DSXG_PATH - path to dump-signedexchange binary (default: #{checker.default_tool})"
|
30
|
+
puts
|
31
|
+
show_statuses
|
32
|
+
end
|
33
|
+
|
34
|
+
def show_statuses
|
35
|
+
puts "Possible statuses:"
|
36
|
+
formatter.icons.map do |status, icon|
|
37
|
+
puts " #{icon} #{status.to_s.tr("_", " ")}"
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
attr_reader :exe_name, :formatter, :checker
|
42
|
+
|
43
|
+
def initialize(exe_name)
|
44
|
+
@exe_name = exe_name
|
45
|
+
@formatter = SxgChecker::Formatter.new
|
46
|
+
@checker = SxgChecker::Checker.new
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
module SxgChecker
|
2
|
+
class Formatter
|
3
|
+
def resource(resource)
|
4
|
+
icon = icons.fetch(resource.status)
|
5
|
+
"#{icon} #{resource.url}"
|
6
|
+
end
|
7
|
+
|
8
|
+
attr_reader :icons
|
9
|
+
|
10
|
+
private
|
11
|
+
|
12
|
+
def initialize(icons = {
|
13
|
+
ok: "✓",
|
14
|
+
missing: "?",
|
15
|
+
invalid: "x",
|
16
|
+
parsing_error: "!",
|
17
|
+
links_mismatch: "~",
|
18
|
+
integrity_mismatch: "≠"
|
19
|
+
})
|
20
|
+
@icons = icons
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
module SxgChecker
|
2
|
+
class Subresource
|
3
|
+
include Comparable
|
4
|
+
|
5
|
+
attr_reader :url, :status
|
6
|
+
|
7
|
+
def fresh_url
|
8
|
+
@fresh_url ||= url.sub(/^.+\/s\//, "https://")
|
9
|
+
end
|
10
|
+
|
11
|
+
def <=>(other)
|
12
|
+
fresh_url <=> other.fresh_url
|
13
|
+
end
|
14
|
+
|
15
|
+
private
|
16
|
+
|
17
|
+
def initialize(url, status)
|
18
|
+
@url = url
|
19
|
+
@status = status
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
data/lib/sxg_checker.rb
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "sxg_checker/version"
|
4
|
+
|
5
|
+
if defined? SxgChecker::AUTOLOADERS
|
6
|
+
require "zeitwerk"
|
7
|
+
SxgChecker::AUTOLOADERS << Zeitwerk::Loader.for_gem.tap do |loader|
|
8
|
+
loader.ignore("#{__dir__}/basic_loader.rb")
|
9
|
+
loader.setup
|
10
|
+
end
|
11
|
+
else
|
12
|
+
require "basic_loader"
|
13
|
+
end
|
14
|
+
|
15
|
+
module SxgChecker
|
16
|
+
Error = Class.new(StandardError)
|
17
|
+
InvalidUrl = Class.new(Error)
|
18
|
+
ToolNotFound = Class.new(Error)
|
19
|
+
end
|
metadata
ADDED
@@ -0,0 +1,91 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: sxg_checker
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Paweł Pokrywka
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2025-05-08 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: http
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '5.2'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '5.2'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: parallel
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '1.27'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '1.27'
|
41
|
+
description:
|
42
|
+
email:
|
43
|
+
- pepawel@users.noreply.github.com
|
44
|
+
executables:
|
45
|
+
- sxg-checker
|
46
|
+
extensions: []
|
47
|
+
extra_rdoc_files: []
|
48
|
+
files:
|
49
|
+
- ".rspec"
|
50
|
+
- ".standard.yml"
|
51
|
+
- CHANGELOG.md
|
52
|
+
- CODE_OF_CONDUCT.md
|
53
|
+
- LICENSE.txt
|
54
|
+
- README.md
|
55
|
+
- Rakefile
|
56
|
+
- exe/sxg-checker
|
57
|
+
- lib/basic_loader.rb
|
58
|
+
- lib/sxg_checker.rb
|
59
|
+
- lib/sxg_checker/checker.rb
|
60
|
+
- lib/sxg_checker/cli.rb
|
61
|
+
- lib/sxg_checker/document.rb
|
62
|
+
- lib/sxg_checker/formatter.rb
|
63
|
+
- lib/sxg_checker/subresource.rb
|
64
|
+
- lib/sxg_checker/version.rb
|
65
|
+
homepage: https://github.com/pepawel/sxg_checker
|
66
|
+
licenses:
|
67
|
+
- MIT
|
68
|
+
metadata:
|
69
|
+
homepage_uri: https://github.com/pepawel/sxg_checker
|
70
|
+
source_code_uri: https://github.com/pepawel/sxg_checker
|
71
|
+
changelog_uri: https://github.com/pepawel/sxg_checker/blob/main/CHANGELOG.md
|
72
|
+
post_install_message:
|
73
|
+
rdoc_options: []
|
74
|
+
require_paths:
|
75
|
+
- lib
|
76
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
77
|
+
requirements:
|
78
|
+
- - ">="
|
79
|
+
- !ruby/object:Gem::Version
|
80
|
+
version: 3.0.0
|
81
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
82
|
+
requirements:
|
83
|
+
- - ">="
|
84
|
+
- !ruby/object:Gem::Version
|
85
|
+
version: '0'
|
86
|
+
requirements: []
|
87
|
+
rubygems_version: 3.3.5
|
88
|
+
signing_key:
|
89
|
+
specification_version: 4
|
90
|
+
summary: Checks SXG document and its subresources validity.
|
91
|
+
test_files: []
|