jekyll-incremental 1.0.3 → 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: 9793102931494fe36f0f4a5a56e27eeca940a0962f3d34fc5b56309aa7db1280
4
- data.tar.gz: d8e6fbc542095b421193def52cef069864e680cf4449575d51ef9424d2dbfcda
3
+ metadata.gz: 6bbe1dbe0d68eb5a232cf4bde2b13eee14b83308ca80a474949d1c6e6c83263b
4
+ data.tar.gz: 0f320fd38c6cd525ee1b7e307c9873911bd559712dcfe4db24fe309c4034b883
5
5
  SHA512:
6
- metadata.gz: 0f7760d024bd9e7f706264e0b0d1ed5a90294ef59a3df9a30e6009a2d251194c79af3b6baa97b243df59832b59120def5b3a08ab17460ab3bbb4450a2c8a87d5
7
- data.tar.gz: d658c37e31764d4d16a4515cda1fe2956081f147c58077b69675ace196d3ddf48f107dd06ae98e1e9ef7ba09bfa11d77aebeb0022df4b16e74631c7968a72dbb
6
+ metadata.gz: f7bb4b2c682ed2b3d8fc6c5db1a122403072c755aa1b70656f459538a7cf4c28c853340d26d62dd01541fa785b6bdc7cdf73fa73e04e31bc6fa09feb7718e916
7
+ data.tar.gz: 21b8db849c736443e6f452fdec9ed8393dc0c01491e82937eb17ecc427add449aeffe4b49483360a0b501b5d0eb0cf9fa7bb1ae55a7296eb26f631b78ddcb8ee
data/LICENSE CHANGED
@@ -186,7 +186,7 @@
186
186
  same "printed page" as the copyright notice for easier
187
187
  identification within third-party archives.
188
188
 
189
- Copyright [yyyy] [name of copyright owner]
189
+ Copyright 2018 Anomaly Software Pty Ltd
190
190
 
191
191
  Licensed under the Apache License, Version 2.0 (the "License");
192
192
  you may not use this file except in compliance with the License.
data/README.md CHANGED
@@ -7,3 +7,20 @@
7
7
  # Jekyll Incremental
8
8
 
9
9
  Jekyll Incremental is a more simple, and to the point version of incremental generation for Jekyll. It also tries to solve the shortfalls of Jekyll's own incremental regeneration by treating all things equal, dynamic, doc, post, or collection. As long as we can get the path, we will track it and make sure it gets generated. It has an almost backwards compatible API (as far as adding dependencies, and dependent's) and merges several other API's in favor of a single, simple interface to track everything.
10
+
11
+ ## Installation
12
+
13
+ ```ruby
14
+ gem "jekyll-reload", {
15
+ group: "jekyll-plugins"
16
+ }
17
+ ```
18
+
19
+ ## Usage
20
+
21
+ By default we replace Jekyll's internal regenerator with our own, so you would use ours the same way you would use theirs. This allows us to stay out of your way and for you not to have to adjust any workflows.
22
+
23
+ ```ruby
24
+ bundle exec jekyll b \
25
+ --incremental
26
+ ```
data/Rakefile CHANGED
@@ -2,31 +2,38 @@
2
2
  # Copyright: 2012 - 2017 - MIT License
3
3
  # Encoding: utf-8
4
4
 
5
+ # --
6
+ # 🔖
7
+ # RSpec, MiniTest, Whatever.
5
8
  # --
6
9
  task :spec do
7
- exec "script/test"
10
+ sh "script/test"
8
11
  end
9
-
12
+ # --
13
+ # 🔖
14
+ # RSpec, MiniTest, Whatever.
10
15
  # --
11
16
  task :test do
12
- exec "script/test"
17
+ sh "script/test"
13
18
  end
14
-
19
+ # --
20
+ # 🔖
21
+ # @see .rubocop.yml
22
+ # Rubocop.
15
23
  # --
16
24
  task :rubocop do
17
- exec "script/lint"
25
+ sh "script/lint"
18
26
  end
19
-
27
+ # --
28
+ # 🔖
29
+ # @see .rubocop.yml
30
+ # Rubocop.
20
31
  # --
21
32
  task :lint do
22
- exec "script/lint"
33
+ sh "script/lint"
23
34
  end
24
35
 
25
36
  # --
26
- # If you wish to have extra rake tasks
27
- # You can load them from within the script
28
- # directory by creating task.rake.
29
- # --
30
- Dir.glob("script/rake/*.rake").each do |v|
37
+ Dir.glob("script/rake.d/*.rake").each do |v|
31
38
  load v
32
39
  end
@@ -6,6 +6,12 @@
6
6
  require "jekyll/cache"
7
7
 
8
8
  module Jekyll
9
+ # --
10
+ # @note we replace theirs in-place.
11
+ # @example bundle exec jekyll b --incremental
12
+ # A replacement of Jekyll's Regenerator. That does a
13
+ # few things a bit differently, most things.
14
+ # --
9
15
  module Incremental
10
16
  FORCE_KEYS = %w(regenerate force force_regenerate regen).freeze
11
17
  CACHE_KEY = "jekyll:regenerator:metadata"
@@ -32,10 +38,18 @@ module Jekyll
32
38
  # whether the file has been modified.
33
39
  # --
34
40
  def regenerate?(doc)
35
- return false unless doc.write?
36
- return true if doc.respond_to?(:asset_file?) && doc.asset_file?
37
- return true if forced_by_data?(doc)
38
- modified?(doc)
41
+ out = false unless doc.write?
42
+ out = true if doc.respond_to?(:asset_file?) && doc.asset_file?
43
+ out = true if forced_by_data?(doc)
44
+ out = modified?(doc)
45
+
46
+ # --
47
+ # Make sure they know.
48
+ # --
49
+ Jekyll.logger.debug "Incremental" do
50
+ "#{out} for #{doc.path}"
51
+ end
52
+ out
39
53
  end
40
54
 
41
55
  # --
@@ -57,14 +71,18 @@ module Jekyll
57
71
  # rubocop:disable Metrics/PerceivedComplexity
58
72
  # rubocop:disable Metrics/CyclomaticComplexity
59
73
  # rubocop:disable Metrics/LineLength
74
+ # rubocop:disable Metrics/AbcSize
60
75
  # --
61
76
  def modified?(doc)
62
77
  return true if metadata[doc.path]&.[](:forced)
78
+ return true unless File.exist?(site.in_dest_dir(doc.path))
63
79
  modified, hash = file_mtime_of(doc.path), metadata[doc.path]
64
80
  return modified > hash[:last_modified] if hash && !hash[:dynamic] && hash[:seen_before]
65
81
  return hash[:seen_before] = true if hash && !hash[:seen_before]
66
82
  return dependencies_modified?(hash) if hash
67
83
  add(doc.path).update(seen_before: true)
84
+
85
+ true
68
86
  end
69
87
 
70
88
  # --
@@ -96,7 +114,7 @@ module Jekyll
96
114
  return metadata[path] if metadata.key?(path)
97
115
  metadata[path] = {
98
116
  seen_before: false,
99
- dynamic: !File.exist?(path),
117
+ dynamic: !File.exist?(site.in_source_dir(path)),
100
118
  last_modified: file_mtime_of(path),
101
119
  dependencies: Set.new,
102
120
  forced: forced,
@@ -167,6 +185,11 @@ end
167
185
 
168
186
  # --
169
187
  module Jekyll
188
+ # --
189
+ # Patches Jekyll's own regenerator, and replaces it with
190
+ # our regenerator, which should in theory be more efficient
191
+ # than Jekyll's since it does less work.
192
+ # --
170
193
  class Regenerator
171
194
  prepend Jekyll::Incremental
172
195
  end
@@ -4,6 +4,6 @@
4
4
 
5
5
  module Jekyll
6
6
  module Incremental
7
- VERSION = "1.0.3"
7
+ VERSION = "1.1.0"
8
8
  end
9
9
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jekyll-incremental
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.3
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jordon Bedwell
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-12-22 00:00:00.000000000 Z
11
+ date: 2017-12-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: jekyll