nanoc 4.11.8 → 4.11.9
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 +4 -4
- data/NEWS.md +8 -0
- data/lib/nanoc.rb +4 -1
- data/lib/nanoc/base.rb +0 -1
- data/lib/nanoc/base/errors.rb +4 -49
- data/lib/nanoc/base/repos.rb +0 -15
- data/lib/nanoc/base/repos/site_loader.rb +1 -1
- data/lib/nanoc/base/services.rb +0 -2
- data/lib/nanoc/base/services/compiler.rb +1 -1
- data/lib/nanoc/base/services/compiler/phases/recalculate.rb +1 -1
- data/lib/nanoc/base/services/compiler/stages/build_reps.rb +1 -1
- data/lib/nanoc/base/services/compiler/stages/cleanup.rb +1 -1
- data/lib/nanoc/base/services/compiler/stages/load_stores.rb +1 -1
- data/lib/nanoc/base/services/compiler_loader.rb +6 -6
- data/lib/nanoc/base/services/outdatedness_checker.rb +10 -10
- data/lib/nanoc/base/services/outdatedness_rules/attributes_modified.rb +4 -4
- data/lib/nanoc/base/services/outdatedness_rules/code_snippets_modified.rb +2 -2
- data/lib/nanoc/base/services/outdatedness_rules/content_modified.rb +2 -2
- data/lib/nanoc/base/services/outdatedness_rules/item_collection_extended.rb +3 -3
- data/lib/nanoc/base/services/outdatedness_rules/layout_collection_extended.rb +3 -3
- data/lib/nanoc/base/services/outdatedness_rules/not_written.rb +2 -2
- data/lib/nanoc/base/services/outdatedness_rules/rules_modified.rb +3 -3
- data/lib/nanoc/base/services/outdatedness_rules/uses_always_outdated_filter.rb +2 -2
- data/lib/nanoc/base/services/pruner.rb +1 -1
- data/lib/nanoc/base/views/view_context_for_compilation.rb +1 -1
- data/lib/nanoc/base/views/view_context_for_pre_compilation.rb +1 -1
- data/lib/nanoc/base/views/view_context_for_shell.rb +2 -2
- data/lib/nanoc/checking/check.rb +17 -1
- data/lib/nanoc/cli/commands/shell.rb +1 -1
- data/lib/nanoc/cli/error_handler.rb +1 -1
- data/lib/nanoc/filters/handlebars.rb +2 -2
- data/lib/nanoc/filters/sass/importer.rb +3 -2
- data/lib/nanoc/rule_dsl/action_provider.rb +1 -1
- data/lib/nanoc/spec.rb +4 -4
- data/lib/nanoc/version.rb +1 -1
- metadata +5 -21
- data/lib/nanoc/base/entities.rb +0 -7
- data/lib/nanoc/base/entities/outdatedness_reasons.rb +0 -88
- data/lib/nanoc/base/entities/outdatedness_status.rb +0 -27
- data/lib/nanoc/base/repos/action_sequence_store.rb +0 -50
- data/lib/nanoc/base/repos/binary_compiled_content_cache.rb +0 -128
- data/lib/nanoc/base/repos/checksum_store.rb +0 -74
- data/lib/nanoc/base/repos/compiled_content_cache.rb +0 -68
- data/lib/nanoc/base/repos/compiled_content_store.rb +0 -77
- data/lib/nanoc/base/repos/dependency_store.rb +0 -204
- data/lib/nanoc/base/repos/item_rep_repo.rb +0 -37
- data/lib/nanoc/base/repos/outdatedness_store.rb +0 -55
- data/lib/nanoc/base/repos/prefixed_data_source.rb +0 -31
- data/lib/nanoc/base/repos/store.rb +0 -114
- data/lib/nanoc/base/repos/textual_compiled_content_cache.rb +0 -82
- data/lib/nanoc/base/services/dependency_tracker.rb +0 -63
- data/lib/nanoc/base/services/outdatedness_rule.rb +0 -34
@@ -3,19 +3,19 @@
|
|
3
3
|
module Nanoc
|
4
4
|
module Int
|
5
5
|
module OutdatednessRules
|
6
|
-
class RulesModified < Nanoc::
|
6
|
+
class RulesModified < Nanoc::Core::OutdatednessRule
|
7
7
|
affects_props :compiled_content, :path
|
8
8
|
|
9
9
|
def apply(obj, outdatedness_checker)
|
10
10
|
# Check rules of obj itself
|
11
11
|
if rules_modified?(obj, outdatedness_checker)
|
12
|
-
return Nanoc::
|
12
|
+
return Nanoc::Core::OutdatednessReasons::RulesModified
|
13
13
|
end
|
14
14
|
|
15
15
|
# Check rules of layouts used by obj
|
16
16
|
layouts = layouts_touched_by(obj, outdatedness_checker)
|
17
17
|
if layouts.any? { |layout| rules_modified?(layout, outdatedness_checker) }
|
18
|
-
return Nanoc::
|
18
|
+
return Nanoc::Core::OutdatednessReasons::RulesModified
|
19
19
|
end
|
20
20
|
|
21
21
|
nil
|
@@ -3,13 +3,13 @@
|
|
3
3
|
module Nanoc
|
4
4
|
module Int
|
5
5
|
module OutdatednessRules
|
6
|
-
class UsesAlwaysOutdatedFilter < Nanoc::
|
6
|
+
class UsesAlwaysOutdatedFilter < Nanoc::Core::OutdatednessRule
|
7
7
|
affects_props :raw_content, :attributes, :path
|
8
8
|
|
9
9
|
def apply(obj, outdatedness_checker)
|
10
10
|
seq = outdatedness_checker.action_sequence_for(obj)
|
11
11
|
if any_always_outdated?(seq)
|
12
|
-
Nanoc::
|
12
|
+
Nanoc::Core::OutdatednessReasons::UsesAlwaysOutdatedFilter
|
13
13
|
end
|
14
14
|
end
|
15
15
|
|
@@ -10,7 +10,7 @@ module Nanoc
|
|
10
10
|
|
11
11
|
# @param [Nanoc::Core::Configuration] config
|
12
12
|
#
|
13
|
-
# @param [Nanoc::
|
13
|
+
# @param [Nanoc::Core::ItemRepRepo] reps
|
14
14
|
#
|
15
15
|
# @param [Boolean] dry_run true if the files to be deleted
|
16
16
|
# should only be printed instead of actually deleted, false if the files
|
@@ -12,7 +12,7 @@ module Nanoc
|
|
12
12
|
attr_reader :compiled_content_store
|
13
13
|
|
14
14
|
contract C::KeywordArgs[
|
15
|
-
reps: Nanoc::
|
15
|
+
reps: Nanoc::Core::ItemRepRepo,
|
16
16
|
items: Nanoc::Core::IdentifiableCollection,
|
17
17
|
dependency_tracker: C::Any,
|
18
18
|
compilation_context: C::Any,
|
@@ -11,13 +11,13 @@ module Nanoc
|
|
11
11
|
|
12
12
|
contract C::KeywordArgs[
|
13
13
|
items: Nanoc::Core::IdentifiableCollection,
|
14
|
-
reps: Nanoc::
|
14
|
+
reps: Nanoc::Core::ItemRepRepo,
|
15
15
|
] => C::Any
|
16
16
|
def initialize(items:, reps:)
|
17
17
|
@items = items
|
18
18
|
@reps = reps
|
19
19
|
|
20
|
-
@dependency_tracker = Nanoc::
|
20
|
+
@dependency_tracker = Nanoc::Core::DependencyTracker::Null.new
|
21
21
|
end
|
22
22
|
end
|
23
23
|
end
|
data/lib/nanoc/checking/check.rb
CHANGED
@@ -12,6 +12,8 @@ module Nanoc::Checking
|
|
12
12
|
class Check < Nanoc::Core::Context
|
13
13
|
extend DDPlugin::Plugin
|
14
14
|
|
15
|
+
DDMemoize.activate(self)
|
16
|
+
|
15
17
|
attr_reader :issues
|
16
18
|
|
17
19
|
def self.define(ident, &block)
|
@@ -34,7 +36,7 @@ module Nanoc::Checking
|
|
34
36
|
res = compiler.run_until_reps_built
|
35
37
|
reps = res.fetch(:reps)
|
36
38
|
compilation_context = compiler.compilation_context(reps: reps)
|
37
|
-
view_context = compilation_context.create_view_context(Nanoc::
|
39
|
+
view_context = compilation_context.create_view_context(Nanoc::Core::DependencyTracker::Null.new)
|
38
40
|
|
39
41
|
context = {
|
40
42
|
items: Nanoc::PostCompileItemCollectionView.new(site.items, view_context),
|
@@ -66,6 +68,20 @@ module Nanoc::Checking
|
|
66
68
|
@issues << Issue.new(desc, subject, self.class)
|
67
69
|
end
|
68
70
|
|
71
|
+
# @private
|
72
|
+
def output_filenames
|
73
|
+
super.reject { |f| excluded_patterns.any? { |pat| pat.match?(f) } }
|
74
|
+
end
|
75
|
+
|
76
|
+
# @private
|
77
|
+
memoized def excluded_patterns
|
78
|
+
@config
|
79
|
+
.fetch(:checks, {})
|
80
|
+
.fetch(:all, {})
|
81
|
+
.fetch(:exclude_files, [])
|
82
|
+
.map { |pattern| Regexp.new(pattern) }
|
83
|
+
end
|
84
|
+
|
69
85
|
# @private
|
70
86
|
def output_html_filenames
|
71
87
|
output_filenames.select { |f| File.extname(f) =~ /\A\.x?html?\z/ }
|
@@ -28,7 +28,7 @@ module Nanoc::CLI::Commands
|
|
28
28
|
end
|
29
29
|
|
30
30
|
def self.reps_for(site)
|
31
|
-
Nanoc::
|
31
|
+
Nanoc::Core::ItemRepRepo.new.tap do |reps|
|
32
32
|
action_provider = Nanoc::Core::ActionProvider.named(site.config.action_provider).for(site)
|
33
33
|
builder = Nanoc::Int::ItemRepBuilder.new(site, action_provider, reps)
|
34
34
|
builder.run
|
@@ -192,7 +192,6 @@ module Nanoc::CLI
|
|
192
192
|
'escape' => 'escape',
|
193
193
|
'fog' => 'fog',
|
194
194
|
'haml' => 'haml',
|
195
|
-
'handlebars' => 'hbs',
|
196
195
|
'json' => 'json',
|
197
196
|
'kramdown' => 'kramdown',
|
198
197
|
'less' => 'less',
|
@@ -212,6 +211,7 @@ module Nanoc::CLI
|
|
212
211
|
'rdiscount' => 'rdiscount',
|
213
212
|
'redcarpet' => 'redcarpet',
|
214
213
|
'redcloth' => 'RedCloth',
|
214
|
+
'ruby-handlebars' => 'hbs',
|
215
215
|
'rubypants' => 'rubypants',
|
216
216
|
'sass' => 'sass',
|
217
217
|
'slim' => 'slim',
|
@@ -5,7 +5,7 @@ module Nanoc::Filters
|
|
5
5
|
class Handlebars < Nanoc::Filter
|
6
6
|
identifier :handlebars
|
7
7
|
|
8
|
-
requires 'handlebars'
|
8
|
+
requires 'ruby-handlebars'
|
9
9
|
|
10
10
|
# Runs the content through
|
11
11
|
# [Handlebars](http://handlebarsjs.com/) using
|
@@ -24,7 +24,7 @@ module Nanoc::Filters
|
|
24
24
|
context[:layout] = assigns[:layout].attributes
|
25
25
|
end
|
26
26
|
|
27
|
-
handlebars = ::Handlebars::
|
27
|
+
handlebars = ::Handlebars::Handlebars.new
|
28
28
|
template = handlebars.compile(content)
|
29
29
|
template.call(context)
|
30
30
|
end
|
@@ -67,8 +67,9 @@ module Nanoc::Filters::SassCommon
|
|
67
67
|
@raw_filename_to_item_map[config.object_id] ||=
|
68
68
|
{}.tap do |map|
|
69
69
|
items.each do |item|
|
70
|
-
|
71
|
-
|
70
|
+
filename_without_registering_dependency = item._unwrap.content.filename
|
71
|
+
if filename_without_registering_dependency
|
72
|
+
path = Pathname.new(filename_without_registering_dependency).realpath.to_s
|
72
73
|
map[path] = item
|
73
74
|
end
|
74
75
|
end
|
@@ -54,7 +54,7 @@ module Nanoc::RuleDSL
|
|
54
54
|
end
|
55
55
|
|
56
56
|
def postprocess(site, compiler)
|
57
|
-
dependency_tracker = Nanoc::
|
57
|
+
dependency_tracker = Nanoc::Core::DependencyTracker::Null.new
|
58
58
|
|
59
59
|
res = compiler.run_until_reps_built
|
60
60
|
reps = res.fetch(:reps)
|
data/lib/nanoc/spec.rb
CHANGED
@@ -42,7 +42,7 @@ module Nanoc
|
|
42
42
|
end
|
43
43
|
|
44
44
|
class HelperContext
|
45
|
-
# @return [Nanoc::
|
45
|
+
# @return [Nanoc::Core::DependencyTracker]
|
46
46
|
attr_reader :dependency_tracker
|
47
47
|
|
48
48
|
attr_reader :erbout
|
@@ -54,11 +54,11 @@ module Nanoc
|
|
54
54
|
@erbout = +''
|
55
55
|
@action_sequence = {}
|
56
56
|
@config = Nanoc::Core::Configuration.new(dir: Dir.getwd).with_defaults
|
57
|
-
@reps = Nanoc::
|
57
|
+
@reps = Nanoc::Core::ItemRepRepo.new
|
58
58
|
@items = Nanoc::Core::ItemCollection.new(@config)
|
59
59
|
@layouts = Nanoc::Core::LayoutCollection.new(@config)
|
60
|
-
@dependency_tracker = Nanoc::
|
61
|
-
@compiled_content_store = Nanoc::
|
60
|
+
@dependency_tracker = Nanoc::Core::DependencyTracker.new(Object.new)
|
61
|
+
@compiled_content_store = Nanoc::Core::CompiledContentStore.new
|
62
62
|
@action_provider = new_action_provider
|
63
63
|
end
|
64
64
|
|
data/lib/nanoc/version.rb
CHANGED
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
|
+
version: 4.11.9
|
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-08-
|
11
|
+
date: 2019-08-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: addressable
|
@@ -58,14 +58,14 @@ dependencies:
|
|
58
58
|
requirements:
|
59
59
|
- - '='
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version: 4.11.
|
61
|
+
version: 4.11.9
|
62
62
|
type: :runtime
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
66
|
- - '='
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version: 4.11.
|
68
|
+
version: 4.11.9
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: parallel
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
@@ -168,26 +168,12 @@ files:
|
|
168
168
|
- lib/nanoc/base.rb
|
169
169
|
- lib/nanoc/base/assertions.rb
|
170
170
|
- lib/nanoc/base/changes_stream.rb
|
171
|
-
- lib/nanoc/base/entities.rb
|
172
|
-
- lib/nanoc/base/entities/outdatedness_reasons.rb
|
173
|
-
- lib/nanoc/base/entities/outdatedness_status.rb
|
174
171
|
- lib/nanoc/base/error.rb
|
175
172
|
- lib/nanoc/base/errors.rb
|
176
173
|
- lib/nanoc/base/feature.rb
|
177
174
|
- lib/nanoc/base/repos.rb
|
178
|
-
- lib/nanoc/base/repos/action_sequence_store.rb
|
179
|
-
- lib/nanoc/base/repos/binary_compiled_content_cache.rb
|
180
|
-
- lib/nanoc/base/repos/checksum_store.rb
|
181
|
-
- lib/nanoc/base/repos/compiled_content_cache.rb
|
182
|
-
- lib/nanoc/base/repos/compiled_content_store.rb
|
183
175
|
- lib/nanoc/base/repos/config_loader.rb
|
184
|
-
- lib/nanoc/base/repos/dependency_store.rb
|
185
|
-
- lib/nanoc/base/repos/item_rep_repo.rb
|
186
|
-
- lib/nanoc/base/repos/outdatedness_store.rb
|
187
|
-
- lib/nanoc/base/repos/prefixed_data_source.rb
|
188
176
|
- lib/nanoc/base/repos/site_loader.rb
|
189
|
-
- lib/nanoc/base/repos/store.rb
|
190
|
-
- lib/nanoc/base/repos/textual_compiled_content_cache.rb
|
191
177
|
- lib/nanoc/base/services.rb
|
192
178
|
- lib/nanoc/base/services/compilation_context.rb
|
193
179
|
- lib/nanoc/base/services/compiler.rb
|
@@ -214,7 +200,6 @@ files:
|
|
214
200
|
- lib/nanoc/base/services/compiler/stages/store_post_compilation_state.rb
|
215
201
|
- lib/nanoc/base/services/compiler/stages/store_pre_compilation_state.rb
|
216
202
|
- lib/nanoc/base/services/compiler_loader.rb
|
217
|
-
- lib/nanoc/base/services/dependency_tracker.rb
|
218
203
|
- lib/nanoc/base/services/executor.rb
|
219
204
|
- lib/nanoc/base/services/filter.rb
|
220
205
|
- lib/nanoc/base/services/item_rep_builder.rb
|
@@ -222,7 +207,6 @@ files:
|
|
222
207
|
- lib/nanoc/base/services/item_rep_selector.rb
|
223
208
|
- lib/nanoc/base/services/item_rep_writer.rb
|
224
209
|
- lib/nanoc/base/services/outdatedness_checker.rb
|
225
|
-
- lib/nanoc/base/services/outdatedness_rule.rb
|
226
210
|
- lib/nanoc/base/services/outdatedness_rules.rb
|
227
211
|
- lib/nanoc/base/services/outdatedness_rules/attributes_modified.rb
|
228
212
|
- lib/nanoc/base/services/outdatedness_rules/code_snippets_modified.rb
|
@@ -401,7 +385,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
401
385
|
- !ruby/object:Gem::Version
|
402
386
|
version: '0'
|
403
387
|
requirements: []
|
404
|
-
rubygems_version: 3.0.
|
388
|
+
rubygems_version: 3.0.6
|
405
389
|
signing_key:
|
406
390
|
specification_version: 4
|
407
391
|
summary: A static-site generator with a focus on flexibility.
|
data/lib/nanoc/base/entities.rb
DELETED
@@ -1,88 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Nanoc
|
4
|
-
module Int
|
5
|
-
# Module that contains all outdatedness reasons.
|
6
|
-
#
|
7
|
-
# @api private
|
8
|
-
module OutdatednessReasons
|
9
|
-
# A generic outdatedness reason. An outdatedness reason is basically a
|
10
|
-
# descriptive message that explains why a given object is outdated.
|
11
|
-
class Generic
|
12
|
-
# @return [String] A descriptive message for this outdatedness reason
|
13
|
-
attr_reader :message
|
14
|
-
|
15
|
-
# @return [Nanoc::Core::DependencyProps]
|
16
|
-
attr_reader :props
|
17
|
-
|
18
|
-
# @param [String] message The descriptive message for this outdatedness
|
19
|
-
# reason
|
20
|
-
def initialize(message, props = Nanoc::Core::DependencyProps.new)
|
21
|
-
@message = message
|
22
|
-
@props = props
|
23
|
-
end
|
24
|
-
end
|
25
|
-
|
26
|
-
CodeSnippetsModified = Generic.new(
|
27
|
-
'The code snippets have been modified since the last time the site was compiled.',
|
28
|
-
Nanoc::Core::DependencyProps.new(raw_content: true, attributes: true, compiled_content: true, path: true),
|
29
|
-
)
|
30
|
-
|
31
|
-
DependenciesOutdated = Generic.new(
|
32
|
-
'This item uses content or attributes that have changed since the last time the site was compiled.',
|
33
|
-
)
|
34
|
-
|
35
|
-
NotWritten = Generic.new(
|
36
|
-
'This item representation has not yet been written to the output directory (but it does have a path).',
|
37
|
-
Nanoc::Core::DependencyProps.new(raw_content: true, attributes: true, compiled_content: true, path: true),
|
38
|
-
)
|
39
|
-
|
40
|
-
RulesModified = Generic.new(
|
41
|
-
'The rules file has been modified since the last time the site was compiled.',
|
42
|
-
Nanoc::Core::DependencyProps.new(compiled_content: true, path: true),
|
43
|
-
)
|
44
|
-
|
45
|
-
ContentModified = Generic.new(
|
46
|
-
'The content of this item has been modified since the last time the site was compiled.',
|
47
|
-
Nanoc::Core::DependencyProps.new(raw_content: true, compiled_content: true),
|
48
|
-
)
|
49
|
-
|
50
|
-
class DocumentCollectionExtended < Generic
|
51
|
-
attr_reader :objects
|
52
|
-
|
53
|
-
def initialize(objects)
|
54
|
-
super(
|
55
|
-
'New items/layouts have been added to the site.',
|
56
|
-
Nanoc::Core::DependencyProps.new(raw_content: true),
|
57
|
-
)
|
58
|
-
|
59
|
-
@objects = objects
|
60
|
-
end
|
61
|
-
end
|
62
|
-
|
63
|
-
class ItemCollectionExtended < DocumentCollectionExtended
|
64
|
-
end
|
65
|
-
|
66
|
-
class LayoutCollectionExtended < DocumentCollectionExtended
|
67
|
-
end
|
68
|
-
|
69
|
-
class AttributesModified < Generic
|
70
|
-
attr_reader :attributes
|
71
|
-
|
72
|
-
def initialize(attributes)
|
73
|
-
super(
|
74
|
-
'The attributes of this item have been modified since the last time the site was compiled.',
|
75
|
-
Nanoc::Core::DependencyProps.new(attributes: true, compiled_content: true),
|
76
|
-
)
|
77
|
-
|
78
|
-
@attributes = attributes
|
79
|
-
end
|
80
|
-
end
|
81
|
-
|
82
|
-
UsesAlwaysOutdatedFilter = Generic.new(
|
83
|
-
'This item rep uses one or more filters that cannot track dependencies, and will thus always be considered as outdated.',
|
84
|
-
Nanoc::Core::DependencyProps.new(raw_content: true, attributes: true, compiled_content: true),
|
85
|
-
)
|
86
|
-
end
|
87
|
-
end
|
88
|
-
end
|
@@ -1,27 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Nanoc
|
4
|
-
module Int
|
5
|
-
# @api private
|
6
|
-
class OutdatednessStatus
|
7
|
-
attr_reader :reasons
|
8
|
-
attr_reader :props
|
9
|
-
|
10
|
-
def initialize(reasons: [], props: Nanoc::Core::DependencyProps.new)
|
11
|
-
@reasons = reasons
|
12
|
-
@props = props
|
13
|
-
end
|
14
|
-
|
15
|
-
def useful_to_apply?(rule)
|
16
|
-
(rule.affected_props - @props.active).any?
|
17
|
-
end
|
18
|
-
|
19
|
-
def update(reason)
|
20
|
-
self.class.new(
|
21
|
-
reasons: @reasons + [reason],
|
22
|
-
props: @props.merge(reason.props),
|
23
|
-
)
|
24
|
-
end
|
25
|
-
end
|
26
|
-
end
|
27
|
-
end
|
@@ -1,50 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Nanoc
|
4
|
-
module Int
|
5
|
-
# Stores action sequences for objects that can be run through a rule (item
|
6
|
-
# representations and layouts).
|
7
|
-
#
|
8
|
-
# @api private
|
9
|
-
class ActionSequenceStore < ::Nanoc::Int::Store
|
10
|
-
include Nanoc::Core::ContractsSupport
|
11
|
-
|
12
|
-
contract C::KeywordArgs[config: Nanoc::Core::Configuration] => C::Any
|
13
|
-
def initialize(config:)
|
14
|
-
super(Nanoc::Int::Store.tmp_path_for(config: config, store_name: 'rule_memory'), 1)
|
15
|
-
|
16
|
-
@action_sequences = {}
|
17
|
-
end
|
18
|
-
|
19
|
-
# @param [Nanoc::Core::ItemRep, Nanoc::Core::Layout] obj The item representation or
|
20
|
-
# the layout to get the action sequence for
|
21
|
-
#
|
22
|
-
# @return [Array] The action sequence for the given object
|
23
|
-
def [](obj)
|
24
|
-
@action_sequences[obj.reference]
|
25
|
-
end
|
26
|
-
|
27
|
-
# @param [Nanoc::Core::ItemRep, Nanoc::Core::Layout] obj The item representation or
|
28
|
-
# the layout to set the action sequence for
|
29
|
-
#
|
30
|
-
# @param [Array] action_sequence The new action sequence to be stored
|
31
|
-
#
|
32
|
-
# @return [void]
|
33
|
-
def []=(obj, action_sequence)
|
34
|
-
@action_sequences[obj.reference] = action_sequence
|
35
|
-
end
|
36
|
-
|
37
|
-
protected
|
38
|
-
|
39
|
-
# @see Nanoc::Int::Store#data
|
40
|
-
def data
|
41
|
-
@action_sequences
|
42
|
-
end
|
43
|
-
|
44
|
-
# @see Nanoc::Int::Store#data=
|
45
|
-
def data=(new_data)
|
46
|
-
@action_sequences = new_data
|
47
|
-
end
|
48
|
-
end
|
49
|
-
end
|
50
|
-
end
|