webmention-cli 0.1.1 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.reek.yml +6 -0
- data/.rubocop.yml +13 -2
- data/.ruby-version +1 -1
- data/.travis.yml +5 -10
- data/CHANGELOG.md +9 -1
- data/CONTRIBUTING.md +2 -2
- data/LICENSE +1 -1
- data/README.md +17 -6
- data/Rakefile +12 -1
- data/exe/webmention +2 -2
- data/lib/webmention/cli.rb +22 -0
- data/lib/webmention/cli/commands/endpoint.rb +20 -0
- data/lib/webmention/cli/commands/send.rb +21 -0
- data/lib/webmention/cli/commands/verify.rb +22 -0
- data/lib/webmention/cli/exceptions.rb +17 -0
- data/lib/webmention/cli/runner.rb +71 -0
- data/lib/webmention/cli/version.rb +5 -0
- data/webmention-cli.gemspec +22 -14
- metadata +79 -30
- data/lib/webmention_cli.rb +0 -6
- data/lib/webmention_cli/version.rb +0 -3
- data/lib/webmention_cli/webmention.rb +0 -40
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4d335a55cc4406e0717186760a5e5f35d8eb1b3a9a5c64f3adb862ceb3583acf
|
4
|
+
data.tar.gz: a7379042d7b8201f051f7b75e59fb13b20225c63141e864b3ea82cd90148257c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: '09e1d040bd656e67d37df20e7c06098f2df93a2b8bbf2b360ac98b51d6cd2e744a90a740ff491957d3ea47162dd73f83edfa10354080af8765255fbf29409abe'
|
7
|
+
data.tar.gz: dc48cfc09b2d7b2300746a42cb29d5826507248e439bc0ddb7c3a80d30e7a0b4bbebf4bdede15234058d784afcdfccd3649f4c43755c187c26d5d1516f9edae9
|
data/.reek.yml
ADDED
data/.rubocop.yml
CHANGED
@@ -1,15 +1,26 @@
|
|
1
1
|
require:
|
2
|
+
- rubocop-performance
|
2
3
|
- rubocop-rspec
|
3
4
|
|
5
|
+
Layout/HashAlignment:
|
6
|
+
EnforcedHashRocketStyle: table
|
7
|
+
|
8
|
+
Layout/LineLength:
|
9
|
+
Enabled: false
|
10
|
+
|
4
11
|
Metrics/BlockLength:
|
5
12
|
Exclude:
|
13
|
+
- webmention-cli.gemspec
|
6
14
|
- spec/**/*.rb
|
7
15
|
|
8
|
-
|
9
|
-
|
16
|
+
Naming/RescuedExceptionsVariableName:
|
17
|
+
PreferredName: exception
|
10
18
|
|
11
19
|
Style/Documentation:
|
12
20
|
Enabled: false
|
13
21
|
|
14
22
|
Style/FrozenStringLiteralComment:
|
15
23
|
Enabled: false
|
24
|
+
|
25
|
+
Style/SymbolArray:
|
26
|
+
Enabled: false
|
data/.ruby-version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
2.
|
1
|
+
2.5.7
|
data/.travis.yml
CHANGED
@@ -1,19 +1,14 @@
|
|
1
|
+
dist: bionic
|
1
2
|
language: ruby
|
2
3
|
rvm:
|
3
|
-
- 2.
|
4
|
-
- 2.
|
5
|
-
- 2.
|
6
|
-
cache:
|
7
|
-
- bundler
|
8
|
-
before_install:
|
9
|
-
- gem install bundler -v '~> 1.17'
|
4
|
+
- 2.5
|
5
|
+
- 2.6
|
6
|
+
- 2.7
|
7
|
+
cache: bundler
|
10
8
|
before_script:
|
11
9
|
- curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter
|
12
10
|
- chmod +x ./cc-test-reporter
|
13
11
|
- ./cc-test-reporter before-build
|
14
|
-
script:
|
15
|
-
- bundle exec rubocop
|
16
|
-
- bundle exec rake
|
17
12
|
after_script:
|
18
13
|
- ./cc-test-reporter after-build --exit-code $TRAVIS_TEST_RESULT
|
19
14
|
notifications:
|
data/CHANGELOG.md
CHANGED
@@ -1,8 +1,16 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
+
## 1.0.0 / 2020-02-08
|
4
|
+
|
5
|
+
- Rewrite gem code
|
6
|
+
- Rewrite specs
|
7
|
+
- Update development and runtime dependencies to latest versions (67744c1)
|
8
|
+
- Change supported Ruby versions to >= 2.5 and < 2.8 (1b30b8c)
|
9
|
+
- Update project Ruby version to 2.5.7 (21e94b6)
|
10
|
+
|
3
11
|
## 0.1.1 / 2019-01-03
|
4
12
|
|
5
|
-
- Expand supported Ruby versions to include 2.6 (
|
13
|
+
- Expand supported Ruby versions to include 2.6 (8930501
|
6
14
|
|
7
15
|
## 0.1.0 / 2018-08-14
|
8
16
|
|
data/CONTRIBUTING.md
CHANGED
@@ -8,9 +8,9 @@ There are a couple ways you can help improve webmention-cli:
|
|
8
8
|
|
9
9
|
## Getting Started
|
10
10
|
|
11
|
-
webmention-cli is developed using Ruby 2.
|
11
|
+
webmention-cli is developed using Ruby 2.5.7 and is additionally tested against Ruby 2.6 and 2.7 using [Travis CI](https://travis-ci.com/jgarber623/webmention-cli).
|
12
12
|
|
13
|
-
Before making changes to webmention-cli, you'll want to install Ruby 2.
|
13
|
+
Before making changes to webmention-cli, you'll want to install Ruby 2.5.7. It's recommended that you use a Ruby version managment tool like [rbenv](https://github.com/rbenv/rbenv), [chruby](https://github.com/postmodern/chruby), or [rvm](https://github.com/rvm/rvm). Once you've installed Ruby 2.5.7 using your method of choice, install the project's gems by running:
|
14
14
|
|
15
15
|
```sh
|
16
16
|
bundle install
|
data/LICENSE
CHANGED
data/README.md
CHANGED
@@ -11,9 +11,9 @@
|
|
11
11
|
|
12
12
|
## Getting Started
|
13
13
|
|
14
|
-
Before installing and using webmention-cli, you'll want to have [Ruby](https://www.ruby-lang.org) 2.
|
14
|
+
Before installing and using webmention-cli, you'll want to have [Ruby](https://www.ruby-lang.org) 2.5 (or newer) installed. It's recommended that you use a Ruby version managment tool like [rbenv](https://github.com/rbenv/rbenv), [chruby](https://github.com/postmodern/chruby), or [rvm](https://github.com/rvm/rvm).
|
15
15
|
|
16
|
-
webmention-cli is developed using Ruby 2.
|
16
|
+
webmention-cli is developed using Ruby 2.5.7 and is additionally tested against Ruby 2.6 and 2.7 using [Travis CI](https://travis-ci.com/jgarber623/webmention-cli).
|
17
17
|
|
18
18
|
## Installation
|
19
19
|
|
@@ -25,29 +25,40 @@ gem install webmention-cli
|
|
25
25
|
|
26
26
|
webmention-cli makes available the following commands:
|
27
27
|
|
28
|
-
### `webmention endpoint <
|
28
|
+
### `webmention endpoint <target>`
|
29
29
|
|
30
|
-
Discover the webmention endpoint for the given `<
|
30
|
+
Discover the webmention endpoint for the given `<target>` URL using the [webmention-endpoint-ruby](https://github.com/jgarber623/webmention-endpoint-ruby) gem's endpoint discovery.
|
31
31
|
|
32
32
|
```sh
|
33
33
|
$ webmention endpoint https://sixtwothree.org
|
34
34
|
https://sixtwothree.org/webmentions
|
35
35
|
```
|
36
36
|
|
37
|
+
### `webmention send <source> <target>`
|
38
|
+
|
39
|
+
Send a webmention from `<source>` URL to the given `<target>` URL using the [webmention-client-ruby](https://github.com/indieweb/webmention-client-ruby) gem.
|
40
|
+
|
41
|
+
```sh
|
42
|
+
$ webmention send https://sixtwothree.org/posts/an-engineer-walks-into-a-design-sprint https://adactio.com/journal/6246
|
43
|
+
202 Accepted
|
44
|
+
```
|
45
|
+
|
46
|
+
The `send` command will return either an HTTP status _or_ the value of the response's `Location` header (if provided _and_ the response's HTTP status is `201 Created`).
|
47
|
+
|
37
48
|
### `webmention verify <source> <target>`
|
38
49
|
|
39
50
|
Confirm whether or not a `<source>` URL links to the given `<target>` URL using the [webmention-verification-ruby](https://github.com/jgarber623/webmention-verification-ruby) gem's verifers.
|
40
51
|
|
41
52
|
```sh
|
42
53
|
$ webmention verify https://kartikprabhu.com/notes/re-launching-franciscms https://sixtwothree.org/posts/launching-franciscms-onto-the-indieweb
|
43
|
-
|
54
|
+
true
|
44
55
|
```
|
45
56
|
|
46
57
|
By default, the `verify` command will strictly match URLs. For a bit more flexibility, use the `--no-strict` flag:
|
47
58
|
|
48
59
|
```sh
|
49
60
|
$ webmention verify https://aaronparecki.com/2014/12/17/5/webmention-indieweb https://sixtwothree.org/posts/open-sourcing-my-webmention-service --no-strict
|
50
|
-
|
61
|
+
true
|
51
62
|
```
|
52
63
|
|
53
64
|
## Contributing
|
data/Rakefile
CHANGED
@@ -1,6 +1,17 @@
|
|
1
1
|
require 'bundler/gem_tasks'
|
2
|
+
|
3
|
+
require 'reek/rake/task'
|
2
4
|
require 'rspec/core/rake_task'
|
5
|
+
require 'rubocop/rake_task'
|
6
|
+
|
7
|
+
Reek::Rake::Task.new do |task|
|
8
|
+
task.fail_on_error = false
|
9
|
+
end
|
3
10
|
|
4
11
|
RSpec::Core::RakeTask.new
|
5
12
|
|
6
|
-
|
13
|
+
RuboCop::RakeTask.new do |task|
|
14
|
+
task.fail_on_error = false
|
15
|
+
end
|
16
|
+
|
17
|
+
task default: [:rubocop, :reek, :spec]
|
data/exe/webmention
CHANGED
@@ -0,0 +1,22 @@
|
|
1
|
+
require 'thor'
|
2
|
+
|
3
|
+
require 'indieweb/endpoints'
|
4
|
+
require 'webmention'
|
5
|
+
require 'webmention/verification'
|
6
|
+
|
7
|
+
require 'webmention/cli/version'
|
8
|
+
require 'webmention/cli/exceptions'
|
9
|
+
|
10
|
+
require 'webmention/cli/commands/endpoint'
|
11
|
+
require 'webmention/cli/commands/send'
|
12
|
+
require 'webmention/cli/commands/verify'
|
13
|
+
|
14
|
+
require 'webmention/cli/runner'
|
15
|
+
|
16
|
+
module Webmention
|
17
|
+
module CLI
|
18
|
+
def self.start(argv)
|
19
|
+
Runner.start(argv)
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
module Webmention
|
2
|
+
module CLI
|
3
|
+
module Commands
|
4
|
+
class Endpoint
|
5
|
+
def initialize(url)
|
6
|
+
@url = url
|
7
|
+
end
|
8
|
+
|
9
|
+
def run
|
10
|
+
IndieWeb::Endpoints.get(@url).webmention
|
11
|
+
rescue IndieWeb::Endpoints::ArgumentError,
|
12
|
+
IndieWeb::Endpoints::InvalidURIError => exception
|
13
|
+
raise ArgumentError, exception
|
14
|
+
rescue IndieWeb::Endpoints::IndieWebEndpointsError => exception
|
15
|
+
raise WebmentionEndpointError, exception
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
module Webmention
|
2
|
+
module CLI
|
3
|
+
module Commands
|
4
|
+
class Send
|
5
|
+
def initialize(source, target)
|
6
|
+
@source = source
|
7
|
+
@target = target
|
8
|
+
end
|
9
|
+
|
10
|
+
def run
|
11
|
+
Webmention.send_mention(@source, @target)
|
12
|
+
rescue Webmention::ArgumentError,
|
13
|
+
Webmention::InvalidURIError => exception
|
14
|
+
raise ArgumentError, exception
|
15
|
+
rescue Webmention::WebmentionClientError => exception
|
16
|
+
raise WebmentionSendError, exception
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
module Webmention
|
2
|
+
module CLI
|
3
|
+
module Commands
|
4
|
+
class Verify
|
5
|
+
def initialize(source, target, strict)
|
6
|
+
@source = source
|
7
|
+
@target = target
|
8
|
+
@strict = strict
|
9
|
+
end
|
10
|
+
|
11
|
+
def run
|
12
|
+
Webmention::Verification.verified?(@source, @target, strict: @strict)
|
13
|
+
rescue Webmention::Verification::ArgumentError,
|
14
|
+
Webmention::Verification::InvalidURIError => exception
|
15
|
+
raise ArgumentError, exception
|
16
|
+
rescue Webmention::Verification::WebmentionVerificationError => exception
|
17
|
+
raise WebmentionVerificationError, exception
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
module Webmention
|
2
|
+
module CLI
|
3
|
+
class Error < RuntimeError; end
|
4
|
+
|
5
|
+
class ArgumentError < Error; end
|
6
|
+
|
7
|
+
class WebmentionEndpointError < Error
|
8
|
+
def initialize(msg = 'No Webmention endpoint found')
|
9
|
+
super(msg)
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
class WebmentionSendError < Error; end
|
14
|
+
|
15
|
+
class WebmentionVerificationError < Error; end
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,71 @@
|
|
1
|
+
module Webmention
|
2
|
+
module CLI
|
3
|
+
class Runner < Thor
|
4
|
+
include Thor::Actions
|
5
|
+
|
6
|
+
package_name 'Webmention'
|
7
|
+
|
8
|
+
map ['-v', '--version'] => :__version
|
9
|
+
|
10
|
+
desc 'endpoint <target>', 'Discover Webmention endpoint for <target> URL'
|
11
|
+
def endpoint(target)
|
12
|
+
url = Commands::Endpoint.new(target).run
|
13
|
+
|
14
|
+
raise WebmentionEndpointError unless url
|
15
|
+
|
16
|
+
say_success(url)
|
17
|
+
rescue Error => exception
|
18
|
+
say_failure(exception)
|
19
|
+
end
|
20
|
+
|
21
|
+
desc 'send <source> <target>', 'Send a webmention from <source> URL to <target> URL'
|
22
|
+
def send(source, target)
|
23
|
+
response = Commands::Send.new(source, target).run
|
24
|
+
|
25
|
+
raise WebmentionEndpointError unless response
|
26
|
+
|
27
|
+
status = response.status
|
28
|
+
location = response.headers[:location]
|
29
|
+
|
30
|
+
raise WebmentionSendError, status unless status.success?
|
31
|
+
|
32
|
+
say_success(response.code == 201 && location ? location : status)
|
33
|
+
rescue Error => exception
|
34
|
+
say_failure(exception)
|
35
|
+
end
|
36
|
+
|
37
|
+
desc 'verify <source> <target>', 'Verify <source> URL links to <target> URL'
|
38
|
+
option :strict, type: :boolean, desc: 'Enable or disable strict URL matching', default: true
|
39
|
+
def verify(source, target)
|
40
|
+
verified = Commands::Verify.new(source, target, options[:strict]).run
|
41
|
+
|
42
|
+
raise WebmentionVerificationError, verified unless verified
|
43
|
+
|
44
|
+
say_success(verified)
|
45
|
+
rescue Error => exception
|
46
|
+
say_failure(exception)
|
47
|
+
end
|
48
|
+
|
49
|
+
desc '--version', 'Print version information'
|
50
|
+
def __version
|
51
|
+
say "webmention-cli version #{Webmention::CLI::VERSION}"
|
52
|
+
end
|
53
|
+
|
54
|
+
no_commands do
|
55
|
+
def say_failure(message)
|
56
|
+
say message, :red
|
57
|
+
exit 1
|
58
|
+
end
|
59
|
+
|
60
|
+
def say_success(message)
|
61
|
+
say message, :green
|
62
|
+
exit 0
|
63
|
+
end
|
64
|
+
end
|
65
|
+
|
66
|
+
def self.exit_on_failure?
|
67
|
+
true
|
68
|
+
end
|
69
|
+
end
|
70
|
+
end
|
71
|
+
end
|
data/webmention-cli.gemspec
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
lib = File.expand_path('lib', __dir__)
|
2
2
|
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
3
3
|
|
4
|
-
require '
|
4
|
+
require 'webmention/cli/version'
|
5
5
|
|
6
6
|
Gem::Specification.new do |spec|
|
7
|
-
spec.required_ruby_version = ['>= 2.
|
7
|
+
spec.required_ruby_version = ['>= 2.5', '< 2.8']
|
8
8
|
|
9
9
|
spec.name = 'webmention-cli'
|
10
|
-
spec.version =
|
10
|
+
spec.version = Webmention::CLI::VERSION
|
11
11
|
spec.authors = ['Jason Garber']
|
12
12
|
spec.email = ['jason@sixtwothree.org']
|
13
13
|
|
@@ -22,15 +22,23 @@ Gem::Specification.new do |spec|
|
|
22
22
|
spec.executables = ['webmention']
|
23
23
|
spec.require_paths = ['lib']
|
24
24
|
|
25
|
-
spec.
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
spec.add_development_dependency '
|
31
|
-
spec.add_development_dependency '
|
32
|
-
|
33
|
-
spec.
|
34
|
-
spec.
|
35
|
-
spec.
|
25
|
+
spec.metadata = {
|
26
|
+
'bug_tracker_uri' => "#{spec.homepage}/issues",
|
27
|
+
'changelog_uri' => "#{spec.homepage}/blob/v#{spec.version}/CHANGELOG.md"
|
28
|
+
}
|
29
|
+
|
30
|
+
spec.add_development_dependency 'rake', '~> 13.0'
|
31
|
+
spec.add_development_dependency 'reek', '~> 5.6'
|
32
|
+
spec.add_development_dependency 'rspec', '~> 3.9'
|
33
|
+
spec.add_development_dependency 'rubocop', '~> 0.79.0'
|
34
|
+
spec.add_development_dependency 'rubocop-performance', '~> 1.5'
|
35
|
+
spec.add_development_dependency 'rubocop-rspec', '~> 1.37'
|
36
|
+
spec.add_development_dependency 'simplecov', '~> 0.18.0'
|
37
|
+
spec.add_development_dependency 'simplecov-console', '~> 0.6.0'
|
38
|
+
spec.add_development_dependency 'webmock', '~> 3.8'
|
39
|
+
|
40
|
+
spec.add_runtime_dependency 'indieweb-endpoints', '~> 2.0'
|
41
|
+
spec.add_runtime_dependency 'thor', '~> 1.0'
|
42
|
+
spec.add_runtime_dependency 'webmention', '~> 2.0'
|
43
|
+
spec.add_runtime_dependency 'webmention-verification', '~> 2.0'
|
36
44
|
end
|
metadata
CHANGED
@@ -1,129 +1,171 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: webmention-cli
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 1.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jason Garber
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2020-02-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
|
-
name:
|
14
|
+
name: rake
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '
|
19
|
+
version: '13.0'
|
20
20
|
type: :development
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '
|
26
|
+
version: '13.0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
|
-
name:
|
28
|
+
name: reek
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '
|
33
|
+
version: '5.6'
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: '
|
40
|
+
version: '5.6'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: rspec
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
45
|
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: '3.
|
47
|
+
version: '3.9'
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: '3.
|
54
|
+
version: '3.9'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: rubocop
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
59
|
- - "~>"
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version: 0.
|
61
|
+
version: 0.79.0
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: 0.79.0
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: rubocop-performance
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - "~>"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '1.5'
|
62
76
|
type: :development
|
63
77
|
prerelease: false
|
64
78
|
version_requirements: !ruby/object:Gem::Requirement
|
65
79
|
requirements:
|
66
80
|
- - "~>"
|
67
81
|
- !ruby/object:Gem::Version
|
68
|
-
version:
|
82
|
+
version: '1.5'
|
69
83
|
- !ruby/object:Gem::Dependency
|
70
84
|
name: rubocop-rspec
|
71
85
|
requirement: !ruby/object:Gem::Requirement
|
72
86
|
requirements:
|
73
87
|
- - "~>"
|
74
88
|
- !ruby/object:Gem::Version
|
75
|
-
version: '1.
|
89
|
+
version: '1.37'
|
76
90
|
type: :development
|
77
91
|
prerelease: false
|
78
92
|
version_requirements: !ruby/object:Gem::Requirement
|
79
93
|
requirements:
|
80
94
|
- - "~>"
|
81
95
|
- !ruby/object:Gem::Version
|
82
|
-
version: '1.
|
96
|
+
version: '1.37'
|
83
97
|
- !ruby/object:Gem::Dependency
|
84
98
|
name: simplecov
|
85
99
|
requirement: !ruby/object:Gem::Requirement
|
86
100
|
requirements:
|
87
101
|
- - "~>"
|
88
102
|
- !ruby/object:Gem::Version
|
89
|
-
version: 0.
|
103
|
+
version: 0.18.0
|
90
104
|
type: :development
|
91
105
|
prerelease: false
|
92
106
|
version_requirements: !ruby/object:Gem::Requirement
|
93
107
|
requirements:
|
94
108
|
- - "~>"
|
95
109
|
- !ruby/object:Gem::Version
|
96
|
-
version: 0.
|
110
|
+
version: 0.18.0
|
97
111
|
- !ruby/object:Gem::Dependency
|
98
112
|
name: simplecov-console
|
99
113
|
requirement: !ruby/object:Gem::Requirement
|
100
114
|
requirements:
|
101
115
|
- - "~>"
|
102
116
|
- !ruby/object:Gem::Version
|
103
|
-
version: 0.
|
117
|
+
version: 0.6.0
|
104
118
|
type: :development
|
105
119
|
prerelease: false
|
106
120
|
version_requirements: !ruby/object:Gem::Requirement
|
107
121
|
requirements:
|
108
122
|
- - "~>"
|
109
123
|
- !ruby/object:Gem::Version
|
110
|
-
version: 0.
|
124
|
+
version: 0.6.0
|
125
|
+
- !ruby/object:Gem::Dependency
|
126
|
+
name: webmock
|
127
|
+
requirement: !ruby/object:Gem::Requirement
|
128
|
+
requirements:
|
129
|
+
- - "~>"
|
130
|
+
- !ruby/object:Gem::Version
|
131
|
+
version: '3.8'
|
132
|
+
type: :development
|
133
|
+
prerelease: false
|
134
|
+
version_requirements: !ruby/object:Gem::Requirement
|
135
|
+
requirements:
|
136
|
+
- - "~>"
|
137
|
+
- !ruby/object:Gem::Version
|
138
|
+
version: '3.8'
|
139
|
+
- !ruby/object:Gem::Dependency
|
140
|
+
name: indieweb-endpoints
|
141
|
+
requirement: !ruby/object:Gem::Requirement
|
142
|
+
requirements:
|
143
|
+
- - "~>"
|
144
|
+
- !ruby/object:Gem::Version
|
145
|
+
version: '2.0'
|
146
|
+
type: :runtime
|
147
|
+
prerelease: false
|
148
|
+
version_requirements: !ruby/object:Gem::Requirement
|
149
|
+
requirements:
|
150
|
+
- - "~>"
|
151
|
+
- !ruby/object:Gem::Version
|
152
|
+
version: '2.0'
|
111
153
|
- !ruby/object:Gem::Dependency
|
112
154
|
name: thor
|
113
155
|
requirement: !ruby/object:Gem::Requirement
|
114
156
|
requirements:
|
115
157
|
- - "~>"
|
116
158
|
- !ruby/object:Gem::Version
|
117
|
-
version: 0
|
159
|
+
version: '1.0'
|
118
160
|
type: :runtime
|
119
161
|
prerelease: false
|
120
162
|
version_requirements: !ruby/object:Gem::Requirement
|
121
163
|
requirements:
|
122
164
|
- - "~>"
|
123
165
|
- !ruby/object:Gem::Version
|
124
|
-
version: 0
|
166
|
+
version: '1.0'
|
125
167
|
- !ruby/object:Gem::Dependency
|
126
|
-
name: webmention
|
168
|
+
name: webmention
|
127
169
|
requirement: !ruby/object:Gem::Requirement
|
128
170
|
requirements:
|
129
171
|
- - "~>"
|
@@ -142,14 +184,14 @@ dependencies:
|
|
142
184
|
requirements:
|
143
185
|
- - "~>"
|
144
186
|
- !ruby/object:Gem::Version
|
145
|
-
version: 0
|
187
|
+
version: '2.0'
|
146
188
|
type: :runtime
|
147
189
|
prerelease: false
|
148
190
|
version_requirements: !ruby/object:Gem::Requirement
|
149
191
|
requirements:
|
150
192
|
- - "~>"
|
151
193
|
- !ruby/object:Gem::Version
|
152
|
-
version: 0
|
194
|
+
version: '2.0'
|
153
195
|
description: A command-line interface for Webmention.
|
154
196
|
email:
|
155
197
|
- jason@sixtwothree.org
|
@@ -160,6 +202,7 @@ extra_rdoc_files: []
|
|
160
202
|
files:
|
161
203
|
- ".editorconfig"
|
162
204
|
- ".gitignore"
|
205
|
+
- ".reek.yml"
|
163
206
|
- ".rspec"
|
164
207
|
- ".rubocop"
|
165
208
|
- ".rubocop.yml"
|
@@ -173,14 +216,20 @@ files:
|
|
173
216
|
- README.md
|
174
217
|
- Rakefile
|
175
218
|
- exe/webmention
|
176
|
-
- lib/
|
177
|
-
- lib/
|
178
|
-
- lib/
|
219
|
+
- lib/webmention/cli.rb
|
220
|
+
- lib/webmention/cli/commands/endpoint.rb
|
221
|
+
- lib/webmention/cli/commands/send.rb
|
222
|
+
- lib/webmention/cli/commands/verify.rb
|
223
|
+
- lib/webmention/cli/exceptions.rb
|
224
|
+
- lib/webmention/cli/runner.rb
|
225
|
+
- lib/webmention/cli/version.rb
|
179
226
|
- webmention-cli.gemspec
|
180
227
|
homepage: https://github.com/jgarber623/webmention-cli
|
181
228
|
licenses:
|
182
229
|
- MIT
|
183
|
-
metadata:
|
230
|
+
metadata:
|
231
|
+
bug_tracker_uri: https://github.com/jgarber623/webmention-cli/issues
|
232
|
+
changelog_uri: https://github.com/jgarber623/webmention-cli/blob/v1.0.0/CHANGELOG.md
|
184
233
|
post_install_message:
|
185
234
|
rdoc_options: []
|
186
235
|
require_paths:
|
@@ -189,17 +238,17 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
189
238
|
requirements:
|
190
239
|
- - ">="
|
191
240
|
- !ruby/object:Gem::Version
|
192
|
-
version: '2.
|
241
|
+
version: '2.5'
|
193
242
|
- - "<"
|
194
243
|
- !ruby/object:Gem::Version
|
195
|
-
version: '2.
|
244
|
+
version: '2.8'
|
196
245
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
197
246
|
requirements:
|
198
247
|
- - ">="
|
199
248
|
- !ruby/object:Gem::Version
|
200
249
|
version: '0'
|
201
250
|
requirements: []
|
202
|
-
rubygems_version: 3.
|
251
|
+
rubygems_version: 3.1.2
|
203
252
|
signing_key:
|
204
253
|
specification_version: 4
|
205
254
|
summary: A command-line interface for Webmention.
|
data/lib/webmention_cli.rb
DELETED
@@ -1,40 +0,0 @@
|
|
1
|
-
module WebmentionCLI
|
2
|
-
class Webmention < Thor
|
3
|
-
def self.exit_on_failure?
|
4
|
-
true
|
5
|
-
end
|
6
|
-
|
7
|
-
desc 'endpoint <url>', 'Discover webmention endpoint for <url>'
|
8
|
-
def endpoint(url)
|
9
|
-
result = ::Webmention::Endpoint.discover(url)
|
10
|
-
|
11
|
-
puts result if result
|
12
|
-
|
13
|
-
exit(result ? true : false)
|
14
|
-
rescue ::Webmention::Endpoint::ArgumentError, ::Webmention::Endpoint::InvalidURIError
|
15
|
-
raise Thor::MalformattedArgumentError, "ERROR: Expected '#{url}' to be an absolute URI (e.g. https://example.com)"
|
16
|
-
end
|
17
|
-
|
18
|
-
# desc 'send <source> <target>', 'Send a webmention from <source> URL to <target> URL'
|
19
|
-
# def send(source, target)
|
20
|
-
# puts source
|
21
|
-
# puts target
|
22
|
-
# end
|
23
|
-
|
24
|
-
desc 'verify <source> <target>', 'Verify <source> URL links to <target> URL'
|
25
|
-
option :strict, type: :boolean, desc: 'Enable or disable strict URL matching', default: true
|
26
|
-
def verify(source, target)
|
27
|
-
result = ::Webmention::Verification::Client.new(source, target, strict: options[:strict]).verified?
|
28
|
-
|
29
|
-
if result
|
30
|
-
puts "SUCCESS: #{source} links to #{target}"
|
31
|
-
else
|
32
|
-
puts "ERROR: #{source} does not link to #{target}"
|
33
|
-
end
|
34
|
-
|
35
|
-
exit(result)
|
36
|
-
rescue ::Webmention::Verification::ArgumentError
|
37
|
-
raise Thor::MalformattedArgumentError, "ERROR: Expected '#{source}' and '#{target}' to be absolute URIs (e.g. https://example.com)"
|
38
|
-
end
|
39
|
-
end
|
40
|
-
end
|