nanoc 4.8.9 → 4.8.10
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +6 -4
- data/Gemfile +2 -1
- data/NEWS.md +7 -0
- data/README.md +1 -1
- data/lib/nanoc.rb +2 -6
- data/lib/nanoc/base/entities/site.rb +9 -5
- data/lib/nanoc/base/repos/data_source.rb +0 -15
- data/lib/nanoc/base/repos/outdatedness_store.rb +17 -15
- data/lib/nanoc/base/services/compilation_context.rb +4 -4
- data/lib/nanoc/base/services/compiler.rb +102 -103
- data/lib/nanoc/base/services/compiler/stages/build_reps.rb +7 -7
- data/lib/nanoc/base/services/compiler/stages/compile_reps.rb +4 -2
- data/lib/nanoc/base/services/compiler/stages/determine_outdatedness.rb +25 -7
- data/lib/nanoc/base/services/compiler/stages/postprocess.rb +3 -3
- data/lib/nanoc/base/services/compiler/stages/preprocess.rb +3 -0
- data/lib/nanoc/base/services/compiler_loader.rb +1 -4
- data/lib/nanoc/base/views.rb +13 -6
- data/lib/nanoc/base/views/{item_rep_collection_view.rb → basic_item_rep_collection_view.rb} +6 -6
- data/lib/nanoc/base/views/{item_rep_view.rb → basic_item_rep_view.rb} +8 -29
- data/lib/nanoc/base/views/{item_without_reps_view.rb → basic_item_view.rb} +3 -3
- data/lib/nanoc/base/views/compilation_item_rep_collection_view.rb +10 -0
- data/lib/nanoc/base/views/compilation_item_rep_view.rb +42 -0
- data/lib/nanoc/base/views/{mixins/with_reps_view_mixin.rb → compilation_item_view.rb} +3 -3
- data/lib/nanoc/base/views/item_collection_with_reps_view.rb +1 -1
- data/lib/nanoc/base/views/item_collection_without_reps_view.rb +1 -1
- data/lib/nanoc/base/views/mixins/mutable_document_view_mixin.rb +1 -1
- data/lib/nanoc/base/views/mutable_item_view.rb +1 -1
- data/lib/nanoc/base/views/post_compile_item_rep_collection_view.rb +1 -1
- data/lib/nanoc/base/views/post_compile_item_rep_view.rb +7 -2
- data/lib/nanoc/base/views/post_compile_item_view.rb +1 -1
- data/lib/nanoc/base/views/{view_context.rb → view_context_for_compilation.rb} +10 -1
- data/lib/nanoc/base/views/view_context_for_pre_compilation.rb +18 -0
- data/lib/nanoc/base/views/view_context_for_shell.rb +23 -0
- data/lib/nanoc/checking/check.rb +5 -1
- data/lib/nanoc/checking/runner.rb +1 -1
- data/lib/nanoc/cli.rb +1 -0
- data/lib/nanoc/cli/command_runner.rb +1 -7
- data/lib/nanoc/cli/commands/check.rb +2 -2
- data/lib/nanoc/cli/commands/compile.rb +8 -47
- data/lib/nanoc/cli/commands/compile_listeners/abstract.rb +9 -0
- data/lib/nanoc/cli/commands/compile_listeners/aggregate.rb +49 -0
- data/lib/nanoc/cli/commands/deploy.rb +2 -1
- data/lib/nanoc/cli/commands/prune.rb +5 -4
- data/lib/nanoc/cli/commands/shell.rb +4 -6
- data/lib/nanoc/cli/commands/show-data.rb +20 -27
- data/lib/nanoc/cli/commands/show-rules.rb +20 -22
- data/lib/nanoc/cli/error_handler.rb +0 -17
- data/lib/nanoc/data_sources/filesystem.rb +4 -2
- data/lib/nanoc/deploying/deployers/fog.rb +4 -1
- data/lib/nanoc/helpers/link_to.rb +1 -1
- data/lib/nanoc/rule_dsl/action_provider.rb +8 -11
- data/lib/nanoc/rule_dsl/action_sequence_calculator.rb +14 -5
- data/lib/nanoc/rule_dsl/recording_executor.rb +4 -0
- data/lib/nanoc/rule_dsl/rule.rb +14 -9
- data/lib/nanoc/rule_dsl/rule_context.rb +4 -4
- data/lib/nanoc/spec.rb +27 -19
- data/lib/nanoc/version.rb +1 -1
- data/spec/nanoc/base/checksummer_spec.rb +19 -11
- data/spec/nanoc/base/compiler_spec.rb +18 -14
- data/spec/nanoc/base/filter_spec.rb +7 -6
- data/spec/nanoc/base/repos/outdatedness_store_spec.rb +3 -32
- data/spec/nanoc/base/services/compiler/stages/compile_reps_spec.rb +2 -1
- data/spec/nanoc/base/services/compiler/stages/determine_outdatedness_spec.rb +148 -0
- data/spec/nanoc/base/services/compiler/stages/preprocess_spec.rb +110 -0
- data/spec/nanoc/base/services/executor_spec.rb +6 -6
- data/spec/nanoc/base/views/basic_item_rep_collection_view_spec.rb +8 -0
- data/spec/nanoc/base/views/basic_item_rep_view_spec.rb +9 -0
- data/spec/nanoc/base/views/compilation_item_rep_collection_view_spec.rb +8 -0
- data/spec/nanoc/base/views/compilation_item_rep_view_spec.rb +136 -0
- data/spec/nanoc/base/views/config_view_spec.rb +5 -5
- data/spec/nanoc/base/views/item_collection_with_reps_view_spec.rb +4 -2
- data/spec/nanoc/base/views/item_collection_without_reps_view_spec.rb +4 -2
- data/spec/nanoc/base/views/item_view_spec.rb +13 -11
- data/spec/nanoc/base/views/layout_collection_view_spec.rb +3 -1
- data/spec/nanoc/base/views/layout_view_spec.rb +3 -1
- data/spec/nanoc/base/views/mutable_item_collection_view_spec.rb +5 -2
- data/spec/nanoc/base/views/mutable_item_view_spec.rb +2 -0
- data/spec/nanoc/base/views/mutable_layout_collection_view_spec.rb +5 -2
- data/spec/nanoc/base/views/mutable_layout_view_spec.rb +2 -0
- data/spec/nanoc/base/views/post_compile_item_rep_collection_view_spec.rb +2 -0
- data/spec/nanoc/base/views/post_compile_item_rep_view_spec.rb +9 -3
- data/spec/nanoc/base/views/{document_view_spec.rb → support/document_view_examples.rb} +5 -5
- data/spec/nanoc/base/views/{identifiable_collection_view_spec.rb → support/identifiable_collection_view_examples.rb} +4 -4
- data/spec/nanoc/base/views/{item_rep_collection_view_spec.rb → support/item_rep_collection_view_examples.rb} +3 -8
- data/spec/nanoc/base/views/{item_rep_view_spec.rb → support/item_rep_view_examples.rb} +10 -111
- data/spec/nanoc/base/views/{mutable_document_view_spec.rb → support/mutable_document_view_examples.rb} +7 -6
- data/spec/nanoc/base/views/{mutable_identifiable_collection_view_spec.rb → support/mutable_identifiable_collection_view_examples.rb} +1 -1
- data/spec/nanoc/cli/commands/compile/abstract_spec.rb +80 -0
- data/spec/nanoc/cli/commands/compile_spec.rb +30 -51
- data/spec/nanoc/cli/commands/show_data_spec.rb +2 -23
- data/spec/nanoc/cli/commands/show_rules_spec.rb +4 -2
- data/spec/nanoc/regressions/gh_767_spec.rb +1 -1
- data/spec/nanoc/regressions/gh_776_spec.rb +2 -1
- data/spec/nanoc/rule_dsl/action_sequence_calculator_spec.rb +25 -12
- data/spec/nanoc/rule_dsl/rule_context_spec.rb +16 -6
- data/test/base/test_data_source.rb +0 -18
- data/test/checking/checks/test_external_links.rb +4 -6
- data/test/checking/checks/test_internal_links.rb +6 -9
- data/test/cli/commands/test_compile.rb +0 -35
- data/test/cli/test_cleaning_stream.rb +1 -1
- data/test/data_sources/test_filesystem.rb +16 -0
- data/test/filters/test_kramdown.rb +4 -4
- data/test/filters/test_sass.rb +1 -1
- data/test/filters/test_slim.rb +7 -5
- data/test/filters/test_xsl.rb +10 -8
- data/test/helpers/test_blogging.rb +5 -5
- data/test/helpers/test_capturing.rb +8 -6
- data/test/helpers/test_link_to.rb +4 -4
- data/test/helpers/test_xml_sitemap.rb +19 -19
- metadata +25 -15
- data/lib/nanoc/base/views/item_with_reps_view.rb +0 -7
- data/spec/nanoc/base/core_ext/pathname_spec.rb +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 651f15c4ee22daacf31bab68c3ec1a00a02238f0
|
4
|
+
data.tar.gz: 6a8a41fd4ecc345ebb70814cd9f7f89d0cd6decc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0f9576114f97906cf843f19dcff2e84a45d4612165162e267ef10ab441e910b82fbaac55d1cc71f68d7add44214269c003eca73c31118119b7f9d238f08e3391
|
7
|
+
data.tar.gz: 66be4b141524b69d045e636ecc01b33c69c9e7f4267eb8ff7a5a6978c2b7fbb9c1960bf6cd482458484a4477dfc1aeb1821a03d4ec3e358c2de3c2009b727792
|
data/.gitignore
CHANGED
data/Gemfile
CHANGED
data/NEWS.md
CHANGED
data/README.md
CHANGED
@@ -20,4 +20,4 @@ Contributions are greatly appreciated! Consult the [Development guidelines](http
|
|
20
20
|
|
21
21
|
Many thanks to everyone who has contributed to Nanoc in one way or another:
|
22
22
|
|
23
|
-
Ale Muñoz, Alexander Groß, Alexander Mankuta, Andy Drop, Arnau Siches, Ben Armston, Bil Bas, Brian Candler, Bruno Dufour, Cédric Boutillier, Chris Burkhardt, 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, Jan M. Faber, 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
|
23
|
+
Abubakar Ango, Ale Muñoz, Alexander Groß, Alexander Mankuta, Andy Drop, Arnau Siches, Ben Armston, Bil Bas, Brian Candler, Bruno Dufour, Cédric Boutillier, Chris Burkhardt, 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, Jan M. Faber, 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, Seiichi Yonezawa, Š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
|
data/lib/nanoc.rb
CHANGED
@@ -6,12 +6,8 @@ module Nanoc
|
|
6
6
|
#
|
7
7
|
# @api private
|
8
8
|
def self.version_information
|
9
|
-
|
10
|
-
|
11
|
-
res = +''
|
12
|
-
res << "Nanoc #{Nanoc::VERSION} © 2007-2017 Denis Defreyne.\n"
|
13
|
-
res << "Running #{engine} #{RUBY_VERSION} (#{RUBY_RELEASE_DATE}) on #{RUBY_PLATFORM} #{gem_info}.\n"
|
14
|
-
res
|
9
|
+
"Nanoc #{Nanoc::VERSION} © 2007-2017 Denis Defreyne.\n" \
|
10
|
+
"Running #{RUBY_ENGINE} #{RUBY_VERSION} (#{RUBY_RELEASE_DATE}) on #{RUBY_PLATFORM} with RubyGems #{Gem::VERSION}.\n"
|
15
11
|
end
|
16
12
|
|
17
13
|
# @return [Boolean] True if the current platform is Windows, false otherwise.
|
@@ -8,7 +8,6 @@ module Nanoc::Int
|
|
8
8
|
attr_reader :code_snippets
|
9
9
|
attr_reader :config
|
10
10
|
attr_accessor :data_source
|
11
|
-
attr_writer :compiler
|
12
11
|
|
13
12
|
contract C::KeywordArgs[config: Nanoc::Int::Configuration, code_snippets: C::IterOf[Nanoc::Int::CodeSnippet], data_source: C::Maybe[C::Named['Nanoc::DataSource']]] => C::Any
|
14
13
|
def initialize(config:, code_snippets:, data_source:)
|
@@ -16,19 +15,24 @@ module Nanoc::Int
|
|
16
15
|
@code_snippets = code_snippets
|
17
16
|
@data_source = data_source
|
18
17
|
|
18
|
+
@preprocessed = false
|
19
|
+
|
19
20
|
ensure_identifier_uniqueness(@data_source.items, 'item')
|
20
21
|
ensure_identifier_uniqueness(@data_source.layouts, 'layout')
|
21
22
|
end
|
22
23
|
|
23
24
|
contract C::None => self
|
24
25
|
def compile
|
25
|
-
|
26
|
+
Nanoc::Int::Compiler.new_for(self).run_until_end
|
26
27
|
self
|
27
28
|
end
|
28
29
|
|
29
|
-
|
30
|
-
|
31
|
-
|
30
|
+
def mark_as_preprocessed
|
31
|
+
@preprocessed = true
|
32
|
+
end
|
33
|
+
|
34
|
+
def preprocessed?
|
35
|
+
@preprocessed
|
32
36
|
end
|
33
37
|
|
34
38
|
def items
|
@@ -40,21 +40,6 @@ module Nanoc
|
|
40
40
|
@references = 0
|
41
41
|
end
|
42
42
|
|
43
|
-
# Loads the data source when necessary (calling {#up}), yields, and
|
44
|
-
# unloads (using {#down}) the data source when it is not being used
|
45
|
-
# elsewhere. All data source queries and data manipulations should be
|
46
|
-
# wrapped in a {#loading} block; it ensures that the data source is loaded
|
47
|
-
# when necessary and makes sure the data source does not get unloaded
|
48
|
-
# while it is still being used elsewhere.
|
49
|
-
#
|
50
|
-
# @return [void]
|
51
|
-
def loading
|
52
|
-
use
|
53
|
-
yield
|
54
|
-
ensure
|
55
|
-
unuse
|
56
|
-
end
|
57
|
-
|
58
43
|
# Marks the data source as used by the caller.
|
59
44
|
#
|
60
45
|
# Calling this method increases the internal reference count. When the
|
@@ -5,47 +5,49 @@ module Nanoc::Int
|
|
5
5
|
class OutdatednessStore < ::Nanoc::Int::Store
|
6
6
|
include Nanoc::Int::ContractsSupport
|
7
7
|
|
8
|
-
contract C::KeywordArgs[site: C::Maybe[Nanoc::Int::Site]
|
9
|
-
def initialize(site: nil
|
8
|
+
contract C::KeywordArgs[site: C::Maybe[Nanoc::Int::Site]] => C::Any
|
9
|
+
def initialize(site: nil)
|
10
10
|
super(Nanoc::Int::Store.tmp_path_for(site: site, store_name: 'outdatedness'), 1)
|
11
11
|
|
12
|
-
@
|
13
|
-
@all_reps = reps
|
12
|
+
@outdated_refs = Set.new
|
14
13
|
end
|
15
14
|
|
16
15
|
contract Nanoc::Int::ItemRep => C::Bool
|
17
16
|
def include?(obj)
|
18
|
-
@
|
17
|
+
@outdated_refs.include?(obj.reference)
|
19
18
|
end
|
20
19
|
|
21
20
|
contract Nanoc::Int::ItemRep => self
|
22
21
|
def add(obj)
|
23
|
-
@
|
22
|
+
@outdated_refs << obj.reference
|
24
23
|
self
|
25
24
|
end
|
26
25
|
|
27
26
|
contract Nanoc::Int::ItemRep => self
|
28
27
|
def remove(obj)
|
29
|
-
@
|
28
|
+
@outdated_refs.delete(obj.reference)
|
30
29
|
self
|
31
30
|
end
|
32
31
|
|
33
|
-
contract C::None => C::
|
34
|
-
def
|
35
|
-
@
|
32
|
+
contract C::None => C::Bool
|
33
|
+
def empty?
|
34
|
+
@outdated_refs.empty?
|
35
|
+
end
|
36
|
+
|
37
|
+
contract C::None => self
|
38
|
+
def clear
|
39
|
+
@outdated_refs = Set.new
|
40
|
+
self
|
36
41
|
end
|
37
42
|
|
38
43
|
protected
|
39
44
|
|
40
45
|
def data
|
41
|
-
@
|
46
|
+
@outdated_refs
|
42
47
|
end
|
43
48
|
|
44
49
|
def data=(new_data)
|
45
|
-
outdated_refs = Set.new(new_data)
|
46
|
-
all_reps = Set.new(@all_reps)
|
47
|
-
|
48
|
-
@outdated_reps = Set.new(all_reps.select { |rep| outdated_refs.include?(rep.reference) })
|
50
|
+
@outdated_refs = Set.new(new_data)
|
49
51
|
end
|
50
52
|
end
|
51
53
|
end
|
@@ -23,7 +23,7 @@ module Nanoc::Int
|
|
23
23
|
end
|
24
24
|
|
25
25
|
def create_view_context(dependency_tracker)
|
26
|
-
Nanoc::
|
26
|
+
Nanoc::ViewContextForCompilation.new(
|
27
27
|
reps: @reps,
|
28
28
|
items: @site.items,
|
29
29
|
dependency_tracker: dependency_tracker,
|
@@ -44,9 +44,9 @@ module Nanoc::Int
|
|
44
44
|
view_context = create_view_context(dependency_tracker)
|
45
45
|
|
46
46
|
content_or_filename_assigns.merge(
|
47
|
-
item: Nanoc::
|
48
|
-
rep: Nanoc::
|
49
|
-
item_rep: Nanoc::
|
47
|
+
item: Nanoc::CompilationItemView.new(rep.item, view_context),
|
48
|
+
rep: Nanoc::CompilationItemRepView.new(rep, view_context),
|
49
|
+
item_rep: Nanoc::CompilationItemRepView.new(rep, view_context),
|
50
50
|
items: Nanoc::ItemCollectionWithRepsView.new(@site.items, view_context),
|
51
51
|
layouts: Nanoc::LayoutCollectionView.new(@site.layouts, view_context),
|
52
52
|
config: Nanoc::ConfigView.new(@site.config, view_context),
|
@@ -4,106 +4,93 @@ module Nanoc::Int
|
|
4
4
|
class Compiler
|
5
5
|
include Nanoc::Int::ContractsSupport
|
6
6
|
|
7
|
-
|
8
|
-
attr_reader :site
|
9
|
-
|
10
|
-
# @api private
|
11
|
-
attr_reader :compiled_content_cache
|
12
|
-
|
13
|
-
# @api private
|
14
|
-
attr_reader :checksum_store
|
15
|
-
|
16
|
-
# @api private
|
17
|
-
attr_reader :action_sequence_store
|
18
|
-
|
19
|
-
# @api private
|
20
|
-
attr_reader :action_provider
|
21
|
-
|
22
|
-
# @api private
|
23
|
-
attr_reader :dependency_store
|
24
|
-
|
25
|
-
# @api private
|
26
|
-
attr_reader :reps
|
27
|
-
|
28
|
-
# @api private
|
29
|
-
attr_reader :outdatedness_store
|
30
|
-
|
31
|
-
# @api private
|
32
|
-
attr_reader :snapshot_repo
|
33
|
-
|
34
|
-
def initialize(site, compiled_content_cache:, checksum_store:, action_sequence_store:, action_provider:, dependency_store:, reps:, outdatedness_store:)
|
7
|
+
def initialize(site, compiled_content_cache:, checksum_store:, action_sequence_store:, action_provider:, dependency_store:, outdatedness_store:)
|
35
8
|
@site = site
|
36
9
|
|
37
10
|
@compiled_content_cache = compiled_content_cache
|
38
11
|
@checksum_store = checksum_store
|
39
12
|
@action_sequence_store = action_sequence_store
|
40
13
|
@dependency_store = dependency_store
|
41
|
-
@reps = reps
|
42
14
|
@action_provider = action_provider
|
43
15
|
@outdatedness_store = outdatedness_store
|
44
16
|
|
45
|
-
# TODO: inject
|
46
17
|
@snapshot_repo = Nanoc::Int::SnapshotRepo.new
|
47
18
|
end
|
48
19
|
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
checksum_store: @checksum_store,
|
53
|
-
dependency_store: @dependency_store,
|
54
|
-
action_sequence_store: @action_sequence_store,
|
55
|
-
action_sequences: @action_sequences,
|
56
|
-
checksums: @checksums,
|
57
|
-
reps: reps,
|
58
|
-
)
|
20
|
+
contract Nanoc::Int::Site => Nanoc::Int::Compiler
|
21
|
+
def self.new_for(site)
|
22
|
+
Nanoc::Int::CompilerLoader.new.load(site)
|
59
23
|
end
|
60
24
|
|
61
|
-
def
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
run_stage(prune_stage)
|
67
|
-
run_stage(compile_reps_stage(@action_sequences))
|
68
|
-
run_stage(store_post_compilation_state_stage)
|
69
|
-
run_stage(postprocess_stage)
|
70
|
-
ensure
|
71
|
-
run_stage(cleanup_stage)
|
25
|
+
def run_until_preprocessed
|
26
|
+
@_res_preprocessed ||= begin
|
27
|
+
run_stage(preprocess_stage)
|
28
|
+
{}
|
29
|
+
end
|
72
30
|
end
|
73
31
|
|
74
|
-
def
|
75
|
-
|
32
|
+
def run_until_reps_built
|
33
|
+
@_res_reps_built ||= begin
|
34
|
+
prev = run_until_preprocessed
|
76
35
|
|
77
|
-
|
78
|
-
@action_sequences = run_stage(build_reps_stage)
|
79
|
-
run_stage(load_stores_stage)
|
80
|
-
@checksums = run_stage(calculate_checksums_stage)
|
81
|
-
@outdated_items = run_stage(determine_outdatedness_stage)
|
82
|
-
end
|
36
|
+
res = run_stage(build_reps_stage)
|
83
37
|
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
compiled_content_cache: compiled_content_cache,
|
90
|
-
snapshot_repo: snapshot_repo,
|
91
|
-
)
|
38
|
+
prev.merge(
|
39
|
+
reps: res.fetch(:reps),
|
40
|
+
action_sequences: res.fetch(:action_sequences),
|
41
|
+
)
|
42
|
+
end
|
92
43
|
end
|
93
44
|
|
94
|
-
|
95
|
-
|
96
|
-
|
45
|
+
def run_until_precompiled
|
46
|
+
@_res_precompiled ||= begin
|
47
|
+
prev = run_until_reps_built
|
48
|
+
action_sequences = prev.fetch(:action_sequences)
|
49
|
+
reps = prev.fetch(:reps)
|
50
|
+
|
51
|
+
run_stage(load_stores_stage)
|
52
|
+
checksums = run_stage(calculate_checksums_stage)
|
53
|
+
outdatedness_checker = create_outdatedness_checker(
|
54
|
+
checksums: checksums,
|
55
|
+
action_sequences: action_sequences,
|
56
|
+
reps: reps,
|
57
|
+
)
|
58
|
+
outdated_items = run_stage(determine_outdatedness_stage(outdatedness_checker, reps))
|
59
|
+
|
60
|
+
prev.merge(
|
61
|
+
checksums: checksums,
|
62
|
+
dependency_store: @dependency_store,
|
63
|
+
outdatedness_checker: outdatedness_checker,
|
64
|
+
outdated_items: outdated_items,
|
65
|
+
)
|
66
|
+
end
|
97
67
|
end
|
98
68
|
|
99
|
-
|
100
|
-
|
101
|
-
|
69
|
+
def run_until_end
|
70
|
+
res = run_until_precompiled
|
71
|
+
action_sequences = res.fetch(:action_sequences)
|
72
|
+
reps = res.fetch(:reps)
|
73
|
+
checksums = res.fetch(:checksums)
|
74
|
+
outdated_items = res.fetch(:outdated_items)
|
75
|
+
|
76
|
+
run_stage(forget_outdated_dependencies_stage, outdated_items)
|
77
|
+
run_stage(store_pre_compilation_state_stage(action_sequences, reps), checksums)
|
78
|
+
run_stage(prune_stage(reps))
|
79
|
+
run_stage(compile_reps_stage(action_sequences, reps))
|
80
|
+
run_stage(store_post_compilation_state_stage)
|
81
|
+
run_stage(postprocess_stage(reps), self)
|
82
|
+
ensure
|
83
|
+
run_stage(cleanup_stage)
|
102
84
|
end
|
103
85
|
|
104
|
-
|
105
|
-
|
106
|
-
|
86
|
+
def compilation_context(reps:)
|
87
|
+
Nanoc::Int::CompilationContext.new(
|
88
|
+
action_provider: @action_provider,
|
89
|
+
reps: reps,
|
90
|
+
site: @site,
|
91
|
+
compiled_content_cache: @compiled_content_cache,
|
92
|
+
snapshot_repo: @snapshot_repo,
|
93
|
+
)
|
107
94
|
end
|
108
95
|
|
109
96
|
private
|
@@ -115,36 +102,47 @@ module Nanoc::Int
|
|
115
102
|
Nanoc::Int::NotificationCenter.post(:stage_ended, stage.class)
|
116
103
|
end
|
117
104
|
|
105
|
+
def create_outdatedness_checker(checksums:, action_sequences:, reps:)
|
106
|
+
Nanoc::Int::OutdatednessChecker.new(
|
107
|
+
site: @site,
|
108
|
+
checksum_store: @checksum_store,
|
109
|
+
dependency_store: @dependency_store,
|
110
|
+
action_sequence_store: @action_sequence_store,
|
111
|
+
action_sequences: action_sequences,
|
112
|
+
checksums: checksums,
|
113
|
+
reps: reps,
|
114
|
+
)
|
115
|
+
end
|
116
|
+
|
118
117
|
def preprocess_stage
|
119
118
|
@_preprocess_stage ||= Stages::Preprocess.new(
|
120
|
-
action_provider: action_provider,
|
121
|
-
site: site,
|
122
|
-
dependency_store: dependency_store,
|
123
|
-
checksum_store: checksum_store,
|
119
|
+
action_provider: @action_provider,
|
120
|
+
site: @site,
|
121
|
+
dependency_store: @dependency_store,
|
122
|
+
checksum_store: @checksum_store,
|
124
123
|
)
|
125
124
|
end
|
126
125
|
|
127
126
|
def build_reps_stage
|
128
127
|
@_build_reps_stage ||= Stages::BuildReps.new(
|
129
|
-
site: site,
|
130
|
-
action_provider: action_provider,
|
131
|
-
reps: @reps,
|
128
|
+
site: @site,
|
129
|
+
action_provider: @action_provider,
|
132
130
|
)
|
133
131
|
end
|
134
132
|
|
135
|
-
def prune_stage
|
133
|
+
def prune_stage(reps)
|
136
134
|
@_prune_stage ||= Stages::Prune.new(
|
137
|
-
config: site.config,
|
135
|
+
config: @site.config,
|
138
136
|
reps: reps,
|
139
137
|
)
|
140
138
|
end
|
141
139
|
|
142
140
|
def load_stores_stage
|
143
141
|
@_load_stores_stage ||= Stages::LoadStores.new(
|
144
|
-
checksum_store: checksum_store,
|
145
|
-
compiled_content_cache: compiled_content_cache,
|
142
|
+
checksum_store: @checksum_store,
|
143
|
+
compiled_content_cache: @compiled_content_cache,
|
146
144
|
dependency_store: @dependency_store,
|
147
|
-
action_sequence_store: action_sequence_store,
|
145
|
+
action_sequence_store: @action_sequence_store,
|
148
146
|
outdatedness_store: @outdatedness_store,
|
149
147
|
)
|
150
148
|
end
|
@@ -158,50 +156,51 @@ module Nanoc::Int
|
|
158
156
|
)
|
159
157
|
end
|
160
158
|
|
161
|
-
def determine_outdatedness_stage
|
159
|
+
def determine_outdatedness_stage(outdatedness_checker, reps)
|
162
160
|
@_determine_outdatedness_stage ||= Stages::DetermineOutdatedness.new(
|
163
161
|
reps: reps,
|
164
|
-
outdatedness_checker:
|
165
|
-
outdatedness_store: outdatedness_store,
|
162
|
+
outdatedness_checker: outdatedness_checker,
|
163
|
+
outdatedness_store: @outdatedness_store,
|
166
164
|
)
|
167
165
|
end
|
168
166
|
|
169
|
-
def store_pre_compilation_state_stage(action_sequences)
|
167
|
+
def store_pre_compilation_state_stage(action_sequences, reps)
|
170
168
|
@_store_pre_compilation_state_stage ||= Stages::StorePreCompilationState.new(
|
171
|
-
reps:
|
172
|
-
layouts: site.layouts,
|
173
|
-
checksum_store: checksum_store,
|
174
|
-
action_sequence_store: action_sequence_store,
|
169
|
+
reps: reps,
|
170
|
+
layouts: @site.layouts,
|
171
|
+
checksum_store: @checksum_store,
|
172
|
+
action_sequence_store: @action_sequence_store,
|
175
173
|
action_sequences: action_sequences,
|
176
174
|
)
|
177
175
|
end
|
178
176
|
|
179
|
-
def compile_reps_stage(action_sequences)
|
177
|
+
def compile_reps_stage(action_sequences, reps)
|
180
178
|
@_compile_reps_stage ||= Stages::CompileReps.new(
|
179
|
+
reps: reps,
|
181
180
|
outdatedness_store: @outdatedness_store,
|
182
181
|
dependency_store: @dependency_store,
|
183
182
|
action_sequences: action_sequences,
|
184
|
-
compilation_context: compilation_context,
|
185
|
-
compiled_content_cache: compiled_content_cache,
|
183
|
+
compilation_context: compilation_context(reps: reps),
|
184
|
+
compiled_content_cache: @compiled_content_cache,
|
186
185
|
)
|
187
186
|
end
|
188
187
|
|
189
188
|
def store_post_compilation_state_stage
|
190
189
|
@_store_post_compilation_state_stage ||= Stages::StorePostCompilationState.new(
|
191
|
-
dependency_store: dependency_store,
|
190
|
+
dependency_store: @dependency_store,
|
192
191
|
)
|
193
192
|
end
|
194
193
|
|
195
|
-
def postprocess_stage
|
194
|
+
def postprocess_stage(reps)
|
196
195
|
@_postprocess_stage ||= Stages::Postprocess.new(
|
197
196
|
action_provider: @action_provider,
|
198
197
|
site: @site,
|
199
|
-
reps:
|
198
|
+
reps: reps,
|
200
199
|
)
|
201
200
|
end
|
202
201
|
|
203
202
|
def cleanup_stage
|
204
|
-
@_cleanup_stage ||= Stages::Cleanup.new(site.config)
|
203
|
+
@_cleanup_stage ||= Stages::Cleanup.new(@site.config)
|
205
204
|
end
|
206
205
|
|
207
206
|
def forget_outdated_dependencies_stage
|