webmention-cli 3.0.2 → 4.0.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 +4 -4
- data/README.md +24 -14
- data/exe/webmention +1 -1
- data/lib/webmention/cli.rb +75 -2
- data/webmention-cli.gemspec +3 -5
- metadata +9 -11
- data/lib/webmention/cli/runner.rb +0 -56
- data/lib/webmention/cli/version.rb +0 -7
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: '09c76cc99dd47cc9118e6ee945273f78e34aac9a57b8fc869056c7e0f980107b'
|
|
4
|
+
data.tar.gz: 2d7a8f4d9268329e3a6166775a3e0853c38701a360b92b5d228d80682d4b14f7
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 7409e32b1b3ac4f8e9ef5edf4932d4d61d945260e504dc67c08549c194e0e252912ad91e895390ee8afc638e8fe08f5edca54b51ecff6b2ac14eacdfa4373912
|
|
7
|
+
data.tar.gz: f23d442031b48defe2a18a121bd31dc93c7b0ccb7c1c57fb883cc010d14da5b8d890deb79f4d4939c7f2972ef06e8df7fc415e8bc39f9841c75e73980adc4027
|
data/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# webmention-cli
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
A command-line interface for Webmention written in Ruby.
|
|
4
4
|
|
|
5
5
|
[](https://rubygems.org/gems/webmention-cli)
|
|
6
6
|
[](https://rubygems.org/gems/webmention-cli)
|
|
@@ -22,29 +22,39 @@ $ gem install webmention-cli
|
|
|
22
22
|
|
|
23
23
|
webmention-cli makes available the following commands:
|
|
24
24
|
|
|
25
|
-
### `webmention endpoint
|
|
25
|
+
### `webmention endpoint URL`
|
|
26
26
|
|
|
27
|
-
Discover the Webmention endpoint for a
|
|
27
|
+
Discover the Webmention endpoint for a URL.
|
|
28
28
|
|
|
29
29
|
```sh
|
|
30
30
|
$ webmention endpoint https://sixtwothree.org
|
|
31
31
|
https://sixtwothree.org/webmentions
|
|
32
32
|
```
|
|
33
33
|
|
|
34
|
-
The command returns a non-zero exit code if the
|
|
34
|
+
The command returns a non-zero exit code if the given URL does not advertise a Webmention endpoint (or if an HTTP error was encountered).
|
|
35
35
|
|
|
36
|
-
### `webmention
|
|
36
|
+
### `webmention mentions URL`
|
|
37
37
|
|
|
38
|
-
|
|
38
|
+
Discover the unique URLs mentioned by the given URL.
|
|
39
|
+
|
|
40
|
+
```sh
|
|
41
|
+
$ webmention mentions https://sixtwothree.org/posts/now-accepting-webmentions
|
|
42
|
+
http://aaronparecki.com/
|
|
43
|
+
http://indiewebcamp.com/
|
|
44
|
+
http://indiewebcamp.com/2014
|
|
45
|
+
# etc. etc. etc.
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
### `webmention send SOURCE TARGET`
|
|
49
|
+
|
|
50
|
+
Send a webmention from a `SOURCE` URL to a `TARGET` URL.
|
|
39
51
|
|
|
40
52
|
```sh
|
|
41
53
|
$ webmention send https://sixtwothree.org/posts/an-engineer-walks-into-a-design-sprint https://adactio.com/journal/6246
|
|
42
54
|
202 Accepted
|
|
43
55
|
```
|
|
44
56
|
|
|
45
|
-
The command
|
|
46
|
-
|
|
47
|
-
A non-zero exit code is returned if the HTTP status is _not_ within the 200 range (or if an HTTP error was encountered).
|
|
57
|
+
The command returns either an HTTP status _or_ the value of the response's `Location` header (if provided _and_ the response's HTTP status is `201 Created`). A non-zero exit code is returned if the HTTP status is _not_ within the 200 range (or if an HTTP error was encountered).
|
|
48
58
|
|
|
49
59
|
#### Send a webmention with a vouch URL
|
|
50
60
|
|
|
@@ -55,15 +65,15 @@ $ webmention send https://sixtwothree.org/posts/now-accepting-webmentions https:
|
|
|
55
65
|
|
|
56
66
|
The command with a vouch URL included responds in the same fashion as noted above.
|
|
57
67
|
|
|
58
|
-
### `webmention verify
|
|
68
|
+
### `webmention verify SOURCE TARGET`
|
|
59
69
|
|
|
60
|
-
Confirm whether or not a
|
|
70
|
+
Confirm whether or not a `SOURCE` URL links to a `TARGET` URL.
|
|
61
71
|
|
|
62
72
|
```sh
|
|
63
73
|
$ webmention verify https://kartikprabhu.com/notes/re-launching-franciscms https://sixtwothree.org/posts/launching-franciscms-onto-the-indieweb
|
|
64
74
|
```
|
|
65
75
|
|
|
66
|
-
The command
|
|
76
|
+
The command returns a zero exit code if `SOURCE` links to `TARGET` and a non-zero exit code in all other cases.
|
|
67
77
|
|
|
68
78
|
#### Verify a webmention with a vouch URL
|
|
69
79
|
|
|
@@ -71,7 +81,7 @@ The command will return a zero exit code if `<source>` links to `<target>` and a
|
|
|
71
81
|
$ webmention verify https://kartikprabhu.com/notes/re-launching-franciscms https://sixtwothree.org/posts/launching-franciscms-onto-the-indieweb --vouch https://adactio.com/links/9229
|
|
72
82
|
```
|
|
73
83
|
|
|
74
|
-
The command
|
|
84
|
+
The command returns a zero exit code if `SOURCE` links to `TARGET` _and_ the provided vouch URL links to the `SOURCE`'s domain. A non-zero exist code is returned in all other cases.
|
|
75
85
|
|
|
76
86
|
## Acknowledgments
|
|
77
87
|
|
|
@@ -81,4 +91,4 @@ webmention-cli is written and maintained by [Jason Garber](https://sixtwothree.o
|
|
|
81
91
|
|
|
82
92
|
## License
|
|
83
93
|
|
|
84
|
-
|
|
94
|
+
This project is freely available under the [MIT License](https://opensource.org/licenses/MIT).
|
data/exe/webmention
CHANGED
data/lib/webmention/cli.rb
CHANGED
|
@@ -3,6 +3,79 @@
|
|
|
3
3
|
require "thor"
|
|
4
4
|
require "webmention"
|
|
5
5
|
|
|
6
|
-
|
|
6
|
+
module Webmention
|
|
7
|
+
# A command-line interface for Webmention.
|
|
8
|
+
#
|
|
9
|
+
# @api private
|
|
10
|
+
#
|
|
11
|
+
# @see https://www.w3.org/TR/webmention/
|
|
12
|
+
# @see https://indieweb.org/Webmention
|
|
13
|
+
class CLI < Thor
|
|
14
|
+
include Thor::Actions
|
|
7
15
|
|
|
8
|
-
|
|
16
|
+
package_name "Webmention"
|
|
17
|
+
|
|
18
|
+
map ["-v", "--version"] => :version
|
|
19
|
+
|
|
20
|
+
# simplecov:disable
|
|
21
|
+
def self.exit_on_failure?
|
|
22
|
+
true
|
|
23
|
+
end
|
|
24
|
+
# simplecov:enable
|
|
25
|
+
|
|
26
|
+
desc "endpoint URL", "Discover a URL's Webmention endpoint"
|
|
27
|
+
def endpoint(url)
|
|
28
|
+
webmention_endpoint = Webmention::Url.new(url).webmention_endpoint
|
|
29
|
+
|
|
30
|
+
exit 1 if webmention_endpoint.nil?
|
|
31
|
+
|
|
32
|
+
say webmention_endpoint
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
desc "mentions URL", "Discover unique URLs mentioned by a URL"
|
|
36
|
+
def mentions(url)
|
|
37
|
+
urls = Webmention.mentioned_urls(url)
|
|
38
|
+
|
|
39
|
+
exit 1 if urls.none?
|
|
40
|
+
|
|
41
|
+
say urls.join("\n")
|
|
42
|
+
rescue Burly::UnsupportedMimeType
|
|
43
|
+
exit 1
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
desc "send SOURCE TARGET", "Send a webmention from a source URL to a target URL"
|
|
47
|
+
method_option :vouch,
|
|
48
|
+
desc: "Submit a vouch URL (https://indieweb.org/Vouch)",
|
|
49
|
+
type: :string
|
|
50
|
+
def send(source, target)
|
|
51
|
+
response = Webmention.send_webmention(source, target, vouch: options[:vouch])
|
|
52
|
+
|
|
53
|
+
exit 1 unless response.ok?
|
|
54
|
+
|
|
55
|
+
code = response.code
|
|
56
|
+
location = response.headers["Location"]
|
|
57
|
+
|
|
58
|
+
say(code == 201 && location ? location : "#{code} #{response.reason}")
|
|
59
|
+
|
|
60
|
+
exit 1 unless code.between?(200, 299)
|
|
61
|
+
end
|
|
62
|
+
|
|
63
|
+
desc "verify SOURCE TARGET", "Verify a source URL links to a target URL"
|
|
64
|
+
method_option :vouch,
|
|
65
|
+
desc: "Verify a vouch URL mentions a source URL's domain (https://indieweb.org/Vouch)",
|
|
66
|
+
type: :string
|
|
67
|
+
def verify(source, target)
|
|
68
|
+
verification = Webmention.verify_webmention(source, target, vouch: options[:vouch])
|
|
69
|
+
|
|
70
|
+
exit 1 unless verification.verified?
|
|
71
|
+
end
|
|
72
|
+
|
|
73
|
+
desc "version", "Print version information"
|
|
74
|
+
def version
|
|
75
|
+
webmention_version = Gem::Specification.find_by_name("webmention").version
|
|
76
|
+
webmention_cli_version = Gem::Specification.find_by_name("webmention-cli").version
|
|
77
|
+
|
|
78
|
+
say "webmention-cli v#{webmention_cli_version} (webmention-client-ruby v#{webmention_version})"
|
|
79
|
+
end
|
|
80
|
+
end
|
|
81
|
+
end
|
data/webmention-cli.gemspec
CHANGED
|
@@ -1,12 +1,10 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
require_relative "lib/webmention/cli/version"
|
|
4
|
-
|
|
5
3
|
Gem::Specification.new do |spec|
|
|
6
4
|
spec.required_ruby_version = ">= 2.7"
|
|
7
5
|
|
|
8
6
|
spec.name = "webmention-cli"
|
|
9
|
-
spec.version =
|
|
7
|
+
spec.version = "4.0.0"
|
|
10
8
|
spec.authors = ["Jason Garber"]
|
|
11
9
|
spec.email = ["jason@sixtwothree.org"]
|
|
12
10
|
|
|
@@ -32,6 +30,6 @@ Gem::Specification.new do |spec|
|
|
|
32
30
|
"source_code_uri" => "#{spec.homepage}/src/tag/v#{spec.version}",
|
|
33
31
|
}
|
|
34
32
|
|
|
35
|
-
spec.add_dependency "thor", "~> 1.
|
|
36
|
-
spec.add_dependency "webmention", "~>
|
|
33
|
+
spec.add_dependency "thor", "~> 1.5"
|
|
34
|
+
spec.add_dependency "webmention", "~> 10.1"
|
|
37
35
|
end
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: webmention-cli
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version:
|
|
4
|
+
version: 4.0.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Jason Garber
|
|
@@ -15,28 +15,28 @@ dependencies:
|
|
|
15
15
|
requirements:
|
|
16
16
|
- - "~>"
|
|
17
17
|
- !ruby/object:Gem::Version
|
|
18
|
-
version: '1.
|
|
18
|
+
version: '1.5'
|
|
19
19
|
type: :runtime
|
|
20
20
|
prerelease: false
|
|
21
21
|
version_requirements: !ruby/object:Gem::Requirement
|
|
22
22
|
requirements:
|
|
23
23
|
- - "~>"
|
|
24
24
|
- !ruby/object:Gem::Version
|
|
25
|
-
version: '1.
|
|
25
|
+
version: '1.5'
|
|
26
26
|
- !ruby/object:Gem::Dependency
|
|
27
27
|
name: webmention
|
|
28
28
|
requirement: !ruby/object:Gem::Requirement
|
|
29
29
|
requirements:
|
|
30
30
|
- - "~>"
|
|
31
31
|
- !ruby/object:Gem::Version
|
|
32
|
-
version: '
|
|
32
|
+
version: '10.1'
|
|
33
33
|
type: :runtime
|
|
34
34
|
prerelease: false
|
|
35
35
|
version_requirements: !ruby/object:Gem::Requirement
|
|
36
36
|
requirements:
|
|
37
37
|
- - "~>"
|
|
38
38
|
- !ruby/object:Gem::Version
|
|
39
|
-
version: '
|
|
39
|
+
version: '10.1'
|
|
40
40
|
description: A command-line interface for Webmention.
|
|
41
41
|
email:
|
|
42
42
|
- jason@sixtwothree.org
|
|
@@ -50,19 +50,17 @@ files:
|
|
|
50
50
|
- README.md
|
|
51
51
|
- exe/webmention
|
|
52
52
|
- lib/webmention/cli.rb
|
|
53
|
-
- lib/webmention/cli/runner.rb
|
|
54
|
-
- lib/webmention/cli/version.rb
|
|
55
53
|
- webmention-cli.gemspec
|
|
56
54
|
homepage: https://codeberg.org/jgarber/webmention-cli
|
|
57
55
|
licenses:
|
|
58
56
|
- MIT
|
|
59
57
|
metadata:
|
|
60
58
|
bug_tracker_uri: https://codeberg.org/jgarber/webmention-cli/issues
|
|
61
|
-
changelog_uri: https://codeberg.org/jgarber/webmention-cli/releases/tag/
|
|
62
|
-
documentation_uri: https://rubydoc.info/gems/webmention-cli/
|
|
59
|
+
changelog_uri: https://codeberg.org/jgarber/webmention-cli/releases/tag/v4.0.0
|
|
60
|
+
documentation_uri: https://rubydoc.info/gems/webmention-cli/4.0.0
|
|
63
61
|
homepage_uri: https://codeberg.org/jgarber/webmention-cli
|
|
64
62
|
rubygems_mfa_required: 'true'
|
|
65
|
-
source_code_uri: https://codeberg.org/jgarber/webmention-cli/src/tag/
|
|
63
|
+
source_code_uri: https://codeberg.org/jgarber/webmention-cli/src/tag/v4.0.0
|
|
66
64
|
rdoc_options: []
|
|
67
65
|
require_paths:
|
|
68
66
|
- lib
|
|
@@ -77,7 +75,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
77
75
|
- !ruby/object:Gem::Version
|
|
78
76
|
version: '0'
|
|
79
77
|
requirements: []
|
|
80
|
-
rubygems_version:
|
|
78
|
+
rubygems_version: 4.0.20
|
|
81
79
|
specification_version: 4
|
|
82
80
|
summary: A command-line interface for Webmention.
|
|
83
81
|
test_files: []
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
module Webmention
|
|
4
|
-
module CLI
|
|
5
|
-
class Runner < Thor
|
|
6
|
-
include Thor::Actions
|
|
7
|
-
|
|
8
|
-
package_name "Webmention"
|
|
9
|
-
|
|
10
|
-
map ["-v", "--version"] => :version
|
|
11
|
-
|
|
12
|
-
# :nocov:
|
|
13
|
-
def self.exit_on_failure?
|
|
14
|
-
true
|
|
15
|
-
end
|
|
16
|
-
# :nocov:
|
|
17
|
-
|
|
18
|
-
desc "endpoint <target>", "Discover the Webmention endpoint for <target> URL"
|
|
19
|
-
def endpoint(target)
|
|
20
|
-
url = Webmention::Url.new(target)
|
|
21
|
-
|
|
22
|
-
exit 1 unless url.webmention_endpoint?
|
|
23
|
-
|
|
24
|
-
say url.webmention_endpoint
|
|
25
|
-
end
|
|
26
|
-
|
|
27
|
-
desc "send <source> <target>", "Send a webmention from <source> URL to <target> URL"
|
|
28
|
-
option :vouch, desc: "Submit a <vouch> URL"
|
|
29
|
-
def send(source, target)
|
|
30
|
-
response = Webmention.send_webmention(source, target, vouch: options[:vouch])
|
|
31
|
-
|
|
32
|
-
exit 1 unless response.ok?
|
|
33
|
-
|
|
34
|
-
code = response.code
|
|
35
|
-
location = response.headers["Location"]
|
|
36
|
-
|
|
37
|
-
say(code == 201 && location ? location : "#{code} #{response.reason}")
|
|
38
|
-
|
|
39
|
-
exit 1 unless code.between?(200, 299)
|
|
40
|
-
end
|
|
41
|
-
|
|
42
|
-
desc "verify <source> <target>", "Verify that <source> URL links to <target> URL"
|
|
43
|
-
option :vouch, desc: "Verify that <vouch> URL mentions the <source> URL domain"
|
|
44
|
-
def verify(source, target)
|
|
45
|
-
verification = Webmention.verify_webmention(source, target, vouch: options[:vouch])
|
|
46
|
-
|
|
47
|
-
exit 1 unless verification.verified?
|
|
48
|
-
end
|
|
49
|
-
|
|
50
|
-
desc "version", "Print version information"
|
|
51
|
-
def version
|
|
52
|
-
say "webmention-cli version #{Webmention::CLI::VERSION}"
|
|
53
|
-
end
|
|
54
|
-
end
|
|
55
|
-
end
|
|
56
|
-
end
|