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
@@ -2,19 +2,16 @@
|
|
2
2
|
|
3
3
|
module Nanoc::Int::Compiler::Stages
|
4
4
|
class BuildReps
|
5
|
-
def initialize(site:, action_provider
|
5
|
+
def initialize(site:, action_provider:)
|
6
6
|
@site = site
|
7
7
|
@action_provider = action_provider
|
8
|
-
@reps = reps
|
9
8
|
end
|
10
9
|
|
11
10
|
def run
|
12
|
-
|
13
|
-
# Better: let this stage return a mapping of reps onto (raw) paths *and* a mapping of objects
|
14
|
-
# onto action sequences.
|
11
|
+
reps = Nanoc::Int::ItemRepRepo.new
|
15
12
|
|
16
13
|
builder = Nanoc::Int::ItemRepBuilder.new(
|
17
|
-
@site, @action_provider,
|
14
|
+
@site, @action_provider, reps
|
18
15
|
)
|
19
16
|
|
20
17
|
action_sequences = builder.run
|
@@ -23,7 +20,10 @@ module Nanoc::Int::Compiler::Stages
|
|
23
20
|
action_sequences[layout] = @action_provider.action_sequence_for(layout)
|
24
21
|
end
|
25
22
|
|
26
|
-
|
23
|
+
{
|
24
|
+
reps: reps,
|
25
|
+
action_sequences: action_sequences,
|
26
|
+
}
|
27
27
|
end
|
28
28
|
end
|
29
29
|
end
|
@@ -2,7 +2,8 @@
|
|
2
2
|
|
3
3
|
module Nanoc::Int::Compiler::Stages
|
4
4
|
class CompileReps
|
5
|
-
def initialize(outdatedness_store:, dependency_store:, action_sequences:, compilation_context:, compiled_content_cache:)
|
5
|
+
def initialize(reps:, outdatedness_store:, dependency_store:, action_sequences:, compilation_context:, compiled_content_cache:)
|
6
|
+
@reps = reps
|
6
7
|
@outdatedness_store = outdatedness_store
|
7
8
|
@dependency_store = dependency_store
|
8
9
|
@action_sequences = action_sequences
|
@@ -11,7 +12,8 @@ module Nanoc::Int::Compiler::Stages
|
|
11
12
|
end
|
12
13
|
|
13
14
|
def run
|
14
|
-
|
15
|
+
outdated_reps = @reps.select { |r| @outdatedness_store.include?(r) }
|
16
|
+
selector = Nanoc::Int::ItemRepSelector.new(outdated_reps)
|
15
17
|
selector.each do |rep|
|
16
18
|
handle_errors_while(rep) { compile_rep(rep, is_outdated: @outdatedness_store.include?(rep)) }
|
17
19
|
end
|
@@ -12,16 +12,34 @@ module Nanoc::Int::Compiler::Stages
|
|
12
12
|
|
13
13
|
contract C::None => C::Any
|
14
14
|
def run
|
15
|
-
|
16
|
-
|
17
|
-
end
|
15
|
+
outdated_items = select_outdated_items
|
16
|
+
outdated_reps = reps_of_items(outdated_items)
|
18
17
|
|
19
|
-
|
20
|
-
outdated_reps = Set.new(outdated_items.flat_map { |i| @reps[i] })
|
21
|
-
|
22
|
-
outdated_reps.each { |r| @outdatedness_store.add(r) }
|
18
|
+
store_outdated_reps(outdated_reps)
|
23
19
|
|
24
20
|
outdated_items
|
25
21
|
end
|
22
|
+
|
23
|
+
private
|
24
|
+
|
25
|
+
def store_outdated_reps(reps)
|
26
|
+
@outdatedness_store.clear
|
27
|
+
reps.each { |r| @outdatedness_store.add(r) }
|
28
|
+
end
|
29
|
+
|
30
|
+
def select_outdated_items
|
31
|
+
@reps
|
32
|
+
.select { |r| outdated?(r) }
|
33
|
+
.map(&:item)
|
34
|
+
.uniq
|
35
|
+
end
|
36
|
+
|
37
|
+
def reps_of_items(items)
|
38
|
+
Set.new(items.flat_map { |i| @reps[i] })
|
39
|
+
end
|
40
|
+
|
41
|
+
def outdated?(r)
|
42
|
+
@outdatedness_store.include?(r) || @outdatedness_checker.outdated?(r)
|
43
|
+
end
|
26
44
|
end
|
27
45
|
end
|
@@ -10,9 +10,9 @@ module Nanoc::Int::Compiler::Stages
|
|
10
10
|
@reps = reps
|
11
11
|
end
|
12
12
|
|
13
|
-
contract
|
14
|
-
def run
|
15
|
-
@action_provider.postprocess(@site, @reps)
|
13
|
+
contract Nanoc::Int::Compiler => C::Any
|
14
|
+
def run(compiler)
|
15
|
+
@action_provider.postprocess(@site, compiler, @reps)
|
16
16
|
end
|
17
17
|
end
|
18
18
|
end
|
@@ -10,6 +10,8 @@ module Nanoc::Int::Compiler::Stages
|
|
10
10
|
end
|
11
11
|
|
12
12
|
def run
|
13
|
+
return if @site.preprocessed?
|
14
|
+
|
13
15
|
if @action_provider.need_preprocessing?
|
14
16
|
@site.data_source = Nanoc::Int::InMemDataSource.new(@site.items, @site.layouts)
|
15
17
|
@action_provider.preprocess(@site)
|
@@ -19,6 +21,7 @@ module Nanoc::Int::Compiler::Stages
|
|
19
21
|
@checksum_store.objects = @site.items.to_a + @site.layouts.to_a + @site.code_snippets + [@site.config]
|
20
22
|
end
|
21
23
|
|
24
|
+
@site.mark_as_preprocessed
|
22
25
|
@site.freeze
|
23
26
|
end
|
24
27
|
end
|
@@ -14,12 +14,10 @@ module Nanoc::Int
|
|
14
14
|
checksum_store =
|
15
15
|
Nanoc::Int::ChecksumStore.new(site: site, objects: objects)
|
16
16
|
|
17
|
-
item_rep_repo = Nanoc::Int::ItemRepRepo.new
|
18
|
-
|
19
17
|
action_provider ||= Nanoc::Int::ActionProvider.named(:rule_dsl).for(site)
|
20
18
|
|
21
19
|
outdatedness_store =
|
22
|
-
Nanoc::Int::OutdatednessStore.new(site: site
|
20
|
+
Nanoc::Int::OutdatednessStore.new(site: site)
|
23
21
|
|
24
22
|
compiled_content_cache =
|
25
23
|
Nanoc::Int::CompiledContentCache.new(
|
@@ -32,7 +30,6 @@ module Nanoc::Int
|
|
32
30
|
checksum_store: checksum_store,
|
33
31
|
action_sequence_store: action_sequence_store,
|
34
32
|
dependency_store: dependency_store,
|
35
|
-
reps: item_rep_repo,
|
36
33
|
action_provider: action_provider,
|
37
34
|
outdatedness_store: outdatedness_store,
|
38
35
|
}
|
data/lib/nanoc/base/views.rb
CHANGED
@@ -2,21 +2,28 @@
|
|
2
2
|
|
3
3
|
require_relative 'views/mixins/document_view_mixin'
|
4
4
|
require_relative 'views/mixins/mutable_document_view_mixin'
|
5
|
-
|
5
|
+
|
6
|
+
require_relative 'views/view_context_for_compilation'
|
7
|
+
require_relative 'views/view_context_for_pre_compilation'
|
8
|
+
require_relative 'views/view_context_for_shell'
|
6
9
|
|
7
10
|
require_relative 'views/view'
|
8
|
-
|
11
|
+
|
12
|
+
require_relative 'views/basic_item_rep_view'
|
13
|
+
require_relative 'views/basic_item_rep_collection_view'
|
14
|
+
require_relative 'views/basic_item_view'
|
15
|
+
|
16
|
+
require_relative 'views/compilation_item_rep_view'
|
17
|
+
require_relative 'views/compilation_item_rep_collection_view'
|
18
|
+
require_relative 'views/compilation_item_view'
|
9
19
|
|
10
20
|
require_relative 'views/config_view'
|
11
21
|
require_relative 'views/identifiable_collection_view'
|
12
|
-
require_relative 'views/item_without_reps_view'
|
13
|
-
require_relative 'views/item_with_reps_view'
|
14
22
|
require_relative 'views/item_collection_with_reps_view'
|
15
23
|
require_relative 'views/item_collection_without_reps_view'
|
16
|
-
require_relative 'views/item_rep_view'
|
17
|
-
require_relative 'views/item_rep_collection_view'
|
18
24
|
require_relative 'views/layout_view'
|
19
25
|
require_relative 'views/layout_collection_view'
|
26
|
+
|
20
27
|
require_relative 'views/mutable_config_view'
|
21
28
|
require_relative 'views/mutable_identifiable_collection_view'
|
22
29
|
require_relative 'views/mutable_item_view'
|
@@ -1,7 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
module Nanoc
|
4
|
-
class
|
4
|
+
class BasicItemRepCollectionView < ::Nanoc::View
|
5
5
|
include Enumerable
|
6
6
|
|
7
7
|
class NoSuchItemRepError < ::Nanoc::Error
|
@@ -23,7 +23,7 @@ module Nanoc
|
|
23
23
|
|
24
24
|
# @api private
|
25
25
|
def view_class
|
26
|
-
Nanoc::
|
26
|
+
Nanoc::BasicItemRepView
|
27
27
|
end
|
28
28
|
|
29
29
|
def to_ary
|
@@ -53,16 +53,16 @@ module Nanoc
|
|
53
53
|
#
|
54
54
|
# @return [nil] if no item rep with the given name was found
|
55
55
|
#
|
56
|
-
# @return [Nanoc::
|
56
|
+
# @return [Nanoc::BasicItemRepView] if an item rep with the given name was found
|
57
57
|
def [](rep_name)
|
58
58
|
case rep_name
|
59
59
|
when Symbol
|
60
60
|
res = @item_reps.find { |ir| ir.name == rep_name }
|
61
61
|
res && view_class.new(res, @context)
|
62
62
|
when Integer
|
63
|
-
raise ArgumentError, "expected
|
63
|
+
raise ArgumentError, "expected BasicItemRepCollectionView#[] to be called with a symbol (you likely want `.reps[:default]` rather than `.reps[#{rep_name}]`)"
|
64
64
|
else
|
65
|
-
raise ArgumentError, 'expected
|
65
|
+
raise ArgumentError, 'expected BasicItemRepCollectionView#[] to be called with a symbol'
|
66
66
|
end
|
67
67
|
end
|
68
68
|
|
@@ -71,7 +71,7 @@ module Nanoc
|
|
71
71
|
#
|
72
72
|
# @param [Symbol] rep_name
|
73
73
|
#
|
74
|
-
# @return [Nanoc::
|
74
|
+
# @return [Nanoc::BasicItemRepView]
|
75
75
|
#
|
76
76
|
# @raise if no rep was found
|
77
77
|
def fetch(rep_name)
|
@@ -1,13 +1,18 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
module Nanoc
|
4
|
-
class
|
4
|
+
class BasicItemRepView < ::Nanoc::View
|
5
5
|
# @api private
|
6
6
|
def initialize(item_rep, context)
|
7
7
|
super(context)
|
8
8
|
@item_rep = item_rep
|
9
9
|
end
|
10
10
|
|
11
|
+
# @abstract
|
12
|
+
def item_view_class
|
13
|
+
Nanoc::BasicItemView
|
14
|
+
end
|
15
|
+
|
11
16
|
# @api private
|
12
17
|
def unwrap
|
13
18
|
@item_rep
|
@@ -35,19 +40,6 @@ module Nanoc
|
|
35
40
|
@item_rep.name
|
36
41
|
end
|
37
42
|
|
38
|
-
# Returns the compiled content.
|
39
|
-
#
|
40
|
-
# @param [String] snapshot The name of the snapshot from which to
|
41
|
-
# fetch the compiled content. By default, the returned compiled content
|
42
|
-
# will be the content compiled right before the first layout call (if
|
43
|
-
# any).
|
44
|
-
#
|
45
|
-
# @return [String] The content at the given snapshot.
|
46
|
-
def compiled_content(snapshot: nil)
|
47
|
-
@context.dependency_tracker.bounce(unwrap.item, compiled_content: true)
|
48
|
-
@context.snapshot_repo.compiled_content(rep: unwrap, snapshot: snapshot)
|
49
|
-
end
|
50
|
-
|
51
43
|
def snapshot?(name)
|
52
44
|
@context.dependency_tracker.bounce(unwrap.item, compiled_content: true)
|
53
45
|
@item_rep.snapshot?(name)
|
@@ -69,22 +61,9 @@ module Nanoc
|
|
69
61
|
|
70
62
|
# Returns the item that this item rep belongs to.
|
71
63
|
#
|
72
|
-
# @return [Nanoc::
|
64
|
+
# @return [Nanoc::CompilationItemView]
|
73
65
|
def item
|
74
|
-
|
75
|
-
end
|
76
|
-
|
77
|
-
# @api private
|
78
|
-
def raw_path(snapshot: :last)
|
79
|
-
@context.dependency_tracker.bounce(unwrap.item, compiled_content: true)
|
80
|
-
|
81
|
-
res = @item_rep.raw_path(snapshot: snapshot)
|
82
|
-
|
83
|
-
unless @item_rep.compiled?
|
84
|
-
Fiber.yield(Nanoc::Int::Errors::UnmetDependency.new(@item_rep))
|
85
|
-
end
|
86
|
-
|
87
|
-
res
|
66
|
+
item_view_class.new(@item_rep.item, @context)
|
88
67
|
end
|
89
68
|
|
90
69
|
# @api private
|
@@ -1,13 +1,13 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
module Nanoc
|
4
|
-
class
|
4
|
+
class BasicItemView < ::Nanoc::View
|
5
5
|
include Nanoc::DocumentViewMixin
|
6
6
|
|
7
7
|
# Returns the children of this item. For items with identifiers that have
|
8
8
|
# extensions, returns an empty collection.
|
9
9
|
#
|
10
|
-
# @return [Enumerable<Nanoc::
|
10
|
+
# @return [Enumerable<Nanoc::CompilationItemView>]
|
11
11
|
def children
|
12
12
|
unless unwrap.identifier.legacy?
|
13
13
|
raise Nanoc::Int::Errors::CannotGetParentOrChildrenOfNonLegacyItem.new(unwrap.identifier)
|
@@ -22,7 +22,7 @@ module Nanoc
|
|
22
22
|
# Returns the parent of this item, if one exists. For items with identifiers
|
23
23
|
# that have extensions, returns nil.
|
24
24
|
#
|
25
|
-
# @return [Nanoc::
|
25
|
+
# @return [Nanoc::CompilationItemView] if the item has a parent
|
26
26
|
#
|
27
27
|
# @return [nil] if the item has no parent
|
28
28
|
def parent
|
@@ -0,0 +1,42 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Nanoc
|
4
|
+
class CompilationItemRepView < ::Nanoc::BasicItemRepView
|
5
|
+
# @abstract
|
6
|
+
def item_view_class
|
7
|
+
Nanoc::CompilationItemView
|
8
|
+
end
|
9
|
+
|
10
|
+
# Returns the item rep’s raw path. It includes the path to the output
|
11
|
+
# directory and the full filename.
|
12
|
+
#
|
13
|
+
# @param [Symbol] snapshot The snapshot for which the path should be
|
14
|
+
# returned.
|
15
|
+
#
|
16
|
+
# @return [String] The item rep’s raw path.
|
17
|
+
def raw_path(snapshot: :last)
|
18
|
+
@context.dependency_tracker.bounce(unwrap.item, compiled_content: true)
|
19
|
+
|
20
|
+
res = @item_rep.raw_path(snapshot: snapshot)
|
21
|
+
|
22
|
+
unless @item_rep.compiled?
|
23
|
+
Fiber.yield(Nanoc::Int::Errors::UnmetDependency.new(@item_rep))
|
24
|
+
end
|
25
|
+
|
26
|
+
res
|
27
|
+
end
|
28
|
+
|
29
|
+
# Returns the compiled content.
|
30
|
+
#
|
31
|
+
# @param [String] snapshot The name of the snapshot from which to
|
32
|
+
# fetch the compiled content. By default, the returned compiled content
|
33
|
+
# will be the content compiled right before the first layout call (if
|
34
|
+
# any).
|
35
|
+
#
|
36
|
+
# @return [String] The content at the given snapshot.
|
37
|
+
def compiled_content(snapshot: nil)
|
38
|
+
@context.dependency_tracker.bounce(unwrap.item, compiled_content: true)
|
39
|
+
@context.snapshot_repo.compiled_content(rep: unwrap, snapshot: snapshot)
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
@@ -1,7 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
module Nanoc
|
4
|
-
|
4
|
+
class CompilationItemView < ::Nanoc::BasicItemView
|
5
5
|
# Returns the compiled content.
|
6
6
|
#
|
7
7
|
# @param [String] rep The name of the representation
|
@@ -37,9 +37,9 @@ module Nanoc
|
|
37
37
|
|
38
38
|
# Returns the representations of this item.
|
39
39
|
#
|
40
|
-
# @return [Nanoc::
|
40
|
+
# @return [Nanoc::BasicItemRepCollectionView]
|
41
41
|
def reps
|
42
|
-
Nanoc::
|
42
|
+
Nanoc::CompilationItemRepCollectionView.new(@context.reps[unwrap], @context)
|
43
43
|
end
|
44
44
|
end
|
45
45
|
end
|