nanoc 4.6.0 → 4.6.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +7 -7
- data/NEWS.md +13 -3
- data/README.md +1 -1
- data/lib/nanoc/base/entities/context.rb +14 -2
- data/lib/nanoc/base/services/compiler/phases/cache.rb +32 -0
- data/lib/nanoc/base/services/compiler/phases/mark_done.rb +16 -0
- data/lib/nanoc/base/services/compiler/phases/recalculate.rb +38 -0
- data/lib/nanoc/base/services/compiler/phases/resume.rb +46 -0
- data/lib/nanoc/base/services/compiler/phases/write.rb +19 -0
- data/lib/nanoc/base/services/compiler/phases.rb +8 -0
- data/lib/nanoc/base/services/compiler/stages/cleanup.rb +37 -0
- data/lib/nanoc/base/services/compiler/stages/compile_reps.rb +65 -0
- data/lib/nanoc/base/services/compiler/stages/determine_outdatedness.rb +22 -0
- data/lib/nanoc/base/services/compiler/stages/preprocess.rb +19 -0
- data/lib/nanoc/base/services/compiler/stages/prune.rb +24 -0
- data/lib/nanoc/base/services/compiler/stages.rb +8 -0
- data/lib/nanoc/base/services/compiler.rb +1 -308
- data/lib/nanoc/base/services/item_rep_selector.rb +38 -6
- data/lib/nanoc/base/services.rb +3 -0
- data/lib/nanoc/cli/commands/compile.rb +32 -29
- data/lib/nanoc/data_sources/filesystem.rb +12 -4
- data/lib/nanoc/version.rb +1 -1
- data/spec/nanoc/base/compiler_spec.rb +0 -77
- data/spec/nanoc/base/services/compiler/stages/cleanup_spec.rb +65 -1
- data/spec/nanoc/base/services/compiler/stages/compile_reps_spec.rb +141 -0
- data/spec/nanoc/base/services/item_rep_selector_spec.rb +16 -1
- data/spec/nanoc/cli/commands/compile/timing_recorder_spec.rb +3 -3
- data/spec/nanoc/data_sources/filesystem_spec.rb +23 -11
- metadata +16 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3215906d4c407f3712161bcf4464b5b5358e50c8
|
4
|
+
data.tar.gz: 1e3877875fd5f931ab99fce68ff6c1130acd2936
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 34b4e72944f26ee705b66ab40367528a78733ee623bd580656d385e9a71f0b4d125dd334c356699723390c82e214064fc85a627865e52414737a4141705af294
|
7
|
+
data.tar.gz: f1772e11403f7ffc7b62e1421a63c59c87c2024f448d61ddc4eb7c5c838dd6a576d40580eb4a8fcf502603bdbd54906a33981d28af30e9e761bac3b8dbfdac67
|
data/Gemfile.lock
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
GIT
|
2
2
|
remote: git://github.com/bbatsov/rubocop.git
|
3
|
-
revision:
|
3
|
+
revision: 1c0cf571afc608229c3116fa6f66dd480e395772
|
4
4
|
specs:
|
5
5
|
rubocop (0.47.1)
|
6
6
|
parser (>= 2.3.3.1, < 3.0)
|
@@ -27,7 +27,7 @@ GIT
|
|
27
27
|
PATH
|
28
28
|
remote: .
|
29
29
|
specs:
|
30
|
-
nanoc (4.6.
|
30
|
+
nanoc (4.6.1)
|
31
31
|
cri (~> 2.3)
|
32
32
|
ddplugin (~> 1.0)
|
33
33
|
hamster (~> 3.0)
|
@@ -36,7 +36,7 @@ PATH
|
|
36
36
|
GEM
|
37
37
|
remote: https://rubygems.org/
|
38
38
|
specs:
|
39
|
-
CFPropertyList (2.3.
|
39
|
+
CFPropertyList (2.3.5)
|
40
40
|
RedCloth (4.3.2)
|
41
41
|
addressable (2.5.0)
|
42
42
|
public_suffix (~> 2.0, >= 2.0.2)
|
@@ -219,7 +219,7 @@ GEM
|
|
219
219
|
fuubar (2.2.0)
|
220
220
|
rspec-core (~> 3.0)
|
221
221
|
ruby-progressbar (~> 1.4)
|
222
|
-
guard (2.14.
|
222
|
+
guard (2.14.1)
|
223
223
|
formatador (>= 0.2.4)
|
224
224
|
listen (>= 2.7, < 4.0)
|
225
225
|
lumberjack (~> 1.0)
|
@@ -289,7 +289,7 @@ GEM
|
|
289
289
|
rainpress (1.0)
|
290
290
|
rake (12.0.0)
|
291
291
|
rb-fsevent (0.9.8)
|
292
|
-
rb-inotify (0.9.
|
292
|
+
rb-inotify (0.9.8)
|
293
293
|
ffi (>= 0.5.0)
|
294
294
|
rbvmomi (1.9.4)
|
295
295
|
builder (~> 3.2)
|
@@ -336,7 +336,7 @@ GEM
|
|
336
336
|
term-ansicolor (1.4.0)
|
337
337
|
tins (~> 1.0)
|
338
338
|
thor (0.19.4)
|
339
|
-
tilt (2.0.
|
339
|
+
tilt (2.0.6)
|
340
340
|
timecop (0.8.1)
|
341
341
|
tins (1.13.0)
|
342
342
|
trollop (2.1.2)
|
@@ -425,4 +425,4 @@ DEPENDENCIES
|
|
425
425
|
yuicompressor
|
426
426
|
|
427
427
|
BUNDLED WITH
|
428
|
-
1.14.
|
428
|
+
1.14.3
|
data/NEWS.md
CHANGED
@@ -1,6 +1,16 @@
|
|
1
1
|
# Nanoc news
|
2
2
|
|
3
|
-
## 4.6.
|
3
|
+
## 4.6.1 (2017-01-29)
|
4
|
+
|
5
|
+
Fixes:
|
6
|
+
|
7
|
+
* Fixed table formatting in `compile --verbose` (#1074) [Hugo Peixoto]
|
8
|
+
|
9
|
+
Enhancements:
|
10
|
+
|
11
|
+
* Reduced memory usage (#1075, #1076, #1077, #1078)
|
12
|
+
|
13
|
+
## 4.6 (2017-01-22)
|
4
14
|
|
5
15
|
Features:
|
6
16
|
|
@@ -39,7 +49,7 @@ Fixes:
|
|
39
49
|
|
40
50
|
* Fixed crash when Nokogiri is not installed (#1053)
|
41
51
|
|
42
|
-
## 4.5
|
52
|
+
## 4.5 (2017-01-09)
|
43
53
|
|
44
54
|
Features:
|
45
55
|
|
@@ -113,7 +123,7 @@ Enhancements:
|
|
113
123
|
|
114
124
|
* Made `view` command use index filenames specified in the `index_filenames` site configuration attribute (#998)
|
115
125
|
|
116
|
-
## 4.4
|
126
|
+
## 4.4 (2016-11-19)
|
117
127
|
|
118
128
|
Features:
|
119
129
|
|
data/README.md
CHANGED
@@ -19,4 +19,4 @@ Contributions are greatly appreciated! Consult the [Development guidelines](http
|
|
19
19
|
|
20
20
|
Many thanks to everyone who has contributed to Nanoc in one way or another:
|
21
21
|
|
22
|
-
Ale Muñoz, Alexander Mankuta, Andy Drop, Arnau Siches, Ben Armston, Bil Bas, Brian Candler, Bruno Dufour, Cédric Boutillier, Chris Chapman, Chris Eppstein, Christian Plessl, Colin Barrett, Colin Seymour, Croath Liu, Damien Pollet, Dan Callahan, Daniel Hofstetter, Daniel Mendler, Daniel Wollschlaeger, David Alexander, David Everitt, Denis Defreyne, Dennis Sutch, Devon Luke Buchanan, Dmitry Bilunov, Eric Sunshine, Erik Hollensbe, Fabian Buch, Felix Hanley, Garen Torikian, Go Maeda, Grégory Karékinian, Gregory Pakosz, Guilherme Garnier, Jack Chu, Jake Benilov, Jasper Van der Jeugt, Jeff Forcier, Jim Mendenhall, John Nishinaga, Justin Clift, Justin Hileman, Kevin Lynagh, Lorin Werthen, Louis T., Lucas Vuotto, Mathias Bynens, Matt Keveney, Matthew Frazier, Matthias Beyer, Matthias Reitinger, Matthias Vallentin, Micha Rosenbaum, Michal Cichra, Michal Papis, Mike Pennisi, Nelson Chen, Nicky Peeters, Nikhil Marathe, Oliver Byford, Paul Boone, Peter Aronoff, Raphael von der Grün, Rémi Barraquand, Remko Tronçon, Riley Goodside, Ruben Verborgh, Scott Vokes, Šime Ramov, Simon South, Spencer Whitt, Stanley Rost, Starr Horne, Stefan Bühler, Stuart Montgomery, Takashi Uchibe, Toon Willems, Tuomas Kareinen, Ursula Kallio, Vincent Driessen, Vlatko Kosturjak, whitequark, Xavier Shay, Yannick Ihmels, Zaiste de Grengolada
|
22
|
+
Ale Muñoz, Alexander Mankuta, Andy Drop, Arnau Siches, Ben Armston, Bil Bas, Brian Candler, Bruno Dufour, Cédric Boutillier, Chris Chapman, Chris Eppstein, Christian Plessl, Colin Barrett, Colin Seymour, Croath Liu, Damien Pollet, Dan Callahan, Daniel Hofstetter, Daniel Mendler, Daniel Wollschlaeger, David Alexander, David Everitt, Denis Defreyne, Dennis Sutch, Devon Luke Buchanan, Dmitry Bilunov, Eric Sunshine, Erik Hollensbe, Fabian Buch, Felix Hanley, Garen Torikian, Go Maeda, Grégory Karékinian, Gregory Pakosz, Guilherme Garnier, Hugo Peixoto, Jack Chu, Jake Benilov, Jasper Van der Jeugt, Jeff Forcier, Jim Mendenhall, John Nishinaga, Justin Clift, Justin Hileman, Kevin Lynagh, Lorin Werthen, Louis T., Lucas Vuotto, Mathias Bynens, Matt Keveney, Matthew Frazier, Matthias Beyer, Matthias Reitinger, Matthias Vallentin, Micha Rosenbaum, Michal Cichra, Michal Papis, Mike Pennisi, Nelson Chen, Nicky Peeters, Nikhil Marathe, Oliver Byford, Paul Boone, Peter Aronoff, Raphael von der Grün, Rémi Barraquand, Remko Tronçon, Riley Goodside, Ruben Verborgh, Scott Vokes, Šime Ramov, Simon South, Spencer Whitt, Stanley Rost, Starr Horne, Stefan Bühler, Stuart Montgomery, Takashi Uchibe, Toon Willems, Tuomas Kareinen, Ursula Kallio, Vincent Driessen, Vlatko Kosturjak, whitequark, Xavier Shay, Yannick Ihmels, Zaiste de Grengolada
|
@@ -24,10 +24,8 @@ module Nanoc::Int
|
|
24
24
|
# end
|
25
25
|
# # => "I am Max Payne and I am hiding in a cheap motel."
|
26
26
|
def initialize(hash)
|
27
|
-
metaclass = class << self; self; end
|
28
27
|
hash.each_pair do |key, value|
|
29
28
|
instance_variable_set('@' + key.to_s, value)
|
30
|
-
metaclass.send(:define_method, key) { value }
|
31
29
|
end
|
32
30
|
end
|
33
31
|
|
@@ -40,6 +38,20 @@ module Nanoc::Int
|
|
40
38
|
end
|
41
39
|
# rubocop:enable Style/AccessorMethodName
|
42
40
|
|
41
|
+
def method_missing(method, *args, &blk)
|
42
|
+
ivar_name = '@' + method.to_s
|
43
|
+
if instance_variable_defined?(ivar_name)
|
44
|
+
instance_variable_get(ivar_name)
|
45
|
+
else
|
46
|
+
super
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
def respond_to_missing?(method, include_all)
|
51
|
+
ivar_name = '@' + method.to_s
|
52
|
+
instance_variable_defined?(ivar_name) || super
|
53
|
+
end
|
54
|
+
|
43
55
|
def include(mod)
|
44
56
|
metaclass = class << self; self; end
|
45
57
|
metaclass.instance_eval { include(mod) }
|
@@ -0,0 +1,32 @@
|
|
1
|
+
module Nanoc::Int::Compiler::Phases
|
2
|
+
# Provides functionality for (re)calculating the content of an item rep, with caching or
|
3
|
+
# outdatedness checking. Delegates to s::Recalculate if outdated or no cache available.
|
4
|
+
class Cache
|
5
|
+
include Nanoc::Int::ContractsSupport
|
6
|
+
|
7
|
+
def initialize(compiled_content_cache:, snapshot_repo:, wrapped:)
|
8
|
+
@compiled_content_cache = compiled_content_cache
|
9
|
+
@snapshot_repo = snapshot_repo
|
10
|
+
@wrapped = wrapped
|
11
|
+
end
|
12
|
+
|
13
|
+
contract Nanoc::Int::ItemRep, C::KeywordArgs[is_outdated: C::Bool] => C::Any
|
14
|
+
def run(rep, is_outdated:)
|
15
|
+
if can_reuse_content_for_rep?(rep, is_outdated: is_outdated)
|
16
|
+
Nanoc::Int::NotificationCenter.post(:cached_content_used, rep)
|
17
|
+
|
18
|
+
@snapshot_repo.set_all(rep, @compiled_content_cache[rep])
|
19
|
+
else
|
20
|
+
@wrapped.run(rep, is_outdated: is_outdated)
|
21
|
+
end
|
22
|
+
|
23
|
+
rep.compiled = true
|
24
|
+
@compiled_content_cache[rep] = @snapshot_repo.get_all(rep)
|
25
|
+
end
|
26
|
+
|
27
|
+
contract Nanoc::Int::ItemRep, C::KeywordArgs[is_outdated: C::Bool] => C::Bool
|
28
|
+
def can_reuse_content_for_rep?(rep, is_outdated:)
|
29
|
+
!is_outdated && !@compiled_content_cache[rep].nil?
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
module Nanoc::Int::Compiler::Phases
|
2
|
+
class MarkDone
|
3
|
+
include Nanoc::Int::ContractsSupport
|
4
|
+
|
5
|
+
def initialize(wrapped:, outdatedness_store:)
|
6
|
+
@wrapped = wrapped
|
7
|
+
@outdatedness_store = outdatedness_store
|
8
|
+
end
|
9
|
+
|
10
|
+
contract Nanoc::Int::ItemRep, C::KeywordArgs[is_outdated: C::Bool] => C::Any
|
11
|
+
def run(rep, is_outdated:)
|
12
|
+
@wrapped.run(rep, is_outdated: is_outdated)
|
13
|
+
@outdatedness_store.remove(rep)
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,38 @@
|
|
1
|
+
module Nanoc::Int::Compiler::Phases
|
2
|
+
# Provides functionality for (re)calculating the content of an item rep, without caching or
|
3
|
+
# outdatedness checking.
|
4
|
+
class Recalculate
|
5
|
+
include Nanoc::Int::ContractsSupport
|
6
|
+
|
7
|
+
def initialize(action_provider:, dependency_store:, compilation_context:)
|
8
|
+
@action_provider = action_provider
|
9
|
+
@dependency_store = dependency_store
|
10
|
+
@compilation_context = compilation_context
|
11
|
+
end
|
12
|
+
|
13
|
+
contract Nanoc::Int::ItemRep, C::KeywordArgs[is_outdated: C::Bool] => C::Any
|
14
|
+
def run(rep, is_outdated:) # rubocop:disable Lint/UnusedMethodArgument
|
15
|
+
dependency_tracker = Nanoc::Int::DependencyTracker.new(@dependency_store)
|
16
|
+
dependency_tracker.enter(rep.item)
|
17
|
+
|
18
|
+
executor = Nanoc::Int::Executor.new(rep, @compilation_context, dependency_tracker)
|
19
|
+
|
20
|
+
@compilation_context.snapshot_repo.set(rep, :last, rep.item.content)
|
21
|
+
|
22
|
+
@action_provider.memory_for(rep).each do |action|
|
23
|
+
case action
|
24
|
+
when Nanoc::Int::ProcessingActions::Filter
|
25
|
+
executor.filter(action.filter_name, action.params)
|
26
|
+
when Nanoc::Int::ProcessingActions::Layout
|
27
|
+
executor.layout(action.layout_identifier, action.params)
|
28
|
+
when Nanoc::Int::ProcessingActions::Snapshot
|
29
|
+
executor.snapshot(action.snapshot_name)
|
30
|
+
else
|
31
|
+
raise Nanoc::Int::Errors::InternalInconsistency, "unknown action #{action.inspect}"
|
32
|
+
end
|
33
|
+
end
|
34
|
+
ensure
|
35
|
+
dependency_tracker.exit
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
@@ -0,0 +1,46 @@
|
|
1
|
+
module Nanoc::Int::Compiler::Phases
|
2
|
+
# Provides functionality for suspending and resuming item rep compilation (using fibers).
|
3
|
+
class Resume
|
4
|
+
include Nanoc::Int::ContractsSupport
|
5
|
+
|
6
|
+
def initialize(wrapped:)
|
7
|
+
@wrapped = wrapped
|
8
|
+
end
|
9
|
+
|
10
|
+
contract Nanoc::Int::ItemRep, C::KeywordArgs[is_outdated: C::Bool] => C::Any
|
11
|
+
def run(rep, is_outdated:)
|
12
|
+
fiber = fiber_for(rep, is_outdated: is_outdated)
|
13
|
+
while fiber.alive?
|
14
|
+
Nanoc::Int::NotificationCenter.post(:compilation_started, rep)
|
15
|
+
res = fiber.resume
|
16
|
+
|
17
|
+
case res
|
18
|
+
when Nanoc::Int::Errors::UnmetDependency
|
19
|
+
Nanoc::Int::NotificationCenter.post(:compilation_suspended, rep, res)
|
20
|
+
raise(res)
|
21
|
+
when Proc
|
22
|
+
fiber.resume(res.call)
|
23
|
+
else
|
24
|
+
# TODO: raise
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
Nanoc::Int::NotificationCenter.post(:compilation_ended, rep)
|
29
|
+
end
|
30
|
+
|
31
|
+
private
|
32
|
+
|
33
|
+
contract Nanoc::Int::ItemRep, C::KeywordArgs[is_outdated: C::Bool] => Fiber
|
34
|
+
def fiber_for(rep, is_outdated:)
|
35
|
+
@fibers ||= {}
|
36
|
+
|
37
|
+
@fibers[rep] ||=
|
38
|
+
Fiber.new do
|
39
|
+
@wrapped.run(rep, is_outdated: is_outdated)
|
40
|
+
@fibers.delete(rep)
|
41
|
+
end
|
42
|
+
|
43
|
+
@fibers[rep]
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
module Nanoc::Int::Compiler::Phases
|
2
|
+
class Write
|
3
|
+
include Nanoc::Int::ContractsSupport
|
4
|
+
|
5
|
+
def initialize(snapshot_repo:, wrapped:)
|
6
|
+
@snapshot_repo = snapshot_repo
|
7
|
+
@wrapped = wrapped
|
8
|
+
end
|
9
|
+
|
10
|
+
contract Nanoc::Int::ItemRep, C::KeywordArgs[is_outdated: C::Bool] => C::Any
|
11
|
+
def run(rep, is_outdated:)
|
12
|
+
@wrapped.run(rep, is_outdated: is_outdated)
|
13
|
+
|
14
|
+
rep.snapshot_defs.each do |sdef|
|
15
|
+
Nanoc::Int::ItemRepWriter.new.write(rep, @snapshot_repo, sdef.name)
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,37 @@
|
|
1
|
+
module Nanoc::Int::Compiler::Stages
|
2
|
+
class Cleanup
|
3
|
+
def initialize(config)
|
4
|
+
@config = config
|
5
|
+
end
|
6
|
+
|
7
|
+
def run
|
8
|
+
cleanup_temps(Nanoc::Filter::TMP_BINARY_ITEMS_DIR)
|
9
|
+
cleanup_temps(Nanoc::Int::ItemRepWriter::TMP_TEXT_ITEMS_DIR)
|
10
|
+
cleanup_unused_stores
|
11
|
+
cleanup_old_stores
|
12
|
+
end
|
13
|
+
|
14
|
+
private
|
15
|
+
|
16
|
+
def cleanup_temps(dir)
|
17
|
+
Nanoc::Int::TempFilenameFactory.instance.cleanup(dir)
|
18
|
+
end
|
19
|
+
|
20
|
+
def cleanup_unused_stores
|
21
|
+
used_paths = @config.output_dirs.map { |d| Nanoc::Int::Store.tmp_path_prefix(d) }
|
22
|
+
all_paths = Dir.glob('tmp/nanoc/*')
|
23
|
+
(all_paths - used_paths).each do |obsolete_path|
|
24
|
+
FileUtils.rm_rf(obsolete_path)
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
def cleanup_old_stores
|
29
|
+
%w(checksums compiled_content dependencies outdatedness rule_memory).each do |fn|
|
30
|
+
full_fn = File.join('tmp', fn)
|
31
|
+
if File.file?(full_fn)
|
32
|
+
FileUtils.rm_f(full_fn)
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
@@ -0,0 +1,65 @@
|
|
1
|
+
module Nanoc::Int::Compiler::Stages
|
2
|
+
class CompileReps
|
3
|
+
def initialize(outdatedness_store:, dependency_store:, action_provider:, compilation_context:, compiled_content_cache:)
|
4
|
+
@outdatedness_store = outdatedness_store
|
5
|
+
@dependency_store = dependency_store
|
6
|
+
@action_provider = action_provider
|
7
|
+
@compilation_context = compilation_context
|
8
|
+
@compiled_content_cache = compiled_content_cache
|
9
|
+
end
|
10
|
+
|
11
|
+
def run
|
12
|
+
selector = Nanoc::Int::ItemRepSelector.new(@outdatedness_store.to_a)
|
13
|
+
selector.each do |rep|
|
14
|
+
handle_errors_while(rep) { compile_rep(rep, is_outdated: @outdatedness_store.include?(rep)) }
|
15
|
+
end
|
16
|
+
ensure
|
17
|
+
@outdatedness_store.store
|
18
|
+
@compiled_content_cache.store
|
19
|
+
end
|
20
|
+
|
21
|
+
private
|
22
|
+
|
23
|
+
def handle_errors_while(item_rep)
|
24
|
+
yield
|
25
|
+
rescue => e
|
26
|
+
raise Nanoc::Int::Errors::CompilationError.new(e, item_rep)
|
27
|
+
end
|
28
|
+
|
29
|
+
def compile_rep(rep, is_outdated:)
|
30
|
+
item_rep_compiler.run(rep, is_outdated: is_outdated)
|
31
|
+
end
|
32
|
+
|
33
|
+
def item_rep_compiler
|
34
|
+
@_item_rep_compiler ||= begin
|
35
|
+
recalculate_phase = Nanoc::Int::Compiler::Phases::Recalculate.new(
|
36
|
+
action_provider: @action_provider,
|
37
|
+
dependency_store: @dependency_store,
|
38
|
+
compilation_context: @compilation_context,
|
39
|
+
)
|
40
|
+
|
41
|
+
cache_phase = Nanoc::Int::Compiler::Phases::Cache.new(
|
42
|
+
compiled_content_cache: @compiled_content_cache,
|
43
|
+
snapshot_repo: @compilation_context.snapshot_repo,
|
44
|
+
wrapped: recalculate_phase,
|
45
|
+
)
|
46
|
+
|
47
|
+
resume_phase = Nanoc::Int::Compiler::Phases::Resume.new(
|
48
|
+
wrapped: cache_phase,
|
49
|
+
)
|
50
|
+
|
51
|
+
write_phase = Nanoc::Int::Compiler::Phases::Write.new(
|
52
|
+
snapshot_repo: @compilation_context.snapshot_repo,
|
53
|
+
wrapped: resume_phase,
|
54
|
+
)
|
55
|
+
|
56
|
+
mark_done_phase = Nanoc::Int::Compiler::Phases::MarkDone.new(
|
57
|
+
wrapped: write_phase,
|
58
|
+
outdatedness_store: @outdatedness_store,
|
59
|
+
)
|
60
|
+
|
61
|
+
mark_done_phase
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|
65
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
module Nanoc::Int::Compiler::Stages
|
2
|
+
class DetermineOutdatedness
|
3
|
+
def initialize(reps:, outdatedness_checker:, outdatedness_store:)
|
4
|
+
@reps = reps
|
5
|
+
@outdatedness_checker = outdatedness_checker
|
6
|
+
@outdatedness_store = outdatedness_store
|
7
|
+
end
|
8
|
+
|
9
|
+
def run
|
10
|
+
outdated_reps_tmp = @reps.select do |r|
|
11
|
+
@outdatedness_store.include?(r) || @outdatedness_checker.outdated?(r)
|
12
|
+
end
|
13
|
+
|
14
|
+
outdated_items = outdated_reps_tmp.map(&:item).uniq
|
15
|
+
outdated_reps = Set.new(outdated_items.flat_map { |i| @reps[i] })
|
16
|
+
|
17
|
+
outdated_reps.each { |r| @outdatedness_store.add(r) }
|
18
|
+
|
19
|
+
yield(outdated_items)
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
module Nanoc::Int::Compiler::Stages
|
2
|
+
class Preprocess
|
3
|
+
def initialize(action_provider:, site:, dependency_store:, checksum_store:)
|
4
|
+
@action_provider = action_provider
|
5
|
+
@site = site
|
6
|
+
@dependency_store = dependency_store
|
7
|
+
@checksum_store = checksum_store
|
8
|
+
end
|
9
|
+
|
10
|
+
def run
|
11
|
+
@action_provider.preprocess(@site)
|
12
|
+
|
13
|
+
@dependency_store.objects = @site.items.to_a + @site.layouts.to_a
|
14
|
+
@checksum_store.objects = @site.items.to_a + @site.layouts.to_a + @site.code_snippets + [@site.config]
|
15
|
+
|
16
|
+
@site.freeze
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
module Nanoc::Int::Compiler::Stages
|
2
|
+
class Prune
|
3
|
+
def initialize(config:, reps:)
|
4
|
+
@config = config
|
5
|
+
@reps = reps
|
6
|
+
end
|
7
|
+
|
8
|
+
def run
|
9
|
+
if @config[:prune][:auto_prune]
|
10
|
+
Nanoc::Pruner.new(@config, @reps, exclude: prune_config_exclude).run
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
private
|
15
|
+
|
16
|
+
def prune_config
|
17
|
+
@config[:prune] || {}
|
18
|
+
end
|
19
|
+
|
20
|
+
def prune_config_exclude
|
21
|
+
prune_config[:exclude] || {}
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|