jekyll-wkd 1.0.0 → 1.1.0

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
  SHA256:
3
- metadata.gz: a06312e387e2b7da2c7bc5071f2b614a435436c47b883da84430b1d1bbbaeb3f
4
- data.tar.gz: 60196f579ce1740cab8ae47d787e18f7a0c6badeaf1c679b05926feda5f76446
3
+ metadata.gz: 4169163b6bfaa8e85e0d818d90e2aedf4726e9da547f5ded4bb073b2d0bdf1ac
4
+ data.tar.gz: ddcc2b92af6cd6d656cfad97dcc25725e922ab6fdccc0bc3c03f6546f77c059e
5
5
  SHA512:
6
- metadata.gz: 9879f889d072ba3d0291105c901aa50b18fca5fa9fb2464af07f8a552bc6d393f818e62f1b6d1eafc5572f5c83656b3da1a579a9851ed8d4b2333ea97fafc913
7
- data.tar.gz: bac3744510b72721c0c89e34c811af06287151185aaf60f02b92ed9a018e72b81d3227faf7f57e4b342830794a0a0e4d77c4b6b4fae48b864c990f8a68feba54
6
+ metadata.gz: 85cbd02d9b14dec3dfa8dffd0c38cec46a6d2f753546af11c60b309c7090ec9f61d27fcef2d3e728653a9c645e9a8ac90e8923954356c20d62e03d62f485d204
7
+ data.tar.gz: 3b6c1490e11823a7eb0bd43c39abed83f06ed9e015872cabf08c1c049fe6632a5a898633a89699794ef0c093c3f8509ad7b52f4b960247ad57589457baffad6d
@@ -12,8 +12,9 @@ module JekyllWKD
12
12
 
13
13
  CONF_KEY = "wkd"
14
14
  CONF_DEFAULT = {
15
- "path" => "keys",
16
- "exts" => %w[.asc .pub]
15
+ "exts" => %w[.asc .pub],
16
+ "mode" => "advanced",
17
+ "path" => "keys"
17
18
  }
18
19
 
19
20
  def generate site
@@ -22,7 +23,7 @@ module JekyllWKD
22
23
  pgp_home = Dir.mktmpdir "jekyll-wkd-"
23
24
  GPGME::Engine.home_dir = pgp_home
24
25
  Jekyll::Hooks.register :site, :post_write do
25
- FileUtils.remove_dir pgp_home
26
+ FileUtils.remove_dir pgp_home if File.directory? pgp_home
26
27
  end
27
28
 
28
29
  domains = Set.new
@@ -35,7 +36,8 @@ module JekyllWKD
35
36
  @site.source,
36
37
  File.dirname(file.relative_path),
37
38
  File.basename(file.relative_path),
38
- key.fingerprint
39
+ key.fingerprint,
40
+ advanced?
39
41
  )
40
42
  domains << kf.domain
41
43
  @site.static_files << kf
@@ -43,6 +45,10 @@ module JekyllWKD
43
45
  end
44
46
  end
45
47
 
48
+ if !advanced? && domains.size > 1
49
+ Jekyll.logger.warn "Cannot export multiple domains in direct mode"
50
+ end
51
+
46
52
  domains.each do |domain|
47
53
  @site.pages << make_policy(domain)
48
54
  end
@@ -54,6 +60,10 @@ module JekyllWKD
54
60
  @config ||= CONF_DEFAULT.merge @site.config.fetch(CONF_KEY, {})
55
61
  end
56
62
 
63
+ def advanced?
64
+ config["mode"] == "advanced"
65
+ end
66
+
57
67
  def in_path? file
58
68
  File.exist? @site.in_source_dir(config["path"], file.name)
59
69
  end
@@ -65,7 +75,7 @@ module JekyllWKD
65
75
  end
66
76
 
67
77
  def make_policy domain
68
- path = File.join(PGP_PATH, domain, "policy")
78
+ path = File.join(PGP_PATH, advanced? ? domain : "", "policy")
69
79
  PolicyFile.new(@site, __dir__, "", path).tap do |page|
70
80
  page.content = "# Policy flags for domain `#{domain}`\n"
71
81
  page.data.merge!(
@@ -5,15 +5,18 @@ require "digest"
5
5
 
6
6
  module JekyllWKD
7
7
  class KeyFile < ::Jekyll::StaticFile
8
- def initialize site, base, dir, name, fpr
9
- @fpr = fpr
8
+ attr_reader :advanced, :fingerprint
9
+
10
+ def initialize site, base, dir, name, fpr, adv = true
11
+ @fingerprint = fpr
12
+ @advanced = adv
10
13
  super site, base, dir, name
11
14
  end
12
15
 
13
16
  def destination dest
14
17
  @destination ||= {}
15
18
  @destination[dest] ||= @site.in_dest_dir(
16
- dest, PGP_PATH, domain, "hu", hash
19
+ dest, PGP_PATH, advanced ? domain : "", "hu", hash
17
20
  )
18
21
  end
19
22
 
@@ -45,7 +48,7 @@ module JekyllWKD
45
48
  private
46
49
 
47
50
  def pgpkey
48
- @pgpkey ||= GPGME::Key.get(@fpr)
51
+ @pgpkey ||= GPGME::Key.get(fingerprint)
49
52
  end
50
53
  end
51
54
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module JekyllWKD
4
- VERSION = "1.0.0"
4
+ VERSION = "1.1.0"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jekyll-wkd
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Fern Zapata
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-06-08 00:00:00.000000000 Z
11
+ date: 2023-06-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: jekyll