jekyll-webmention_io 3.3.2 → 3.3.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 33b8089dd07065db73ad59fbf4da05f5e6a6a65d
4
- data.tar.gz: 4dcd8591cc9ff96aff981440d1042538c595e7f1
3
+ metadata.gz: 88a46606dd33c75831806c6e23393e895c789b41
4
+ data.tar.gz: b5898399c88d1dcfa2f935d3a2dfe4add6ed8de2
5
5
  SHA512:
6
- metadata.gz: d04a8b7e3f54e1d13235f5d68d3a781f8c2185e1662fdabc4a202f54750683ef215f00dd0b02bf3b0a8af2cb99d019128cf49ab78f3da54dddcecc6f4d7ec411
7
- data.tar.gz: 7692c870f2e8cc5068a132de7176906c3280bdfe96ff6d6db6dbeb351bb03a98f2a4ee3a075cfc245e24cec528818ca061a96859b11ec6ace2235858838e655c
6
+ metadata.gz: a1b0e90e457913a9fe52ebdc17f436b2235478d5e5ee4854bb949596320b7f7a1ed9290aac305c40c6265ea0672584bdb8e62bafacb3591cf591782f2ec1b295
7
+ data.tar.gz: 3aad19c81497b2215127d0a9ef9fd78563864dedf036e6b4eef43016b0bd0a7d11139e92a877c389983e195587d5fd5d2093e9883e5a5943895c62422d4fa49e
@@ -3,65 +3,70 @@
3
3
  require "json"
4
4
 
5
5
  module Jekyll
6
- module Commands
7
- class WebmentionCommand < Command
8
- def self.init_with_program(prog)
9
- prog.command(:webmention) do |c|
10
- c.syntax "webmention"
11
- c.description "Sends queued webmentions"
6
+ module WebmentionIO
7
+ module Commands
8
+ class WebmentionCommand < Command
9
+ def self.init_with_program(prog)
10
+ prog.command(:webmention) do |c|
11
+ c.syntax "webmention"
12
+ c.description "Sends queued webmentions"
12
13
 
13
- c.action { |args, options| process args, options }
14
+ c.action { |args, options| process args, options }
15
+ end
14
16
  end
15
- end
16
17
 
17
- def self.process(_args = [], options = {})
18
- options = configuration_from_options(options)
19
- WebmentionIO.bootstrap(Jekyll::Site.new(options))
18
+ def self.process(_args = [], options = {})
19
+ options = configuration_from_options(options)
20
+ WebmentionIO.bootstrap(Jekyll::Site.new(options))
20
21
 
21
- if File.exist? WebmentionIO.cache_file("sent.yml")
22
- WebmentionIO.log "error", "Your outgoing webmentions queue needs to be upgraded. Please re-build your project."
23
- end
24
- count = 0
25
- cached_outgoing = WebmentionIO.get_cache_file_path "outgoing"
26
- if File.exist?(cached_outgoing)
27
- outgoing = WebmentionIO.load_yaml(cached_outgoing)
28
- outgoing.each do |source, targets|
29
- targets.each do |target, response|
30
- # skip ones we’ve handled
31
- next unless response == false
22
+ if File.exist? WebmentionIO.cache_file("sent.yml")
23
+ WebmentionIO.log "error", "Your outgoing webmentions queue needs to be upgraded. Please re-build your project."
24
+ end
32
25
 
33
- # convert protocol-less links
34
- if target.index("//").zero?
35
- target = "http:#{target}"
36
- end
26
+ WebmentionIO.log "msg", "Getting ready to send webmentions (this may take a while)."
27
+
28
+ count = 0
29
+ cached_outgoing = WebmentionIO.get_cache_file_path "outgoing"
30
+ if File.exist?(cached_outgoing)
31
+ outgoing = WebmentionIO.load_yaml(cached_outgoing)
32
+ outgoing.each do |source, targets|
33
+ targets.each do |target, response|
34
+ # skip ones we’ve handled
35
+ next unless response == false
37
36
 
38
- # skip bad URLs
39
- next unless WebmentionIO.uri_ok?(target)
37
+ # convert protocol-less links
38
+ if target.index("//").zero?
39
+ target = "http:#{target}"
40
+ end
40
41
 
41
- # get the endpoint
42
- endpoint = WebmentionIO.get_webmention_endpoint(target)
43
- next unless endpoint
42
+ # skip bad URLs
43
+ next unless WebmentionIO.uri_ok?(target)
44
44
 
45
- # get the response
46
- response = WebmentionIO.webmention(source, target, endpoint)
47
- next unless response
45
+ # get the endpoint
46
+ endpoint = WebmentionIO.get_webmention_endpoint(target)
47
+ next unless endpoint
48
48
 
49
- # capture JSON responses in case site wants to do anything with them
50
- begin
51
- response = JSON.parse response
52
- rescue JSON::ParserError
53
- response = ""
49
+ # get the response
50
+ response = WebmentionIO.webmention(source, target, endpoint)
51
+ next unless response
52
+
53
+ # capture JSON responses in case site wants to do anything with them
54
+ begin
55
+ response = JSON.parse response
56
+ rescue JSON::ParserError
57
+ response = ""
58
+ end
59
+ outgoing[source][target] = response
60
+ count += 1
54
61
  end
55
- outgoing[source][target] = response
56
- count += 1
57
62
  end
58
- end
59
- if count.positive?
60
- WebmentionIO.dump_yaml(cached_outgoing, outgoing)
61
- end
62
- WebmentionIO.log "msg", "#{count} webmentions sent."
63
- end # file exists (outgoing)
64
- end # def process
65
- end # WebmentionCommand
66
- end # Commands
63
+ if count.positive?
64
+ WebmentionIO.dump_yaml(cached_outgoing, outgoing)
65
+ end
66
+ WebmentionIO.log "msg", "#{count} webmentions sent."
67
+ end # file exists (outgoing)
68
+ end # def process
69
+ end # WebmentionCommand
70
+ end # Commands
71
+ end # WebmentionIO
67
72
  end # Jekyll
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Jekyll
4
4
  module WebmentionIO
5
- VERSION = "3.3.2"
5
+ VERSION = "3.3.3"
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jekyll-webmention_io
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.3.2
4
+ version: 3.3.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Aaron Gustafson
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-10-29 00:00:00.000000000 Z
11
+ date: 2018-12-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: jekyll