micropub-endpoint 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.editorconfig +14 -0
- data/.gitignore +34 -0
- data/.rspec +2 -0
- data/.rubocop +3 -0
- data/.rubocop.yml +15 -0
- data/.ruby-version +1 -0
- data/.simplecov +11 -0
- data/.travis.yml +19 -0
- data/CONTRIBUTING.md +37 -0
- data/Gemfile +4 -0
- data/LICENSE +21 -0
- data/README.md +107 -0
- data/Rakefile +6 -0
- data/lib/micropub/endpoint.rb +15 -0
- data/lib/micropub/endpoint/discover.rb +93 -0
- data/lib/micropub/endpoint/error.rb +15 -0
- data/lib/micropub/endpoint/version.rb +5 -0
- data/micropub-endpoint.gemspec +35 -0
- metadata +249 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: bbc2dfb68b80f95e2fb6bdcc8146597dbd0fbbf1
|
4
|
+
data.tar.gz: b6d1c604d7e6d74a0feb909eecb2fab8b056520e
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 681b8cda4b0c6aa053a7ec7cc3a467347283694c4d8a01197ded82bf27c79aeecca391ec59df1a358f202705bb160008e96aa91dd30fc18b52e4ca0bad697368
|
7
|
+
data.tar.gz: bb27d44678d41714b76ff1e9673619e2c1c9cc6e08f4fbe983d1a33fc6c7a5efa63d37d0812daa9f115e7a50871c715f553eb3d20338cb09e5cc32531da7ec05
|
data/.editorconfig
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
# EditorConfig is awesome: http://EditorConfig.org
|
2
|
+
root = true
|
3
|
+
|
4
|
+
[*]
|
5
|
+
charset = utf-8
|
6
|
+
end_of_line = lf
|
7
|
+
insert_final_newline = true
|
8
|
+
indent_size = 2
|
9
|
+
indent_style = space
|
10
|
+
trim_trailing_whitespace = true
|
11
|
+
|
12
|
+
[*.md]
|
13
|
+
indent_size = 4
|
14
|
+
indent_style = tab
|
data/.gitignore
ADDED
@@ -0,0 +1,34 @@
|
|
1
|
+
*.gem
|
2
|
+
*.rbc
|
3
|
+
/.config
|
4
|
+
/coverage/
|
5
|
+
/InstalledFiles
|
6
|
+
/pkg/
|
7
|
+
/spec/reports/
|
8
|
+
/spec/examples.txt
|
9
|
+
/test/tmp/
|
10
|
+
/test/version_tmp/
|
11
|
+
/tmp/
|
12
|
+
|
13
|
+
# Used by dotenv library to load environment variables.
|
14
|
+
# .env
|
15
|
+
|
16
|
+
# Documentation cache and generated files:
|
17
|
+
/.yardoc/
|
18
|
+
/_yardoc/
|
19
|
+
/doc/
|
20
|
+
/rdoc/
|
21
|
+
|
22
|
+
# Environment normalization:
|
23
|
+
/.bundle/
|
24
|
+
/vendor/bundle
|
25
|
+
/lib/bundler/man/
|
26
|
+
|
27
|
+
# for a library or gem, you might want to ignore these files since the code is
|
28
|
+
# intended to run in multiple environments; otherwise, check them in:
|
29
|
+
Gemfile.lock
|
30
|
+
# .ruby-version
|
31
|
+
# .ruby-gemset
|
32
|
+
|
33
|
+
# unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
|
34
|
+
.rvmrc
|
data/.rspec
ADDED
data/.rubocop
ADDED
data/.rubocop.yml
ADDED
data/.ruby-version
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
2.4.4
|
data/.simplecov
ADDED
@@ -0,0 +1,11 @@
|
|
1
|
+
require 'simplecov-console'
|
2
|
+
|
3
|
+
formatters = [SimpleCov::Formatter::HTMLFormatter]
|
4
|
+
|
5
|
+
if RSpec.configuration.files_to_run.length > 1
|
6
|
+
formatters << SimpleCov::Formatter::Console
|
7
|
+
end
|
8
|
+
|
9
|
+
SimpleCov.start do
|
10
|
+
formatter SimpleCov::Formatter::MultiFormatter.new(formatters)
|
11
|
+
end
|
data/.travis.yml
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
language: ruby
|
2
|
+
rvm:
|
3
|
+
- 2.4.4
|
4
|
+
- 2.5.1
|
5
|
+
cache: bundler
|
6
|
+
before_script:
|
7
|
+
- curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter
|
8
|
+
- chmod +x ./cc-test-reporter
|
9
|
+
- ./cc-test-reporter before-build
|
10
|
+
script:
|
11
|
+
- bundle exec rubocop
|
12
|
+
- bundle exec rake
|
13
|
+
after_script:
|
14
|
+
- ./cc-test-reporter after-build --exit-code $TRAVIS_TEST_RESULT
|
15
|
+
notifications:
|
16
|
+
email: false
|
17
|
+
slack:
|
18
|
+
rooms:
|
19
|
+
secure: Bw0FKzdizUehIp70994nbbjCoSPobcsKgqg4fc6OLBKnlQMFNnZEdGU57NO8hGpcvDeX2q7YFZ2y3esG8RVbA7Q0iuYlCA8q7FVphsCfrZZ3fVMcjyvS+HpT9AoWj42C/DYufPKllyeeXoGFd0JABx6y3ARDgQX3soD/vATdPeW1jhtlk9wv0Wk25mYLPsmLXXi/wrJNHg9g/gHhZ0MYzg2+DAZXELddepdFbC3rjzYJ/L9SzkpkvU/VoW4DBQuG70kPsP9l7EMQEE9PNdNGeEzE0k7uimNsHTn4Y6gnxOVMXhyied3TFbuZGu6fcHfc7rVLsGxgpigG/LHb2lX2oidIdHbmhkcokWnvxMSWOzn9/ojepPL9yYHEvXkbX/eYwrCCzCuv8GASPCIixEJwZ9EjXCNZmftnxscc3Q1XVyP37buwpEGPyThqdVyLX2AdRqF/wMDcf7wzQN5ugIn1u4ZE0dIYnFSO3mcoRAXcMOC2tFKkwVWy5ogHAr1uCeN3axaycmj5iD9//zOPusYPXDFgsbA3qkK4Bj3+LeecnRhMBSIw4qEybW09Mp7vvo/cpRCnaa/+ztlF2pkwPQnk3Z/DSjzCW0ILvfgU/usJ9h4z9MmQYkWHCF6HHB8qX5FJ39D2VOd/aYCss3O9ZDpqQ2fT/AY8K5/XkjDtiWRWLCE=
|
data/CONTRIBUTING.md
ADDED
@@ -0,0 +1,37 @@
|
|
1
|
+
# Contributing to micropub-endpoint-ruby
|
2
|
+
|
3
|
+
There are a couple ways you can help improve micropub-endpoint-ruby:
|
4
|
+
|
5
|
+
1. Fix an existing [issue][issues] and submit a [pull request][pulls].
|
6
|
+
1. Review open [pull requests][pulls].
|
7
|
+
1. Report a new [issue][issues]. _Only do this after you've made sure the behavior or problem you're observing isn't already documented in an open issue._
|
8
|
+
|
9
|
+
## Getting Started
|
10
|
+
|
11
|
+
micropub-endpoint-ruby is developed using Ruby 2.4.4 and is additionally tested against Ruby 2.5.1 using [Travis CI](https://travis-ci.com/jgarber623/micropub-endpoint-ruby).
|
12
|
+
|
13
|
+
Before making changes to micropub-endpoint-ruby, you'll want to install Ruby 2.4.4. 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.4.4 using your method of choice, install the project's gems by running:
|
14
|
+
|
15
|
+
```sh
|
16
|
+
bundle install
|
17
|
+
```
|
18
|
+
|
19
|
+
## Making Changes
|
20
|
+
|
21
|
+
1. Fork and clone the project's repo.
|
22
|
+
1. Install development dependencies as outlined above.
|
23
|
+
1. Create a feature branch for the code changes you're looking to make: `git checkout -b my-new-feature`.
|
24
|
+
1. _Write some code!_
|
25
|
+
1. If your changes would benefit from testing, add the necessary tests and verify everything passes by running `bundle exec rspec`.
|
26
|
+
1. Commit your changes: `git commit -am 'Add some new feature or fix some issue'`. _(See [this excellent article](https://chris.beams.io/posts/git-commit/) for tips on writing useful Git commit messages.)_
|
27
|
+
1. Push the branch to your fork: `git push -u origin my-new-feature`.
|
28
|
+
1. Create a new [pull request][pulls] and we'll review your changes.
|
29
|
+
|
30
|
+
## Code Style
|
31
|
+
|
32
|
+
Code formatting conventions are defined in the `.editorconfig` file which uses the [EditorConfig](http://editorconfig.org) syntax. There are [plugins for a variety of editors](http://editorconfig.org/#download) that utilize the settings in the `.editorconfig` file. We recommended you install the EditorConfig plugin for your editor of choice.
|
33
|
+
|
34
|
+
Your bug fix or feature addition won't be rejected if it runs afoul of any (or all) of these guidelines, but following the guidelines will definitely make everyone's lives a little easier.
|
35
|
+
|
36
|
+
[issues]: https://github.com/jgarber623/micropub-endpoint-ruby/issues
|
37
|
+
[pulls]: https://github.com/jgarber623/micropub-endpoint-ruby/pulls
|
data/Gemfile
ADDED
data/LICENSE
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
MIT License
|
2
|
+
|
3
|
+
Copyright (c) 2018 Jason Garber
|
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 all
|
13
|
+
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 THE
|
21
|
+
SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,107 @@
|
|
1
|
+
# micropub-endpoint-ruby
|
2
|
+
|
3
|
+
**A Ruby gem for discovering a URL's [Micropub](https://indieweb.org/Micropub) endpoint.**
|
4
|
+
|
5
|
+
[![Gem](https://img.shields.io/gem/v/micropub-endpoint.svg?style=for-the-badge)](https://rubygems.org/gems/micropub-endpoint)
|
6
|
+
[![Downloads](https://img.shields.io/gem/dt/micropub-endpoint.svg?style=for-the-badge)](https://rubygems.org/gems/micropub-endpoint)
|
7
|
+
[![Build](https://img.shields.io/travis/com/jgarber623/micropub-endpoint-ruby/master.svg?style=for-the-badge)](https://travis-ci.com/jgarber623/micropub-endpoint-ruby)
|
8
|
+
[![Dependencies](https://img.shields.io/depfu/jgarber623/micropub-endpoint-ruby.svg?style=for-the-badge)](https://depfu.com/github/jgarber623/micropub-endpoint-ruby)
|
9
|
+
[![Maintainability](https://img.shields.io/codeclimate/maintainability/jgarber623/micropub-endpoint-ruby.svg?style=for-the-badge)](https://codeclimate.com/github/jgarber623/micropub-endpoint-ruby)
|
10
|
+
[![Coverage](https://img.shields.io/codeclimate/c/jgarber623/micropub-endpoint-ruby.svg?style=for-the-badge)](https://codeclimate.com/github/jgarber623/micropub-endpoint-ruby/code)
|
11
|
+
|
12
|
+
## Key Features
|
13
|
+
|
14
|
+
- Compliant with [Section 5.3](https://www.w3.org/TR/micropub/#endpoint-discovery) of [the W3C's Micropub specification](https://www.w3.org/TR/micropub/).
|
15
|
+
- Supports Ruby 2.4 and newer.
|
16
|
+
|
17
|
+
## Getting Started
|
18
|
+
|
19
|
+
Before installing and using micropub-endpoint-ruby, you'll want to have [Ruby](https://www.ruby-lang.org) 2.4 (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).
|
20
|
+
|
21
|
+
micropub-endpoint-ruby is developed using Ruby 2.4.4 and is additionally tested against Ruby 2.5.1 using [Travis CI](https://travis-ci.org/indieweb/micropub-endpoint-ruby).
|
22
|
+
|
23
|
+
## Installation
|
24
|
+
|
25
|
+
If you're using [Bundler](https://bundler.io), add micropub-endpoint-ruby to your project's `Gemfile`:
|
26
|
+
|
27
|
+
```ruby
|
28
|
+
source 'https://rubygems.org'
|
29
|
+
|
30
|
+
gem 'micropub-endpoint'
|
31
|
+
```
|
32
|
+
|
33
|
+
…and hop over to your command prompt and run…
|
34
|
+
|
35
|
+
```sh
|
36
|
+
$ bundle install
|
37
|
+
```
|
38
|
+
|
39
|
+
## Usage
|
40
|
+
|
41
|
+
### Basic Usage
|
42
|
+
|
43
|
+
With micropub-endpoint-ruby added to your project's `Gemfile` and installed, you may discover a URL's Micropub endpoint by doing:
|
44
|
+
|
45
|
+
```ruby
|
46
|
+
require 'micropub/endpoint'
|
47
|
+
|
48
|
+
endpoint = Micropub::Endpoint.discover('https://adactio.com')
|
49
|
+
|
50
|
+
puts endpoint # returns String: 'https://adactio.com/micropub'
|
51
|
+
```
|
52
|
+
|
53
|
+
This example will search `https://adactio.com` for a valid Micropub endpoint in accordance with the rules described in [the W3C's Micropub specification](https://www.w3.org/TR/micropub/#endpoint-discovery). In this case, the program returns a string: `https://adactio.com/micropub`.
|
54
|
+
|
55
|
+
If no endpoint is discovered at the provided URL, the program will return `nil`:
|
56
|
+
|
57
|
+
```ruby
|
58
|
+
require 'micropub/endpoint'
|
59
|
+
|
60
|
+
endpoint = Micropub::Endpoint.discover('https://example.com')
|
61
|
+
|
62
|
+
puts endpoint.nil? # returns Boolean: true
|
63
|
+
```
|
64
|
+
|
65
|
+
### Advanced Usage
|
66
|
+
|
67
|
+
Should the need arise, you may work directly with the `Micropub::Endpoint::Discover` class:
|
68
|
+
|
69
|
+
```ruby
|
70
|
+
require 'micropub/endpoint'
|
71
|
+
|
72
|
+
discoverer = Micropub::Endpoint::Discover.new('https://adactio.com')
|
73
|
+
|
74
|
+
puts discoverer.url # returns String: 'https://adactio.com'
|
75
|
+
puts discoverer.endpoint # returns String: 'https://adactio.com/micropub'
|
76
|
+
|
77
|
+
puts discoverer.uri # returns Addressable::URI
|
78
|
+
puts discoverer.response # returns HTTP::Response
|
79
|
+
```
|
80
|
+
|
81
|
+
### Exception Handling
|
82
|
+
|
83
|
+
There are several exceptions that may be raised by micropub-endpoint-ruby's underlying dependencies. These errors are raised as subclasses of `Micropub::Endpoint::Error` (which itself is a subclass of `StandardError`).
|
84
|
+
|
85
|
+
From [sporkmonger/addressable](https://github.com/sporkmonger/addressable):
|
86
|
+
|
87
|
+
- `Micropub::Endpoint::InvalidURIError`
|
88
|
+
|
89
|
+
From [httprb/http](https://github.com/httprb/http):
|
90
|
+
|
91
|
+
- `Micropub::Endpoint::ConnectionError`
|
92
|
+
- `Micropub::Endpoint::TimeoutError`
|
93
|
+
- `Micropub::Endpoint::TooManyRedirectsError`
|
94
|
+
|
95
|
+
## Contributing
|
96
|
+
|
97
|
+
Interested in helping improve micropub-endpoint-ruby? Awesome! Your help is greatly appreciated. See [CONTRIBUTING.md](https://github.com/jgarber623/micropub-endpoint-ruby/blob/master/CONTRIBUTING.md) for details.
|
98
|
+
|
99
|
+
## Acknowledgments
|
100
|
+
|
101
|
+
micropub-endpoint-ruby wouldn't exist without Micropub and the hard work put in by everyone involved in the [IndieWeb](https://indieweb.org) movement.
|
102
|
+
|
103
|
+
micropub-endpoint-ruby is written and maintained by [Jason Garber](https://sixtwothree.org).
|
104
|
+
|
105
|
+
## License
|
106
|
+
|
107
|
+
micropub-endpoint-ruby is freely available under the [MIT License](https://opensource.org/licenses/MIT). Use it, learn from it, fork it, improve it, change it, tailor it to your needs.
|
data/Rakefile
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
require 'addressable/uri'
|
2
|
+
require 'http'
|
3
|
+
require 'nokogiri'
|
4
|
+
|
5
|
+
require 'micropub/endpoint/version'
|
6
|
+
require 'micropub/endpoint/error'
|
7
|
+
require 'micropub/endpoint/discover'
|
8
|
+
|
9
|
+
module Micropub
|
10
|
+
module Endpoint
|
11
|
+
def self.discover(url)
|
12
|
+
Discover.new(url).endpoint
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,93 @@
|
|
1
|
+
module Micropub
|
2
|
+
module Endpoint
|
3
|
+
class Discover
|
4
|
+
HTTP_HEADERS_OPTS = {
|
5
|
+
accept: '*/*',
|
6
|
+
user_agent: 'Micropub Endpoint Discovery (https://rubygems.org/gems/micropub-endpoint)'
|
7
|
+
}.freeze
|
8
|
+
|
9
|
+
# Ultra-orthodox pattern matching allowed values in HTTP Link header `rel` parameter
|
10
|
+
# https://tools.ietf.org/html/rfc8288#section-3.3
|
11
|
+
REGEXP_REG_REL_TYPE_PATTERN = '[a-z\d][a-z\d\-\.]*'.freeze
|
12
|
+
|
13
|
+
# Liberal pattern matching a string of text between angle brackets
|
14
|
+
# https://tools.ietf.org/html/rfc5988#section-5.1
|
15
|
+
REGEXP_TARGET_URI_PATTERN = /^<(.*)>;/
|
16
|
+
|
17
|
+
# Ultra-orthodox pattern matching HTTP Link header `rel` parameter including a `micropub` value
|
18
|
+
# https://www.w3.org/TR/micropub/#endpoint-discovery
|
19
|
+
REGEXP_MICROPUB_REL_PATTERN = /(?:;|\s)rel="?(?:#{REGEXP_REG_REL_TYPE_PATTERN}+\s)?micropub(?:\s#{REGEXP_REG_REL_TYPE_PATTERN})?"?/
|
20
|
+
|
21
|
+
attr_reader :uri, :url
|
22
|
+
|
23
|
+
def initialize(url)
|
24
|
+
raise ArgumentError, "url must be a String (given #{url.class.name})" unless url.is_a?(String)
|
25
|
+
|
26
|
+
@url = url
|
27
|
+
@uri = Addressable::URI.parse(url)
|
28
|
+
rescue Addressable::URI::InvalidURIError => error
|
29
|
+
raise InvalidURIError, error
|
30
|
+
end
|
31
|
+
|
32
|
+
def endpoint
|
33
|
+
@endpoint ||= absolutize(base: url, relative: (endpoint_from_headers || endpoint_from_body)) || nil
|
34
|
+
end
|
35
|
+
|
36
|
+
def response
|
37
|
+
@response ||= HTTP.follow.headers(HTTP_HEADERS_OPTS).timeout(
|
38
|
+
connect: 10,
|
39
|
+
read: 10
|
40
|
+
).get(uri)
|
41
|
+
rescue HTTP::ConnectionError => error
|
42
|
+
raise ConnectionError, error
|
43
|
+
rescue HTTP::TimeoutError => error
|
44
|
+
raise TimeoutError, error
|
45
|
+
rescue HTTP::Redirector::TooManyRedirectsError => error
|
46
|
+
raise TooManyRedirectsError, error
|
47
|
+
end
|
48
|
+
|
49
|
+
private
|
50
|
+
|
51
|
+
def absolutize(base:, relative:)
|
52
|
+
return unless relative
|
53
|
+
|
54
|
+
base_uri = Addressable::URI.parse(base)
|
55
|
+
relative_uri = Addressable::URI.parse(relative)
|
56
|
+
|
57
|
+
return relative if relative_uri.absolute?
|
58
|
+
|
59
|
+
(base_uri + relative_uri).to_s
|
60
|
+
rescue Addressable::URI::InvalidURIError => error
|
61
|
+
raise InvalidURIError, error
|
62
|
+
end
|
63
|
+
|
64
|
+
def endpoint_from_body
|
65
|
+
return unless response.mime_type == 'text/html'
|
66
|
+
|
67
|
+
doc = Nokogiri::HTML(response.body.to_s)
|
68
|
+
|
69
|
+
# Search response body for first `link` element with valid `rel` attribute
|
70
|
+
link_element = doc.css('link[rel~="micropub"][href]').shift
|
71
|
+
|
72
|
+
return link_element['href'] if link_element
|
73
|
+
end
|
74
|
+
|
75
|
+
def endpoint_from_headers
|
76
|
+
link_headers = response.headers.get('link')
|
77
|
+
|
78
|
+
return unless link_headers
|
79
|
+
|
80
|
+
# Split Link headers with multiple values, flatten the resulting array, and strip whitespace
|
81
|
+
link_headers = link_headers.map { |header| header.split(',') }.flatten.map(&:strip)
|
82
|
+
|
83
|
+
micropub_header = link_headers.find { |header| header.match?(REGEXP_MICROPUB_REL_PATTERN) }
|
84
|
+
|
85
|
+
return unless micropub_header
|
86
|
+
|
87
|
+
endpoint_match_data = micropub_header.match(REGEXP_TARGET_URI_PATTERN)
|
88
|
+
|
89
|
+
return endpoint_match_data[1] if endpoint_match_data
|
90
|
+
end
|
91
|
+
end
|
92
|
+
end
|
93
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
module Micropub
|
2
|
+
module Endpoint
|
3
|
+
class Error < StandardError; end
|
4
|
+
|
5
|
+
class ArgumentError < Error; end
|
6
|
+
|
7
|
+
class ConnectionError < Error; end
|
8
|
+
|
9
|
+
class InvalidURIError < Error; end
|
10
|
+
|
11
|
+
class TimeoutError < Error; end
|
12
|
+
|
13
|
+
class TooManyRedirectsError < Error; end
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,35 @@
|
|
1
|
+
lib = File.expand_path('lib', __dir__)
|
2
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
3
|
+
|
4
|
+
require 'micropub/endpoint/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.required_ruby_version = ['>= 2.4', '< 2.6']
|
8
|
+
|
9
|
+
spec.name = 'micropub-endpoint'
|
10
|
+
spec.version = Micropub::Endpoint::VERSION
|
11
|
+
spec.authors = ['Jason Garber']
|
12
|
+
spec.email = ['jason@sixtwothree.org']
|
13
|
+
|
14
|
+
spec.summary = 'Discover a URL’s Micropub endpoint.'
|
15
|
+
spec.description = spec.summary
|
16
|
+
spec.homepage = 'https://github.com/jgarber623/micropub-endpoint-ruby'
|
17
|
+
spec.license = 'MIT'
|
18
|
+
|
19
|
+
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(bin|spec)/}) }
|
20
|
+
|
21
|
+
spec.require_paths = ['lib']
|
22
|
+
|
23
|
+
spec.add_development_dependency 'bundler', '~> 1.16', '>= 1.16.2'
|
24
|
+
spec.add_development_dependency 'rake', '~> 12.3', '>= 12.3.1'
|
25
|
+
spec.add_development_dependency 'rspec', '~> 3.7'
|
26
|
+
spec.add_development_dependency 'rubocop', '~> 0.57.2'
|
27
|
+
spec.add_development_dependency 'rubocop-rspec', '~> 1.27'
|
28
|
+
spec.add_development_dependency 'simplecov', '~> 0.16.1'
|
29
|
+
spec.add_development_dependency 'simplecov-console', '~> 0.4.2'
|
30
|
+
spec.add_development_dependency 'webmock', '~> 3.4', '>= 3.4.2'
|
31
|
+
|
32
|
+
spec.add_runtime_dependency 'addressable', '~> 2.5', '>= 2.5.2'
|
33
|
+
spec.add_runtime_dependency 'http', '~> 3.3'
|
34
|
+
spec.add_runtime_dependency 'nokogiri', '~> 1.8', '>= 1.8.3'
|
35
|
+
end
|
metadata
ADDED
@@ -0,0 +1,249 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: micropub-endpoint
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Jason Garber
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2018-06-30 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.16'
|
20
|
+
- - ">="
|
21
|
+
- !ruby/object:Gem::Version
|
22
|
+
version: 1.16.2
|
23
|
+
type: :development
|
24
|
+
prerelease: false
|
25
|
+
version_requirements: !ruby/object:Gem::Requirement
|
26
|
+
requirements:
|
27
|
+
- - "~>"
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: '1.16'
|
30
|
+
- - ">="
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: 1.16.2
|
33
|
+
- !ruby/object:Gem::Dependency
|
34
|
+
name: rake
|
35
|
+
requirement: !ruby/object:Gem::Requirement
|
36
|
+
requirements:
|
37
|
+
- - "~>"
|
38
|
+
- !ruby/object:Gem::Version
|
39
|
+
version: '12.3'
|
40
|
+
- - ">="
|
41
|
+
- !ruby/object:Gem::Version
|
42
|
+
version: 12.3.1
|
43
|
+
type: :development
|
44
|
+
prerelease: false
|
45
|
+
version_requirements: !ruby/object:Gem::Requirement
|
46
|
+
requirements:
|
47
|
+
- - "~>"
|
48
|
+
- !ruby/object:Gem::Version
|
49
|
+
version: '12.3'
|
50
|
+
- - ">="
|
51
|
+
- !ruby/object:Gem::Version
|
52
|
+
version: 12.3.1
|
53
|
+
- !ruby/object:Gem::Dependency
|
54
|
+
name: rspec
|
55
|
+
requirement: !ruby/object:Gem::Requirement
|
56
|
+
requirements:
|
57
|
+
- - "~>"
|
58
|
+
- !ruby/object:Gem::Version
|
59
|
+
version: '3.7'
|
60
|
+
type: :development
|
61
|
+
prerelease: false
|
62
|
+
version_requirements: !ruby/object:Gem::Requirement
|
63
|
+
requirements:
|
64
|
+
- - "~>"
|
65
|
+
- !ruby/object:Gem::Version
|
66
|
+
version: '3.7'
|
67
|
+
- !ruby/object:Gem::Dependency
|
68
|
+
name: rubocop
|
69
|
+
requirement: !ruby/object:Gem::Requirement
|
70
|
+
requirements:
|
71
|
+
- - "~>"
|
72
|
+
- !ruby/object:Gem::Version
|
73
|
+
version: 0.57.2
|
74
|
+
type: :development
|
75
|
+
prerelease: false
|
76
|
+
version_requirements: !ruby/object:Gem::Requirement
|
77
|
+
requirements:
|
78
|
+
- - "~>"
|
79
|
+
- !ruby/object:Gem::Version
|
80
|
+
version: 0.57.2
|
81
|
+
- !ruby/object:Gem::Dependency
|
82
|
+
name: rubocop-rspec
|
83
|
+
requirement: !ruby/object:Gem::Requirement
|
84
|
+
requirements:
|
85
|
+
- - "~>"
|
86
|
+
- !ruby/object:Gem::Version
|
87
|
+
version: '1.27'
|
88
|
+
type: :development
|
89
|
+
prerelease: false
|
90
|
+
version_requirements: !ruby/object:Gem::Requirement
|
91
|
+
requirements:
|
92
|
+
- - "~>"
|
93
|
+
- !ruby/object:Gem::Version
|
94
|
+
version: '1.27'
|
95
|
+
- !ruby/object:Gem::Dependency
|
96
|
+
name: simplecov
|
97
|
+
requirement: !ruby/object:Gem::Requirement
|
98
|
+
requirements:
|
99
|
+
- - "~>"
|
100
|
+
- !ruby/object:Gem::Version
|
101
|
+
version: 0.16.1
|
102
|
+
type: :development
|
103
|
+
prerelease: false
|
104
|
+
version_requirements: !ruby/object:Gem::Requirement
|
105
|
+
requirements:
|
106
|
+
- - "~>"
|
107
|
+
- !ruby/object:Gem::Version
|
108
|
+
version: 0.16.1
|
109
|
+
- !ruby/object:Gem::Dependency
|
110
|
+
name: simplecov-console
|
111
|
+
requirement: !ruby/object:Gem::Requirement
|
112
|
+
requirements:
|
113
|
+
- - "~>"
|
114
|
+
- !ruby/object:Gem::Version
|
115
|
+
version: 0.4.2
|
116
|
+
type: :development
|
117
|
+
prerelease: false
|
118
|
+
version_requirements: !ruby/object:Gem::Requirement
|
119
|
+
requirements:
|
120
|
+
- - "~>"
|
121
|
+
- !ruby/object:Gem::Version
|
122
|
+
version: 0.4.2
|
123
|
+
- !ruby/object:Gem::Dependency
|
124
|
+
name: webmock
|
125
|
+
requirement: !ruby/object:Gem::Requirement
|
126
|
+
requirements:
|
127
|
+
- - "~>"
|
128
|
+
- !ruby/object:Gem::Version
|
129
|
+
version: '3.4'
|
130
|
+
- - ">="
|
131
|
+
- !ruby/object:Gem::Version
|
132
|
+
version: 3.4.2
|
133
|
+
type: :development
|
134
|
+
prerelease: false
|
135
|
+
version_requirements: !ruby/object:Gem::Requirement
|
136
|
+
requirements:
|
137
|
+
- - "~>"
|
138
|
+
- !ruby/object:Gem::Version
|
139
|
+
version: '3.4'
|
140
|
+
- - ">="
|
141
|
+
- !ruby/object:Gem::Version
|
142
|
+
version: 3.4.2
|
143
|
+
- !ruby/object:Gem::Dependency
|
144
|
+
name: addressable
|
145
|
+
requirement: !ruby/object:Gem::Requirement
|
146
|
+
requirements:
|
147
|
+
- - "~>"
|
148
|
+
- !ruby/object:Gem::Version
|
149
|
+
version: '2.5'
|
150
|
+
- - ">="
|
151
|
+
- !ruby/object:Gem::Version
|
152
|
+
version: 2.5.2
|
153
|
+
type: :runtime
|
154
|
+
prerelease: false
|
155
|
+
version_requirements: !ruby/object:Gem::Requirement
|
156
|
+
requirements:
|
157
|
+
- - "~>"
|
158
|
+
- !ruby/object:Gem::Version
|
159
|
+
version: '2.5'
|
160
|
+
- - ">="
|
161
|
+
- !ruby/object:Gem::Version
|
162
|
+
version: 2.5.2
|
163
|
+
- !ruby/object:Gem::Dependency
|
164
|
+
name: http
|
165
|
+
requirement: !ruby/object:Gem::Requirement
|
166
|
+
requirements:
|
167
|
+
- - "~>"
|
168
|
+
- !ruby/object:Gem::Version
|
169
|
+
version: '3.3'
|
170
|
+
type: :runtime
|
171
|
+
prerelease: false
|
172
|
+
version_requirements: !ruby/object:Gem::Requirement
|
173
|
+
requirements:
|
174
|
+
- - "~>"
|
175
|
+
- !ruby/object:Gem::Version
|
176
|
+
version: '3.3'
|
177
|
+
- !ruby/object:Gem::Dependency
|
178
|
+
name: nokogiri
|
179
|
+
requirement: !ruby/object:Gem::Requirement
|
180
|
+
requirements:
|
181
|
+
- - "~>"
|
182
|
+
- !ruby/object:Gem::Version
|
183
|
+
version: '1.8'
|
184
|
+
- - ">="
|
185
|
+
- !ruby/object:Gem::Version
|
186
|
+
version: 1.8.3
|
187
|
+
type: :runtime
|
188
|
+
prerelease: false
|
189
|
+
version_requirements: !ruby/object:Gem::Requirement
|
190
|
+
requirements:
|
191
|
+
- - "~>"
|
192
|
+
- !ruby/object:Gem::Version
|
193
|
+
version: '1.8'
|
194
|
+
- - ">="
|
195
|
+
- !ruby/object:Gem::Version
|
196
|
+
version: 1.8.3
|
197
|
+
description: Discover a URL’s Micropub endpoint.
|
198
|
+
email:
|
199
|
+
- jason@sixtwothree.org
|
200
|
+
executables: []
|
201
|
+
extensions: []
|
202
|
+
extra_rdoc_files: []
|
203
|
+
files:
|
204
|
+
- ".editorconfig"
|
205
|
+
- ".gitignore"
|
206
|
+
- ".rspec"
|
207
|
+
- ".rubocop"
|
208
|
+
- ".rubocop.yml"
|
209
|
+
- ".ruby-version"
|
210
|
+
- ".simplecov"
|
211
|
+
- ".travis.yml"
|
212
|
+
- CONTRIBUTING.md
|
213
|
+
- Gemfile
|
214
|
+
- LICENSE
|
215
|
+
- README.md
|
216
|
+
- Rakefile
|
217
|
+
- lib/micropub/endpoint.rb
|
218
|
+
- lib/micropub/endpoint/discover.rb
|
219
|
+
- lib/micropub/endpoint/error.rb
|
220
|
+
- lib/micropub/endpoint/version.rb
|
221
|
+
- micropub-endpoint.gemspec
|
222
|
+
homepage: https://github.com/jgarber623/micropub-endpoint-ruby
|
223
|
+
licenses:
|
224
|
+
- MIT
|
225
|
+
metadata: {}
|
226
|
+
post_install_message:
|
227
|
+
rdoc_options: []
|
228
|
+
require_paths:
|
229
|
+
- lib
|
230
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
231
|
+
requirements:
|
232
|
+
- - ">="
|
233
|
+
- !ruby/object:Gem::Version
|
234
|
+
version: '2.4'
|
235
|
+
- - "<"
|
236
|
+
- !ruby/object:Gem::Version
|
237
|
+
version: '2.6'
|
238
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
239
|
+
requirements:
|
240
|
+
- - ">="
|
241
|
+
- !ruby/object:Gem::Version
|
242
|
+
version: '0'
|
243
|
+
requirements: []
|
244
|
+
rubyforge_project:
|
245
|
+
rubygems_version: 2.6.14.1
|
246
|
+
signing_key:
|
247
|
+
specification_version: 4
|
248
|
+
summary: Discover a URL’s Micropub endpoint.
|
249
|
+
test_files: []
|