nanoc 4.11.4 → 4.11.5

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f85541e423de2233c7f25fe59e834db564e8bc0e5930c1ba019dceac4a8e031b
4
- data.tar.gz: bdb60e52d7503d860ea5e3b8056d267d7e0c13611e210988f4bc604a227c7215
3
+ metadata.gz: 33e67e26b0ffd077aa8a4c28ecf16e992f75486e70d8695868b166b789ad2a66
4
+ data.tar.gz: 9b09738037843e30d6c3c947825c5b2c3cdfeb9597e398534c97c6036a50adaa
5
5
  SHA512:
6
- metadata.gz: 3ce2694d3d47c3e2ed2ba3ed947cbc989b53fdacc2209ca81a555bc40e5768c8d57cb745b7ffe30dd1bf296e0428117d5be9602dd1770c85243fad4f7b923409
7
- data.tar.gz: cee8be2b76dbb7a457454abc8bd1347422034f1c80692ebc5b3ce90d64d2a79f2981650a42858079858261b2a2767a017145278204c2bdcd0bb0da8b89ba367f
6
+ metadata.gz: 78a5a649be27147d22e1bed0a0599db2bf1d013233cc0af24476257e1703b49351f6f268f3d617eaebf9efd74514c1f68f3d37b5254005317393119a78c3a330
7
+ data.tar.gz: ac3fab845b4a1677d19577965ecc683b0977528391d447337fdf4cfd358f1acfd40108e12759ebf7aa8a284261496c92f3f671face43ec35d36fbaa81cea8fad
data/NEWS.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # Nanoc news
2
2
 
3
+ ## 4.11.5 (2019-04-30)
4
+
5
+ Fixes:
6
+
7
+ * Fixed an incompatibility introduced in Cri 2.15.4 (#1423, #1426)
8
+
3
9
  ## 4.11.4 (2019-04-28)
4
10
 
5
11
  Fixes:
@@ -2,6 +2,7 @@
2
2
 
3
3
  # Load external dependencies
4
4
  require 'addressable'
5
+ require 'colored'
5
6
  require 'ddplugin'
6
7
  require 'json'
7
8
  require 'parallel'
@@ -3,9 +3,5 @@
3
3
  # Re-exported from Nanoc::Core
4
4
  Nanoc::Identifier = Nanoc::Core::Identifier
5
5
 
6
- require_relative 'entities/props'
7
- require_relative 'entities/site'
8
-
9
6
  require_relative 'entities/outdatedness_status'
10
7
  require_relative 'entities/outdatedness_reasons'
11
- require_relative 'entities/dependency'
@@ -12,12 +12,12 @@ module Nanoc
12
12
  # @return [String] A descriptive message for this outdatedness reason
13
13
  attr_reader :message
14
14
 
15
- # @return [Nanoc::Int::Props]
15
+ # @return [Nanoc::Core::DependencyProps]
16
16
  attr_reader :props
17
17
 
18
18
  # @param [String] message The descriptive message for this outdatedness
19
19
  # reason
20
- def initialize(message, props = Nanoc::Int::Props.new)
20
+ def initialize(message, props = Nanoc::Core::DependencyProps.new)
21
21
  @message = message
22
22
  @props = props
23
23
  end
@@ -25,7 +25,7 @@ module Nanoc
25
25
 
26
26
  CodeSnippetsModified = Generic.new(
27
27
  'The code snippets have been modified since the last time the site was compiled.',
28
- Props.new(raw_content: true, attributes: true, compiled_content: true, path: true),
28
+ Nanoc::Core::DependencyProps.new(raw_content: true, attributes: true, compiled_content: true, path: true),
29
29
  )
30
30
 
31
31
  DependenciesOutdated = Generic.new(
@@ -34,17 +34,17 @@ module Nanoc
34
34
 
35
35
  NotWritten = Generic.new(
36
36
  'This item representation has not yet been written to the output directory (but it does have a path).',
37
- Props.new(raw_content: true, attributes: true, compiled_content: true, path: true),
37
+ Nanoc::Core::DependencyProps.new(raw_content: true, attributes: true, compiled_content: true, path: true),
38
38
  )
39
39
 
40
40
  RulesModified = Generic.new(
41
41
  'The rules file has been modified since the last time the site was compiled.',
42
- Props.new(compiled_content: true, path: true),
42
+ Nanoc::Core::DependencyProps.new(compiled_content: true, path: true),
43
43
  )
44
44
 
45
45
  ContentModified = Generic.new(
46
46
  'The content of this item has been modified since the last time the site was compiled.',
47
- Props.new(raw_content: true, compiled_content: true),
47
+ Nanoc::Core::DependencyProps.new(raw_content: true, compiled_content: true),
48
48
  )
49
49
 
50
50
  class DocumentCollectionExtended < Generic
@@ -53,7 +53,7 @@ module Nanoc
53
53
  def initialize(objects)
54
54
  super(
55
55
  'New items/layouts have been added to the site.',
56
- Props.new(raw_content: true),
56
+ Nanoc::Core::DependencyProps.new(raw_content: true),
57
57
  )
58
58
 
59
59
  @objects = objects
@@ -72,7 +72,7 @@ module Nanoc
72
72
  def initialize(attributes)
73
73
  super(
74
74
  'The attributes of this item have been modified since the last time the site was compiled.',
75
- Props.new(attributes: true, compiled_content: true),
75
+ Nanoc::Core::DependencyProps.new(attributes: true, compiled_content: true),
76
76
  )
77
77
 
78
78
  @attributes = attributes
@@ -81,7 +81,7 @@ module Nanoc
81
81
 
82
82
  UsesAlwaysOutdatedFilter = Generic.new(
83
83
  'This item rep uses one or more filters that cannot track dependencies, and will thus always be considered as outdated.',
84
- Props.new(raw_content: true, attributes: true, compiled_content: true),
84
+ Nanoc::Core::DependencyProps.new(raw_content: true, attributes: true, compiled_content: true),
85
85
  )
86
86
  end
87
87
  end
@@ -7,7 +7,7 @@ module Nanoc
7
7
  attr_reader :reasons
8
8
  attr_reader :props
9
9
 
10
- def initialize(reasons: [], props: Props.new)
10
+ def initialize(reasons: [], props: Nanoc::Core::DependencyProps.new)
11
11
  @reasons = reasons
12
12
  @props = props
13
13
  end
@@ -30,15 +30,15 @@ module Nanoc
30
30
  C_OBJ_SRC = Nanoc::Core::Item
31
31
  C_OBJ_DST = C::Or[Nanoc::Core::Item, Nanoc::Core::Layout, Nanoc::Core::Configuration, Nanoc::Core::IdentifiableCollection]
32
32
 
33
- contract C_OBJ_SRC => C::ArrayOf[Nanoc::Int::Dependency]
33
+ contract C_OBJ_SRC => C::ArrayOf[Nanoc::Core::Dependency]
34
34
  def dependencies_causing_outdatedness_of(object)
35
35
  objects_causing_outdatedness_of(object).map do |other_object|
36
36
  props = props_for(other_object, object)
37
37
 
38
- Nanoc::Int::Dependency.new(
38
+ Nanoc::Core::Dependency.new(
39
39
  other_object,
40
40
  object,
41
- Nanoc::Int::Props.new(
41
+ Nanoc::Core::DependencyProps.new(
42
42
  raw_content: props.fetch(:raw_content, false),
43
43
  attributes: props.fetch(:attributes, false),
44
44
  compiled_content: props.fetch(:compiled_content, false),
@@ -114,8 +114,8 @@ module Nanoc
114
114
  src_ref = obj2ref(src)
115
115
  dst_ref = obj2ref(dst)
116
116
 
117
- existing_props = Nanoc::Int::Props.new(@graph.props_for(dst_ref, src_ref) || {})
118
- new_props = Nanoc::Int::Props.new(raw_content: raw_content, attributes: attributes, compiled_content: compiled_content, path: path)
117
+ existing_props = Nanoc::Core::DependencyProps.new(@graph.props_for(dst_ref, src_ref) || {})
118
+ new_props = Nanoc::Core::DependencyProps.new(raw_content: raw_content, attributes: attributes, compiled_content: compiled_content, path: path)
119
119
  props = existing_props.merge(new_props)
120
120
 
121
121
  @graph.add_edge(dst_ref, src_ref, props: props.to_h)
@@ -31,7 +31,7 @@ module Nanoc
31
31
 
32
32
  data_source = gen_data_source_for_config(config)
33
33
 
34
- Nanoc::Int::Site.new(
34
+ Nanoc::Core::Site.new(
35
35
  config: config,
36
36
  code_snippets: code_snippets,
37
37
  data_source: data_source,
@@ -21,12 +21,12 @@ module Nanoc
21
21
  @compiled_content_store = Nanoc::Int::CompiledContentStore.new
22
22
  end
23
23
 
24
- contract Nanoc::Int::Site => C::Any
24
+ contract Nanoc::Core::Site => C::Any
25
25
  def self.compile(site)
26
26
  new_for(site).run_until_end
27
27
  end
28
28
 
29
- contract Nanoc::Int::Site => Nanoc::Int::Compiler
29
+ contract Nanoc::Core::Site => Nanoc::Int::Compiler
30
30
  def self.new_for(site)
31
31
  Nanoc::Int::CompilerLoader.new.load(site)
32
32
  end
@@ -16,7 +16,7 @@ module Nanoc
16
16
  return if @site.preprocessed?
17
17
 
18
18
  if @action_provider.need_preprocessing?
19
- @site.data_source = Nanoc::Core::InMemDataSource.new(@site.items, @site.layouts, @site.data_source)
19
+ @site.data_source = Nanoc::Core::InMemoryDataSource.new(@site.items, @site.layouts, @site.data_source)
20
20
  @action_provider.preprocess(@site)
21
21
 
22
22
  @dependency_store.items = @site.items
@@ -115,7 +115,7 @@ module Nanoc
115
115
  C_ITEM_OR_REP = C::Or[Nanoc::Core::Item, Nanoc::Core::ItemRep]
116
116
  C_ACTION_SEQUENCES = C::HashOf[C_OBJ => Nanoc::Core::ActionSequence]
117
117
 
118
- contract C::KeywordArgs[site: Nanoc::Int::Site, checksum_store: Nanoc::Int::ChecksumStore, checksums: Nanoc::Core::ChecksumCollection, dependency_store: Nanoc::Int::DependencyStore, action_sequence_store: Nanoc::Int::ActionSequenceStore, action_sequences: C_ACTION_SEQUENCES, reps: Nanoc::Int::ItemRepRepo] => C::Any
118
+ contract C::KeywordArgs[site: Nanoc::Core::Site, checksum_store: Nanoc::Int::ChecksumStore, checksums: Nanoc::Core::ChecksumCollection, dependency_store: Nanoc::Int::DependencyStore, action_sequence_store: Nanoc::Int::ActionSequenceStore, action_sequences: C_ACTION_SEQUENCES, reps: Nanoc::Int::ItemRepRepo] => C::Any
119
119
  def initialize(site:, checksum_store:, checksums:, dependency_store:, action_sequence_store:, action_sequences:, reps:)
120
120
  @site = site
121
121
  @checksum_store = checksum_store
@@ -185,7 +185,7 @@ module Nanoc
185
185
  is_outdated
186
186
  end
187
187
 
188
- contract Nanoc::Int::Dependency => C::Bool
188
+ contract Nanoc::Core::Dependency => C::Bool
189
189
  def dependency_causes_outdatedness?(dependency)
190
190
  return true if dependency.from.nil?
191
191
 
@@ -78,7 +78,7 @@ module ::Nanoc::Checking::Checks
78
78
  return Result.new(href, 'redirection without a target location') if location.nil?
79
79
 
80
80
  if /^30[18]$/.match?(res.code)
81
- return Result.new(href, "link have moved permanently to '#{location}'")
81
+ return Result.new(href, "link has moved permanently to '#{location}'")
82
82
  end
83
83
 
84
84
  url = URI.parse(location)
@@ -5,7 +5,7 @@ module Nanoc::Checking
5
5
  #
6
6
  # @api private
7
7
  class Runner
8
- # @param [Nanoc::Int::Site] site The Nanoc site this runner is for
8
+ # @param [Nanoc::Core::Site] site The Nanoc site this runner is for
9
9
  def initialize(site)
10
10
  @site = site
11
11
  end
@@ -50,7 +50,7 @@ module Nanoc::RuleDSL
50
50
  end
51
51
 
52
52
  site.data_source =
53
- Nanoc::Core::InMemDataSource.new(ctx.items._unwrap, ctx.layouts._unwrap, site.data_source)
53
+ Nanoc::Core::InMemoryDataSource.new(ctx.items._unwrap, ctx.layouts._unwrap, site.data_source)
54
54
  end
55
55
 
56
56
  def postprocess(site, compiler)
@@ -31,7 +31,7 @@ module Nanoc::RuleDSL
31
31
  # @api private
32
32
  attr_accessor :rules_collection
33
33
 
34
- # @param [Nanoc::Int::Site] site
34
+ # @param [Nanoc::Core::Site] site
35
35
  # @param [Nanoc::RuleDSL::RulesCollection] rules_collection
36
36
  def initialize(site:, rules_collection:)
37
37
  @site = site
@@ -5,7 +5,7 @@ module Nanoc::RuleDSL
5
5
  include Nanoc::Core::ContractsSupport
6
6
 
7
7
  contract Nanoc::Core::ItemRep, C::KeywordArgs[
8
- site: Nanoc::Int::Site,
8
+ site: Nanoc::Core::Site,
9
9
  recorder: Nanoc::RuleDSL::ActionRecorder,
10
10
  view_context: Nanoc::ViewContextForPreCompilation,
11
11
  ] => C::Any
@@ -6,7 +6,7 @@ module Nanoc::RuleDSL
6
6
 
7
7
  contract C::KeywordArgs[
8
8
  rep: Nanoc::Core::ItemRep,
9
- site: Nanoc::Int::Site,
9
+ site: Nanoc::Core::Site,
10
10
  recorder: Nanoc::RuleDSL::ActionRecorder,
11
11
  view_context: Nanoc::ViewContextForPreCompilation,
12
12
  ] => C::Any
@@ -15,7 +15,7 @@ module Nanoc::RuleDSL
15
15
  end
16
16
 
17
17
  contract Nanoc::Core::ItemRep, C::KeywordArgs[
18
- site: Nanoc::Int::Site,
18
+ site: Nanoc::Core::Site,
19
19
  view_context: Nanoc::ViewContextForPreCompilation,
20
20
  ] => C::Any
21
21
  def apply_to(rep, site:, view_context:)
@@ -6,7 +6,7 @@ module Nanoc::RuleDSL
6
6
 
7
7
  contract C::KeywordArgs[
8
8
  rep: Nanoc::Core::ItemRep,
9
- site: Nanoc::Int::Site,
9
+ site: Nanoc::Core::Site,
10
10
  view_context: Nanoc::ViewContextForPreCompilation,
11
11
  ] => C::Any
12
12
  def initialize(rep:, site:, view_context:)
@@ -208,10 +208,10 @@ module Nanoc
208
208
 
209
209
  def site
210
210
  @_site ||=
211
- Nanoc::Int::Site.new(
211
+ Nanoc::Core::Site.new(
212
212
  config: @config,
213
213
  code_snippets: [],
214
- data_source: Nanoc::Core::InMemDataSource.new(@items, @layouts),
214
+ data_source: Nanoc::Core::InMemoryDataSource.new(@items, @layouts),
215
215
  )
216
216
  end
217
217
 
@@ -2,5 +2,5 @@
2
2
 
3
3
  module Nanoc
4
4
  # The current Nanoc version.
5
- VERSION = '4.11.4'
5
+ VERSION = '4.11.5'
6
6
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: nanoc
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.11.4
4
+ version: 4.11.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Denis Defreyne
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-04-28 00:00:00.000000000 Z
11
+ date: 2019-04-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: addressable
@@ -24,6 +24,20 @@ dependencies:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
26
  version: '2.5'
27
+ - !ruby/object:Gem::Dependency
28
+ name: colored
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '1.2'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '1.2'
27
41
  - !ruby/object:Gem::Dependency
28
42
  name: cri
29
43
  requirement: !ruby/object:Gem::Requirement
@@ -44,14 +58,14 @@ dependencies:
44
58
  requirements:
45
59
  - - '='
46
60
  - !ruby/object:Gem::Version
47
- version: 4.11.4
61
+ version: 4.11.5
48
62
  type: :runtime
49
63
  prerelease: false
50
64
  version_requirements: !ruby/object:Gem::Requirement
51
65
  requirements:
52
66
  - - '='
53
67
  - !ruby/object:Gem::Version
54
- version: 4.11.4
68
+ version: 4.11.5
55
69
  - !ruby/object:Gem::Dependency
56
70
  name: parallel
57
71
  requirement: !ruby/object:Gem::Requirement
@@ -155,11 +169,8 @@ files:
155
169
  - lib/nanoc/base/assertions.rb
156
170
  - lib/nanoc/base/changes_stream.rb
157
171
  - lib/nanoc/base/entities.rb
158
- - lib/nanoc/base/entities/dependency.rb
159
172
  - lib/nanoc/base/entities/outdatedness_reasons.rb
160
173
  - lib/nanoc/base/entities/outdatedness_status.rb
161
- - lib/nanoc/base/entities/props.rb
162
- - lib/nanoc/base/entities/site.rb
163
174
  - lib/nanoc/base/error.rb
164
175
  - lib/nanoc/base/errors.rb
165
176
  - lib/nanoc/base/feature.rb
@@ -1,35 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Nanoc
4
- module Int
5
- # @api private
6
- # A dependency between two items/layouts.
7
- class Dependency
8
- include Nanoc::Core::ContractsSupport
9
-
10
- C_OBJ_FROM = C::Or[Nanoc::Core::Item, Nanoc::Core::Layout, Nanoc::Core::Configuration, Nanoc::Core::IdentifiableCollection]
11
- C_OBJ_TO = Nanoc::Core::Item
12
-
13
- contract C::None => C::Maybe[C_OBJ_FROM]
14
- attr_reader :from
15
-
16
- contract C::None => C::Maybe[C_OBJ_TO]
17
- attr_reader :to
18
-
19
- contract C::None => Nanoc::Int::Props
20
- attr_reader :props
21
-
22
- contract C::Maybe[C_OBJ_FROM], C::Maybe[C_OBJ_TO], Nanoc::Int::Props => C::Any
23
- def initialize(from, to, props)
24
- @from = from
25
- @to = to
26
- @props = props
27
- end
28
-
29
- contract C::None => String
30
- def inspect
31
- "Dependency(#{@from.inspect} -> #{@to.inspect}, #{@props.inspect})"
32
- end
33
- end
34
- end
35
- end
@@ -1,150 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Nanoc
4
- module Int
5
- # @api private
6
- class Props
7
- include Nanoc::Core::ContractsSupport
8
-
9
- attr_reader :attributes
10
- attr_reader :raw_content
11
-
12
- # TODO: Split raw_content for documents and collections
13
- C_RAW_CONTENT = C::Or[C::IterOf[C::Or[String, Regexp]], C::Bool]
14
- C_ATTRS = C::Or[C::IterOf[Symbol], C::Bool]
15
- contract C::KeywordArgs[raw_content: C::Optional[C_RAW_CONTENT], attributes: C::Optional[C_ATTRS], compiled_content: C::Optional[C::Bool], path: C::Optional[C::Bool]] => C::Any
16
- def initialize(raw_content: false, attributes: false, compiled_content: false, path: false)
17
- @compiled_content = compiled_content
18
- @path = path
19
-
20
- @attributes =
21
- case attributes
22
- when Set
23
- attributes
24
- when Enumerable
25
- Set.new(attributes)
26
- else
27
- attributes
28
- end
29
-
30
- @raw_content =
31
- case raw_content
32
- when Set
33
- raw_content
34
- when Enumerable
35
- Set.new(raw_content)
36
- else
37
- raw_content
38
- end
39
- end
40
-
41
- contract C::None => String
42
- def inspect
43
- (+'').tap do |s|
44
- s << 'Props('
45
- s << (raw_content? ? 'r' : '_')
46
- s << (attributes? ? 'a' : '_')
47
- s << (compiled_content? ? 'c' : '_')
48
- s << (path? ? 'p' : '_')
49
- s << ')'
50
- end
51
- end
52
-
53
- contract C::None => String
54
- def to_s
55
- (+'').tap do |s|
56
- s << (raw_content? ? 'r' : '_')
57
- s << (attributes? ? 'a' : '_')
58
- s << (compiled_content? ? 'c' : '_')
59
- s << (path? ? 'p' : '_')
60
- end
61
- end
62
-
63
- contract C::None => C::Bool
64
- def raw_content?
65
- case @raw_content
66
- when Enumerable
67
- @raw_content.any?
68
- else
69
- @raw_content
70
- end
71
- end
72
-
73
- contract C::None => C::Bool
74
- def attributes?
75
- case @attributes
76
- when Enumerable
77
- @attributes.any?
78
- else
79
- @attributes
80
- end
81
- end
82
-
83
- contract C::None => C::Bool
84
- def compiled_content?
85
- @compiled_content
86
- end
87
-
88
- contract C::None => C::Bool
89
- def path?
90
- @path
91
- end
92
-
93
- contract Nanoc::Int::Props => Nanoc::Int::Props
94
- def merge(other)
95
- Props.new(
96
- raw_content: merge_raw_content(other),
97
- attributes: merge_attributes(other),
98
- compiled_content: compiled_content? || other.compiled_content?,
99
- path: path? || other.path?,
100
- )
101
- end
102
-
103
- def merge_raw_content(other)
104
- merge_prop(raw_content, other.raw_content)
105
- end
106
-
107
- def merge_attributes(other)
108
- merge_prop(attributes, other.attributes)
109
- end
110
-
111
- def merge_prop(own, other)
112
- case own
113
- when true
114
- true
115
- when false
116
- other
117
- else
118
- case other
119
- when true
120
- true
121
- when false
122
- own
123
- else
124
- own + other
125
- end
126
- end
127
- end
128
-
129
- contract C::None => Set
130
- def active
131
- Set.new.tap do |pr|
132
- pr << :raw_content if raw_content?
133
- pr << :attributes if attributes?
134
- pr << :compiled_content if compiled_content?
135
- pr << :path if path?
136
- end
137
- end
138
-
139
- contract C::None => Hash
140
- def to_h
141
- {
142
- raw_content: raw_content,
143
- attributes: attributes,
144
- compiled_content: compiled_content?,
145
- path: path?,
146
- }
147
- end
148
- end
149
- end
150
- end
@@ -1,71 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Nanoc
4
- module Int
5
- # @api private
6
- class Site
7
- # Error that is raised when multiple items or layouts with the same identifier exist.
8
- class DuplicateIdentifierError < ::Nanoc::Error
9
- def initialize(identifier, type)
10
- super("There are multiple #{type}s with the #{identifier} identifier.")
11
- end
12
- end
13
-
14
- include Nanoc::Core::ContractsSupport
15
-
16
- attr_reader :code_snippets
17
- attr_reader :config
18
- attr_accessor :data_source
19
-
20
- contract C::KeywordArgs[config: Nanoc::Core::Configuration, code_snippets: C::IterOf[Nanoc::Core::CodeSnippet], data_source: C::Named['Nanoc::DataSource']] => C::Any
21
- def initialize(config:, code_snippets:, data_source:)
22
- @config = config
23
- @code_snippets = code_snippets
24
- @data_source = data_source
25
-
26
- @preprocessed = false
27
-
28
- ensure_identifier_uniqueness(@data_source.items, 'item')
29
- ensure_identifier_uniqueness(@data_source.layouts, 'layout')
30
- end
31
-
32
- def mark_as_preprocessed
33
- @preprocessed = true
34
- end
35
-
36
- def preprocessed?
37
- @preprocessed
38
- end
39
-
40
- def items
41
- @data_source.items
42
- end
43
-
44
- def layouts
45
- @data_source.layouts
46
- end
47
-
48
- contract C::None => self
49
- def freeze
50
- config.freeze
51
- items.freeze
52
- layouts.freeze
53
- code_snippets.__nanoc_freeze_recursively
54
- self
55
- end
56
-
57
- contract C::IterOf[C::Or[Nanoc::Core::Item, Nanoc::Core::Layout]], String => self
58
- def ensure_identifier_uniqueness(objects, type)
59
- seen = Set.new
60
- objects.each do |obj|
61
- if seen.include?(obj.identifier)
62
- raise DuplicateIdentifierError.new(obj.identifier, type)
63
- end
64
-
65
- seen << obj.identifier
66
- end
67
- self
68
- end
69
- end
70
- end
71
- end