nanoc 4.6.1 → 4.6.2

Sign up to get free protection for your applications and to get access to all the features.
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
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 3215906d4c407f3712161bcf4464b5b5358e50c8
4
- data.tar.gz: 1e3877875fd5f931ab99fce68ff6c1130acd2936
3
+ metadata.gz: cb5ae7fdab33a2274afd361558045fdac7c5c2f9
4
+ data.tar.gz: 636a45cd39ba85dc37c2fc6abbb43af2e6e98e16
5
5
  SHA512:
6
- metadata.gz: 34b4e72944f26ee705b66ab40367528a78733ee623bd580656d385e9a71f0b4d125dd334c356699723390c82e214064fc85a627865e52414737a4141705af294
7
- data.tar.gz: f1772e11403f7ffc7b62e1421a63c59c87c2024f448d61ddc4eb7c5c838dd6a576d40580eb4a8fcf502603bdbd54906a33981d28af30e9e761bac3b8dbfdac67
6
+ metadata.gz: 98f9a4d6fb54b47bdee2a1c4bef5f7fc141daa1d63d28048076596ce5b88959b5522d1000898873256e46b06b4693f9049bad09809e198110b0ec755c43bfd54
7
+ data.tar.gz: bec451e9af2fa9782c224df87f53629e6e4a3d9dc715d7cc145ce467c813bf33d221adf6a540b063e8ad7a0febf13dcee0a4f619ac096305e2ce60edb038e693
data/Appraisals CHANGED
@@ -8,4 +8,4 @@ appraise 'rouge-2' do
8
8
  group :plugins do
9
9
  gem 'rouge', '~> 2.0'
10
10
  end
11
- end
11
+ end
data/Gemfile.lock CHANGED
@@ -1,6 +1,6 @@
1
1
  GIT
2
- remote: git://github.com/bbatsov/rubocop.git
3
- revision: 1c0cf571afc608229c3116fa6f66dd480e395772
2
+ remote: https://github.com/bbatsov/rubocop.git
3
+ revision: c52c7ea94d1d99f2d384f562b36dbed0f546f628
4
4
  specs:
5
5
  rubocop (0.47.1)
6
6
  parser (>= 2.3.3.1, < 3.0)
@@ -10,7 +10,7 @@ GIT
10
10
  unicode-display_width (~> 1.0, >= 1.0.1)
11
11
 
12
12
  GIT
13
- remote: git://github.com/cowboyd/therubyracer.git
13
+ remote: https://github.com/cowboyd/therubyracer.git
14
14
  revision: 466a1f0d4f696acfe971899272359623ec0a7a97
15
15
  specs:
16
16
  therubyracer (0.12.3)
@@ -18,7 +18,7 @@ GIT
18
18
  ref
19
19
 
20
20
  GIT
21
- remote: git://github.com/tmm1/pygments.rb.git
21
+ remote: https://github.com/tmm1/pygments.rb.git
22
22
  revision: cf50cbeda48e8a242ef9cba9467e092935730f66
23
23
  specs:
24
24
  pygments.rb (1.1.1)
@@ -27,7 +27,7 @@ GIT
27
27
  PATH
28
28
  remote: .
29
29
  specs:
30
- nanoc (4.6.1)
30
+ nanoc (4.6.2)
31
31
  cri (~> 2.3)
32
32
  ddplugin (~> 1.0)
33
33
  hamster (~> 3.0)
@@ -69,8 +69,8 @@ GEM
69
69
  sass (>= 3.3.0, < 3.5)
70
70
  compass-import-once (1.0.5)
71
71
  sass (>= 3.2, < 3.5)
72
- concurrent-ruby (1.0.4)
73
- contracts (0.14.0)
72
+ concurrent-ruby (1.0.5)
73
+ contracts (0.15.0)
74
74
  coveralls (0.8.19)
75
75
  json (>= 1.8, < 3)
76
76
  simplecov (~> 0.12.0)
@@ -81,13 +81,13 @@ GEM
81
81
  safe_yaml (~> 1.0.0)
82
82
  cri (2.7.1)
83
83
  colored (~> 1.2)
84
- ddplugin (1.0.0)
84
+ ddplugin (1.0.1)
85
85
  diff-lcs (1.3)
86
86
  docile (1.1.5)
87
87
  erubis (2.7.0)
88
- excon (0.54.0)
88
+ excon (0.55.0)
89
89
  execjs (2.7.0)
90
- ffi (1.9.17)
90
+ ffi (1.9.18)
91
91
  fission (0.5.0)
92
92
  CFPropertyList (~> 2.2)
93
93
  fog (1.38.0)
@@ -127,7 +127,7 @@ GEM
127
127
  fog-atmos (0.1.0)
128
128
  fog-core
129
129
  fog-xml
130
- fog-aws (1.2.0)
130
+ fog-aws (1.2.1)
131
131
  fog-core (~> 1.38)
132
132
  fog-json (~> 1.0)
133
133
  fog-xml (~> 0.1)
@@ -161,7 +161,7 @@ GEM
161
161
  multi_json (~> 1.10)
162
162
  fog-local (0.3.1)
163
163
  fog-core (~> 1.27)
164
- fog-openstack (0.1.19)
164
+ fog-openstack (0.1.20)
165
165
  fog-core (>= 1.40)
166
166
  fog-json (>= 1.0)
167
167
  ipaddress (>= 0.8)
@@ -206,10 +206,10 @@ GEM
206
206
  fog-voxel (0.1.0)
207
207
  fog-core
208
208
  fog-xml
209
- fog-vsphere (1.7.0)
209
+ fog-vsphere (1.7.1)
210
210
  fog-core
211
211
  rbvmomi (~> 1.9)
212
- fog-xenserver (0.2.3)
212
+ fog-xenserver (0.3.0)
213
213
  fog-core
214
214
  fog-xml
215
215
  fog-xml (0.1.2)
@@ -276,7 +276,7 @@ GEM
276
276
  nenv (~> 0.1)
277
277
  shellany (~> 0.0)
278
278
  pandoc-ruby (2.0.1)
279
- parser (2.3.3.1)
279
+ parser (2.4.0.0)
280
280
  ast (~> 2.2)
281
281
  powerpack (0.1.1)
282
282
  pry (0.10.4)
@@ -286,18 +286,18 @@ GEM
286
286
  public_suffix (2.0.5)
287
287
  rack (2.0.1)
288
288
  rainbow (2.2.1)
289
- rainpress (1.0)
289
+ rainpress (1.0.1)
290
290
  rake (12.0.0)
291
291
  rb-fsevent (0.9.8)
292
292
  rb-inotify (0.9.8)
293
293
  ffi (>= 0.5.0)
294
- rbvmomi (1.9.4)
295
- builder (~> 3.2)
294
+ rbvmomi (1.9.5)
295
+ builder (~> 3.0)
296
296
  json (>= 1.8)
297
297
  nokogiri (~> 1.5)
298
298
  trollop (~> 2.1)
299
299
  rdiscount (2.2.0.1)
300
- rdoc (5.0.0)
300
+ rdoc (5.1.0)
301
301
  redcarpet (3.4.0)
302
302
  ref (2.0.0)
303
303
  rouge (2.0.7)
@@ -338,11 +338,11 @@ GEM
338
338
  thor (0.19.4)
339
339
  tilt (2.0.6)
340
340
  timecop (0.8.1)
341
- tins (1.13.0)
341
+ tins (1.13.2)
342
342
  trollop (2.1.2)
343
343
  typogruby (1.0.18)
344
344
  rubypants
345
- uglifier (3.0.4)
345
+ uglifier (3.1.3)
346
346
  execjs (>= 0.3.0, < 3)
347
347
  unicode-display_width (1.1.3)
348
348
  vcr (3.0.3)
@@ -425,4 +425,4 @@ DEPENDENCIES
425
425
  yuicompressor
426
426
 
427
427
  BUNDLED WITH
428
- 1.14.3
428
+ 1.14.5
data/NEWS.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # Nanoc news
2
2
 
3
+ ## 4.6.2 (2017-03-04)
4
+
5
+ Fixes:
6
+
7
+ * Fixed crash in `#binary?` (#1082, #1083, #1084)
8
+ * Fixed issue which would cause the file referenced by `#raw_path` not to exist (#1097, #1099)
9
+
10
+ Enhancements:
11
+
12
+ * Allowed calling `#write` multiple times in the same rule (#1037, #1085)
13
+ * Changed the `html` check to use validator.nu (#1104)
14
+
3
15
  ## 4.6.1 (2017-01-29)
4
16
 
5
17
  Fixes:
@@ -64,6 +64,13 @@ module Nanoc
64
64
  self
65
65
  end
66
66
 
67
+ contract String => self
68
+ def with_identifier_prefix(prefix)
69
+ other = dup
70
+ other.identifier = @identifier.prefix(prefix)
71
+ other
72
+ end
73
+
67
74
  contract C::None => String
68
75
  # @abstract
69
76
  #
@@ -8,14 +8,15 @@ module Nanoc::Int
8
8
 
9
9
  def_delegator :@objects, :each
10
10
  def_delegator :@objects, :size
11
- def_delegator :@objects, :<<
12
- def_delegator :@objects, :concat
13
11
 
14
- contract C::Or[Hash, C::Named['Nanoc::Int::Configuration']] => C::Any
15
- def initialize(config)
12
+ contract C::Or[Hash, C::Named['Nanoc::Int::Configuration']], C::IterOf[C::RespondTo[:identifier]] => C::Any
13
+ def initialize(config, objects = [])
16
14
  @config = config
15
+ @objects = objects
16
+ end
17
17
 
18
- @objects = []
18
+ def self.from(enum, config)
19
+ new(config, enum)
19
20
  end
20
21
 
21
22
  contract C::None => self
@@ -50,10 +51,12 @@ module Nanoc::Int
50
51
  @objects.empty?
51
52
  end
52
53
 
53
- contract C::Func[C::RespondTo[:identifier] => C::Bool] => self
54
- def delete_if(&block)
55
- @objects.delete_if(&block)
56
- self
54
+ def add(obj)
55
+ self.class.new(@config, @objects + [obj])
56
+ end
57
+
58
+ def reject(&block)
59
+ self.class.new(@config, @objects.reject(&block))
57
60
  end
58
61
 
59
62
  protected
@@ -3,33 +3,30 @@ module Nanoc::Int
3
3
  class ItemRep
4
4
  include Nanoc::Int::ContractsSupport
5
5
 
6
- # @return [Boolean]
6
+ contract C::None => C::Bool
7
7
  attr_accessor :compiled
8
8
  alias compiled? compiled
9
9
 
10
- # @return [Hash<Symbol,String>]
11
- attr_accessor :raw_paths
10
+ contract C::None => C::HashOf[Symbol => C::IterOf[String]]
11
+ attr_reader :raw_paths
12
12
 
13
- # @return [Hash<Symbol,String>]
14
- attr_accessor :paths
13
+ contract C::None => C::HashOf[Symbol => C::IterOf[String]]
14
+ attr_reader :paths
15
15
 
16
- # @return [Nanoc::Int::Item]
16
+ contract C::None => Nanoc::Int::Item
17
17
  attr_reader :item
18
18
 
19
- # @return [Symbol]
19
+ contract C::None => Symbol
20
20
  attr_reader :name
21
21
 
22
- # @return [Enumerable<Nanoc::Int:SnapshotDef]
22
+ contract C::None => C::IterOf[C::Named['Nanoc::Int::SnapshotDef']]
23
23
  attr_accessor :snapshot_defs
24
24
 
25
- # @return [Boolean]
25
+ contract C::None => C::Bool
26
26
  attr_accessor :modified
27
27
  alias modified? modified
28
28
 
29
29
  contract Nanoc::Int::Item, Symbol => C::Any
30
- # @param [Nanoc::Int::Item] item
31
- #
32
- # @param [Symbol] name
33
30
  def initialize(item, name)
34
31
  # Set primary attributes
35
32
  @item = item
@@ -42,6 +39,19 @@ module Nanoc::Int
42
39
 
43
40
  # Reset flags
44
41
  @compiled = false
42
+ @modified = false
43
+ end
44
+
45
+ contract C::HashOf[Symbol => C::IterOf[String]] => self
46
+ def raw_paths=(val)
47
+ @raw_paths = val
48
+ self
49
+ end
50
+
51
+ contract C::HashOf[Symbol => C::IterOf[String]] => self
52
+ def paths=(val)
53
+ @paths = val
54
+ self
45
55
  end
46
56
 
47
57
  contract Symbol => C::Bool
@@ -52,13 +62,8 @@ module Nanoc::Int
52
62
  contract C::KeywordArgs[snapshot: C::Optional[Symbol]] => C::Maybe[String]
53
63
  # Returns the item rep’s raw path. It includes the path to the output
54
64
  # directory and the full filename.
55
- #
56
- # @param [Symbol] snapshot The snapshot for which the path should be
57
- # returned
58
- #
59
- # @return [String] The item rep’s path
60
65
  def raw_path(snapshot: :last)
61
- @raw_paths[snapshot]
66
+ @raw_paths.fetch(snapshot, []).first
62
67
  end
63
68
 
64
69
  contract C::KeywordArgs[snapshot: C::Optional[Symbol]] => C::Maybe[String]
@@ -66,20 +71,11 @@ module Nanoc::Int
66
71
  # with a slash and it is relative to the output directory. It does not
67
72
  # include the path to the output directory. It will not include the
68
73
  # filename if the filename is an index filename.
69
- #
70
- # @param [Symbol] snapshot The snapshot for which the path should be
71
- # returned
72
- #
73
- # @return [String] The item rep’s path
74
74
  def path(snapshot: :last)
75
- @paths[snapshot]
75
+ @paths.fetch(snapshot, []).first
76
76
  end
77
77
 
78
78
  # Returns an object that can be used for uniquely identifying objects.
79
- #
80
- # @api private
81
- #
82
- # @return [Object] An unique reference to this object
83
79
  def reference
84
80
  [:item_rep, item.identifier, name]
85
81
  end
@@ -3,26 +3,30 @@ module Nanoc::Int::ProcessingActions
3
3
  # snapshot :before_layout
4
4
  # snapshot :before_layout, path: '/about.md'
5
5
 
6
- attr_reader :snapshot_name
7
- attr_reader :path
6
+ include Nanoc::Int::ContractsSupport
8
7
 
9
- def initialize(snapshot_name, path)
10
- @snapshot_name = snapshot_name
11
- @path = path
8
+ attr_reader :snapshot_names
9
+ attr_reader :paths
10
+
11
+ contract C::IterOf[Symbol], C::IterOf[String] => C::Any
12
+ def initialize(snapshot_names, paths)
13
+ @snapshot_names = snapshot_names
14
+ @paths = paths
12
15
  end
13
16
 
17
+ contract C::None => Array
14
18
  def serialize
15
- [:snapshot, @snapshot_name, true, @path]
19
+ [:snapshot, @snapshot_names, true, @paths]
16
20
  end
17
21
 
18
- NONE = Object.new
19
-
20
- def copy(path: NONE)
21
- self.class.new(@snapshot_name, path.equal?(NONE) ? @path : path)
22
+ contract C::KeywordArgs[snapshot_names: C::Optional[C::IterOf[Symbol]], paths: C::Optional[C::IterOf[String]]] => self
23
+ def update(snapshot_names: [], paths: [])
24
+ self.class.new(@snapshot_names + snapshot_names, @paths + paths)
22
25
  end
23
26
 
27
+ contract C::None => String
24
28
  def to_s
25
- "snapshot #{@snapshot_name.inspect}, path: #{@path.inspect}"
29
+ "snapshot #{@snapshot_names.inspect}, paths: #{@paths.inspect}"
26
30
  end
27
31
  end
28
32
  end
@@ -33,7 +33,7 @@ module Nanoc::Int
33
33
  contract Symbol, C::Maybe[String] => self
34
34
  def add_snapshot(snapshot_name, path)
35
35
  will_add_snapshot(snapshot_name)
36
- @actions << Nanoc::Int::ProcessingActions::Snapshot.new(snapshot_name, path)
36
+ @actions << Nanoc::Int::ProcessingActions::Snapshot.new([snapshot_name], path ? [path] : [])
37
37
  self
38
38
  end
39
39
 
@@ -47,11 +47,9 @@ module Nanoc::Int
47
47
  @actions.any? { |a| a.is_a?(Nanoc::Int::ProcessingActions::Layout) }
48
48
  end
49
49
 
50
- contract C::None => Hash
50
+ contract C::None => Array
51
51
  def paths
52
- snapshot_actions.each_with_object({}) do |action, paths|
53
- paths[action.snapshot_name] = action.path
54
- end
52
+ snapshot_actions.map { |a| [a.snapshot_names, a.paths] }
55
53
  end
56
54
 
57
55
  # TODO: Add contract
@@ -73,6 +71,18 @@ module Nanoc::Int
73
71
  )
74
72
  end
75
73
 
74
+ def compact_snapshots
75
+ actions = []
76
+ @actions.each do |action|
77
+ if [actions.last, action].all? { |a| a.is_a?(Nanoc::Int::ProcessingActions::Snapshot) }
78
+ actions[-1] = actions.last.update(snapshot_names: action.snapshot_names, paths: action.paths)
79
+ else
80
+ actions << action
81
+ end
82
+ end
83
+ self.class.new(@item_rep, actions: actions)
84
+ end
85
+
76
86
  private
77
87
 
78
88
  def will_add_snapshot(name)
@@ -3,17 +3,19 @@ module Nanoc::Int
3
3
  class Site
4
4
  include Nanoc::Int::ContractsSupport
5
5
 
6
+ attr_reader :code_snippets
7
+ attr_reader :config
8
+ attr_accessor :data_source
6
9
  attr_accessor :compiler
7
10
 
8
- contract C::KeywordArgs[config: Nanoc::Int::Configuration, code_snippets: C::IterOf[Nanoc::Int::CodeSnippet], items: C::IterOf[Nanoc::Int::Item], layouts: C::IterOf[Nanoc::Int::Layout]] => C::Any
9
- def initialize(config:, code_snippets:, items:, layouts:)
11
+ contract C::KeywordArgs[config: Nanoc::Int::Configuration, code_snippets: C::IterOf[Nanoc::Int::CodeSnippet], data_source: C::Maybe[C::Named['Nanoc::DataSource']]] => C::Any
12
+ def initialize(config:, code_snippets:, data_source:)
10
13
  @config = config
11
14
  @code_snippets = code_snippets
12
- @items = items
13
- @layouts = layouts
15
+ @data_source = data_source
14
16
 
15
- ensure_identifier_uniqueness(@items, 'item')
16
- ensure_identifier_uniqueness(@layouts, 'layout')
17
+ ensure_identifier_uniqueness(@data_source.items, 'item')
18
+ ensure_identifier_uniqueness(@data_source.layouts, 'layout')
17
19
  end
18
20
 
19
21
  contract C::None => self
@@ -27,10 +29,13 @@ module Nanoc::Int
27
29
  @compiler ||= Nanoc::Int::CompilerLoader.new.load(self)
28
30
  end
29
31
 
30
- attr_reader :code_snippets
31
- attr_reader :config
32
- attr_reader :items
33
- attr_reader :layouts
32
+ def items
33
+ @data_source.items
34
+ end
35
+
36
+ def layouts
37
+ @data_source.layouts
38
+ end
34
39
 
35
40
  contract C::None => self
36
41
  def freeze