nanoc 4.6.1 → 4.6.2
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/Appraisals +1 -1
- data/Gemfile.lock +22 -22
- data/NEWS.md +12 -0
- data/lib/nanoc/base/entities/document.rb +7 -0
- data/lib/nanoc/base/entities/identifiable_collection.rb +12 -9
- data/lib/nanoc/base/entities/item_rep.rb +24 -28
- data/lib/nanoc/base/entities/processing_actions/snapshot.rb +15 -11
- data/lib/nanoc/base/entities/rule_memory.rb +15 -5
- data/lib/nanoc/base/entities/site.rb +15 -10
- data/lib/nanoc/base/entities/snapshot_def.rb +8 -2
- data/lib/nanoc/base/repos.rb +3 -0
- data/lib/nanoc/base/repos/aggregate_data_source.rb +20 -0
- data/lib/nanoc/base/repos/in_mem_data_source.rb +13 -0
- data/lib/nanoc/base/repos/prefixed_data_source.rb +19 -0
- data/lib/nanoc/base/repos/site_loader.rb +8 -16
- data/lib/nanoc/base/repos/snapshot_repo.rb +10 -5
- data/lib/nanoc/base/services/action_provider.rb +12 -0
- data/lib/nanoc/base/services/compiler/phases/recalculate.rb +5 -2
- data/lib/nanoc/base/services/compiler/phases/write.rb +1 -3
- data/lib/nanoc/base/services/compiler/stages/preprocess.rb +6 -3
- data/lib/nanoc/base/services/executor.rb +2 -4
- data/lib/nanoc/base/services/filter.rb +7 -12
- data/lib/nanoc/base/services/item_rep_router.rb +40 -16
- data/lib/nanoc/base/services/item_rep_writer.rb +19 -3
- data/lib/nanoc/base/services/pruner.rb +1 -1
- data/lib/nanoc/base/views/item_rep_view.rb +12 -3
- data/lib/nanoc/base/views/mutable_identifiable_collection_view.rb +1 -1
- data/lib/nanoc/base/views/mutable_item_collection_view.rb +1 -1
- data/lib/nanoc/base/views/mutable_layout_collection_view.rb +1 -1
- data/lib/nanoc/checking/checks/html.rb +1 -1
- data/lib/nanoc/checking/checks/stale.rb +2 -1
- data/lib/nanoc/checking/checks/w3c_validator.rb +1 -0
- data/lib/nanoc/cli/commands/compile.rb +3 -2
- data/lib/nanoc/cli/commands/show-data.rb +4 -2
- data/lib/nanoc/data_sources/filesystem.rb +1 -1
- data/lib/nanoc/helpers/filtering.rb +1 -2
- data/lib/nanoc/helpers/rendering.rb +1 -2
- data/lib/nanoc/helpers/xml_sitemap.rb +2 -2
- data/lib/nanoc/rule_dsl/action_provider.rb +7 -0
- data/lib/nanoc/rule_dsl/rule_context.rb +4 -1
- data/lib/nanoc/rule_dsl/rule_memory_calculator.rb +33 -13
- data/lib/nanoc/spec.rb +5 -6
- data/lib/nanoc/version.rb +1 -1
- data/spec/nanoc/base/checksummer_spec.rb +19 -9
- data/spec/nanoc/base/compiler_spec.rb +4 -8
- data/spec/nanoc/base/entities/document_spec.rb +20 -0
- data/spec/nanoc/base/entities/identifiable_collection_spec.rb +12 -0
- data/spec/nanoc/base/entities/item_rep_spec.rb +1 -1
- data/spec/nanoc/base/entities/processing_actions/snapshot_spec.rb +19 -13
- data/spec/nanoc/base/entities/rule_memory_spec.rb +39 -3
- data/spec/nanoc/base/entities/site_spec.rb +15 -10
- data/spec/nanoc/base/filter_spec.rb +28 -1
- data/spec/nanoc/base/item_rep_writer_spec.rb +4 -2
- data/spec/nanoc/base/repos/outdatedness_store_spec.rb +1 -2
- data/spec/nanoc/base/repos/snapshot_repo_spec.rb +4 -4
- data/spec/nanoc/base/repos/store_spec.rb +5 -1
- data/spec/nanoc/base/services/compiler/stages/compile_reps_spec.rb +9 -10
- data/spec/nanoc/base/services/executor_spec.rb +2 -2
- data/spec/nanoc/base/services/item_rep_router_spec.rb +83 -39
- data/spec/nanoc/base/services/outdatedness_checker_spec.rb +1 -2
- data/spec/nanoc/base/services/outdatedness_rules_spec.rb +2 -3
- data/spec/nanoc/base/services/pruner_spec.rb +2 -2
- data/spec/nanoc/base/views/identifiable_collection_view_spec.rb +46 -28
- data/spec/nanoc/base/views/item_rep_view_spec.rb +72 -15
- data/spec/nanoc/base/views/item_view_spec.rb +20 -14
- data/spec/nanoc/base/views/mutable_identifiable_collection_view_spec.rb +10 -4
- data/spec/nanoc/base/views/mutable_item_collection_view_spec.rb +10 -5
- data/spec/nanoc/base/views/mutable_layout_collection_view_spec.rb +10 -5
- data/spec/nanoc/cli/commands/compile/file_action_printer_spec.rb +1 -1
- data/spec/nanoc/cli/commands/compile/timing_recorder_spec.rb +1 -1
- data/spec/nanoc/cli/commands/show_data_spec.rb +9 -7
- data/spec/nanoc/cli/commands/show_rules_spec.rb +16 -10
- data/spec/nanoc/regressions/gh_1037a_spec.rb +29 -0
- data/spec/nanoc/regressions/gh_1037b_spec.rb +18 -0
- data/spec/nanoc/regressions/gh_1082a_spec.rb +18 -0
- data/spec/nanoc/regressions/gh_1082b_spec.rb +20 -0
- data/spec/nanoc/regressions/gh_1082c_spec.rb +19 -0
- data/spec/nanoc/regressions/gh_1082d_spec.rb +17 -0
- data/spec/nanoc/regressions/gh_1093_spec.rb +49 -0
- data/spec/nanoc/regressions/gh_1097_spec.rb +21 -0
- data/spec/nanoc/regressions/gh_1100_spec.rb +20 -0
- data/spec/nanoc/regressions/gh_1102_spec.rb +26 -0
- data/spec/nanoc/regressions/gh_776_spec.rb +1 -5
- data/spec/nanoc/rule_dsl/recording_executor_spec.rb +14 -14
- data/spec/nanoc/rule_dsl/rule_context_spec.rb +22 -13
- data/spec/nanoc/rule_dsl/rule_memory_calculator_spec.rb +38 -54
- data/spec/spec_helper.rb +1 -1
- data/test/base/test_compiler.rb +3 -4
- data/test/base/test_item_array.rb +4 -15
- data/test/checking/checks/test_html.rb +4 -3
- data/test/cli/commands/test_compile.rb +2 -2
- data/test/filters/test_relativize_paths.rb +28 -28
- data/test/fixtures/vcr_cassettes/html_run_error.yml +25 -76
- data/test/helpers/test_xml_sitemap.rb +22 -19
- metadata +16 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: cb5ae7fdab33a2274afd361558045fdac7c5c2f9
|
|
4
|
+
data.tar.gz: 636a45cd39ba85dc37c2fc6abbb43af2e6e98e16
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 98f9a4d6fb54b47bdee2a1c4bef5f7fc141daa1d63d28048076596ce5b88959b5522d1000898873256e46b06b4693f9049bad09809e198110b0ec755c43bfd54
|
|
7
|
+
data.tar.gz: bec451e9af2fa9782c224df87f53629e6e4a3d9dc715d7cc145ce467c813bf33d221adf6a540b063e8ad7a0febf13dcee0a4f619ac096305e2ce60edb038e693
|
data/Appraisals
CHANGED
data/Gemfile.lock
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
GIT
|
|
2
|
-
remote:
|
|
3
|
-
revision:
|
|
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:
|
|
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:
|
|
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.
|
|
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.
|
|
73
|
-
contracts (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.
|
|
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.
|
|
88
|
+
excon (0.55.0)
|
|
89
89
|
execjs (2.7.0)
|
|
90
|
-
ffi (1.9.
|
|
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.
|
|
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.
|
|
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.
|
|
209
|
+
fog-vsphere (1.7.1)
|
|
210
210
|
fog-core
|
|
211
211
|
rbvmomi (~> 1.9)
|
|
212
|
-
fog-xenserver (0.
|
|
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.
|
|
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.
|
|
295
|
-
builder (~> 3.
|
|
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.
|
|
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.
|
|
341
|
+
tins (1.13.2)
|
|
342
342
|
trollop (2.1.2)
|
|
343
343
|
typogruby (1.0.18)
|
|
344
344
|
rubypants
|
|
345
|
-
uglifier (3.
|
|
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.
|
|
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:
|
|
@@ -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
|
-
|
|
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
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
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
|
-
|
|
6
|
+
contract C::None => C::Bool
|
|
7
7
|
attr_accessor :compiled
|
|
8
8
|
alias compiled? compiled
|
|
9
9
|
|
|
10
|
-
|
|
11
|
-
|
|
10
|
+
contract C::None => C::HashOf[Symbol => C::IterOf[String]]
|
|
11
|
+
attr_reader :raw_paths
|
|
12
12
|
|
|
13
|
-
|
|
14
|
-
|
|
13
|
+
contract C::None => C::HashOf[Symbol => C::IterOf[String]]
|
|
14
|
+
attr_reader :paths
|
|
15
15
|
|
|
16
|
-
|
|
16
|
+
contract C::None => Nanoc::Int::Item
|
|
17
17
|
attr_reader :item
|
|
18
18
|
|
|
19
|
-
|
|
19
|
+
contract C::None => Symbol
|
|
20
20
|
attr_reader :name
|
|
21
21
|
|
|
22
|
-
|
|
22
|
+
contract C::None => C::IterOf[C::Named['Nanoc::Int::SnapshotDef']]
|
|
23
23
|
attr_accessor :snapshot_defs
|
|
24
24
|
|
|
25
|
-
|
|
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[
|
|
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[
|
|
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
|
-
|
|
7
|
-
attr_reader :path
|
|
6
|
+
include Nanoc::Int::ContractsSupport
|
|
8
7
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
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, @
|
|
19
|
+
[:snapshot, @snapshot_names, true, @paths]
|
|
16
20
|
end
|
|
17
21
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
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 #{@
|
|
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 =>
|
|
50
|
+
contract C::None => Array
|
|
51
51
|
def paths
|
|
52
|
-
snapshot_actions.
|
|
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],
|
|
9
|
-
def initialize(config:, code_snippets:,
|
|
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
|
-
@
|
|
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
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
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
|