nanoc 4.6.1 → 4.6.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (96) hide show
  1. checksums.yaml +4 -4
  2. data/Appraisals +1 -1
  3. data/Gemfile.lock +22 -22
  4. data/NEWS.md +12 -0
  5. data/lib/nanoc/base/entities/document.rb +7 -0
  6. data/lib/nanoc/base/entities/identifiable_collection.rb +12 -9
  7. data/lib/nanoc/base/entities/item_rep.rb +24 -28
  8. data/lib/nanoc/base/entities/processing_actions/snapshot.rb +15 -11
  9. data/lib/nanoc/base/entities/rule_memory.rb +15 -5
  10. data/lib/nanoc/base/entities/site.rb +15 -10
  11. data/lib/nanoc/base/entities/snapshot_def.rb +8 -2
  12. data/lib/nanoc/base/repos.rb +3 -0
  13. data/lib/nanoc/base/repos/aggregate_data_source.rb +20 -0
  14. data/lib/nanoc/base/repos/in_mem_data_source.rb +13 -0
  15. data/lib/nanoc/base/repos/prefixed_data_source.rb +19 -0
  16. data/lib/nanoc/base/repos/site_loader.rb +8 -16
  17. data/lib/nanoc/base/repos/snapshot_repo.rb +10 -5
  18. data/lib/nanoc/base/services/action_provider.rb +12 -0
  19. data/lib/nanoc/base/services/compiler/phases/recalculate.rb +5 -2
  20. data/lib/nanoc/base/services/compiler/phases/write.rb +1 -3
  21. data/lib/nanoc/base/services/compiler/stages/preprocess.rb +6 -3
  22. data/lib/nanoc/base/services/executor.rb +2 -4
  23. data/lib/nanoc/base/services/filter.rb +7 -12
  24. data/lib/nanoc/base/services/item_rep_router.rb +40 -16
  25. data/lib/nanoc/base/services/item_rep_writer.rb +19 -3
  26. data/lib/nanoc/base/services/pruner.rb +1 -1
  27. data/lib/nanoc/base/views/item_rep_view.rb +12 -3
  28. data/lib/nanoc/base/views/mutable_identifiable_collection_view.rb +1 -1
  29. data/lib/nanoc/base/views/mutable_item_collection_view.rb +1 -1
  30. data/lib/nanoc/base/views/mutable_layout_collection_view.rb +1 -1
  31. data/lib/nanoc/checking/checks/html.rb +1 -1
  32. data/lib/nanoc/checking/checks/stale.rb +2 -1
  33. data/lib/nanoc/checking/checks/w3c_validator.rb +1 -0
  34. data/lib/nanoc/cli/commands/compile.rb +3 -2
  35. data/lib/nanoc/cli/commands/show-data.rb +4 -2
  36. data/lib/nanoc/data_sources/filesystem.rb +1 -1
  37. data/lib/nanoc/helpers/filtering.rb +1 -2
  38. data/lib/nanoc/helpers/rendering.rb +1 -2
  39. data/lib/nanoc/helpers/xml_sitemap.rb +2 -2
  40. data/lib/nanoc/rule_dsl/action_provider.rb +7 -0
  41. data/lib/nanoc/rule_dsl/rule_context.rb +4 -1
  42. data/lib/nanoc/rule_dsl/rule_memory_calculator.rb +33 -13
  43. data/lib/nanoc/spec.rb +5 -6
  44. data/lib/nanoc/version.rb +1 -1
  45. data/spec/nanoc/base/checksummer_spec.rb +19 -9
  46. data/spec/nanoc/base/compiler_spec.rb +4 -8
  47. data/spec/nanoc/base/entities/document_spec.rb +20 -0
  48. data/spec/nanoc/base/entities/identifiable_collection_spec.rb +12 -0
  49. data/spec/nanoc/base/entities/item_rep_spec.rb +1 -1
  50. data/spec/nanoc/base/entities/processing_actions/snapshot_spec.rb +19 -13
  51. data/spec/nanoc/base/entities/rule_memory_spec.rb +39 -3
  52. data/spec/nanoc/base/entities/site_spec.rb +15 -10
  53. data/spec/nanoc/base/filter_spec.rb +28 -1
  54. data/spec/nanoc/base/item_rep_writer_spec.rb +4 -2
  55. data/spec/nanoc/base/repos/outdatedness_store_spec.rb +1 -2
  56. data/spec/nanoc/base/repos/snapshot_repo_spec.rb +4 -4
  57. data/spec/nanoc/base/repos/store_spec.rb +5 -1
  58. data/spec/nanoc/base/services/compiler/stages/compile_reps_spec.rb +9 -10
  59. data/spec/nanoc/base/services/executor_spec.rb +2 -2
  60. data/spec/nanoc/base/services/item_rep_router_spec.rb +83 -39
  61. data/spec/nanoc/base/services/outdatedness_checker_spec.rb +1 -2
  62. data/spec/nanoc/base/services/outdatedness_rules_spec.rb +2 -3
  63. data/spec/nanoc/base/services/pruner_spec.rb +2 -2
  64. data/spec/nanoc/base/views/identifiable_collection_view_spec.rb +46 -28
  65. data/spec/nanoc/base/views/item_rep_view_spec.rb +72 -15
  66. data/spec/nanoc/base/views/item_view_spec.rb +20 -14
  67. data/spec/nanoc/base/views/mutable_identifiable_collection_view_spec.rb +10 -4
  68. data/spec/nanoc/base/views/mutable_item_collection_view_spec.rb +10 -5
  69. data/spec/nanoc/base/views/mutable_layout_collection_view_spec.rb +10 -5
  70. data/spec/nanoc/cli/commands/compile/file_action_printer_spec.rb +1 -1
  71. data/spec/nanoc/cli/commands/compile/timing_recorder_spec.rb +1 -1
  72. data/spec/nanoc/cli/commands/show_data_spec.rb +9 -7
  73. data/spec/nanoc/cli/commands/show_rules_spec.rb +16 -10
  74. data/spec/nanoc/regressions/gh_1037a_spec.rb +29 -0
  75. data/spec/nanoc/regressions/gh_1037b_spec.rb +18 -0
  76. data/spec/nanoc/regressions/gh_1082a_spec.rb +18 -0
  77. data/spec/nanoc/regressions/gh_1082b_spec.rb +20 -0
  78. data/spec/nanoc/regressions/gh_1082c_spec.rb +19 -0
  79. data/spec/nanoc/regressions/gh_1082d_spec.rb +17 -0
  80. data/spec/nanoc/regressions/gh_1093_spec.rb +49 -0
  81. data/spec/nanoc/regressions/gh_1097_spec.rb +21 -0
  82. data/spec/nanoc/regressions/gh_1100_spec.rb +20 -0
  83. data/spec/nanoc/regressions/gh_1102_spec.rb +26 -0
  84. data/spec/nanoc/regressions/gh_776_spec.rb +1 -5
  85. data/spec/nanoc/rule_dsl/recording_executor_spec.rb +14 -14
  86. data/spec/nanoc/rule_dsl/rule_context_spec.rb +22 -13
  87. data/spec/nanoc/rule_dsl/rule_memory_calculator_spec.rb +38 -54
  88. data/spec/spec_helper.rb +1 -1
  89. data/test/base/test_compiler.rb +3 -4
  90. data/test/base/test_item_array.rb +4 -15
  91. data/test/checking/checks/test_html.rb +4 -3
  92. data/test/cli/commands/test_compile.rb +2 -2
  93. data/test/filters/test_relativize_paths.rb +28 -28
  94. data/test/fixtures/vcr_cassettes/html_run_error.yml +25 -76
  95. data/test/helpers/test_xml_sitemap.rb +22 -19
  96. metadata +16 -2
@@ -4,10 +4,16 @@ module Nanoc
4
4
  include Nanoc::Int::ContractsSupport
5
5
 
6
6
  attr_reader :name
7
+ attr_reader :binary
7
8
 
8
- contract Symbol => C::Any
9
- def initialize(name)
9
+ contract Symbol, C::KeywordArgs[binary: C::Optional[C::Bool]] => C::Any
10
+ def initialize(name, binary:)
10
11
  @name = name
12
+ @binary = binary
13
+ end
14
+
15
+ def binary?
16
+ @binary
11
17
  end
12
18
  end
13
19
  end
@@ -10,3 +10,6 @@ require_relative 'repos/outdatedness_store'
10
10
  require_relative 'repos/rule_memory_store'
11
11
  require_relative 'repos/site_loader'
12
12
  require_relative 'repos/snapshot_repo'
13
+ require_relative 'repos/in_mem_data_source'
14
+ require_relative 'repos/aggregate_data_source'
15
+ require_relative 'repos/prefixed_data_source'
@@ -0,0 +1,20 @@
1
+ module Nanoc::Int
2
+ class AggregateDataSource < Nanoc::DataSource
3
+ def initialize(data_sources, config)
4
+ super({}, '/', '/', {})
5
+
6
+ @data_sources = data_sources
7
+ @config = config
8
+ end
9
+
10
+ def items
11
+ objs = @data_sources.flat_map(&:items)
12
+ @_items ||= Nanoc::Int::IdentifiableCollection.from(objs, @config)
13
+ end
14
+
15
+ def layouts
16
+ objs = @data_sources.flat_map(&:layouts)
17
+ @_layouts ||= Nanoc::Int::IdentifiableCollection.from(objs, @config)
18
+ end
19
+ end
20
+ end
@@ -0,0 +1,13 @@
1
+ module Nanoc::Int
2
+ class InMemDataSource < Nanoc::DataSource
3
+ attr_reader :items
4
+ attr_reader :layouts
5
+
6
+ def initialize(items, layouts)
7
+ super({}, '/', '/', {})
8
+
9
+ @items = items
10
+ @layouts = layouts
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,19 @@
1
+ module Nanoc::Int
2
+ class PrefixedDataSource < Nanoc::DataSource
3
+ def initialize(data_source, items_prefix, layouts_prefix)
4
+ super({}, '/', '/', {})
5
+
6
+ @data_source = data_source
7
+ @items_prefix = items_prefix
8
+ @layouts_prefix = layouts_prefix
9
+ end
10
+
11
+ def items
12
+ @data_source.items.map { |d| d.with_identifier_prefix(@items_prefix) }
13
+ end
14
+
15
+ def layouts
16
+ @data_source.layouts.map { |d| d.with_identifier_prefix(@layouts_prefix) }
17
+ end
18
+ end
19
+ end
@@ -23,27 +23,19 @@ module Nanoc::Int
23
23
  code_snippets = code_snippets_from_config(config)
24
24
  code_snippets.each(&:load)
25
25
 
26
- items = Nanoc::Int::IdentifiableCollection.new(config)
27
- layouts = Nanoc::Int::IdentifiableCollection.new(config)
28
-
29
- with_data_sources(config) do |data_sources|
30
- data_sources.each do |ds|
31
- items_in_ds = ds.items
32
- layouts_in_ds = ds.layouts
33
-
34
- items_in_ds.each { |i| i.identifier = i.identifier.prefix(ds.items_root) }
35
- layouts_in_ds.each { |l| l.identifier = l.identifier.prefix(ds.layouts_root) }
36
-
37
- items.concat(items_in_ds)
38
- layouts.concat(layouts_in_ds)
26
+ data_sources_to_aggregate =
27
+ with_data_sources(config) do |data_sources|
28
+ data_sources.map do |ds|
29
+ Nanoc::Int::PrefixedDataSource.new(ds, ds.items_root, ds.layouts_root)
30
+ end
39
31
  end
40
- end
32
+
33
+ data_source = Nanoc::Int::AggregateDataSource.new(data_sources_to_aggregate, config)
41
34
 
42
35
  Nanoc::Int::Site.new(
43
36
  config: config,
44
37
  code_snippets: code_snippets,
45
- items: items,
46
- layouts: layouts,
38
+ data_source: data_source,
47
39
  )
48
40
  end
49
41
 
@@ -29,8 +29,8 @@ module Nanoc::Int
29
29
  @contents[rep] = contents_per_snapshot
30
30
  end
31
31
 
32
- contract C::KeywordArgs[rep: Nanoc::Int::ItemRep, snapshot: C::Optional[C::Maybe[Symbol]]] => String
33
- def compiled_content(rep:, snapshot: nil)
32
+ contract C::KeywordArgs[rep: Nanoc::Int::ItemRep, snapshot: C::Optional[C::Maybe[Symbol]]] => Nanoc::Int::Content
33
+ def raw_compiled_content(rep:, snapshot: nil)
34
34
  # Get name of last pre-layout snapshot
35
35
  snapshot_name = snapshot || (get(rep, :pre) ? :pre : :last)
36
36
 
@@ -45,11 +45,16 @@ module Nanoc::Int
45
45
  is_usable_snapshot = get(rep, snapshot_name) && stopped_moving
46
46
  unless is_usable_snapshot
47
47
  Fiber.yield(Nanoc::Int::Errors::UnmetDependency.new(rep))
48
- return compiled_content(rep: rep, snapshot: snapshot)
48
+ return raw_compiled_content(rep: rep, snapshot: snapshot)
49
49
  end
50
50
 
51
- # Verify snapshot is not binary
52
- snapshot_content = get(rep, snapshot_name)
51
+ get(rep, snapshot_name)
52
+ end
53
+
54
+ contract C::KeywordArgs[rep: Nanoc::Int::ItemRep, snapshot: C::Optional[C::Maybe[Symbol]]] => String
55
+ def compiled_content(rep:, snapshot: nil)
56
+ snapshot_content = raw_compiled_content(rep: rep, snapshot: snapshot)
57
+
53
58
  if snapshot_content.binary?
54
59
  raise Nanoc::Int::Errors::CannotGetCompiledContentOfBinaryItem.new(rep)
55
60
  end
@@ -22,5 +22,17 @@ module Nanoc::Int
22
22
  def paths_for(rep)
23
23
  memory_for(rep).paths
24
24
  end
25
+
26
+ def need_preprocessing?
27
+ raise NotImplementedError
28
+ end
29
+
30
+ def preprocess(_site)
31
+ raise NotImplementedError
32
+ end
33
+
34
+ def postprocess(_site, _reps)
35
+ raise NotImplementedError
36
+ end
25
37
  end
26
38
  end
@@ -19,14 +19,17 @@ module Nanoc::Int::Compiler::Phases
19
19
 
20
20
  @compilation_context.snapshot_repo.set(rep, :last, rep.item.content)
21
21
 
22
- @action_provider.memory_for(rep).each do |action|
22
+ actions = @action_provider.memory_for(rep)
23
+ actions.each do |action|
23
24
  case action
24
25
  when Nanoc::Int::ProcessingActions::Filter
25
26
  executor.filter(action.filter_name, action.params)
26
27
  when Nanoc::Int::ProcessingActions::Layout
27
28
  executor.layout(action.layout_identifier, action.params)
28
29
  when Nanoc::Int::ProcessingActions::Snapshot
29
- executor.snapshot(action.snapshot_name)
30
+ action.snapshot_names.each do |snapshot_name|
31
+ executor.snapshot(snapshot_name)
32
+ end
30
33
  else
31
34
  raise Nanoc::Int::Errors::InternalInconsistency, "unknown action #{action.inspect}"
32
35
  end
@@ -11,9 +11,7 @@ module Nanoc::Int::Compiler::Phases
11
11
  def run(rep, is_outdated:)
12
12
  @wrapped.run(rep, is_outdated: is_outdated)
13
13
 
14
- rep.snapshot_defs.each do |sdef|
15
- Nanoc::Int::ItemRepWriter.new.write(rep, @snapshot_repo, sdef.name)
16
- end
14
+ Nanoc::Int::ItemRepWriter.new.write_all(rep, @snapshot_repo)
17
15
  end
18
16
  end
19
17
  end
@@ -8,10 +8,13 @@ module Nanoc::Int::Compiler::Stages
8
8
  end
9
9
 
10
10
  def run
11
- @action_provider.preprocess(@site)
11
+ if @action_provider.need_preprocessing?
12
+ @site.data_source = Nanoc::Int::InMemDataSource.new(@site.items, @site.layouts)
13
+ @action_provider.preprocess(@site)
12
14
 
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
+ @dependency_store.objects = @site.items.to_a + @site.layouts.to_a
16
+ @checksum_store.objects = @site.items.to_a + @site.layouts.to_a + @site.code_snippets + [@site.config]
17
+ end
15
18
 
16
19
  @site.freeze
17
20
  end
@@ -57,8 +57,7 @@ module Nanoc
57
57
  raise Nanoc::Int::Errors::CannotLayoutBinaryItem.new(@rep) if last.binary?
58
58
 
59
59
  # Create filter
60
- klass = Nanoc::Filter.named(filter_name)
61
- raise Nanoc::Int::Errors::UnknownFilter.new(filter_name) if klass.nil?
60
+ klass = Nanoc::Filter.named!(filter_name)
62
61
  view_context = @compilation_context.create_view_context(@dependency_tracker)
63
62
  layout_view = Nanoc::LayoutView.new(layout, view_context)
64
63
  filter = klass.new(assigns_for(@rep).merge(layout: layout_view))
@@ -110,8 +109,7 @@ module Nanoc
110
109
  end
111
110
 
112
111
  def filter_for_filtering(rep, filter_name)
113
- klass = Nanoc::Filter.named(filter_name)
114
- raise Nanoc::Int::Errors::UnknownFilter.new(filter_name) if klass.nil?
112
+ klass = Nanoc::Filter.named!(filter_name)
115
113
 
116
114
  last = @compilation_context.snapshot_repo.get(@rep, :last)
117
115
  if klass.from_binary? && !last.binary?
@@ -45,6 +45,12 @@ module Nanoc
45
45
  end
46
46
  end
47
47
 
48
+ def named!(name)
49
+ klass = named(name)
50
+ raise Nanoc::Int::Errors::UnknownFilter.new(name) if klass.nil?
51
+ klass
52
+ end
53
+
48
54
  # Sets the new type for the filter. The type can be `:binary` (default)
49
55
  # or `:text`. The given argument can either be a symbol indicating both
50
56
  # “from” and “to” types, or a hash where the only key is the “from” type
@@ -195,18 +201,7 @@ module Nanoc
195
201
  #
196
202
  # @return [void]
197
203
  def depend_on(items)
198
- orig_items = items
199
- items = items.map { |i| i.is_a?(Nanoc::ItemWithRepsView) ? i.unwrap : i }
200
-
201
- # Notify
202
- dependency_tracker = @assigns[:item]._context.dependency_tracker
203
- items.each { |item| dependency_tracker.bounce(item, compiled_content: true) }
204
-
205
- # Raise unmet dependency error if necessary
206
- items.each do |item|
207
- rep = orig_items.sample._context.reps[item].find { |r| !r.compiled? }
208
- Fiber.yield(Nanoc::Int::Errors::UnmetDependency.new(rep)) if rep
209
- end
204
+ items.flat_map(&:reps).flat_map(&:raw_path)
210
205
  end
211
206
  end
212
207
  end
@@ -3,6 +3,8 @@ module Nanoc::Int
3
3
  #
4
4
  # @api private
5
5
  class ItemRepRouter
6
+ include Nanoc::Int::ContractsSupport
7
+
6
8
  class IdenticalRoutesError < ::Nanoc::Error
7
9
  def initialize(output_path, rep_a, rep_b)
8
10
  super("The item representations #{rep_a.inspect} and #{rep_b.inspect} are both routed to #{output_path}.")
@@ -22,34 +24,56 @@ module Nanoc::Int
22
24
  end
23
25
 
24
26
  def run
25
- paths_to_reps = {}
27
+ assigned_paths = {}
26
28
  @reps.each do |rep|
27
- @action_provider.paths_for(rep).each do |snapshot_name, path|
28
- route_rep(rep, path, snapshot_name, paths_to_reps)
29
+ # Sigh. We route reps twice, because the first time, the paths might not have converged
30
+ # yet. This isn’t ideal, but it’s the only way to work around the divergence issues that
31
+ # I can think of. For details, see
32
+ # https://github.com/nanoc/nanoc/pull/1085#issuecomment-280628426.
33
+
34
+ @action_provider.paths_for(rep).each do |(snapshot_names, paths)|
35
+ route_rep(rep, paths, snapshot_names, {})
29
36
  end
37
+
38
+ @action_provider.paths_for(rep).each do |(snapshot_names, paths)|
39
+ route_rep(rep, paths, snapshot_names, assigned_paths)
40
+ end
41
+
42
+ # TODO: verify that paths converge
30
43
  end
31
44
  end
32
45
 
33
- def route_rep(rep, path, snapshot_name, paths_to_reps)
34
- basic_path = path
35
- return if basic_path.nil?
36
- basic_path = basic_path.encode('UTF-8')
46
+ contract Nanoc::Int::ItemRep, C::IterOf[String], C::IterOf[Symbol], C::HashOf[String => Nanoc::Int::ItemRep] => C::Any
47
+ def route_rep(rep, paths, snapshot_names, assigned_paths)
48
+ # Encode
49
+ paths = paths.map { |path| path.encode('UTF-8') }
37
50
 
38
- unless basic_path.start_with?('/')
39
- raise RouteWithoutSlashError.new(basic_path, rep)
51
+ # Validate format
52
+ paths.each do |path|
53
+ unless path.start_with?('/')
54
+ raise RouteWithoutSlashError.new(path, rep)
55
+ end
40
56
  end
41
57
 
42
- # Check for duplicate paths
43
- if paths_to_reps.key?(basic_path)
44
- raise IdenticalRoutesError.new(basic_path, paths_to_reps[basic_path], rep)
45
- else
46
- paths_to_reps[basic_path] = rep
58
+ # Validate uniqueness
59
+ paths.each do |path|
60
+ if assigned_paths.include?(path)
61
+ # TODO: Include snapshot names in error message
62
+ raise IdenticalRoutesError.new(path, assigned_paths[path], rep)
63
+ end
64
+ end
65
+ paths.each do |path|
66
+ assigned_paths[path] = rep
47
67
  end
48
68
 
49
- rep.raw_paths[snapshot_name] = @site.config[:output_dir] + basic_path
50
- rep.paths[snapshot_name] = strip_index_filename(basic_path)
69
+ # Assign
70
+ snapshot_names.each do |snapshot_name|
71
+ rep.raw_paths[snapshot_name] = paths.map { |path| @site.config[:output_dir] + path }
72
+ rep.paths[snapshot_name] = paths.map { |path| strip_index_filename(path) }
73
+ end
51
74
  end
52
75
 
76
+ contract String => String
53
77
  def strip_index_filename(basic_path)
54
78
  @site.config[:index_filenames].each do |index_filename|
55
79
  slashed_index_filename = '/' + index_filename
@@ -3,9 +3,25 @@ module Nanoc::Int
3
3
  class ItemRepWriter
4
4
  TMP_TEXT_ITEMS_DIR = 'text_items'.freeze
5
5
 
6
- def write(item_rep, snapshot_repo, snapshot_name)
7
- raw_path = item_rep.raw_path(snapshot: snapshot_name)
8
- return unless raw_path
6
+ def write_all(item_rep, snapshot_repo)
7
+ written_paths = Set.new
8
+
9
+ item_rep.snapshot_defs.map(&:name).each do |snapshot_name|
10
+ write(item_rep, snapshot_repo, snapshot_name, written_paths)
11
+ end
12
+ end
13
+
14
+ def write(item_rep, snapshot_repo, snapshot_name, written_paths)
15
+ item_rep.raw_paths.fetch(snapshot_name, []).each do |raw_path|
16
+ write_single(item_rep, snapshot_repo, snapshot_name, raw_path, written_paths)
17
+ end
18
+ end
19
+
20
+ def write_single(item_rep, snapshot_repo, snapshot_name, raw_path, written_paths)
21
+ # Don’t write twice
22
+ # TODO: test written_paths behavior
23
+ return if written_paths.include?(raw_path)
24
+ written_paths << raw_path
9
25
 
10
26
  # Create parent directory
11
27
  FileUtils.mkdir_p(File.dirname(raw_path))
@@ -28,7 +28,7 @@ module Nanoc
28
28
  def run
29
29
  return unless File.directory?(@config[:output_dir])
30
30
 
31
- compiled_files = @reps.flat_map { |r| r.raw_paths.values }.compact
31
+ compiled_files = @reps.flat_map { |r| r.raw_paths.values.flatten }.compact
32
32
  present_files, present_dirs = files_and_dirs_in(@config[:output_dir] + '/')
33
33
 
34
34
  remove_stray_files(present_files, compiled_files)
@@ -74,13 +74,22 @@ module Nanoc
74
74
 
75
75
  # @api private
76
76
  def raw_path(snapshot: :last)
77
- @context.dependency_tracker.bounce(unwrap.item, path: true)
78
- @item_rep.raw_path(snapshot: snapshot)
77
+ @context.dependency_tracker.bounce(unwrap.item, compiled_content: true)
78
+
79
+ res = @item_rep.raw_path(snapshot: snapshot)
80
+
81
+ unless @item_rep.compiled?
82
+ Fiber.yield(Nanoc::Int::Errors::UnmetDependency.new(@item_rep))
83
+ end
84
+
85
+ res
79
86
  end
80
87
 
81
88
  # @api private
82
89
  def binary?
83
- @context.snapshot_repo.get(unwrap, :last).binary?
90
+ snapshot_def = unwrap.snapshot_defs.find { |sd| sd.name == :last }
91
+ raise Nanoc::Int::Errors::NoSuchSnapshot.new(unwrap, :last) if snapshot_def.nil?
92
+ snapshot_def.binary?
84
93
  end
85
94
 
86
95
  def inspect
@@ -8,7 +8,7 @@ module Nanoc
8
8
  #
9
9
  # @return [self]
10
10
  def delete_if(&_block)
11
- @objects.delete_if { |o| yield(view_class.new(o, @context)) }
11
+ @objects = @objects.reject { |o| yield(view_class.new(o, @context)) }
12
12
  self
13
13
  end
14
14
  end
@@ -23,7 +23,7 @@ module Nanoc
23
23
  # @return [self]
24
24
  def create(content, attributes, identifier, binary: false, filename: nil)
25
25
  content = Nanoc::Int::Content.create(content, binary: binary, filename: filename)
26
- @objects << Nanoc::Int::Item.new(content, attributes, identifier)
26
+ @objects = @objects.add(Nanoc::Int::Item.new(content, attributes, identifier))
27
27
  self
28
28
  end
29
29
  end