jekyll-paspagon 1.0.0 → 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +4 -4
- data/lib/jekyll-paspagon/config.rb +4 -1
- data/lib/jekyll-paspagon/hooks.rb +2 -2
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ed2906a3b3c966f623b2ee0af8c6fa8c8c0acbf1
|
4
|
+
data.tar.gz: 77ba587dc6f6bd3fc2762832c6074adabe057b62
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a930f7f04a920f492f04f404ea0e2ab16f81ac1811a6f79879de60de4ad26269b6a2880d38b82d2d2b410c426b486801ebfa5319fbf53e1935cc4a73ad109814
|
7
|
+
data.tar.gz: 6295693d3e6ffd335cef73d5a002fa1c44f25d9696c7210119519f2e0e474ffbb9bbe08ae6412e93f829e1dd0066365103df6cbd188f6a9f5649f331ed465944
|
data/README.md
CHANGED
@@ -74,7 +74,7 @@ defaults:
|
|
74
74
|
bucket: your-bucket-name
|
75
75
|
```
|
76
76
|
|
77
|
-
Caveat: “default” values in Jekyll are actually not default values that can be simply overridden. Instead they get “deep merged” into post variables. If you want to unset a specific nested value
|
77
|
+
Caveat: “default” values in Jekyll are actually not default values that can be simply overridden. Instead they get “deep merged” into post variables. If you want to unset a specific nested value inside the `formats` hash, set it to `false`.
|
78
78
|
|
79
79
|
### Change post template
|
80
80
|
|
@@ -130,7 +130,7 @@ layout: post
|
|
130
130
|
title: Foo
|
131
131
|
payment:
|
132
132
|
price:
|
133
|
-
USD:
|
133
|
+
USD: false
|
134
134
|
XAU: 3
|
135
135
|
address:
|
136
136
|
bitcoin: 1Foo
|
@@ -139,9 +139,9 @@ formats:
|
|
139
139
|
epub:
|
140
140
|
paid_after: 15
|
141
141
|
pdf:
|
142
|
-
# Setting this to
|
142
|
+
# Setting this to false means that a post will be paid from the beginning.
|
143
143
|
# If you want a format to be free instead, set this to 0.
|
144
|
-
paid_before:
|
144
|
+
paid_before: false
|
145
145
|
azw3: {}
|
146
146
|
```
|
147
147
|
|
@@ -1,4 +1,5 @@
|
|
1
1
|
# -*- coding: utf-8 -*-
|
2
|
+
require 'fileutils'
|
2
3
|
|
3
4
|
class PaspagonConfig
|
4
5
|
attr_reader :buckets, :formats, :full_config
|
@@ -40,7 +41,9 @@ class PaspagonConfig
|
|
40
41
|
@buckets.each do |bucket_name, bucket_hash|
|
41
42
|
bucket_config = bucket_hash.update('accept-terms' => @full_config['accept-terms'])
|
42
43
|
ini = hash_to_ini bucket_config
|
43
|
-
|
44
|
+
bucket_dest_dir = bucket_dest_dir(bucket_name)
|
45
|
+
FileUtils.mkdir_p(bucket_dest_dir)
|
46
|
+
dest = File.join(bucket_dest_dir, 'paspagon.ini')
|
44
47
|
ini_hash = Digest::SHA256.digest(ini)
|
45
48
|
next if File.exist?(dest) && Digest::SHA256.file(dest).digest == ini_hash
|
46
49
|
File.open(dest, 'wb') do |f|
|
@@ -11,7 +11,7 @@ Jekyll::Hooks.register :site, :pre_render do |site|
|
|
11
11
|
post.data['formats'] ||= {}
|
12
12
|
# Jekyll does not do a simple merge of default values with post values, so
|
13
13
|
# we cannot unset default formats in an ordinary way. Instead, we reject null values.
|
14
|
-
post.data['formats'].reject
|
14
|
+
post.data['formats'] = post.data['formats'].reject { |_, v| !v }
|
15
15
|
prices = post.data['price'] || {}
|
16
16
|
addresses = post.data['address'] || {}
|
17
17
|
link_expiration_time = post.data['link-expiration-time'] || nil
|
@@ -50,7 +50,7 @@ Jekyll::Hooks.register :site, :pre_render do |site|
|
|
50
50
|
'prices' => prices,
|
51
51
|
'name' => format.upcase,
|
52
52
|
'addresses' => addresses}
|
53
|
-
post.data['formats'][format].merge
|
53
|
+
post.data['formats'][format] = post.data['formats'][format].merge(format_info)
|
54
54
|
post.data['format_array'] = post.data['formats'].map { |_, v| v }
|
55
55
|
end
|
56
56
|
end
|