nanoc 4.8.9 → 4.8.10

Sign up to get free protection for your applications and to get access to all the features.
Files changed (113) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +6 -4
  3. data/Gemfile +2 -1
  4. data/NEWS.md +7 -0
  5. data/README.md +1 -1
  6. data/lib/nanoc.rb +2 -6
  7. data/lib/nanoc/base/entities/site.rb +9 -5
  8. data/lib/nanoc/base/repos/data_source.rb +0 -15
  9. data/lib/nanoc/base/repos/outdatedness_store.rb +17 -15
  10. data/lib/nanoc/base/services/compilation_context.rb +4 -4
  11. data/lib/nanoc/base/services/compiler.rb +102 -103
  12. data/lib/nanoc/base/services/compiler/stages/build_reps.rb +7 -7
  13. data/lib/nanoc/base/services/compiler/stages/compile_reps.rb +4 -2
  14. data/lib/nanoc/base/services/compiler/stages/determine_outdatedness.rb +25 -7
  15. data/lib/nanoc/base/services/compiler/stages/postprocess.rb +3 -3
  16. data/lib/nanoc/base/services/compiler/stages/preprocess.rb +3 -0
  17. data/lib/nanoc/base/services/compiler_loader.rb +1 -4
  18. data/lib/nanoc/base/views.rb +13 -6
  19. data/lib/nanoc/base/views/{item_rep_collection_view.rb → basic_item_rep_collection_view.rb} +6 -6
  20. data/lib/nanoc/base/views/{item_rep_view.rb → basic_item_rep_view.rb} +8 -29
  21. data/lib/nanoc/base/views/{item_without_reps_view.rb → basic_item_view.rb} +3 -3
  22. data/lib/nanoc/base/views/compilation_item_rep_collection_view.rb +10 -0
  23. data/lib/nanoc/base/views/compilation_item_rep_view.rb +42 -0
  24. data/lib/nanoc/base/views/{mixins/with_reps_view_mixin.rb → compilation_item_view.rb} +3 -3
  25. data/lib/nanoc/base/views/item_collection_with_reps_view.rb +1 -1
  26. data/lib/nanoc/base/views/item_collection_without_reps_view.rb +1 -1
  27. data/lib/nanoc/base/views/mixins/mutable_document_view_mixin.rb +1 -1
  28. data/lib/nanoc/base/views/mutable_item_view.rb +1 -1
  29. data/lib/nanoc/base/views/post_compile_item_rep_collection_view.rb +1 -1
  30. data/lib/nanoc/base/views/post_compile_item_rep_view.rb +7 -2
  31. data/lib/nanoc/base/views/post_compile_item_view.rb +1 -1
  32. data/lib/nanoc/base/views/{view_context.rb → view_context_for_compilation.rb} +10 -1
  33. data/lib/nanoc/base/views/view_context_for_pre_compilation.rb +18 -0
  34. data/lib/nanoc/base/views/view_context_for_shell.rb +23 -0
  35. data/lib/nanoc/checking/check.rb +5 -1
  36. data/lib/nanoc/checking/runner.rb +1 -1
  37. data/lib/nanoc/cli.rb +1 -0
  38. data/lib/nanoc/cli/command_runner.rb +1 -7
  39. data/lib/nanoc/cli/commands/check.rb +2 -2
  40. data/lib/nanoc/cli/commands/compile.rb +8 -47
  41. data/lib/nanoc/cli/commands/compile_listeners/abstract.rb +9 -0
  42. data/lib/nanoc/cli/commands/compile_listeners/aggregate.rb +49 -0
  43. data/lib/nanoc/cli/commands/deploy.rb +2 -1
  44. data/lib/nanoc/cli/commands/prune.rb +5 -4
  45. data/lib/nanoc/cli/commands/shell.rb +4 -6
  46. data/lib/nanoc/cli/commands/show-data.rb +20 -27
  47. data/lib/nanoc/cli/commands/show-rules.rb +20 -22
  48. data/lib/nanoc/cli/error_handler.rb +0 -17
  49. data/lib/nanoc/data_sources/filesystem.rb +4 -2
  50. data/lib/nanoc/deploying/deployers/fog.rb +4 -1
  51. data/lib/nanoc/helpers/link_to.rb +1 -1
  52. data/lib/nanoc/rule_dsl/action_provider.rb +8 -11
  53. data/lib/nanoc/rule_dsl/action_sequence_calculator.rb +14 -5
  54. data/lib/nanoc/rule_dsl/recording_executor.rb +4 -0
  55. data/lib/nanoc/rule_dsl/rule.rb +14 -9
  56. data/lib/nanoc/rule_dsl/rule_context.rb +4 -4
  57. data/lib/nanoc/spec.rb +27 -19
  58. data/lib/nanoc/version.rb +1 -1
  59. data/spec/nanoc/base/checksummer_spec.rb +19 -11
  60. data/spec/nanoc/base/compiler_spec.rb +18 -14
  61. data/spec/nanoc/base/filter_spec.rb +7 -6
  62. data/spec/nanoc/base/repos/outdatedness_store_spec.rb +3 -32
  63. data/spec/nanoc/base/services/compiler/stages/compile_reps_spec.rb +2 -1
  64. data/spec/nanoc/base/services/compiler/stages/determine_outdatedness_spec.rb +148 -0
  65. data/spec/nanoc/base/services/compiler/stages/preprocess_spec.rb +110 -0
  66. data/spec/nanoc/base/services/executor_spec.rb +6 -6
  67. data/spec/nanoc/base/views/basic_item_rep_collection_view_spec.rb +8 -0
  68. data/spec/nanoc/base/views/basic_item_rep_view_spec.rb +9 -0
  69. data/spec/nanoc/base/views/compilation_item_rep_collection_view_spec.rb +8 -0
  70. data/spec/nanoc/base/views/compilation_item_rep_view_spec.rb +136 -0
  71. data/spec/nanoc/base/views/config_view_spec.rb +5 -5
  72. data/spec/nanoc/base/views/item_collection_with_reps_view_spec.rb +4 -2
  73. data/spec/nanoc/base/views/item_collection_without_reps_view_spec.rb +4 -2
  74. data/spec/nanoc/base/views/item_view_spec.rb +13 -11
  75. data/spec/nanoc/base/views/layout_collection_view_spec.rb +3 -1
  76. data/spec/nanoc/base/views/layout_view_spec.rb +3 -1
  77. data/spec/nanoc/base/views/mutable_item_collection_view_spec.rb +5 -2
  78. data/spec/nanoc/base/views/mutable_item_view_spec.rb +2 -0
  79. data/spec/nanoc/base/views/mutable_layout_collection_view_spec.rb +5 -2
  80. data/spec/nanoc/base/views/mutable_layout_view_spec.rb +2 -0
  81. data/spec/nanoc/base/views/post_compile_item_rep_collection_view_spec.rb +2 -0
  82. data/spec/nanoc/base/views/post_compile_item_rep_view_spec.rb +9 -3
  83. data/spec/nanoc/base/views/{document_view_spec.rb → support/document_view_examples.rb} +5 -5
  84. data/spec/nanoc/base/views/{identifiable_collection_view_spec.rb → support/identifiable_collection_view_examples.rb} +4 -4
  85. data/spec/nanoc/base/views/{item_rep_collection_view_spec.rb → support/item_rep_collection_view_examples.rb} +3 -8
  86. data/spec/nanoc/base/views/{item_rep_view_spec.rb → support/item_rep_view_examples.rb} +10 -111
  87. data/spec/nanoc/base/views/{mutable_document_view_spec.rb → support/mutable_document_view_examples.rb} +7 -6
  88. data/spec/nanoc/base/views/{mutable_identifiable_collection_view_spec.rb → support/mutable_identifiable_collection_view_examples.rb} +1 -1
  89. data/spec/nanoc/cli/commands/compile/abstract_spec.rb +80 -0
  90. data/spec/nanoc/cli/commands/compile_spec.rb +30 -51
  91. data/spec/nanoc/cli/commands/show_data_spec.rb +2 -23
  92. data/spec/nanoc/cli/commands/show_rules_spec.rb +4 -2
  93. data/spec/nanoc/regressions/gh_767_spec.rb +1 -1
  94. data/spec/nanoc/regressions/gh_776_spec.rb +2 -1
  95. data/spec/nanoc/rule_dsl/action_sequence_calculator_spec.rb +25 -12
  96. data/spec/nanoc/rule_dsl/rule_context_spec.rb +16 -6
  97. data/test/base/test_data_source.rb +0 -18
  98. data/test/checking/checks/test_external_links.rb +4 -6
  99. data/test/checking/checks/test_internal_links.rb +6 -9
  100. data/test/cli/commands/test_compile.rb +0 -35
  101. data/test/cli/test_cleaning_stream.rb +1 -1
  102. data/test/data_sources/test_filesystem.rb +16 -0
  103. data/test/filters/test_kramdown.rb +4 -4
  104. data/test/filters/test_sass.rb +1 -1
  105. data/test/filters/test_slim.rb +7 -5
  106. data/test/filters/test_xsl.rb +10 -8
  107. data/test/helpers/test_blogging.rb +5 -5
  108. data/test/helpers/test_capturing.rb +8 -6
  109. data/test/helpers/test_link_to.rb +4 -4
  110. data/test/helpers/test_xml_sitemap.rb +19 -19
  111. metadata +25 -15
  112. data/lib/nanoc/base/views/item_with_reps_view.rb +0 -7
  113. data/spec/nanoc/base/core_ext/pathname_spec.rb +0 -0
@@ -1,9 +1,14 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Nanoc
4
- class PostCompileItemRepView < ::Nanoc::ItemRepView
4
+ class PostCompileItemRepView < ::Nanoc::BasicItemRepView
5
+ def item_view_class
6
+ Nanoc::PostCompileItemView
7
+ end
8
+
5
9
  def compiled_content(snapshot: nil)
6
- snapshot_contents = @context.compilation_context.compiled_content_cache[unwrap]
10
+ compilation_context = @context.compilation_context
11
+ snapshot_contents = compilation_context.compiled_content_cache[unwrap]
7
12
 
8
13
  snapshot_name = snapshot || (snapshot_contents[:pre] ? :pre : :last)
9
14
 
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Nanoc
4
- class PostCompileItemView < Nanoc::ItemWithRepsView
4
+ class PostCompileItemView < Nanoc::CompilationItemView
5
5
  def reps
6
6
  Nanoc::PostCompileItemRepCollectionView.new(@context.reps[unwrap], @context)
7
7
  end
@@ -2,13 +2,22 @@
2
2
 
3
3
  module Nanoc
4
4
  # @api private
5
- class ViewContext
5
+ class ViewContextForCompilation
6
+ include Nanoc::Int::ContractsSupport
7
+
6
8
  attr_reader :reps
7
9
  attr_reader :items
8
10
  attr_reader :dependency_tracker
9
11
  attr_reader :compilation_context
10
12
  attr_reader :snapshot_repo
11
13
 
14
+ contract C::KeywordArgs[
15
+ reps: Nanoc::Int::ItemRepRepo,
16
+ items: Nanoc::Int::IdentifiableCollection,
17
+ dependency_tracker: C::Any,
18
+ compilation_context: C::Any,
19
+ snapshot_repo: C::Any,
20
+ ] => C::Any
12
21
  def initialize(reps:, items:, dependency_tracker:, compilation_context:, snapshot_repo:)
13
22
  @reps = reps
14
23
  @items = items
@@ -0,0 +1,18 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Nanoc
4
+ # @api private
5
+ class ViewContextForPreCompilation
6
+ include Nanoc::Int::ContractsSupport
7
+
8
+ attr_reader :items
9
+ attr_reader :dependency_tracker
10
+
11
+ contract C::KeywordArgs[items: Nanoc::Int::IdentifiableCollection] => C::Any
12
+ def initialize(items:)
13
+ @items = items
14
+
15
+ @dependency_tracker = Nanoc::Int::DependencyTracker::Null.new
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,23 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Nanoc
4
+ # @api private
5
+ class ViewContextForShell
6
+ include Nanoc::Int::ContractsSupport
7
+
8
+ attr_reader :items
9
+ attr_reader :reps
10
+ attr_reader :dependency_tracker
11
+
12
+ contract C::KeywordArgs[
13
+ items: Nanoc::Int::IdentifiableCollection,
14
+ reps: Nanoc::Int::ItemRepRepo,
15
+ ] => C::Any
16
+ def initialize(items:, reps:)
17
+ @items = items
18
+ @reps = reps
19
+
20
+ @dependency_tracker = Nanoc::Int::DependencyTracker::Null.new
21
+ end
22
+ end
23
+ end
@@ -22,7 +22,11 @@ module Nanoc::Checking
22
22
  output_filenames = Dir[output_dir + '/**/*'].select { |f| File.file?(f) }
23
23
 
24
24
  # FIXME: ugly
25
- view_context = site.compiler.compilation_context.create_view_context(Nanoc::Int::DependencyTracker::Null.new)
25
+ compiler = Nanoc::Int::Compiler.new_for(site)
26
+ res = compiler.run_until_reps_built
27
+ reps = res.fetch(:reps)
28
+ compilation_context = compiler.compilation_context(reps: reps)
29
+ view_context = compilation_context.create_view_context(Nanoc::Int::DependencyTracker::Null.new)
26
30
 
27
31
  context = {
28
32
  items: Nanoc::PostCompileItemCollectionView.new(site.items, view_context),
@@ -111,7 +111,7 @@ module Nanoc::Checking
111
111
  return [] if classes.empty?
112
112
 
113
113
  # TODO: remove me
114
- @site.compiler.build_reps
114
+ Nanoc::Int::Compiler.new_for(@site).run_until_reps_built
115
115
 
116
116
  checks = []
117
117
  issues = Set.new
@@ -26,6 +26,7 @@ require_relative 'cli/commands/compile_listeners/debug_printer'
26
26
  require_relative 'cli/commands/compile_listeners/diff_generator'
27
27
  require_relative 'cli/commands/compile_listeners/file_action_printer'
28
28
  require_relative 'cli/commands/compile_listeners/timing_recorder'
29
+ require_relative 'cli/commands/compile_listeners/aggregate'
29
30
 
30
31
  # @api private
31
32
  module Nanoc::CLI
@@ -50,20 +50,14 @@ module Nanoc::CLI
50
50
  # Asserts that the current working directory contains a site and loads the site into memory.
51
51
  #
52
52
  # @return [void]
53
- def load_site(preprocess: false)
53
+ def load_site
54
54
  self.class.enter_site_dir
55
55
 
56
56
  $stderr.print 'Loading site… '
57
57
  $stderr.flush
58
-
59
58
  site = Nanoc::Int::SiteLoader.new.new_from_cwd
60
59
 
61
- if preprocess
62
- site.compiler.action_provider.preprocess(site)
63
- end
64
-
65
60
  $stderr.puts 'done'
66
-
67
61
  site
68
62
  end
69
63
 
@@ -14,9 +14,9 @@ module Nanoc::CLI::Commands
14
14
  class Check < ::Nanoc::CLI::CommandRunner
15
15
  def run
16
16
  validate_options_and_arguments
17
- @site = load_site(preprocess: true)
17
+ site = load_site
18
18
 
19
- runner = Nanoc::Checking::Runner.new(@site)
19
+ runner = Nanoc::Checking::Runner.new(site)
20
20
 
21
21
  if options[:list]
22
22
  runner.list_checks
@@ -11,65 +11,26 @@ module Nanoc::CLI::Commands
11
11
  class Compile < ::Nanoc::CLI::CommandRunner
12
12
  attr_accessor :listener_classes
13
13
 
14
- def initialize(options, arguments, command)
15
- super
16
- @listener_classes = default_listener_classes
17
- end
18
-
19
14
  def run
20
15
  time_before = Time.now
21
16
 
22
17
  @site = load_site
23
18
 
24
19
  puts 'Compiling site…'
25
- run_listeners_while do
26
- @site.compile
20
+ compiler = Nanoc::Int::Compiler.new_for(@site)
21
+ listener = Nanoc::CLI::Commands::CompileListeners::Aggregate.new(
22
+ command_runner: self,
23
+ site: @site,
24
+ compiler: compiler,
25
+ )
26
+ listener.run_while do
27
+ compiler.run_until_end
27
28
  end
28
29
 
29
30
  time_after = Time.now
30
31
  puts
31
32
  puts "Site compiled in #{format('%.2f', time_after - time_before)}s."
32
33
  end
33
-
34
- protected
35
-
36
- def default_listener_classes
37
- [
38
- Nanoc::CLI::Commands::CompileListeners::DiffGenerator,
39
- Nanoc::CLI::Commands::CompileListeners::DebugPrinter,
40
- Nanoc::CLI::Commands::CompileListeners::TimingRecorder,
41
- Nanoc::CLI::Commands::CompileListeners::FileActionPrinter,
42
- ]
43
- end
44
-
45
- def setup_listeners
46
- @listeners =
47
- @listener_classes
48
- .select { |klass| klass.enable_for?(self, @site) }
49
- .map { |klass| klass.new(reps: reps) }
50
-
51
- @listeners.each(&:start_safely)
52
- end
53
-
54
- def listeners
55
- @listeners
56
- end
57
-
58
- def run_listeners_while
59
- setup_listeners
60
- yield
61
- ensure
62
- teardown_listeners
63
- end
64
-
65
- def teardown_listeners
66
- return unless @listeners
67
- @listeners.reverse_each(&:stop_safely)
68
- end
69
-
70
- def reps
71
- @site.compiler.reps
72
- end
73
34
  end
74
35
  end
75
36
 
@@ -8,12 +8,21 @@ module Nanoc::CLI::Commands::CompileListeners
8
8
  true
9
9
  end
10
10
 
11
+ # @abstract
11
12
  def start
12
13
  raise NotImplementedError, "Subclasses of #{self.class} must implement #start"
13
14
  end
14
15
 
16
+ # @abstract
15
17
  def stop; end
16
18
 
19
+ def run_while
20
+ start
21
+ yield
22
+ ensure
23
+ stop
24
+ end
25
+
17
26
  def start_safely
18
27
  start
19
28
  @_started = true
@@ -0,0 +1,49 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Nanoc::CLI::Commands::CompileListeners
4
+ class Aggregate < Abstract
5
+ def initialize(command_runner:, site:, compiler:)
6
+ @site = site
7
+ @compiler = compiler
8
+ @command_runner = command_runner
9
+
10
+ @listener_classes = self.class.default_listener_classes
11
+ end
12
+
13
+ def start
14
+ setup_listeners
15
+ end
16
+
17
+ def stop
18
+ teardown_listeners
19
+ end
20
+
21
+ def self.default_listener_classes
22
+ [
23
+ Nanoc::CLI::Commands::CompileListeners::DiffGenerator,
24
+ Nanoc::CLI::Commands::CompileListeners::DebugPrinter,
25
+ Nanoc::CLI::Commands::CompileListeners::TimingRecorder,
26
+ Nanoc::CLI::Commands::CompileListeners::FileActionPrinter,
27
+ ]
28
+ end
29
+
30
+ protected
31
+
32
+ def setup_listeners
33
+ res = @compiler.run_until_reps_built
34
+ reps = res.fetch(:reps)
35
+
36
+ @listeners =
37
+ @listener_classes
38
+ .select { |klass| klass.enable_for?(@command_runner, @site) }
39
+ .map { |klass| klass.new(reps: reps) }
40
+
41
+ @listeners.each(&:start_safely)
42
+ end
43
+
44
+ def teardown_listeners
45
+ return unless @listeners
46
+ @listeners.reverse_each(&:stop_safely)
47
+ end
48
+ end
49
+ end
@@ -15,7 +15,8 @@ option :n, :'dry-run', 'show what would be deployed'
15
15
  module Nanoc::CLI::Commands
16
16
  class Deploy < ::Nanoc::CLI::CommandRunner
17
17
  def run
18
- @site = load_site(preprocess: true)
18
+ @site = load_site
19
+ Nanoc::Int::Compiler.new_for(@site).run_until_preprocessed
19
20
 
20
21
  if options[:'list-deployers']
21
22
  list_deployers
@@ -17,13 +17,14 @@ flag :n, :'dry-run', 'print files to be deleted instead of actually deleting the
17
17
  module Nanoc::CLI::Commands
18
18
  class Prune < ::Nanoc::CLI::CommandRunner
19
19
  def run
20
- @site = load_site(preprocess: true)
21
- @site.compiler.build_reps
20
+ @site = load_site
21
+ res = Nanoc::Int::Compiler.new_for(@site).run_until_reps_built
22
+ reps = res.fetch(:reps)
22
23
 
23
24
  if options.key?(:yes)
24
- Nanoc::Pruner.new(@site.config, @site.compiler.reps, exclude: prune_config_exclude).run
25
+ Nanoc::Pruner.new(@site.config, reps, exclude: prune_config_exclude).run
25
26
  elsif options.key?(:'dry-run')
26
- Nanoc::Pruner.new(@site.config, @site.compiler.reps, exclude: prune_config_exclude, dry_run: true).run
27
+ Nanoc::Pruner.new(@site.config, reps, exclude: prune_config_exclude, dry_run: true).run
27
28
  else
28
29
  $stderr.puts 'WARNING: Since the prune command is a destructive command, it requires an additional --yes flag in order to work.'
29
30
  $stderr.puts
@@ -13,7 +13,8 @@ module Nanoc::CLI::Commands
13
13
  def run
14
14
  require 'pry'
15
15
 
16
- @site = load_site(preprocess: options[:preprocess])
16
+ @site = load_site
17
+ Nanoc::Int::Compiler.new_for(@site).run_until_preprocessed if options[:preprocess]
17
18
 
18
19
  Nanoc::Int::Context.new(env).pry
19
20
  end
@@ -31,12 +32,9 @@ module Nanoc::CLI::Commands
31
32
  end
32
33
 
33
34
  def self.view_context_for(site)
34
- Nanoc::ViewContext.new(
35
- reps: reps_for(site),
35
+ Nanoc::ViewContextForShell.new(
36
36
  items: site.items,
37
- dependency_tracker: Nanoc::Int::DependencyTracker::Null.new,
38
- compilation_context: nil,
39
- snapshot_repo: nil,
37
+ reps: reps_for(site),
40
38
  )
41
39
  end
42
40
 
@@ -11,25 +11,20 @@ EOS
11
11
  module Nanoc::CLI::Commands
12
12
  class ShowData < ::Nanoc::CLI::CommandRunner
13
13
  def run
14
- @site = load_site(preprocess: true)
14
+ site = load_site
15
+ res = Nanoc::Int::Compiler.new_for(site).run_until_precompiled
15
16
 
16
- # Get data
17
- items = @site.items
18
- layouts = @site.layouts
19
-
20
- # Get dependency tracker
21
- compiler = @site.compiler
22
- compiler.load_stores
23
- dependency_store = compiler.dependency_store
24
-
25
- # Build reps
26
- compiler.build_reps
17
+ items = site.items
18
+ layouts = site.layouts
19
+ reps = res.fetch(:reps)
20
+ dependency_store = res.fetch(:dependency_store)
21
+ outdatedness_checker = res.fetch(:outdatedness_checker)
27
22
 
28
23
  # Print data
29
24
  print_item_dependencies(items, dependency_store)
30
- print_item_rep_paths(items)
31
- print_item_rep_outdatedness(items, compiler)
32
- print_layouts(layouts, compiler)
25
+ print_item_rep_paths(items, reps)
26
+ print_item_rep_outdatedness(items, outdatedness_checker, reps)
27
+ print_layouts(layouts, outdatedness_checker)
33
28
  end
34
29
 
35
30
  protected
@@ -42,10 +37,10 @@ module Nanoc::CLI::Commands
42
37
  end
43
38
  end
44
39
 
45
- def sorted_reps_with_prev(items)
40
+ def sorted_reps_with_prev(items, reps)
46
41
  prev = nil
47
42
  items.sort_by(&:identifier).each do |item|
48
- @site.compiler.reps[item].sort_by { |r| r.name.to_s }.each do |rep|
43
+ reps[item].sort_by { |r| r.name.to_s }.each do |rep|
49
44
  yield(rep, prev)
50
45
  prev = rep
51
46
  end
@@ -131,10 +126,10 @@ module Nanoc::CLI::Commands
131
126
  end
132
127
  end
133
128
 
134
- def print_item_rep_paths(items)
129
+ def print_item_rep_paths(items, reps)
135
130
  print_header('Item representation paths')
136
131
 
137
- sorted_reps_with_prev(items) do |rep, prev|
132
+ sorted_reps_with_prev(items, reps) do |rep, prev|
138
133
  puts if prev
139
134
  puts "item #{rep.item.identifier}, rep #{rep.name}:"
140
135
  if rep.raw_paths.empty?
@@ -149,29 +144,27 @@ module Nanoc::CLI::Commands
149
144
  end
150
145
  end
151
146
 
152
- def print_item_rep_outdatedness(items, compiler)
147
+ def print_item_rep_outdatedness(items, outdatedness_checker, reps)
153
148
  print_header('Item representation outdatedness')
154
149
 
155
- sorted_reps_with_prev(items) do |rep, prev|
150
+ sorted_reps_with_prev(items, reps) do |rep, prev|
156
151
  puts if prev
157
152
  puts "item #{rep.item.identifier}, rep #{rep.name}:"
158
- print_outdatedness_reasons_for(rep, compiler)
153
+ print_outdatedness_reasons_for(rep, outdatedness_checker)
159
154
  end
160
155
  end
161
156
 
162
- def print_layouts(layouts, compiler)
157
+ def print_layouts(layouts, outdatedness_checker)
163
158
  print_header('Layouts')
164
159
 
165
160
  sorted_with_prev(layouts) do |layout, prev|
166
161
  puts if prev
167
162
  puts "layout #{layout.identifier}:"
168
- print_outdatedness_reasons_for(layout, compiler)
163
+ print_outdatedness_reasons_for(layout, outdatedness_checker)
169
164
  end
170
165
  end
171
166
 
172
- def print_outdatedness_reasons_for(obj, compiler)
173
- compiler.calculate_checksums
174
- outdatedness_checker = compiler.create_outdatedness_checker
167
+ def print_outdatedness_reasons_for(obj, outdatedness_checker)
175
168
  reasons = outdatedness_checker.outdatedness_reasons_for(obj)
176
169
  if reasons.any?
177
170
  puts ' is outdated:'