nanoc 3.7.3 → 3.7.4
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.lock +71 -46
- data/NEWS.md +14 -0
- data/lib/nanoc.rb +1 -1
- data/lib/nanoc/base/checksummer.rb +1 -1
- data/lib/nanoc/base/compilation/checksum_store.rb +1 -1
- data/lib/nanoc/base/compilation/compiled_content_cache.rb +1 -1
- data/lib/nanoc/base/compilation/compiler.rb +11 -10
- data/lib/nanoc/base/compilation/compiler_dsl.rb +4 -4
- data/lib/nanoc/base/compilation/dependency_tracker.rb +7 -7
- data/lib/nanoc/base/compilation/filter.rb +1 -1
- data/lib/nanoc/base/compilation/item_rep_proxy.rb +6 -5
- data/lib/nanoc/base/compilation/item_rep_recorder_proxy.rb +8 -7
- data/lib/nanoc/base/compilation/outdatedness_checker.rb +6 -6
- data/lib/nanoc/base/compilation/rule.rb +1 -1
- data/lib/nanoc/base/compilation/rule_memory_store.rb +1 -1
- data/lib/nanoc/base/compilation/rules_collection.rb +5 -5
- data/lib/nanoc/base/context.rb +1 -1
- data/lib/nanoc/base/core_ext/array.rb +1 -1
- data/lib/nanoc/base/core_ext/date.rb +1 -1
- data/lib/nanoc/base/core_ext/hash.rb +1 -1
- data/lib/nanoc/base/directed_graph.rb +3 -3
- data/lib/nanoc/base/memoization.rb +1 -1
- data/lib/nanoc/base/notification_center.rb +1 -1
- data/lib/nanoc/base/ordered_hash.rb +1 -1
- data/lib/nanoc/base/plugin_registry.rb +3 -3
- data/lib/nanoc/base/result_data/item_rep.rb +13 -11
- data/lib/nanoc/base/source_data/code_snippet.rb +2 -2
- data/lib/nanoc/base/source_data/data_source.rb +3 -3
- data/lib/nanoc/base/source_data/item.rb +8 -8
- data/lib/nanoc/base/source_data/item_array.rb +1 -1
- data/lib/nanoc/base/source_data/layout.rb +1 -1
- data/lib/nanoc/base/source_data/site.rb +27 -18
- data/lib/nanoc/base/store.rb +3 -3
- data/lib/nanoc/base/temp_filename_factory.rb +2 -2
- data/lib/nanoc/cli.rb +6 -6
- data/lib/nanoc/cli/cleaning_stream.rb +1 -1
- data/lib/nanoc/cli/command_runner.rb +4 -3
- data/lib/nanoc/cli/commands/autocompile.rb +3 -3
- data/lib/nanoc/cli/commands/check.rb +3 -3
- data/lib/nanoc/cli/commands/compile.rb +23 -23
- data/lib/nanoc/cli/commands/create-item.rb +5 -5
- data/lib/nanoc/cli/commands/create-layout.rb +14 -14
- data/lib/nanoc/cli/commands/create-site.rb +6 -6
- data/lib/nanoc/cli/commands/deploy.rb +8 -8
- data/lib/nanoc/cli/commands/nanoc.rb +3 -3
- data/lib/nanoc/cli/commands/prune.rb +3 -3
- data/lib/nanoc/cli/commands/shell.rb +4 -4
- data/lib/nanoc/cli/commands/show-data.rb +5 -5
- data/lib/nanoc/cli/commands/show-plugins.rb +5 -5
- data/lib/nanoc/cli/commands/show-rules.rb +4 -4
- data/lib/nanoc/cli/commands/sync.rb +1 -1
- data/lib/nanoc/cli/commands/update.rb +13 -13
- data/lib/nanoc/cli/commands/validate-css.rb +3 -3
- data/lib/nanoc/cli/commands/validate-html.rb +3 -3
- data/lib/nanoc/cli/commands/validate-links.rb +6 -6
- data/lib/nanoc/cli/commands/view.rb +4 -4
- data/lib/nanoc/cli/commands/watch.rb +11 -11
- data/lib/nanoc/cli/error_handler.rb +10 -10
- data/lib/nanoc/cli/logger.rb +1 -1
- data/lib/nanoc/cli/stream_cleaners/abstract.rb +1 -1
- data/lib/nanoc/data_sources/deprecated/last_fm.rb +5 -5
- data/lib/nanoc/data_sources/deprecated/twitter.rb +1 -1
- data/lib/nanoc/data_sources/filesystem.rb +16 -16
- data/lib/nanoc/data_sources/filesystem_unified.rb +1 -1
- data/lib/nanoc/data_sources/filesystem_verbose.rb +1 -1
- data/lib/nanoc/data_sources/static.rb +1 -1
- data/lib/nanoc/extra/auto_compiler.rb +2 -2
- data/lib/nanoc/extra/checking/check.rb +11 -1
- data/lib/nanoc/extra/checking/checks/external_links.rb +15 -7
- data/lib/nanoc/extra/checking/checks/internal_links.rb +3 -3
- data/lib/nanoc/extra/checking/checks/stale.rb +6 -6
- data/lib/nanoc/extra/checking/runner.rb +10 -9
- data/lib/nanoc/extra/chick.rb +2 -2
- data/lib/nanoc/extra/core_ext/enumerable.rb +1 -1
- data/lib/nanoc/extra/deployers/fog.rb +2 -2
- data/lib/nanoc/extra/deployers/rsync.rb +3 -3
- data/lib/nanoc/extra/file_proxy.rb +3 -3
- data/lib/nanoc/extra/jruby_nokogiri_warner.rb +1 -1
- data/lib/nanoc/extra/link_collector.rb +3 -3
- data/lib/nanoc/extra/piper.rb +2 -2
- data/lib/nanoc/extra/pruner.rb +4 -3
- data/lib/nanoc/extra/validators/links.rb +2 -2
- data/lib/nanoc/extra/validators/w3c.rb +1 -1
- data/lib/nanoc/extra/vcs.rb +5 -5
- data/lib/nanoc/extra/vcses/dummy.rb +1 -1
- data/lib/nanoc/filters/asciidoc.rb +1 -1
- data/lib/nanoc/filters/bluecloth.rb +1 -1
- data/lib/nanoc/filters/coffeescript.rb +1 -1
- data/lib/nanoc/filters/colorize_syntax.rb +19 -21
- data/lib/nanoc/filters/erubis.rb +1 -1
- data/lib/nanoc/filters/handlebars.rb +1 -1
- data/lib/nanoc/filters/less.rb +2 -2
- data/lib/nanoc/filters/markaby.rb +1 -1
- data/lib/nanoc/filters/mustache.rb +1 -1
- data/lib/nanoc/filters/rdoc.rb +1 -1
- data/lib/nanoc/filters/relativize_paths.rb +5 -5
- data/lib/nanoc/filters/rubypants.rb +1 -1
- data/lib/nanoc/filters/sass/sass_filesystem_importer.rb +1 -1
- data/lib/nanoc/filters/typogruby.rb +1 -1
- data/lib/nanoc/filters/xsl.rb +1 -1
- data/lib/nanoc/helpers/blogging.rb +12 -12
- data/lib/nanoc/helpers/capturing.rb +3 -3
- data/lib/nanoc/helpers/html_escape.rb +6 -6
- data/lib/nanoc/helpers/tagging.rb +1 -1
- data/lib/nanoc/helpers/xml_sitemap.rb +4 -4
- data/lib/nanoc/tasks/clean.rake +1 -1
- data/lib/nanoc/tasks/clean.rb +1 -1
- data/lib/nanoc/tasks/deploy/rsync.rake +2 -2
- data/lib/nanoc/version.rb +1 -1
- data/tasks/rubocop.rake +1 -0
- data/test/base/core_ext/array_spec.rb +7 -7
- data/test/base/core_ext/hash_spec.rb +1 -1
- data/test/base/test_checksum_store.rb +1 -1
- data/test/base/test_compiler.rb +14 -14
- data/test/base/test_compiler_dsl.rb +13 -13
- data/test/base/test_context.rb +2 -2
- data/test/base/test_dependency_tracker.rb +42 -42
- data/test/base/test_directed_graph.rb +102 -102
- data/test/base/test_item.rb +21 -21
- data/test/base/test_item_array.rb +19 -19
- data/test/base/test_item_rep.rb +50 -50
- data/test/base/test_layout.rb +6 -6
- data/test/base/test_outdatedness_checker.rb +2 -2
- data/test/base/test_rule_context.rb +2 -2
- data/test/base/test_site.rb +5 -5
- data/test/cli/commands/test_compile.rb +7 -7
- data/test/cli/commands/test_create_site.rb +2 -2
- data/test/cli/commands/test_deploy.rb +10 -10
- data/test/cli/commands/test_prune.rb +2 -2
- data/test/cli/commands/test_sync.rb +1 -1
- data/test/cli/commands/test_watch.rb +7 -7
- data/test/cli/test_cleaning_stream.rb +4 -4
- data/test/cli/test_cli.rb +3 -3
- data/test/cli/test_error_handler.rb +3 -3
- data/test/data_sources/test_filesystem.rb +19 -19
- data/test/data_sources/test_filesystem_unified.rb +30 -30
- data/test/data_sources/test_filesystem_verbose.rb +3 -3
- data/test/data_sources/test_static.rb +9 -9
- data/test/extra/checking/checks/test_stale.rb +8 -8
- data/test/extra/checking/test_check.rb +11 -1
- data/test/extra/checking/test_dsl.rb +1 -1
- data/test/extra/core_ext/test_enumerable.rb +2 -2
- data/test/extra/deployers/test_fog.rb +10 -10
- data/test/extra/deployers/test_rsync.rb +2 -2
- data/test/extra/test_auto_compiler.rb +28 -28
- data/test/extra/test_filesystem_tools.rb +3 -3
- data/test/extra/test_link_collector.rb +39 -20
- data/test/extra/validators/test_w3c.rb +5 -5
- data/test/filters/test_asciidoc.rb +2 -2
- data/test/filters/test_bluecloth.rb +1 -1
- data/test/filters/test_coffeescript.rb +1 -1
- data/test/filters/test_colorize_syntax.rb +20 -13
- data/test/filters/test_erb.rb +1 -1
- data/test/filters/test_kramdown.rb +1 -1
- data/test/filters/test_less.rb +10 -10
- data/test/filters/test_markaby.rb +2 -2
- data/test/filters/test_maruku.rb +2 -2
- data/test/filters/test_pandoc.rb +3 -3
- data/test/filters/test_rainpress.rb +4 -4
- data/test/filters/test_rdiscount.rb +2 -2
- data/test/filters/test_rdoc.rb +1 -1
- data/test/filters/test_redcarpet.rb +5 -5
- data/test/filters/test_redcloth.rb +5 -5
- data/test/filters/test_relativize_paths.rb +33 -31
- data/test/filters/test_rubypants.rb +2 -2
- data/test/filters/test_sass.rb +8 -8
- data/test/filters/test_slim.rb +3 -3
- data/test/filters/test_uglify_js.rb +1 -1
- data/test/filters/test_yui_compressor.rb +3 -3
- data/test/gem_loader.rb +1 -1
- data/test/helper.rb +14 -16
- data/test/helpers/test_blogging.rb +28 -28
- data/test/helpers/test_breadcrumbs.rb +12 -12
- data/test/helpers/test_capturing.rb +7 -7
- data/test/helpers/test_filtering.rb +16 -16
- data/test/helpers/test_link_to.rb +3 -3
- data/test/helpers/test_rendering.rb +1 -1
- data/test/helpers/test_tagging.rb +11 -11
- data/test/helpers/test_xml_sitemap.rb +18 -18
- data/test/tasks/test_clean.rb +8 -8
- metadata +2 -2
|
@@ -46,11 +46,11 @@ class Nanoc::ItemArrayTest < Nanoc::TestCase
|
|
|
46
46
|
end
|
|
47
47
|
|
|
48
48
|
def test_brackets_and_slice_with_range
|
|
49
|
-
assert_equal [
|
|
50
|
-
assert_equal [
|
|
49
|
+
assert_equal [@one, @two], @items[0..1]
|
|
50
|
+
assert_equal [@one, @two], @items[0, 2]
|
|
51
51
|
|
|
52
|
-
assert_equal [
|
|
53
|
-
assert_equal [
|
|
52
|
+
assert_equal [@one, @two], @items.slice(0..1)
|
|
53
|
+
assert_equal [@one, @two], @items.slice(0, 2)
|
|
54
54
|
end
|
|
55
55
|
|
|
56
56
|
def test_brackets_and_slice_and_at_with_identifier
|
|
@@ -150,11 +150,11 @@ class Nanoc::ItemArrayTest < Nanoc::TestCase
|
|
|
150
150
|
assert_nil @items['/one/']
|
|
151
151
|
assert_nil @items['/two/']
|
|
152
152
|
|
|
153
|
-
assert_equal
|
|
154
|
-
assert_equal
|
|
153
|
+
assert_equal 'New Item One', @items[0].raw_content
|
|
154
|
+
assert_equal 'New Item One', @items['/new/one/'].raw_content
|
|
155
155
|
|
|
156
|
-
assert_equal
|
|
157
|
-
assert_equal
|
|
156
|
+
assert_equal 'New Item Two', @items[1].raw_content
|
|
157
|
+
assert_equal 'New Item Two', @items['/new/two/'].raw_content
|
|
158
158
|
end
|
|
159
159
|
|
|
160
160
|
def test_collect_bang_frozen
|
|
@@ -169,7 +169,7 @@ class Nanoc::ItemArrayTest < Nanoc::TestCase
|
|
|
169
169
|
|
|
170
170
|
def test_concat
|
|
171
171
|
new_item = Nanoc::Item.new('New item', {}, '/new/')
|
|
172
|
-
@items.concat([
|
|
172
|
+
@items.concat([new_item])
|
|
173
173
|
|
|
174
174
|
assert_equal new_item, @items[2]
|
|
175
175
|
assert_equal new_item, @items['/new/']
|
|
@@ -211,10 +211,10 @@ class Nanoc::ItemArrayTest < Nanoc::TestCase
|
|
|
211
211
|
assert_nil @items['/one/']
|
|
212
212
|
assert_nil @items['/two/']
|
|
213
213
|
|
|
214
|
-
assert_equal
|
|
215
|
-
assert_equal
|
|
216
|
-
assert_equal
|
|
217
|
-
assert_equal
|
|
214
|
+
assert_equal 'Item 0', @items[0].raw_content
|
|
215
|
+
assert_equal 'Item 0', @items['/new/0/'].raw_content
|
|
216
|
+
assert_equal 'Item 1', @items[1].raw_content
|
|
217
|
+
assert_equal 'Item 1', @items['/new/1/'].raw_content
|
|
218
218
|
end
|
|
219
219
|
|
|
220
220
|
def test_fill_range
|
|
@@ -225,8 +225,8 @@ class Nanoc::ItemArrayTest < Nanoc::TestCase
|
|
|
225
225
|
|
|
226
226
|
assert_equal @one, @items[0]
|
|
227
227
|
assert_equal @one, @items['/one/']
|
|
228
|
-
assert_equal
|
|
229
|
-
assert_equal
|
|
228
|
+
assert_equal 'Item 1', @items[1].raw_content
|
|
229
|
+
assert_equal 'Item 1', @items['/new/1/'].raw_content
|
|
230
230
|
end
|
|
231
231
|
|
|
232
232
|
if Array.new.respond_to?(:keep_if)
|
|
@@ -253,7 +253,7 @@ class Nanoc::ItemArrayTest < Nanoc::TestCase
|
|
|
253
253
|
end
|
|
254
254
|
|
|
255
255
|
def test_push
|
|
256
|
-
pushy = Nanoc::Item.new(
|
|
256
|
+
pushy = Nanoc::Item.new('Pushy', {}, '/pushy/')
|
|
257
257
|
@items.push(pushy)
|
|
258
258
|
|
|
259
259
|
assert_equal @one, @items[0]
|
|
@@ -275,10 +275,10 @@ class Nanoc::ItemArrayTest < Nanoc::TestCase
|
|
|
275
275
|
end
|
|
276
276
|
|
|
277
277
|
def test_replace
|
|
278
|
-
max = Nanoc::Item.new(
|
|
278
|
+
max = Nanoc::Item.new('Max', {}, '/max/')
|
|
279
279
|
mona = Nanoc::Item.new('Mona', {}, '/mona/')
|
|
280
280
|
|
|
281
|
-
@items.replace([
|
|
281
|
+
@items.replace([max, mona])
|
|
282
282
|
|
|
283
283
|
assert_nil @items['/one/']
|
|
284
284
|
assert_nil @items['/two/']
|
|
@@ -320,7 +320,7 @@ class Nanoc::ItemArrayTest < Nanoc::TestCase
|
|
|
320
320
|
end
|
|
321
321
|
|
|
322
322
|
def test_unshift
|
|
323
|
-
unshifty = Nanoc::Item.new(
|
|
323
|
+
unshifty = Nanoc::Item.new('Unshifty', {}, '/unshifty/')
|
|
324
324
|
@items.unshift(unshifty)
|
|
325
325
|
|
|
326
326
|
assert_equal unshifty, @items[0]
|
data/test/base/test_item_rep.rb
CHANGED
|
@@ -66,7 +66,7 @@ class Nanoc::ItemRepTest < Nanoc::TestCase
|
|
|
66
66
|
def test_compiled_content_with_uncompiled_content
|
|
67
67
|
# Create rep
|
|
68
68
|
item = Nanoc::Item.new(
|
|
69
|
-
|
|
69
|
+
'blah blah', {}, '/',
|
|
70
70
|
:binary => false
|
|
71
71
|
)
|
|
72
72
|
rep = Nanoc::ItemRep.new(item, nil)
|
|
@@ -87,7 +87,7 @@ class Nanoc::ItemRepTest < Nanoc::TestCase
|
|
|
87
87
|
|
|
88
88
|
# Mock item
|
|
89
89
|
item = Nanoc::Item.new(
|
|
90
|
-
%
|
|
90
|
+
%(<%= '<%= "blah" %' + '>' %>), {}, '/',
|
|
91
91
|
:binary => false
|
|
92
92
|
)
|
|
93
93
|
|
|
@@ -101,21 +101,21 @@ class Nanoc::ItemRepTest < Nanoc::TestCase
|
|
|
101
101
|
# Filter once
|
|
102
102
|
item_rep.assigns = {}
|
|
103
103
|
item_rep.filter(:erb)
|
|
104
|
-
assert_equal(%
|
|
104
|
+
assert_equal(%(<%= "blah" %>), item_rep.instance_eval { @content[:last] })
|
|
105
105
|
|
|
106
106
|
# Filter twice
|
|
107
107
|
item_rep.assigns = {}
|
|
108
108
|
item_rep.filter(:erb)
|
|
109
|
-
assert_equal(%
|
|
109
|
+
assert_equal(%(blah), item_rep.instance_eval { @content[:last] })
|
|
110
110
|
end
|
|
111
111
|
|
|
112
112
|
def test_layout
|
|
113
113
|
# Mock layout
|
|
114
|
-
layout = Nanoc::Layout.new(%
|
|
114
|
+
layout = Nanoc::Layout.new(%(<%= "blah" %>), {}, '/somelayout/')
|
|
115
115
|
|
|
116
116
|
# Mock item
|
|
117
117
|
item = Nanoc::Item.new(
|
|
118
|
-
|
|
118
|
+
'blah blah', {}, '/',
|
|
119
119
|
:binary => false
|
|
120
120
|
)
|
|
121
121
|
|
|
@@ -129,7 +129,7 @@ class Nanoc::ItemRepTest < Nanoc::TestCase
|
|
|
129
129
|
# Layout
|
|
130
130
|
item_rep.assigns = {}
|
|
131
131
|
item_rep.layout(layout, :erb, {})
|
|
132
|
-
assert_equal(%
|
|
132
|
+
assert_equal(%(blah), item_rep.instance_eval { @content[:last] })
|
|
133
133
|
end
|
|
134
134
|
|
|
135
135
|
def test_snapshot
|
|
@@ -141,7 +141,7 @@ class Nanoc::ItemRepTest < Nanoc::TestCase
|
|
|
141
141
|
|
|
142
142
|
# Mock item
|
|
143
143
|
item = Nanoc::Item.new(
|
|
144
|
-
%
|
|
144
|
+
%(<%= '<%= "blah" %' + '>' %>), {}, '/foobar/',
|
|
145
145
|
:binary => false
|
|
146
146
|
)
|
|
147
147
|
|
|
@@ -161,15 +161,15 @@ class Nanoc::ItemRepTest < Nanoc::TestCase
|
|
|
161
161
|
item_rep.snapshot(:qux)
|
|
162
162
|
|
|
163
163
|
# Check snapshots
|
|
164
|
-
assert_equal(%
|
|
165
|
-
assert_equal(%
|
|
166
|
-
assert_equal(%
|
|
164
|
+
assert_equal(%(<%= '<%= "blah" %' + '>' %>), item_rep.instance_eval { @content[:foo] })
|
|
165
|
+
assert_equal(%(<%= "blah" %>), item_rep.instance_eval { @content[:bar] })
|
|
166
|
+
assert_equal(%(blah), item_rep.instance_eval { @content[:qux] })
|
|
167
167
|
end
|
|
168
168
|
|
|
169
169
|
def test_snapshot_should_be_written
|
|
170
170
|
# Mock item
|
|
171
171
|
item = Nanoc::Item.new(
|
|
172
|
-
|
|
172
|
+
'blah blah', {}, '/',
|
|
173
173
|
:binary => false
|
|
174
174
|
)
|
|
175
175
|
|
|
@@ -198,13 +198,13 @@ class Nanoc::ItemRepTest < Nanoc::TestCase
|
|
|
198
198
|
def test_write_should_not_touch_identical_textual_files
|
|
199
199
|
# Mock item
|
|
200
200
|
item = Nanoc::Item.new(
|
|
201
|
-
|
|
201
|
+
'blah blah', {}, '/',
|
|
202
202
|
:binary => false
|
|
203
203
|
)
|
|
204
204
|
|
|
205
205
|
# Create rep
|
|
206
206
|
item_rep = Nanoc::ItemRep.new(item, :foo)
|
|
207
|
-
def item_rep.generate_diff
|
|
207
|
+
def item_rep.generate_diff; end
|
|
208
208
|
item_rep.instance_eval { @content[:last] = 'Lorem ipsum, etc.' }
|
|
209
209
|
item_rep.raw_path = 'foo/bar/baz/quux.txt'
|
|
210
210
|
|
|
@@ -222,7 +222,7 @@ class Nanoc::ItemRepTest < Nanoc::TestCase
|
|
|
222
222
|
def test_write
|
|
223
223
|
# Mock item
|
|
224
224
|
item = Nanoc::Item.new(
|
|
225
|
-
|
|
225
|
+
'blah blah', {}, '/',
|
|
226
226
|
:binary => false
|
|
227
227
|
)
|
|
228
228
|
|
|
@@ -242,19 +242,19 @@ class Nanoc::ItemRepTest < Nanoc::TestCase
|
|
|
242
242
|
def test_filter_text_to_binary
|
|
243
243
|
# Mock item
|
|
244
244
|
item = Nanoc::Item.new(
|
|
245
|
-
|
|
245
|
+
'blah blah', {}, '/',
|
|
246
246
|
:binary => false
|
|
247
247
|
)
|
|
248
248
|
|
|
249
249
|
# Create rep
|
|
250
250
|
rep = Nanoc::ItemRep.new(item, :foo)
|
|
251
|
-
def rep.assigns
|
|
251
|
+
def rep.assigns; {}; end
|
|
252
252
|
|
|
253
253
|
# Create fake filter
|
|
254
254
|
def rep.filter_named(name)
|
|
255
255
|
@filter ||= Class.new(::Nanoc::Filter) do
|
|
256
256
|
type :text => :binary
|
|
257
|
-
def run(content, params={})
|
|
257
|
+
def run(content, params = {})
|
|
258
258
|
File.open(output_filename, 'w') { |io| io.write(content) }
|
|
259
259
|
end
|
|
260
260
|
end
|
|
@@ -270,19 +270,19 @@ class Nanoc::ItemRepTest < Nanoc::TestCase
|
|
|
270
270
|
def test_filter_with_textual_rep_and_binary_filter
|
|
271
271
|
# Mock item
|
|
272
272
|
item = Nanoc::Item.new(
|
|
273
|
-
|
|
273
|
+
'blah blah', {}, '/',
|
|
274
274
|
:binary => false
|
|
275
275
|
)
|
|
276
276
|
|
|
277
277
|
# Create rep
|
|
278
278
|
rep = Nanoc::ItemRep.new(item, :foo)
|
|
279
|
-
def rep.assigns
|
|
279
|
+
def rep.assigns; {}; end
|
|
280
280
|
|
|
281
281
|
# Create fake filter
|
|
282
282
|
def rep.filter_named(name)
|
|
283
283
|
@filter ||= Class.new(::Nanoc::Filter) do
|
|
284
284
|
type :binary
|
|
285
|
-
def run(content, params={})
|
|
285
|
+
def run(content, params = {})
|
|
286
286
|
File.open(output_filename, 'w') { |io| io.write(content) }
|
|
287
287
|
end
|
|
288
288
|
end
|
|
@@ -329,7 +329,7 @@ class Nanoc::ItemRepTest < Nanoc::TestCase
|
|
|
329
329
|
|
|
330
330
|
def test_converted_binary_rep_can_be_layed_out
|
|
331
331
|
# Mock layout
|
|
332
|
-
layout = Nanoc::Layout.new(%
|
|
332
|
+
layout = Nanoc::Layout.new(%(<%= "blah" %> <%= yield %>), {}, '/somelayout/')
|
|
333
333
|
|
|
334
334
|
# Create item and item rep
|
|
335
335
|
item = create_binary_item
|
|
@@ -338,9 +338,9 @@ class Nanoc::ItemRepTest < Nanoc::TestCase
|
|
|
338
338
|
|
|
339
339
|
# Create filter
|
|
340
340
|
Class.new(::Nanoc::Filter) do
|
|
341
|
-
type
|
|
341
|
+
type :binary => :text
|
|
342
342
|
identifier :binary_to_text
|
|
343
|
-
def run(content, params={})
|
|
343
|
+
def run(content, params = {})
|
|
344
344
|
content + ' textified'
|
|
345
345
|
end
|
|
346
346
|
end
|
|
@@ -367,8 +367,8 @@ class Nanoc::ItemRepTest < Nanoc::TestCase
|
|
|
367
367
|
def rep.filter_named(name)
|
|
368
368
|
Class.new(::Nanoc::Filter) do
|
|
369
369
|
type :binary => :text
|
|
370
|
-
def run(content, params={})
|
|
371
|
-
|
|
370
|
+
def run(content, params = {})
|
|
371
|
+
'Some textual content'
|
|
372
372
|
end
|
|
373
373
|
end
|
|
374
374
|
end
|
|
@@ -378,8 +378,8 @@ class Nanoc::ItemRepTest < Nanoc::TestCase
|
|
|
378
378
|
def rep.filter_named(name)
|
|
379
379
|
Class.new(::Nanoc::Filter) do
|
|
380
380
|
type :text
|
|
381
|
-
def run(content, params={})
|
|
382
|
-
|
|
381
|
+
def run(content, params = {})
|
|
382
|
+
'Some textual content'
|
|
383
383
|
end
|
|
384
384
|
end
|
|
385
385
|
end
|
|
@@ -403,8 +403,8 @@ class Nanoc::ItemRepTest < Nanoc::TestCase
|
|
|
403
403
|
def rep.filter_named(name)
|
|
404
404
|
@filter ||= Class.new(::Nanoc::Filter) do
|
|
405
405
|
type :binary => :text
|
|
406
|
-
def run(content, params={})
|
|
407
|
-
|
|
406
|
+
def run(content, params = {})
|
|
407
|
+
'Some textual content'
|
|
408
408
|
end
|
|
409
409
|
end
|
|
410
410
|
end
|
|
@@ -415,16 +415,16 @@ class Nanoc::ItemRepTest < Nanoc::TestCase
|
|
|
415
415
|
|
|
416
416
|
def test_new_content_should_be_frozen
|
|
417
417
|
filter_class = Class.new(::Nanoc::Filter) do
|
|
418
|
-
def run(content, params={})
|
|
418
|
+
def run(content, params = {})
|
|
419
419
|
content.gsub!('foo', 'moo')
|
|
420
420
|
content
|
|
421
421
|
end
|
|
422
422
|
end
|
|
423
423
|
|
|
424
|
-
item = Nanoc::Item.new(
|
|
424
|
+
item = Nanoc::Item.new('foo bar', {}, '/foo/')
|
|
425
425
|
rep = Nanoc::ItemRep.new(item, :default)
|
|
426
426
|
rep.instance_eval { @filter_class = filter_class }
|
|
427
|
-
def rep.filter_named(name)
|
|
427
|
+
def rep.filter_named(name); @filter_class; end
|
|
428
428
|
|
|
429
429
|
assert_raises_frozen_error do
|
|
430
430
|
rep.filter(:whatever)
|
|
@@ -433,16 +433,16 @@ class Nanoc::ItemRepTest < Nanoc::TestCase
|
|
|
433
433
|
|
|
434
434
|
def test_filter_should_freeze_content
|
|
435
435
|
filter_class = Class.new(::Nanoc::Filter) do
|
|
436
|
-
def run(content, params={})
|
|
436
|
+
def run(content, params = {})
|
|
437
437
|
content.gsub!('foo', 'moo')
|
|
438
438
|
content
|
|
439
439
|
end
|
|
440
440
|
end
|
|
441
441
|
|
|
442
|
-
item = Nanoc::Item.new(
|
|
442
|
+
item = Nanoc::Item.new('foo bar', {}, '/foo/')
|
|
443
443
|
rep = Nanoc::ItemRep.new(item, :default)
|
|
444
444
|
rep.instance_eval { @filter_class = filter_class }
|
|
445
|
-
def rep.filter_named(name)
|
|
445
|
+
def rep.filter_named(name); @filter_class; end
|
|
446
446
|
|
|
447
447
|
assert_raises_frozen_error do
|
|
448
448
|
rep.filter(:erb)
|
|
@@ -452,8 +452,8 @@ class Nanoc::ItemRepTest < Nanoc::TestCase
|
|
|
452
452
|
|
|
453
453
|
def test_raw_path_should_generate_dependency
|
|
454
454
|
items = [
|
|
455
|
-
Nanoc3::Item.new(
|
|
456
|
-
Nanoc3::Item.new(
|
|
455
|
+
Nanoc3::Item.new('foo', {}, '/foo/'),
|
|
456
|
+
Nanoc3::Item.new('bar', {}, '/bar/')
|
|
457
457
|
]
|
|
458
458
|
item_reps = [
|
|
459
459
|
Nanoc3::ItemRep.new(items[0], :default),
|
|
@@ -467,13 +467,13 @@ class Nanoc::ItemRepTest < Nanoc::TestCase
|
|
|
467
467
|
Nanoc3::NotificationCenter.post(:visit_ended, items[0])
|
|
468
468
|
dt.stop
|
|
469
469
|
|
|
470
|
-
assert_equal [
|
|
470
|
+
assert_equal [items[1]], dt.objects_causing_outdatedness_of(items[0])
|
|
471
471
|
end
|
|
472
472
|
|
|
473
473
|
def test_path_should_generate_dependency
|
|
474
474
|
items = [
|
|
475
|
-
Nanoc3::Item.new(
|
|
476
|
-
Nanoc3::Item.new(
|
|
475
|
+
Nanoc3::Item.new('foo', {}, '/foo/'),
|
|
476
|
+
Nanoc3::Item.new('bar', {}, '/bar/')
|
|
477
477
|
]
|
|
478
478
|
item_reps = [
|
|
479
479
|
Nanoc3::ItemRep.new(items[0], :default),
|
|
@@ -487,11 +487,11 @@ class Nanoc::ItemRepTest < Nanoc::TestCase
|
|
|
487
487
|
Nanoc3::NotificationCenter.post(:visit_ended, items[0])
|
|
488
488
|
dt.stop
|
|
489
489
|
|
|
490
|
-
assert_equal [
|
|
490
|
+
assert_equal [items[1]], dt.objects_causing_outdatedness_of(items[0])
|
|
491
491
|
end
|
|
492
492
|
|
|
493
493
|
def test_access_compiled_content_of_binary_item
|
|
494
|
-
item = Nanoc::Item.new(
|
|
494
|
+
item = Nanoc::Item.new('content/somefile.dat', {}, '/somefile/', :binary => true)
|
|
495
495
|
item_rep = Nanoc::ItemRep.new(item, :foo)
|
|
496
496
|
assert_raises(Nanoc::Errors::CannotGetCompiledContentOfBinaryItem) do
|
|
497
497
|
item_rep.compiled_content
|
|
@@ -503,7 +503,7 @@ class Nanoc::ItemRepTest < Nanoc::TestCase
|
|
|
503
503
|
FileUtils.mkdir_p('content')
|
|
504
504
|
File.open('content/meow.dat', 'w') { |io| io.write('asdf') }
|
|
505
505
|
item = Nanoc::Item.new(
|
|
506
|
-
|
|
506
|
+
'content/meow.dat', {}, '/',
|
|
507
507
|
:binary => true
|
|
508
508
|
)
|
|
509
509
|
|
|
@@ -531,7 +531,7 @@ class Nanoc::ItemRepTest < Nanoc::TestCase
|
|
|
531
531
|
FileUtils.mkdir_p('content')
|
|
532
532
|
File.open('content/meow.dat', 'w') { |io| io.write('asdf') }
|
|
533
533
|
item = Nanoc::Item.new(
|
|
534
|
-
|
|
534
|
+
'content/meow.dat', {}, '/',
|
|
535
535
|
:binary => true
|
|
536
536
|
)
|
|
537
537
|
|
|
@@ -556,11 +556,11 @@ class Nanoc::ItemRepTest < Nanoc::TestCase
|
|
|
556
556
|
Nanoc::NotificationCenter.remove(:rep_written, self)
|
|
557
557
|
end
|
|
558
558
|
|
|
559
|
-
private
|
|
559
|
+
private
|
|
560
560
|
|
|
561
561
|
def create_binary_item
|
|
562
562
|
Nanoc::Item.new(
|
|
563
|
-
|
|
563
|
+
'/a/file/name.dat', {}, '/',
|
|
564
564
|
:binary => true
|
|
565
565
|
)
|
|
566
566
|
end
|
|
@@ -580,8 +580,8 @@ private
|
|
|
580
580
|
def create_textual_filter
|
|
581
581
|
f = create_filter(:text)
|
|
582
582
|
f.class_eval do
|
|
583
|
-
def run(content, params={})
|
|
584
|
-
|
|
583
|
+
def run(content, params = {})
|
|
584
|
+
''
|
|
585
585
|
end
|
|
586
586
|
end
|
|
587
587
|
f
|
|
@@ -590,7 +590,7 @@ private
|
|
|
590
590
|
def create_binary_filter
|
|
591
591
|
f = create_filter(:binary)
|
|
592
592
|
f.class_eval do
|
|
593
|
-
def run(content, params={})
|
|
593
|
+
def run(content, params = {})
|
|
594
594
|
File.open(output_filename, 'w') { |io| io.write(content) }
|
|
595
595
|
end
|
|
596
596
|
end
|
data/test/base/test_layout.rb
CHANGED
|
@@ -4,16 +4,16 @@ class Nanoc::LayoutTest < Nanoc::TestCase
|
|
|
4
4
|
|
|
5
5
|
def test_initialize
|
|
6
6
|
# Make sure attributes are cleaned
|
|
7
|
-
layout = Nanoc::Layout.new(
|
|
7
|
+
layout = Nanoc::Layout.new('content', { 'foo' => 'bar' }, '/foo/')
|
|
8
8
|
assert_equal({ :foo => 'bar' }, layout.attributes)
|
|
9
9
|
|
|
10
10
|
# Make sure identifier is cleaned
|
|
11
|
-
layout = Nanoc::Layout.new(
|
|
11
|
+
layout = Nanoc::Layout.new('content', { 'foo' => 'bar' }, 'foo')
|
|
12
12
|
assert_equal('/foo/', layout.identifier)
|
|
13
13
|
end
|
|
14
14
|
|
|
15
15
|
def test_frozen_identifier
|
|
16
|
-
layout = Nanoc::Layout.new(
|
|
16
|
+
layout = Nanoc::Layout.new('foo', {}, '/foo')
|
|
17
17
|
|
|
18
18
|
assert_raises_frozen_error do
|
|
19
19
|
layout.identifier.chop!
|
|
@@ -22,7 +22,7 @@ class Nanoc::LayoutTest < Nanoc::TestCase
|
|
|
22
22
|
|
|
23
23
|
def test_lookup_with_known_attribute
|
|
24
24
|
# Create layout
|
|
25
|
-
layout = Nanoc::Layout.new(
|
|
25
|
+
layout = Nanoc::Layout.new('content', { 'foo' => 'bar' }, '/foo/')
|
|
26
26
|
|
|
27
27
|
# Check attributes
|
|
28
28
|
assert_equal('bar', layout[:foo])
|
|
@@ -30,7 +30,7 @@ class Nanoc::LayoutTest < Nanoc::TestCase
|
|
|
30
30
|
|
|
31
31
|
def test_lookup_with_unknown_attribute
|
|
32
32
|
# Create layout
|
|
33
|
-
layout = Nanoc::Layout.new(
|
|
33
|
+
layout = Nanoc::Layout.new('content', { 'foo' => 'bar' }, '/foo/')
|
|
34
34
|
|
|
35
35
|
# Check attributes
|
|
36
36
|
assert_equal(nil, layout[:filter])
|
|
@@ -38,7 +38,7 @@ class Nanoc::LayoutTest < Nanoc::TestCase
|
|
|
38
38
|
|
|
39
39
|
def test_dump_and_load
|
|
40
40
|
layout = Nanoc::Layout.new(
|
|
41
|
-
|
|
41
|
+
'foobar',
|
|
42
42
|
{ :a => { :b => 123 }},
|
|
43
43
|
'/foo/')
|
|
44
44
|
|