webmention-cli 0.1.1 → 1.4.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 +12 -2
- data/.ruby-version +1 -1
- data/.simplecov +2 -0
- data/.travis.yml +5 -10
- data/CHANGELOG.md +27 -1
- data/CONTRIBUTING.md +2 -2
- data/Gemfile +11 -0
- data/LICENSE +1 -1
- data/README.md +19 -8
- 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 +12 -17
- metadata +27 -104
- 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: 31d9b57ae80edd1395e5f7654549188fe100fef2935a8443c3e0344bd0c74283
|
4
|
+
data.tar.gz: d72e9fa7cdda10a343e0905c7894571eda995530f9e8f2a46b0c99d93e4afed0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: dd40e283f9f0ac5feada5c49dac1639cbbfe7d59d4f2b99a9d020be457fe8d1d748071d2bc9b89fa4c87473903f8b2bf4704a35ff60245d516268f694e740346
|
7
|
+
data.tar.gz: 8c51593f86a30cffbdf87aff1c75e0a6bfd75a12092c2459f0242e2ddab02ae7c34e6f59609fe3c97be7da95b3dea7122bdc287c215b184ebb122f5639990cdf
|
data/.reek.yml
ADDED
data/.rubocop.yml
CHANGED
@@ -1,15 +1,25 @@
|
|
1
1
|
require:
|
2
|
+
- rubocop-performance
|
2
3
|
- rubocop-rspec
|
3
4
|
|
5
|
+
AllCops:
|
6
|
+
NewCops: enable
|
7
|
+
|
8
|
+
Layout/LineLength:
|
9
|
+
Enabled: false
|
10
|
+
|
4
11
|
Metrics/BlockLength:
|
5
12
|
Exclude:
|
6
13
|
- spec/**/*.rb
|
7
14
|
|
8
|
-
|
9
|
-
|
15
|
+
Naming/RescuedExceptionsVariableName:
|
16
|
+
PreferredName: exception
|
10
17
|
|
11
18
|
Style/Documentation:
|
12
19
|
Enabled: false
|
13
20
|
|
14
21
|
Style/FrozenStringLiteralComment:
|
15
22
|
Enabled: false
|
23
|
+
|
24
|
+
Style/SymbolArray:
|
25
|
+
Enabled: false
|
data/.ruby-version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
2.
|
1
|
+
2.5.8
|
data/.simplecov
CHANGED
@@ -2,9 +2,11 @@ require 'simplecov-console'
|
|
2
2
|
|
3
3
|
formatters = [SimpleCov::Formatter::HTMLFormatter]
|
4
4
|
|
5
|
+
# rubocop:disable Style/IfUnlessModifier
|
5
6
|
if RSpec.configuration.files_to_run.length > 1
|
6
7
|
formatters << SimpleCov::Formatter::Console
|
7
8
|
end
|
9
|
+
# rubocop:enable Style/IfUnlessModifier
|
8
10
|
|
9
11
|
SimpleCov.start do
|
10
12
|
formatter SimpleCov::Formatter::MultiFormatter.new(formatters)
|
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,34 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
+
## 1.4.0 / 2020-08-23
|
4
|
+
|
5
|
+
- Update indieweb-endpoints and webmention dependencies (32bd719)
|
6
|
+
|
7
|
+
## 1.3.0 / 2020-05-26
|
8
|
+
|
9
|
+
- Update webmention dependency (4540771)
|
10
|
+
|
11
|
+
## 1.2.0 / 2020-05-18
|
12
|
+
|
13
|
+
- Update indieweb-endpoints, webmention, and webmention-verification gems (2ad2f78)
|
14
|
+
- Move development dependencies to Gemfile per current Bundler conventions (434f785)
|
15
|
+
- Update development Ruby version to 2.5.8 (1438a62)
|
16
|
+
|
17
|
+
## 1.1.0 / 2020-04-17
|
18
|
+
|
19
|
+
- Update webmention dependency (21695df)
|
20
|
+
|
21
|
+
## 1.0.0 / 2020-02-08
|
22
|
+
|
23
|
+
- Rewrite gem code
|
24
|
+
- Rewrite specs
|
25
|
+
- Update development and runtime dependencies to latest versions (67744c1)
|
26
|
+
- Change supported Ruby versions to >= 2.5 and < 2.8 (1b30b8c)
|
27
|
+
- Update project Ruby version to 2.5.7 (21e94b6)
|
28
|
+
|
3
29
|
## 0.1.1 / 2019-01-03
|
4
30
|
|
5
|
-
- Expand supported Ruby versions to include 2.6 (
|
31
|
+
- Expand supported Ruby versions to include 2.6 (8930501)
|
6
32
|
|
7
33
|
## 0.1.0 / 2018-08-14
|
8
34
|
|
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.8 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.8. 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.8 using your method of choice, install the project's gems by running:
|
14
14
|
|
15
15
|
```sh
|
16
16
|
bundle install
|
data/Gemfile
CHANGED
@@ -2,3 +2,14 @@ source 'https://rubygems.org'
|
|
2
2
|
|
3
3
|
# Specify your gem's dependencies in webmention-cli.gemspec
|
4
4
|
gemspec
|
5
|
+
|
6
|
+
gem 'pry-byebug', '~> 3.9'
|
7
|
+
gem 'rake', '~> 13.0'
|
8
|
+
gem 'reek', '~> 6.0'
|
9
|
+
gem 'rspec', '~> 3.9'
|
10
|
+
gem 'rubocop', '~> 0.89.1'
|
11
|
+
gem 'rubocop-performance', '~> 1.7'
|
12
|
+
gem 'rubocop-rspec', '~> 1.43'
|
13
|
+
gem 'simplecov', '~> 0.19.0'
|
14
|
+
gem 'simplecov-console', '~> 0.7.2'
|
15
|
+
gem 'webmock', '~> 3.8'
|
data/LICENSE
CHANGED
data/README.md
CHANGED
@@ -4,16 +4,16 @@
|
|
4
4
|
|
5
5
|
[![Gem](https://img.shields.io/gem/v/webmention-cli.svg?style=for-the-badge)](https://rubygems.org/gems/webmention-cli)
|
6
6
|
[![Downloads](https://img.shields.io/gem/dt/webmention-cli.svg?style=for-the-badge)](https://rubygems.org/gems/webmention-cli)
|
7
|
-
[![Build](https://img.shields.io/travis/com/jgarber623/webmention-cli/
|
7
|
+
[![Build](https://img.shields.io/travis/com/jgarber623/webmention-cli/main.svg?style=for-the-badge)](https://travis-ci.com/jgarber623/webmention-cli)
|
8
8
|
[![Dependencies](https://img.shields.io/depfu/jgarber623/webmention-cli.svg?style=for-the-badge)](https://depfu.com/github/jgarber623/webmention-cli)
|
9
9
|
[![Maintainability](https://img.shields.io/codeclimate/maintainability/jgarber623/webmention-cli.svg?style=for-the-badge)](https://codeclimate.com/github/jgarber623/webmention-cli)
|
10
10
|
[![Coverage](https://img.shields.io/codeclimate/c/jgarber623/webmention-cli.svg?style=for-the-badge)](https://codeclimate.com/github/jgarber623/webmention-cli/code)
|
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.8 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,34 +25,45 @@ 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
|
54
65
|
|
55
|
-
Interested in helping improve webmention-cli? Awesome! Your help is greatly appreciated. See [CONTRIBUTING.md](https://github.com/jgarber623/webmention-cli/blob/
|
66
|
+
Interested in helping improve webmention-cli? Awesome! Your help is greatly appreciated. See [CONTRIBUTING.md](https://github.com/jgarber623/webmention-cli/blob/main/CONTRIBUTING.md) for details.
|
56
67
|
|
57
68
|
## Acknowledgments
|
58
69
|
|
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,10 @@
|
|
1
|
-
|
2
|
-
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
3
|
-
|
4
|
-
require 'webmention_cli/version'
|
1
|
+
require_relative 'lib/webmention/cli/version'
|
5
2
|
|
6
3
|
Gem::Specification.new do |spec|
|
7
|
-
spec.required_ruby_version =
|
4
|
+
spec.required_ruby_version = Gem::Requirement.new('>= 2.5', '< 2.8')
|
8
5
|
|
9
6
|
spec.name = 'webmention-cli'
|
10
|
-
spec.version =
|
7
|
+
spec.version = Webmention::CLI::VERSION
|
11
8
|
spec.authors = ['Jason Garber']
|
12
9
|
spec.email = ['jason@sixtwothree.org']
|
13
10
|
|
@@ -16,21 +13,19 @@ Gem::Specification.new do |spec|
|
|
16
13
|
spec.homepage = 'https://github.com/jgarber623/webmention-cli'
|
17
14
|
spec.license = 'MIT'
|
18
15
|
|
19
|
-
spec.files =
|
16
|
+
spec.files = Dir.chdir(File.expand_path(__dir__)) do
|
17
|
+
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(bin|spec)/}) }
|
18
|
+
end
|
20
19
|
|
21
20
|
spec.bindir = 'exe'
|
22
21
|
spec.executables = ['webmention']
|
23
22
|
spec.require_paths = ['lib']
|
24
23
|
|
25
|
-
spec.
|
26
|
-
spec.
|
27
|
-
spec.add_development_dependency 'rspec', '~> 3.8'
|
28
|
-
spec.add_development_dependency 'rubocop', '~> 0.62.0'
|
29
|
-
spec.add_development_dependency 'rubocop-rspec', '~> 1.31'
|
30
|
-
spec.add_development_dependency 'simplecov', '~> 0.16.1'
|
31
|
-
spec.add_development_dependency 'simplecov-console', '~> 0.4.2'
|
24
|
+
spec.metadata['bug_tracker_uri'] = "#{spec.homepage}/issues"
|
25
|
+
spec.metadata['changelog_uri'] = "#{spec.homepage}/blob/v#{spec.version}/CHANGELOG.md"
|
32
26
|
|
33
|
-
spec.add_runtime_dependency '
|
34
|
-
spec.add_runtime_dependency '
|
35
|
-
spec.add_runtime_dependency 'webmention
|
27
|
+
spec.add_runtime_dependency 'indieweb-endpoints', '~> 4.0'
|
28
|
+
spec.add_runtime_dependency 'thor', '~> 1.0'
|
29
|
+
spec.add_runtime_dependency 'webmention', '~> 4.0'
|
30
|
+
spec.add_runtime_dependency 'webmention-verification', '~> 3.0'
|
36
31
|
end
|
metadata
CHANGED
@@ -1,155 +1,71 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: webmention-cli
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 1.4.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-08-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
|
-
name:
|
14
|
+
name: indieweb-endpoints
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '
|
20
|
-
type: :
|
21
|
-
prerelease: false
|
22
|
-
version_requirements: !ruby/object:Gem::Requirement
|
23
|
-
requirements:
|
24
|
-
- - "~>"
|
25
|
-
- !ruby/object:Gem::Version
|
26
|
-
version: '1.17'
|
27
|
-
- !ruby/object:Gem::Dependency
|
28
|
-
name: rake
|
29
|
-
requirement: !ruby/object:Gem::Requirement
|
30
|
-
requirements:
|
31
|
-
- - "~>"
|
32
|
-
- !ruby/object:Gem::Version
|
33
|
-
version: '12.3'
|
34
|
-
type: :development
|
35
|
-
prerelease: false
|
36
|
-
version_requirements: !ruby/object:Gem::Requirement
|
37
|
-
requirements:
|
38
|
-
- - "~>"
|
39
|
-
- !ruby/object:Gem::Version
|
40
|
-
version: '12.3'
|
41
|
-
- !ruby/object:Gem::Dependency
|
42
|
-
name: rspec
|
43
|
-
requirement: !ruby/object:Gem::Requirement
|
44
|
-
requirements:
|
45
|
-
- - "~>"
|
46
|
-
- !ruby/object:Gem::Version
|
47
|
-
version: '3.8'
|
48
|
-
type: :development
|
49
|
-
prerelease: false
|
50
|
-
version_requirements: !ruby/object:Gem::Requirement
|
51
|
-
requirements:
|
52
|
-
- - "~>"
|
53
|
-
- !ruby/object:Gem::Version
|
54
|
-
version: '3.8'
|
55
|
-
- !ruby/object:Gem::Dependency
|
56
|
-
name: rubocop
|
57
|
-
requirement: !ruby/object:Gem::Requirement
|
58
|
-
requirements:
|
59
|
-
- - "~>"
|
60
|
-
- !ruby/object:Gem::Version
|
61
|
-
version: 0.62.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.62.0
|
69
|
-
- !ruby/object:Gem::Dependency
|
70
|
-
name: rubocop-rspec
|
71
|
-
requirement: !ruby/object:Gem::Requirement
|
72
|
-
requirements:
|
73
|
-
- - "~>"
|
74
|
-
- !ruby/object:Gem::Version
|
75
|
-
version: '1.31'
|
76
|
-
type: :development
|
77
|
-
prerelease: false
|
78
|
-
version_requirements: !ruby/object:Gem::Requirement
|
79
|
-
requirements:
|
80
|
-
- - "~>"
|
81
|
-
- !ruby/object:Gem::Version
|
82
|
-
version: '1.31'
|
83
|
-
- !ruby/object:Gem::Dependency
|
84
|
-
name: simplecov
|
85
|
-
requirement: !ruby/object:Gem::Requirement
|
86
|
-
requirements:
|
87
|
-
- - "~>"
|
88
|
-
- !ruby/object:Gem::Version
|
89
|
-
version: 0.16.1
|
90
|
-
type: :development
|
91
|
-
prerelease: false
|
92
|
-
version_requirements: !ruby/object:Gem::Requirement
|
93
|
-
requirements:
|
94
|
-
- - "~>"
|
95
|
-
- !ruby/object:Gem::Version
|
96
|
-
version: 0.16.1
|
97
|
-
- !ruby/object:Gem::Dependency
|
98
|
-
name: simplecov-console
|
99
|
-
requirement: !ruby/object:Gem::Requirement
|
100
|
-
requirements:
|
101
|
-
- - "~>"
|
102
|
-
- !ruby/object:Gem::Version
|
103
|
-
version: 0.4.2
|
104
|
-
type: :development
|
19
|
+
version: '4.0'
|
20
|
+
type: :runtime
|
105
21
|
prerelease: false
|
106
22
|
version_requirements: !ruby/object:Gem::Requirement
|
107
23
|
requirements:
|
108
24
|
- - "~>"
|
109
25
|
- !ruby/object:Gem::Version
|
110
|
-
version:
|
26
|
+
version: '4.0'
|
111
27
|
- !ruby/object:Gem::Dependency
|
112
28
|
name: thor
|
113
29
|
requirement: !ruby/object:Gem::Requirement
|
114
30
|
requirements:
|
115
31
|
- - "~>"
|
116
32
|
- !ruby/object:Gem::Version
|
117
|
-
version: 0
|
33
|
+
version: '1.0'
|
118
34
|
type: :runtime
|
119
35
|
prerelease: false
|
120
36
|
version_requirements: !ruby/object:Gem::Requirement
|
121
37
|
requirements:
|
122
38
|
- - "~>"
|
123
39
|
- !ruby/object:Gem::Version
|
124
|
-
version: 0
|
40
|
+
version: '1.0'
|
125
41
|
- !ruby/object:Gem::Dependency
|
126
|
-
name: webmention
|
42
|
+
name: webmention
|
127
43
|
requirement: !ruby/object:Gem::Requirement
|
128
44
|
requirements:
|
129
45
|
- - "~>"
|
130
46
|
- !ruby/object:Gem::Version
|
131
|
-
version: '
|
47
|
+
version: '4.0'
|
132
48
|
type: :runtime
|
133
49
|
prerelease: false
|
134
50
|
version_requirements: !ruby/object:Gem::Requirement
|
135
51
|
requirements:
|
136
52
|
- - "~>"
|
137
53
|
- !ruby/object:Gem::Version
|
138
|
-
version: '
|
54
|
+
version: '4.0'
|
139
55
|
- !ruby/object:Gem::Dependency
|
140
56
|
name: webmention-verification
|
141
57
|
requirement: !ruby/object:Gem::Requirement
|
142
58
|
requirements:
|
143
59
|
- - "~>"
|
144
60
|
- !ruby/object:Gem::Version
|
145
|
-
version: 0
|
61
|
+
version: '3.0'
|
146
62
|
type: :runtime
|
147
63
|
prerelease: false
|
148
64
|
version_requirements: !ruby/object:Gem::Requirement
|
149
65
|
requirements:
|
150
66
|
- - "~>"
|
151
67
|
- !ruby/object:Gem::Version
|
152
|
-
version: 0
|
68
|
+
version: '3.0'
|
153
69
|
description: A command-line interface for Webmention.
|
154
70
|
email:
|
155
71
|
- jason@sixtwothree.org
|
@@ -160,6 +76,7 @@ extra_rdoc_files: []
|
|
160
76
|
files:
|
161
77
|
- ".editorconfig"
|
162
78
|
- ".gitignore"
|
79
|
+
- ".reek.yml"
|
163
80
|
- ".rspec"
|
164
81
|
- ".rubocop"
|
165
82
|
- ".rubocop.yml"
|
@@ -173,14 +90,20 @@ files:
|
|
173
90
|
- README.md
|
174
91
|
- Rakefile
|
175
92
|
- exe/webmention
|
176
|
-
- lib/
|
177
|
-
- lib/
|
178
|
-
- lib/
|
93
|
+
- lib/webmention/cli.rb
|
94
|
+
- lib/webmention/cli/commands/endpoint.rb
|
95
|
+
- lib/webmention/cli/commands/send.rb
|
96
|
+
- lib/webmention/cli/commands/verify.rb
|
97
|
+
- lib/webmention/cli/exceptions.rb
|
98
|
+
- lib/webmention/cli/runner.rb
|
99
|
+
- lib/webmention/cli/version.rb
|
179
100
|
- webmention-cli.gemspec
|
180
101
|
homepage: https://github.com/jgarber623/webmention-cli
|
181
102
|
licenses:
|
182
103
|
- MIT
|
183
|
-
metadata:
|
104
|
+
metadata:
|
105
|
+
bug_tracker_uri: https://github.com/jgarber623/webmention-cli/issues
|
106
|
+
changelog_uri: https://github.com/jgarber623/webmention-cli/blob/v1.4.0/CHANGELOG.md
|
184
107
|
post_install_message:
|
185
108
|
rdoc_options: []
|
186
109
|
require_paths:
|
@@ -189,17 +112,17 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
189
112
|
requirements:
|
190
113
|
- - ">="
|
191
114
|
- !ruby/object:Gem::Version
|
192
|
-
version: '2.
|
115
|
+
version: '2.5'
|
193
116
|
- - "<"
|
194
117
|
- !ruby/object:Gem::Version
|
195
|
-
version: '2.
|
118
|
+
version: '2.8'
|
196
119
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
197
120
|
requirements:
|
198
121
|
- - ">="
|
199
122
|
- !ruby/object:Gem::Version
|
200
123
|
version: '0'
|
201
124
|
requirements: []
|
202
|
-
rubygems_version: 3.
|
125
|
+
rubygems_version: 3.1.2
|
203
126
|
signing_key:
|
204
127
|
specification_version: 4
|
205
128
|
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
|