jekyll-write-and-commit-changes 0.1.2 → 0.2.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: 4d11364244720840dee84dc75c1b3e0ff4df4d6dda09bbda344bc4b8249f1d05
4
- data.tar.gz: 0d398ab0f33984e5f20c89114f35ed8ed4eb3b98e26ceb4773430093dfb71509
3
+ metadata.gz: 78d20acdf607a3be5c5ba44f765a89e5913b9f9fca9b687a21740c0cb9b6aedc
4
+ data.tar.gz: ba74dbbb3b777b4357902d58a50c296c17d4954d0496ab705e5a2774b2c9140d
5
5
  SHA512:
6
- metadata.gz: 136a964da322f74fb36f42072accf4f1e2fa4b6a219819432dc7ffbb19e6c1d19dcc2990f26d0de3e8f817258d819e1c7fff2f886837e7aff6999d00ec3652c3
7
- data.tar.gz: 29c48b360a49e1188ff2524ac10ba1aa67b7e3e4ace6b4f07c5f40a05c8468f4f10c96ba44e0545b0163f1d1ae88dd256737060d347b50162206ac993517a331
6
+ metadata.gz: 81a7a75d6bf724b19dc5ef5fc63cc460ba370c09fa407ffb4fd63be46e43bec31674baf2acba79c39430b7a74084f1d0efc02ee530ba62350b36f9fddd5f98ff
7
+ data.tar.gz: 3f689cd694d958c5ab3a4c941137031b9b40b28344fc7b1065668437260f786f331ae6eda08d9f6004af893a049ee6201ff9e608093745dd1b35d290017f1c52
data/README.md CHANGED
@@ -29,6 +29,9 @@ plugins:
29
29
  - jekyll-write-and-commit-changes
30
30
  ```
31
31
 
32
+ If you don't want a post to be saved, add `save: false` to its metadata.
33
+ It's useful on other plugins.
34
+
32
35
  ### Example
33
36
 
34
37
  An ad-hoc plugin at `_plugins/change_something.rb`
@@ -8,6 +8,8 @@ module Jekyll
8
8
  base.class_eval do
9
9
  # Writes changes to the file and adds it to git staged changes
10
10
  def save
11
+ return unless data.fetch('save', true)
12
+
11
13
  Jekyll.logger.debug "Writing #{relative_path}"
12
14
 
13
15
  file = File.open(path, File::RDWR | File::CREAT, 0o640) do |f|
@@ -38,13 +40,15 @@ module Jekyll
38
40
  case value
39
41
  when Jekyll::Document
40
42
  value.data['uuid']
43
+ when Jekyll::Convertible
44
+ value.data['uuid']
41
45
  when Array
42
46
  value.map do |v|
43
- v.is_a?(Jekyll::Document) ? v.data['uuid'] : v
47
+ v.respond_to?(:data) ? v.data['uuid'] : v
44
48
  end
45
49
  when Hash
46
50
  value.transform_values do |v|
47
- v.is_a?(Jekyll::Document) ? v.data['uuid'] : v
51
+ v.respond_to?(:data) ? v.data['uuid'] : v
48
52
  end
49
53
  else
50
54
  value
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jekyll-write-and-commit-changes
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - f
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-12-09 00:00:00.000000000 Z
11
+ date: 2021-07-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: jekyll