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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 2d9c1cbf4a393ffc471f25e509d78e1ac3a681f3
4
- data.tar.gz: eed3f8f170893e1f48ee441e495356d838b3f845
3
+ metadata.gz: ed2906a3b3c966f623b2ee0af8c6fa8c8c0acbf1
4
+ data.tar.gz: 77ba587dc6f6bd3fc2762832c6074adabe057b62
5
5
  SHA512:
6
- metadata.gz: 9c7badcc45eba408df2b4e04576837e25c2d9bcda364026acb2350b9114e6709d9aac523a0c5d5302964205a5f80b14483e82c3632dd91b2387b51ecd2521e9c
7
- data.tar.gz: a5c921004ed08b4f81802c8ddc9f1e494f048386507971d2f27c4f3ab02e710c7c6687ac1a40dfda3236968c588046865d6fbd0319bae49fa55b5a816a08de16
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 in the `formats` hash, set it to `null`.
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: null
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 null means that a post will be paid from the beginning.
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: null
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
- dest = File.join(bucket_dest_dir(bucket_name), 'paspagon.ini')
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! { |_, v| !v }
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! format_info
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
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jekyll-paspagon
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Krzysztof Jurewicz