nanoc 4.0.0b3 → 4.0.0b4
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/Gemfile +1 -0
- data/Gemfile.lock +4 -2
- data/NEWS.md +10 -0
- data/TODO.md +15 -0
- data/lib/nanoc/base.rb +4 -27
- data/lib/nanoc/base/checksummer.rb +69 -19
- data/lib/nanoc/base/compilation/compiler.rb +14 -12
- data/lib/nanoc/base/compilation/compiler_dsl.rb +2 -0
- data/lib/nanoc/base/compilation/filter.rb +4 -2
- data/lib/nanoc/base/compilation/outdatedness_checker.rb +7 -7
- data/lib/nanoc/base/compilation/rule.rb +5 -6
- data/lib/nanoc/base/compilation/rule_context.rb +16 -34
- data/lib/nanoc/base/compilation/rule_memory_calculator.rb +3 -3
- data/lib/nanoc/base/compilation/rules_collection.rb +4 -10
- data/lib/nanoc/base/context.rb +2 -0
- data/lib/nanoc/base/core_ext/array.rb +0 -10
- data/lib/nanoc/base/core_ext/hash.rb +0 -10
- data/lib/nanoc/base/core_ext/pathname.rb +0 -9
- data/lib/nanoc/base/core_ext/string.rb +0 -10
- data/lib/nanoc/base/entities.rb +5 -0
- data/lib/nanoc/base/entities/content.rb +86 -0
- data/lib/nanoc/base/entities/document.rb +56 -0
- data/lib/nanoc/base/{source_data → entities}/identifier.rb +12 -1
- data/lib/nanoc/base/entities/layout.rb +8 -0
- data/lib/nanoc/base/{pattern.rb → entities/pattern.rb} +0 -0
- data/lib/nanoc/base/errors.rb +2 -1
- data/lib/nanoc/base/result_data/item_rep.rb +13 -278
- data/lib/nanoc/base/services.rb +5 -0
- data/lib/nanoc/base/services/executor.rb +141 -0
- data/lib/nanoc/base/services/item_rep_writer.rb +40 -0
- data/lib/nanoc/base/{notification_center.rb → services/notification_center.rb} +0 -0
- data/lib/nanoc/base/services/recording_executor.rb +41 -0
- data/lib/nanoc/base/{temp_filename_factory.rb → services/temp_filename_factory.rb} +0 -0
- data/lib/nanoc/base/source_data/code_snippet.rb +0 -6
- data/lib/nanoc/base/source_data/data_source.rb +4 -3
- data/lib/nanoc/base/source_data/item.rb +23 -213
- data/lib/nanoc/base/source_data/site.rb +0 -1
- data/lib/nanoc/base/views.rb +18 -0
- data/lib/nanoc/base/views/config.rb +1 -1
- data/lib/nanoc/base/views/item.rb +8 -73
- data/lib/nanoc/base/views/item_rep.rb +9 -0
- data/lib/nanoc/base/views/item_rep_collection.rb +17 -0
- data/lib/nanoc/base/views/layout.rb +1 -40
- data/lib/nanoc/base/views/mixins/document.rb +76 -0
- data/lib/nanoc/base/views/mixins/mutable_document.rb +22 -0
- data/lib/nanoc/base/views/mutable_identifiable_collection.rb +1 -1
- data/lib/nanoc/base/views/mutable_item.rb +1 -18
- data/lib/nanoc/base/views/mutable_item_collection.rb +6 -2
- data/lib/nanoc/base/views/mutable_layout.rb +1 -8
- data/lib/nanoc/cli/commands/compile.rb +1 -2
- data/lib/nanoc/cli/commands/create-site.rb +5 -5
- data/lib/nanoc/cli/commands/show-data.rb +11 -1
- data/lib/nanoc/data_sources/filesystem.rb +17 -10
- data/lib/nanoc/helpers/capturing.rb +1 -2
- data/lib/nanoc/helpers/filtering.rb +13 -1
- data/lib/nanoc/helpers/rendering.rb +4 -2
- data/lib/nanoc/version.rb +1 -1
- data/test/base/core_ext/array_spec.rb +0 -7
- data/test/base/core_ext/hash_spec.rb +0 -13
- data/test/base/core_ext/pathname_spec.rb +0 -33
- data/test/base/core_ext/string_spec.rb +0 -10
- data/test/base/test_compiler_dsl.rb +3 -3
- data/test/base/test_data_source.rb +2 -2
- data/test/base/test_item.rb +5 -129
- data/test/base/test_item_rep.rb +26 -558
- data/test/base/test_layout.rb +2 -26
- data/test/base/test_rule.rb +3 -3
- data/test/base/test_rule_context.rb +34 -15
- data/test/data_sources/test_filesystem.rb +2 -2
- data/test/data_sources/test_filesystem_unified.rb +39 -33
- data/test/extra/checking/checks/test_html.rb +0 -1
- data/test/extra/checking/checks/test_mixed_content.rb +3 -3
- data/test/extra/deployers/test_fog.rb +24 -24
- data/test/filters/test_less.rb +4 -4
- data/test/filters/test_sass.rb +10 -5
- data/test/filters/test_xsl.rb +6 -0
- data/test/helpers/test_capturing.rb +0 -1
- data/test/helpers/test_filtering.rb +5 -19
- data/test/helpers/test_tagging.rb +6 -6
- metadata +18 -11
- data/lib/nanoc/base/compilation/item_rep_proxy.rb +0 -109
- data/lib/nanoc/base/compilation/item_rep_recorder_proxy.rb +0 -97
- data/lib/nanoc/base/source_data/layout.rb +0 -111
- data/test/base/checksummer_spec.rb +0 -256
- data/test/base/test_item_rep_recorder_proxy.rb +0 -17
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c6a2272e514cd909fa601f4fea595a3827b82ae4
|
4
|
+
data.tar.gz: d2817ebcf5353f903262f858b7ce2b7dbcd995e6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bbaeae81947c39944044cb73ac30d7347c5a204ccfe70843f7796e7aa17d5def67be3fc1a77f65abca4f64ce704cf81dff123ced4c08e98f1b7e124841d96d63
|
7
|
+
data.tar.gz: e58c103c1bbf728768f349d286b1c299524513b20bff9a0621548b861eeba906b9cb4582a01f688ef6b8bc6318aefa7958166b58ba7db4187a8e8d61f9223745
|
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
nanoc (4.0.
|
4
|
+
nanoc (4.0.0b4)
|
5
5
|
cri (~> 2.3)
|
6
6
|
|
7
7
|
GEM
|
@@ -48,6 +48,7 @@ GEM
|
|
48
48
|
erubis (2.7.0)
|
49
49
|
excon (0.45.3)
|
50
50
|
execjs (2.5.2)
|
51
|
+
fakefs (0.6.7)
|
51
52
|
ffi (1.9.8)
|
52
53
|
fission (0.5.0)
|
53
54
|
CFPropertyList (~> 2.2)
|
@@ -289,6 +290,7 @@ DEPENDENCIES
|
|
289
290
|
compass
|
290
291
|
coveralls
|
291
292
|
erubis
|
293
|
+
fakefs
|
292
294
|
fog
|
293
295
|
haml
|
294
296
|
handlebars
|
@@ -327,4 +329,4 @@ DEPENDENCIES
|
|
327
329
|
yuicompressor
|
328
330
|
|
329
331
|
BUNDLED WITH
|
330
|
-
1.10.
|
332
|
+
1.10.3
|
data/NEWS.md
CHANGED
@@ -1,5 +1,15 @@
|
|
1
1
|
# nanoc news
|
2
2
|
|
3
|
+
## 4.0.0b4 (2015-06-10)
|
4
|
+
|
5
|
+
Fixes:
|
6
|
+
|
7
|
+
* Added missing `#ext` method to identifiers (#612)
|
8
|
+
* Fixed issue where identifiers would have the wrong extension (#611)
|
9
|
+
* Fixed rule context exposing entities rather than views (#614, #615)
|
10
|
+
* Fixed `#key?` and `#fetch` not being available on layout views (#618)
|
11
|
+
* Fixed `#update_attributes` not being available on mutable layout views (#619)
|
12
|
+
|
3
13
|
## 4.0.0b3 (2015-05-31)
|
4
14
|
|
5
15
|
Changes:
|
data/TODO.md
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
# To do
|
2
|
+
|
3
|
+
## Ideas
|
4
|
+
|
5
|
+
* snapshots [name, array] is weird
|
6
|
+
* binary snapshots could be possible
|
7
|
+
* binary layotus could be possible
|
8
|
+
|
9
|
+
## Removing `forget_progress`
|
10
|
+
|
11
|
+
This means not storing compiled content inside item reps anymore.
|
12
|
+
|
13
|
+
Compiler could store it, and `snapshot` could move temporary compiled content (like `:last`) and crystallize it in a more permanent store (even in-memory).
|
14
|
+
|
15
|
+
CompiledContent class, which is basically snapshot -> Content.
|
data/lib/nanoc/base.rb
CHANGED
@@ -2,51 +2,26 @@ module Nanoc
|
|
2
2
|
require 'nanoc/base/core_ext'
|
3
3
|
|
4
4
|
autoload 'Error', 'nanoc/base/error'
|
5
|
-
|
6
5
|
autoload 'DataSource', 'nanoc/base/source_data/data_source'
|
7
|
-
autoload 'Identifier', 'nanoc/base/source_data/identifier'
|
8
|
-
|
9
|
-
autoload 'ConfigView', 'nanoc/base/views/config'
|
10
|
-
autoload 'IdentifiableCollectionView', 'nanoc/base/views/identifiable_collection'
|
11
|
-
autoload 'ItemView', 'nanoc/base/views/item'
|
12
|
-
autoload 'ItemRepCollectionView', 'nanoc/base/views/item_rep_collection'
|
13
|
-
autoload 'ItemRepView', 'nanoc/base/views/item_rep'
|
14
|
-
autoload 'ItemCollectionView', 'nanoc/base/views/item_collection'
|
15
|
-
autoload 'LayoutView', 'nanoc/base/views/layout'
|
16
|
-
autoload 'LayoutCollectionView', 'nanoc/base/views/layout_collection'
|
17
|
-
autoload 'SiteView', 'nanoc/base/views/site'
|
18
|
-
|
19
|
-
autoload 'MutableIdentifiableCollectionView', 'nanoc/base/views/mutable_identifiable_collection'
|
20
|
-
autoload 'MutableConfigView', 'nanoc/base/views/mutable_config'
|
21
|
-
autoload 'MutableItemView', 'nanoc/base/views/mutable_item'
|
22
|
-
autoload 'MutableItemCollectionView', 'nanoc/base/views/mutable_item_collection'
|
23
|
-
autoload 'MutableLayoutView', 'nanoc/base/views/mutable_layout'
|
24
|
-
autoload 'MutableLayoutCollectionView', 'nanoc/base/views/mutable_layout_collection'
|
25
|
-
|
26
6
|
autoload 'Filter', 'nanoc/base/compilation/filter'
|
27
7
|
end
|
28
8
|
|
29
9
|
# @api private
|
30
10
|
module Nanoc::Int
|
31
|
-
require_relative 'base/pattern'
|
32
|
-
|
33
11
|
# Load helper classes
|
34
12
|
autoload 'Context', 'nanoc/base/context'
|
35
13
|
autoload 'Checksummer', 'nanoc/base/checksummer'
|
36
14
|
autoload 'DirectedGraph', 'nanoc/base/directed_graph'
|
37
15
|
autoload 'Errors', 'nanoc/base/errors'
|
38
16
|
autoload 'Memoization', 'nanoc/base/memoization'
|
39
|
-
autoload 'NotificationCenter', 'nanoc/base/notification_center'
|
40
17
|
autoload 'PluginRegistry', 'nanoc/base/plugin_registry'
|
41
18
|
autoload 'Store', 'nanoc/base/store'
|
42
|
-
autoload 'TempFilenameFactory', 'nanoc/base/temp_filename_factory'
|
43
19
|
autoload 'IdentifiableCollection', 'nanoc/base/identifiable_collection'
|
44
20
|
|
45
21
|
# Load source data classes
|
46
22
|
autoload 'CodeSnippet', 'nanoc/base/source_data/code_snippet'
|
47
23
|
autoload 'Configuration', 'nanoc/base/source_data/configuration'
|
48
24
|
autoload 'Item', 'nanoc/base/source_data/item'
|
49
|
-
autoload 'Layout', 'nanoc/base/source_data/layout'
|
50
25
|
autoload 'Site', 'nanoc/base/source_data/site'
|
51
26
|
|
52
27
|
# Load result data classes
|
@@ -58,8 +33,6 @@ module Nanoc::Int
|
|
58
33
|
autoload 'Compiler', 'nanoc/base/compilation/compiler'
|
59
34
|
autoload 'CompilerDSL', 'nanoc/base/compilation/compiler_dsl'
|
60
35
|
autoload 'DependencyTracker', 'nanoc/base/compilation/dependency_tracker'
|
61
|
-
autoload 'ItemRepProxy', 'nanoc/base/compilation/item_rep_proxy'
|
62
|
-
autoload 'ItemRepRecorderProxy', 'nanoc/base/compilation/item_rep_recorder_proxy'
|
63
36
|
autoload 'OutdatednessChecker', 'nanoc/base/compilation/outdatedness_checker'
|
64
37
|
autoload 'OutdatednessReasons', 'nanoc/base/compilation/outdatedness_reasons'
|
65
38
|
autoload 'Rule', 'nanoc/base/compilation/rule'
|
@@ -68,3 +41,7 @@ module Nanoc::Int
|
|
68
41
|
autoload 'RuleMemoryStore', 'nanoc/base/compilation/rule_memory_store'
|
69
42
|
autoload 'RulesCollection', 'nanoc/base/compilation/rules_collection'
|
70
43
|
end
|
44
|
+
|
45
|
+
require_relative 'base/entities'
|
46
|
+
require_relative 'base/services'
|
47
|
+
require_relative 'base/views'
|
@@ -6,63 +6,111 @@ module Nanoc::Int
|
|
6
6
|
#
|
7
7
|
# @api private
|
8
8
|
class Checksummer
|
9
|
+
class VerboseDigest
|
10
|
+
def initialize
|
11
|
+
@str = ''
|
12
|
+
end
|
13
|
+
|
14
|
+
def update(str)
|
15
|
+
@str << str
|
16
|
+
end
|
17
|
+
|
18
|
+
def to_s
|
19
|
+
@str
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
class CompactDigest
|
24
|
+
def initialize
|
25
|
+
@digest = Digest::SHA1.new
|
26
|
+
end
|
27
|
+
|
28
|
+
def update(str)
|
29
|
+
@digest.update(str)
|
30
|
+
end
|
31
|
+
|
32
|
+
def to_s
|
33
|
+
@digest.base64digest
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
9
37
|
class << self
|
10
38
|
# @param obj The object to create a checksum for
|
11
39
|
#
|
12
40
|
# @return [String] The digest
|
13
|
-
def calc(obj)
|
14
|
-
digest =
|
41
|
+
def calc(obj, digest_class = CompactDigest)
|
42
|
+
digest = digest_class.new
|
15
43
|
update(obj, digest)
|
16
|
-
digest.
|
44
|
+
digest.to_s
|
17
45
|
end
|
18
46
|
|
19
47
|
private
|
20
48
|
|
21
49
|
def update(obj, digest, visited = Set.new)
|
22
50
|
digest.update(obj.class.to_s)
|
51
|
+
digest.update('<')
|
23
52
|
|
24
53
|
if visited.include?(obj)
|
25
|
-
digest.update('recur')
|
54
|
+
digest.update('recur>')
|
26
55
|
return
|
27
56
|
end
|
28
57
|
|
29
58
|
case obj
|
30
|
-
when String
|
59
|
+
when ::String
|
31
60
|
digest.update(obj)
|
32
|
-
when
|
61
|
+
when ::Symbol
|
62
|
+
digest.update(obj.to_s)
|
63
|
+
when nil, true, false
|
64
|
+
when ::Array
|
33
65
|
obj.each do |el|
|
34
|
-
digest.update('elem')
|
35
66
|
update(el, digest, visited + [obj])
|
67
|
+
digest.update(',')
|
36
68
|
end
|
37
|
-
when Hash
|
69
|
+
when ::Hash
|
38
70
|
obj.each do |key, value|
|
39
|
-
digest.update('key')
|
40
71
|
update(key, digest, visited + [obj])
|
41
|
-
digest.update('
|
72
|
+
digest.update('=')
|
42
73
|
update(value, digest, visited + [obj])
|
74
|
+
digest.update(',')
|
43
75
|
end
|
44
|
-
when Pathname
|
76
|
+
when ::Pathname
|
45
77
|
filename = obj.to_s
|
46
78
|
if File.exist?(filename)
|
47
79
|
stat = File.stat(filename)
|
48
|
-
digest.update(stat.size.to_s + '-' + stat.mtime.
|
80
|
+
digest.update(stat.size.to_s + '-' + stat.mtime.to_i.to_s)
|
49
81
|
else
|
50
82
|
digest.update('???')
|
51
83
|
end
|
84
|
+
when Time
|
85
|
+
digest.update(obj.to_i.to_s)
|
86
|
+
when Numeric
|
87
|
+
digest.update(obj.to_s)
|
88
|
+
when Nanoc::Identifier
|
89
|
+
update(obj.to_s, digest)
|
52
90
|
when Nanoc::Int::RulesCollection
|
53
91
|
update(obj.data, digest)
|
54
92
|
when Nanoc::Int::CodeSnippet
|
55
93
|
update(obj.data, digest)
|
94
|
+
when Nanoc::Int::TextualContent
|
95
|
+
update(obj.string, digest)
|
96
|
+
when Nanoc::Int::BinaryContent
|
97
|
+
update(Pathname.new(obj.filename), digest)
|
56
98
|
when Nanoc::Int::Item, Nanoc::Int::Layout
|
57
|
-
digest.update('content')
|
58
|
-
|
59
|
-
update(Pathname.new(obj.raw_filename), digest)
|
60
|
-
else
|
61
|
-
update(obj.raw_content, digest)
|
62
|
-
end
|
99
|
+
digest.update('content=')
|
100
|
+
update(obj.content, digest)
|
63
101
|
|
64
|
-
digest.update('attributes')
|
102
|
+
digest.update(',attributes=')
|
65
103
|
update(obj.attributes, digest, visited + [obj])
|
104
|
+
|
105
|
+
digest.update(',identifier=')
|
106
|
+
update(obj.identifier, digest)
|
107
|
+
when Nanoc::ItemView, Nanoc::LayoutView, Nanoc::ConfigView, Nanoc::IdentifiableCollectionView
|
108
|
+
update(obj.unwrap, digest)
|
109
|
+
when Nanoc::Int::IdentifiableCollection
|
110
|
+
obj.each do |el|
|
111
|
+
update(el, digest, visited + [obj])
|
112
|
+
digest.update(',')
|
113
|
+
end
|
66
114
|
else
|
67
115
|
data = begin
|
68
116
|
Marshal.dump(obj)
|
@@ -72,6 +120,8 @@ module Nanoc::Int
|
|
72
120
|
|
73
121
|
digest.update(data)
|
74
122
|
end
|
123
|
+
|
124
|
+
digest.update('>')
|
75
125
|
end
|
76
126
|
end
|
77
127
|
end
|
@@ -91,7 +91,7 @@ module Nanoc::Int
|
|
91
91
|
Nanoc::Int::TempFilenameFactory.instance.cleanup(
|
92
92
|
Nanoc::Filter::TMP_BINARY_ITEMS_DIR)
|
93
93
|
Nanoc::Int::TempFilenameFactory.instance.cleanup(
|
94
|
-
Nanoc::Int::
|
94
|
+
Nanoc::Int::ItemRepWriter::TMP_TEXT_ITEMS_DIR)
|
95
95
|
end
|
96
96
|
|
97
97
|
# @group Private instance methods
|
@@ -163,7 +163,7 @@ module Nanoc::Int
|
|
163
163
|
|
164
164
|
# Calculate checksums
|
165
165
|
objects.each do |obj|
|
166
|
-
checksum_store[obj] = obj
|
166
|
+
checksum_store[obj] = Nanoc::Int::Checksummer.calc(obj)
|
167
167
|
end
|
168
168
|
|
169
169
|
# Store
|
@@ -228,7 +228,7 @@ module Nanoc::Int
|
|
228
228
|
|
229
229
|
rules.each_pair do |snapshot, rule|
|
230
230
|
# Get basic path by applying matching rule
|
231
|
-
basic_path = rule.apply_to(rep, compiler: self)
|
231
|
+
basic_path = rule.apply_to(rep, executor: nil, compiler: self)
|
232
232
|
next if basic_path.nil?
|
233
233
|
if basic_path !~ %r{^/}
|
234
234
|
raise "The path returned for the #{rep.inspect} item representation, “#{basic_path}”, does not start with a slash. Please ensure that all routing rules return a path that starts with a slash."
|
@@ -260,9 +260,9 @@ module Nanoc::Int
|
|
260
260
|
# @api private
|
261
261
|
def assigns_for(rep)
|
262
262
|
if rep.binary?
|
263
|
-
content_or_filename_assigns = { filename: rep.
|
263
|
+
content_or_filename_assigns = { filename: rep.content_snapshots[:last].filename }
|
264
264
|
else
|
265
|
-
content_or_filename_assigns = { content: rep.
|
265
|
+
content_or_filename_assigns = { content: rep.content_snapshots[:last].string }
|
266
266
|
end
|
267
267
|
|
268
268
|
# TODO: Do not expose @site (necessary for captures store though…)
|
@@ -361,6 +361,8 @@ module Nanoc::Int
|
|
361
361
|
#
|
362
362
|
# @return [void]
|
363
363
|
def compile_rep(rep)
|
364
|
+
executor = Nanoc::Int::Executor.new(self)
|
365
|
+
|
364
366
|
Nanoc::Int::NotificationCenter.post(:compilation_started, rep)
|
365
367
|
Nanoc::Int::NotificationCenter.post(:processing_started, rep)
|
366
368
|
Nanoc::Int::NotificationCenter.post(:visit_started, rep.item)
|
@@ -371,18 +373,18 @@ module Nanoc::Int
|
|
371
373
|
if !rep.item.forced_outdated? && !outdatedness_checker.outdated?(rep) && compiled_content_cache[rep]
|
372
374
|
# Reuse content
|
373
375
|
Nanoc::Int::NotificationCenter.post(:cached_content_used, rep)
|
374
|
-
rep.
|
376
|
+
rep.content_snapshots = compiled_content_cache[rep]
|
375
377
|
else
|
376
378
|
# Recalculate content
|
377
|
-
|
378
|
-
|
379
|
-
rules_collection.compilation_rule_for(rep).apply_to(rep, compiler: self)
|
380
|
-
|
381
|
-
|
379
|
+
executor.snapshot(rep, :raw)
|
380
|
+
executor.snapshot(rep, :pre, final: false)
|
381
|
+
rules_collection.compilation_rule_for(rep).apply_to(rep, executor: executor, compiler: self)
|
382
|
+
executor.snapshot(rep, :post) if rep.has_snapshot?(:post)
|
383
|
+
executor.snapshot(rep, :last)
|
382
384
|
end
|
383
385
|
|
384
386
|
rep.compiled = true
|
385
|
-
compiled_content_cache[rep] = rep.
|
387
|
+
compiled_content_cache[rep] = rep.content_snapshots
|
386
388
|
|
387
389
|
Nanoc::Int::NotificationCenter.post(:processing_ended, rep)
|
388
390
|
Nanoc::Int::NotificationCenter.post(:compilation_ended, rep)
|
@@ -81,8 +81,8 @@ module Nanoc::Int
|
|
81
81
|
# @return [Nanoc::Int::OutdatednessReasons::Generic, nil] The reason why the
|
82
82
|
# given object is outdated, or nil if the object is not outdated.
|
83
83
|
def basic_outdatedness_reason_for(obj)
|
84
|
-
case obj
|
85
|
-
when
|
84
|
+
case obj
|
85
|
+
when Nanoc::Int::ItemRep
|
86
86
|
# Outdated if rules outdated
|
87
87
|
return Nanoc::Int::OutdatednessReasons::RulesModified if
|
88
88
|
rule_memory_differs_for(obj)
|
@@ -104,9 +104,9 @@ module Nanoc::Int
|
|
104
104
|
|
105
105
|
# Not outdated
|
106
106
|
return nil
|
107
|
-
when
|
107
|
+
when Nanoc::Int::Item
|
108
108
|
obj.reps.find { |rep| basic_outdatedness_reason_for(rep) }
|
109
|
-
when
|
109
|
+
when Nanoc::Int::Layout
|
110
110
|
# Outdated if rules outdated
|
111
111
|
return Nanoc::Int::OutdatednessReasons::RulesModified if
|
112
112
|
rule_memory_differs_for(obj)
|
@@ -136,7 +136,7 @@ module Nanoc::Int
|
|
136
136
|
# @return [Boolean] true if the object is outdated, false otherwise
|
137
137
|
def outdated_due_to_dependencies?(obj, processed = Set.new)
|
138
138
|
# Convert from rep to item if necessary
|
139
|
-
obj = obj.item if obj.
|
139
|
+
obj = obj.item if obj.is_a?(Nanoc::Int::ItemRep)
|
140
140
|
|
141
141
|
# Get from cache
|
142
142
|
if @objects_outdated_due_to_dependencies.key?(obj)
|
@@ -175,7 +175,7 @@ module Nanoc::Int
|
|
175
175
|
# @return [Boolean] false if either the new or the old checksum for the
|
176
176
|
# given object is not available, true if both checksums are available
|
177
177
|
def checksums_available?(obj)
|
178
|
-
checksum_store[obj] && obj
|
178
|
+
checksum_store[obj] && Nanoc::Int::Checksummer.calc(obj)
|
179
179
|
end
|
180
180
|
memoize :checksums_available?
|
181
181
|
|
@@ -184,7 +184,7 @@ module Nanoc::Int
|
|
184
184
|
# @return [Boolean] false if the old and new checksums for the given
|
185
185
|
# object differ, true if they are identical
|
186
186
|
def checksums_identical?(obj)
|
187
|
-
checksum_store[obj] == obj
|
187
|
+
checksum_store[obj] == Nanoc::Int::Checksummer.calc(obj)
|
188
188
|
end
|
189
189
|
memoize :checksums_identical?
|
190
190
|
|
@@ -31,7 +31,7 @@ module Nanoc::Int
|
|
31
31
|
def initialize(pattern, rep_name, block, params = {})
|
32
32
|
# TODO: remove me
|
33
33
|
unless pattern.is_a?(Nanoc::Int::StringPattern) || pattern.is_a?(Nanoc::Int::RegexpPattern)
|
34
|
-
raise
|
34
|
+
raise 'Can only create rules with patterns'
|
35
35
|
end
|
36
36
|
|
37
37
|
@pattern = pattern
|
@@ -60,11 +60,10 @@ module Nanoc::Int
|
|
60
60
|
#
|
61
61
|
# @return [void]
|
62
62
|
def apply_to(rep, params = {})
|
63
|
-
compiler = params.fetch(:compiler)
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
context = Nanoc::Int::RuleContext.new(rep: rep, compiler: compiler)
|
63
|
+
compiler = params.fetch(:compiler)
|
64
|
+
executor = params.fetch(:executor)
|
65
|
+
|
66
|
+
context = Nanoc::Int::RuleContext.new(rep: rep, executor: executor, compiler: compiler)
|
68
67
|
context.instance_exec(matches(rep.item.identifier), &@block)
|
69
68
|
end
|
70
69
|
|