nanoc 3.7.3 → 3.7.4
Sign up to get free protection for your applications and to get access to all the features.
- 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
@@ -14,7 +14,7 @@ class Nanoc::Helpers::BloggingTest < Nanoc::TestCase
|
|
14
14
|
item.stubs(:[]).with(:custom_path_in_feed).returns(nil)
|
15
15
|
item.stubs(:[]).with(:custom_url_in_feed).returns(nil)
|
16
16
|
item.stubs(:[]).with(:excerpt).returns(nil)
|
17
|
-
item.stubs(:path).returns(
|
17
|
+
item.stubs(:path).returns('/item/')
|
18
18
|
item.stubs(:[]).with(:author_name).returns(nil)
|
19
19
|
item.stubs(:[]).with(:author_uri).returns(nil)
|
20
20
|
item.stubs(:compiled_content).returns('item content')
|
@@ -88,7 +88,7 @@ class Nanoc::Helpers::BloggingTest < Nanoc::TestCase
|
|
88
88
|
def test_atom_feed
|
89
89
|
if_have 'builder' do
|
90
90
|
# Create items
|
91
|
-
@items = [
|
91
|
+
@items = [mock, mock_article, mock_article]
|
92
92
|
|
93
93
|
# Create item 0
|
94
94
|
@items[0].stubs(:[]).with(:kind).returns('item')
|
@@ -101,7 +101,7 @@ class Nanoc::Helpers::BloggingTest < Nanoc::TestCase
|
|
101
101
|
@items[1].stubs(:[]).with(:custom_path_in_feed).returns(nil)
|
102
102
|
@items[1].stubs(:[]).with(:custom_url_in_feed).returns(nil)
|
103
103
|
@items[1].stubs(:[]).with(:excerpt).returns(nil)
|
104
|
-
@items[1].stubs(:path).returns(
|
104
|
+
@items[1].stubs(:path).returns('/item1/')
|
105
105
|
@items[1].expects(:compiled_content).with(:snapshot => :pre).returns('item 1 content')
|
106
106
|
|
107
107
|
# Create item 2
|
@@ -117,7 +117,7 @@ class Nanoc::Helpers::BloggingTest < Nanoc::TestCase
|
|
117
117
|
@item.stubs(:[]).with(:author_name).returns('Denis Defreyne')
|
118
118
|
@item.stubs(:[]).with(:author_uri).returns('http://stoneship.org/')
|
119
119
|
@item.stubs(:[]).with(:feed_url).returns(nil)
|
120
|
-
@item.stubs(:path).returns(
|
120
|
+
@item.stubs(:path).returns('/journal/feed/')
|
121
121
|
|
122
122
|
# Check
|
123
123
|
atom_feed
|
@@ -127,7 +127,7 @@ class Nanoc::Helpers::BloggingTest < Nanoc::TestCase
|
|
127
127
|
def test_atom_feed_with_times
|
128
128
|
if_have 'builder' do
|
129
129
|
# Create items
|
130
|
-
@items = [
|
130
|
+
@items = [mock_item, mock_article, mock_article]
|
131
131
|
|
132
132
|
# Create item 1
|
133
133
|
@items[1].stubs(:[]).with(:updated_at).returns(Time.now - 500)
|
@@ -149,7 +149,7 @@ class Nanoc::Helpers::BloggingTest < Nanoc::TestCase
|
|
149
149
|
@item.stubs(:[]).with(:author_name).returns('Denis Defreyne')
|
150
150
|
@item.stubs(:[]).with(:author_uri).returns('http://stoneship.org/')
|
151
151
|
@item.stubs(:[]).with(:feed_url).returns(nil)
|
152
|
-
@item.stubs(:path).returns(
|
152
|
+
@item.stubs(:path).returns('/journal/feed/')
|
153
153
|
|
154
154
|
# Check
|
155
155
|
atom_feed
|
@@ -159,7 +159,7 @@ class Nanoc::Helpers::BloggingTest < Nanoc::TestCase
|
|
159
159
|
def test_atom_feed_without_articles
|
160
160
|
if_have 'builder' do
|
161
161
|
# Mock items
|
162
|
-
@items = [
|
162
|
+
@items = [mock_item, mock_item]
|
163
163
|
|
164
164
|
# Mock site
|
165
165
|
@site = mock
|
@@ -185,7 +185,7 @@ class Nanoc::Helpers::BloggingTest < Nanoc::TestCase
|
|
185
185
|
def test_atom_feed_without_base_url
|
186
186
|
if_have 'builder' do
|
187
187
|
# Create items
|
188
|
-
@items = [
|
188
|
+
@items = [mock_item, mock_article]
|
189
189
|
|
190
190
|
# Mock site
|
191
191
|
@site = mock
|
@@ -211,7 +211,7 @@ class Nanoc::Helpers::BloggingTest < Nanoc::TestCase
|
|
211
211
|
def test_atom_feed_without_title
|
212
212
|
if_have 'builder' do
|
213
213
|
# Create items
|
214
|
-
@items = [
|
214
|
+
@items = [mock_item, mock_article]
|
215
215
|
|
216
216
|
# Mock site
|
217
217
|
@site = mock
|
@@ -237,7 +237,7 @@ class Nanoc::Helpers::BloggingTest < Nanoc::TestCase
|
|
237
237
|
def test_atom_feed_without_author_name
|
238
238
|
if_have 'builder' do
|
239
239
|
# Create items
|
240
|
-
@items = [
|
240
|
+
@items = [mock_item, mock_article]
|
241
241
|
|
242
242
|
# Mock site
|
243
243
|
@site = mock
|
@@ -263,11 +263,11 @@ class Nanoc::Helpers::BloggingTest < Nanoc::TestCase
|
|
263
263
|
def test_atom_feed_with_author_name_and_uri_from_content_item
|
264
264
|
if_have 'builder' do
|
265
265
|
# Create items
|
266
|
-
@items = [
|
266
|
+
@items = [mock_article]
|
267
267
|
|
268
268
|
# Create item 1
|
269
|
-
@items[0].stubs(:[]).with(:author_name).returns(
|
270
|
-
@items[0].stubs(:[]).with(:author_uri).returns(
|
269
|
+
@items[0].stubs(:[]).with(:author_name).returns('Don Alias')
|
270
|
+
@items[0].stubs(:[]).with(:author_uri).returns('http://don.example.com/')
|
271
271
|
@items[0].expects(:compiled_content).returns('item 1 content')
|
272
272
|
|
273
273
|
# Mock site
|
@@ -281,7 +281,7 @@ class Nanoc::Helpers::BloggingTest < Nanoc::TestCase
|
|
281
281
|
@item.stubs(:[]).with(:author_name).returns('Denis Defreyne')
|
282
282
|
@item.stubs(:[]).with(:author_uri).returns('http://stoneship.org/')
|
283
283
|
@item.stubs(:[]).with(:feed_url).returns(nil)
|
284
|
-
@item.stubs(:path).returns(
|
284
|
+
@item.stubs(:path).returns('/journal/feed/')
|
285
285
|
|
286
286
|
# Check
|
287
287
|
# TODO: Use xpath matchers for more specific test
|
@@ -311,7 +311,7 @@ class Nanoc::Helpers::BloggingTest < Nanoc::TestCase
|
|
311
311
|
def test_atom_feed_without_author_uri
|
312
312
|
if_have 'builder' do
|
313
313
|
# Create items
|
314
|
-
@items = [
|
314
|
+
@items = [mock_item, mock_article]
|
315
315
|
|
316
316
|
# Mock site
|
317
317
|
@site = mock
|
@@ -337,7 +337,7 @@ class Nanoc::Helpers::BloggingTest < Nanoc::TestCase
|
|
337
337
|
def test_atom_feed_without_articles_created_at
|
338
338
|
if_have 'builder' do
|
339
339
|
# Create items
|
340
|
-
@items = [
|
340
|
+
@items = [mock_item, mock_article, mock_article]
|
341
341
|
@items[1].stubs(:[]).with(:created_at).returns(Time.now.to_s)
|
342
342
|
@items[2].stubs(:[]).with(:created_at).returns(nil)
|
343
343
|
|
@@ -365,7 +365,7 @@ class Nanoc::Helpers::BloggingTest < Nanoc::TestCase
|
|
365
365
|
def test_atom_feed_with_title_author_name_and_uri_as_params
|
366
366
|
if_have 'builder' do
|
367
367
|
# Create items
|
368
|
-
@items = [
|
368
|
+
@items = [mock_item, mock_article]
|
369
369
|
@items[1].expects(:compiled_content).with(:snapshot => :pre).returns('asdf')
|
370
370
|
|
371
371
|
# Mock site
|
@@ -391,7 +391,7 @@ class Nanoc::Helpers::BloggingTest < Nanoc::TestCase
|
|
391
391
|
def test_atom_feed_with_title_author_name_and_uri_from_config
|
392
392
|
if_have 'builder' do
|
393
393
|
# Create items
|
394
|
-
@items = [
|
394
|
+
@items = [mock_item, mock_article]
|
395
395
|
@items[1].expects(:compiled_content).with(:snapshot => :pre).returns('asdf')
|
396
396
|
|
397
397
|
# Mock site
|
@@ -419,7 +419,7 @@ class Nanoc::Helpers::BloggingTest < Nanoc::TestCase
|
|
419
419
|
def test_atom_feed_with_articles_param
|
420
420
|
if_have 'builder' do
|
421
421
|
# Mock items
|
422
|
-
@items = [
|
422
|
+
@items = [mock_article, mock_article]
|
423
423
|
|
424
424
|
@items[0].expects(:compiled_content).never
|
425
425
|
@items[1].stubs(:[]).with(:title).returns('Item One')
|
@@ -437,14 +437,14 @@ class Nanoc::Helpers::BloggingTest < Nanoc::TestCase
|
|
437
437
|
@item.stubs(:[]).with(:[]).with(:feed_url).returns('http://example.com/feed')
|
438
438
|
|
439
439
|
# Check
|
440
|
-
atom_feed :articles => [
|
440
|
+
atom_feed :articles => [@items[1]]
|
441
441
|
end
|
442
442
|
end
|
443
443
|
|
444
444
|
def test_atom_feed_with_limit_param
|
445
445
|
if_have 'builder' do
|
446
446
|
# Mock articles
|
447
|
-
@items = [
|
447
|
+
@items = [mock_article, mock_article]
|
448
448
|
@items.each_with_index do |article, i|
|
449
449
|
article.stubs(:[]).with(:title).returns("Article #{i}")
|
450
450
|
article.stubs(:[]).with(:created_at).returns(Time.now - i)
|
@@ -477,7 +477,7 @@ class Nanoc::Helpers::BloggingTest < Nanoc::TestCase
|
|
477
477
|
def test_atom_feed_sorting
|
478
478
|
if_have 'builder' do
|
479
479
|
# Mock articles
|
480
|
-
@items = [
|
480
|
+
@items = [mock_article, mock_article]
|
481
481
|
@items.each_with_index do |article, i|
|
482
482
|
article.stubs(:[]).with(:title).returns("Article #{i}")
|
483
483
|
end
|
@@ -507,7 +507,7 @@ class Nanoc::Helpers::BloggingTest < Nanoc::TestCase
|
|
507
507
|
def test_atom_feed_with_content_proc_param
|
508
508
|
if_have 'builder' do
|
509
509
|
# Mock article
|
510
|
-
@items = [
|
510
|
+
@items = [mock_article]
|
511
511
|
|
512
512
|
# Mock site
|
513
513
|
@site = mock
|
@@ -529,7 +529,7 @@ class Nanoc::Helpers::BloggingTest < Nanoc::TestCase
|
|
529
529
|
def test_atom_feed_with_excerpt_proc_param
|
530
530
|
if_have 'builder' do
|
531
531
|
# Mock article
|
532
|
-
@items = [
|
532
|
+
@items = [mock_article]
|
533
533
|
|
534
534
|
# Mock site
|
535
535
|
@site = mock
|
@@ -551,7 +551,7 @@ class Nanoc::Helpers::BloggingTest < Nanoc::TestCase
|
|
551
551
|
def test_atom_feed_with_icon_param
|
552
552
|
if_have 'builder' do
|
553
553
|
# Mock article
|
554
|
-
@items = [
|
554
|
+
@items = [mock_article]
|
555
555
|
|
556
556
|
# Mock site
|
557
557
|
@site = mock
|
@@ -573,7 +573,7 @@ class Nanoc::Helpers::BloggingTest < Nanoc::TestCase
|
|
573
573
|
def test_atom_feed_with_logo_param
|
574
574
|
if_have 'builder' do
|
575
575
|
# Mock article
|
576
|
-
@items = [
|
576
|
+
@items = [mock_article]
|
577
577
|
|
578
578
|
# Mock site
|
579
579
|
@site = mock
|
@@ -595,7 +595,7 @@ class Nanoc::Helpers::BloggingTest < Nanoc::TestCase
|
|
595
595
|
def test_atom_feed_with_item_without_path
|
596
596
|
if_have 'builder' do
|
597
597
|
# Create items
|
598
|
-
@items = [
|
598
|
+
@items = [mock_article]
|
599
599
|
@items[0].stubs(:path).returns(nil)
|
600
600
|
|
601
601
|
# Mock site
|
@@ -609,7 +609,7 @@ class Nanoc::Helpers::BloggingTest < Nanoc::TestCase
|
|
609
609
|
@item.stubs(:[]).with(:author_name).returns('Denis Defreyne')
|
610
610
|
@item.stubs(:[]).with(:author_uri).returns('http://stoneship.org/')
|
611
611
|
@item.stubs(:[]).with(:feed_url).returns(nil)
|
612
|
-
@item.stubs(:path).returns(
|
612
|
+
@item.stubs(:path).returns('/journal/feed/')
|
613
613
|
|
614
614
|
# Check
|
615
615
|
atom_feed
|
@@ -6,38 +6,38 @@ class Nanoc::Helpers::BreadcrumbsTest < Nanoc::TestCase
|
|
6
6
|
|
7
7
|
def test_breadcrumbs_trail_at_root
|
8
8
|
@items = Nanoc::ItemArray.new
|
9
|
-
@items << Nanoc::Item.new(
|
9
|
+
@items << Nanoc::Item.new('root', {}, '/')
|
10
10
|
@item = @items.last
|
11
11
|
|
12
|
-
assert_equal [
|
12
|
+
assert_equal [@items[0]], breadcrumbs_trail
|
13
13
|
end
|
14
14
|
|
15
15
|
def test_breadcrumbs_trail_with_1_parent
|
16
16
|
@items = Nanoc::ItemArray.new
|
17
|
-
@items << Nanoc::Item.new(
|
18
|
-
@items << Nanoc::Item.new(
|
17
|
+
@items << Nanoc::Item.new('parent', {}, '/')
|
18
|
+
@items << Nanoc::Item.new('child', {}, '/foo/')
|
19
19
|
@item = @items.last
|
20
20
|
|
21
|
-
assert_equal [
|
21
|
+
assert_equal [@items[0], @items[1]], breadcrumbs_trail
|
22
22
|
end
|
23
23
|
|
24
24
|
def test_breadcrumbs_trail_with_many_parents
|
25
25
|
@items = Nanoc::ItemArray.new
|
26
|
-
@items << Nanoc::Item.new(
|
27
|
-
@items << Nanoc::Item.new(
|
28
|
-
@items << Nanoc::Item.new(
|
26
|
+
@items << Nanoc::Item.new('grandparent', {}, '/')
|
27
|
+
@items << Nanoc::Item.new('parent', {}, '/foo/')
|
28
|
+
@items << Nanoc::Item.new('child', {}, '/foo/bar/')
|
29
29
|
@item = @items.last
|
30
30
|
|
31
|
-
assert_equal [
|
31
|
+
assert_equal [@items[0], @items[1], @items[2]], breadcrumbs_trail
|
32
32
|
end
|
33
33
|
|
34
34
|
def test_breadcrumbs_trail_with_nils
|
35
35
|
@items = Nanoc::ItemArray.new
|
36
|
-
@items << Nanoc::Item.new(
|
37
|
-
@items << Nanoc::Item.new(
|
36
|
+
@items << Nanoc::Item.new('grandparent', {}, '/')
|
37
|
+
@items << Nanoc::Item.new('child', {}, '/foo/bar/')
|
38
38
|
@item = @items.last
|
39
39
|
|
40
|
-
assert_equal [
|
40
|
+
assert_equal [@items[0], nil, @items[1]], breadcrumbs_trail
|
41
41
|
end
|
42
42
|
|
43
43
|
end
|
@@ -13,9 +13,9 @@ class Nanoc::Helpers::CapturingTest < Nanoc::TestCase
|
|
13
13
|
end
|
14
14
|
|
15
15
|
# Build content to be evaluated
|
16
|
-
content = "head <% content_for :sidebar do %>\n"
|
17
|
-
" <%= 1+2 %>\n"
|
18
|
-
|
16
|
+
content = "head <% content_for :sidebar do %>\n" \
|
17
|
+
" <%= 1+2 %>\n" \
|
18
|
+
'<% end %> foot'
|
19
19
|
|
20
20
|
# Build site
|
21
21
|
@site = Nanoc3::Site.new({})
|
@@ -89,7 +89,7 @@ EOS
|
|
89
89
|
|
90
90
|
@site = Nanoc3::Site.new({})
|
91
91
|
@item = Nanoc::Item.new('content', {}, '/')
|
92
|
-
content =
|
92
|
+
content = '<% content_for :a do %>Content One<% end %>'
|
93
93
|
::ERB.new(content).result(binding)
|
94
94
|
|
95
95
|
assert_equal 'Content One', content_for(@item, :a)
|
@@ -97,7 +97,7 @@ EOS
|
|
97
97
|
|
98
98
|
@site = Nanoc3::Site.new({})
|
99
99
|
@item = Nanoc::Item.new('content', {}, '/')
|
100
|
-
content =
|
100
|
+
content = '<% content_for :b do %>Content Two<% end %>'
|
101
101
|
::ERB.new(content).result(binding)
|
102
102
|
|
103
103
|
assert_equal nil, content_for(@item, :a)
|
@@ -176,8 +176,8 @@ EOS
|
|
176
176
|
end
|
177
177
|
|
178
178
|
File.open('content/self.erb', 'w') do |io|
|
179
|
-
io.write
|
180
|
-
io.write
|
179
|
+
io.write '<% content_for :foo do %>Foo!<% end %>'
|
180
|
+
io.write '<%= content_for(@item, :foo) %>'
|
181
181
|
end
|
182
182
|
|
183
183
|
File.open('Rules', 'w') do |io|
|
@@ -7,9 +7,9 @@ class Nanoc::Helpers::FilteringTest < Nanoc::TestCase
|
|
7
7
|
def test_filter_simple
|
8
8
|
if_have 'rubypants' do
|
9
9
|
# Build content to be evaluated
|
10
|
-
content = "<p>Foo...</p>\n"
|
11
|
-
"<% filter :rubypants do %>\n"
|
12
|
-
" <p>Bar...</p>\n"
|
10
|
+
content = "<p>Foo...</p>\n" \
|
11
|
+
"<% filter :rubypants do %>\n" \
|
12
|
+
" <p>Bar...</p>\n" \
|
13
13
|
"<% end %>\n"
|
14
14
|
|
15
15
|
# Mock item and rep
|
@@ -28,9 +28,9 @@ class Nanoc::Helpers::FilteringTest < Nanoc::TestCase
|
|
28
28
|
def test_filter_with_assigns
|
29
29
|
if_have 'rubypants' do
|
30
30
|
# Build content to be evaluated
|
31
|
-
content = "<p>Foo...</p>\n"
|
32
|
-
"<% filter :erb do %>\n"
|
33
|
-
" <p><%%= @item[:title] %></p>\n"
|
31
|
+
content = "<p>Foo...</p>\n" \
|
32
|
+
"<% filter :erb do %>\n" \
|
33
|
+
" <p><%%= @item[:title] %></p>\n" \
|
34
34
|
"<% end %>\n"
|
35
35
|
|
36
36
|
# Mock item and rep
|
@@ -55,9 +55,9 @@ class Nanoc::Helpers::FilteringTest < Nanoc::TestCase
|
|
55
55
|
|
56
56
|
def test_filter_with_unknown_filter_name
|
57
57
|
# Build content to be evaluated
|
58
|
-
content = "<p>Foo...</p>\n"
|
59
|
-
"<% filter :askjdflkawgjlkwaheflnvz do %>\n"
|
60
|
-
" <p>Blah blah blah.</p>\n"
|
58
|
+
content = "<p>Foo...</p>\n" \
|
59
|
+
"<% filter :askjdflkawgjlkwaheflnvz do %>\n" \
|
60
|
+
" <p>Blah blah blah.</p>\n" \
|
61
61
|
"<% end %>\n"
|
62
62
|
|
63
63
|
# Evaluate content
|
@@ -69,8 +69,8 @@ class Nanoc::Helpers::FilteringTest < Nanoc::TestCase
|
|
69
69
|
def test_filter_with_arguments
|
70
70
|
if_have 'coderay' do
|
71
71
|
# Build content to be evaluated
|
72
|
-
content = "<% filter :coderay, :language => 'ruby' do %>\n"
|
73
|
-
" def some_function ; x = blah.foo ; x.bar 'xyzzy' ; end\n"
|
72
|
+
content = "<% filter :coderay, :language => 'ruby' do %>\n" \
|
73
|
+
" def some_function ; x = blah.foo ; x.bar 'xyzzy' ; end\n" \
|
74
74
|
"<% end %>\n"
|
75
75
|
|
76
76
|
# Mock item and rep
|
@@ -86,9 +86,9 @@ class Nanoc::Helpers::FilteringTest < Nanoc::TestCase
|
|
86
86
|
def test_with_haml
|
87
87
|
if_have 'haml' do
|
88
88
|
# Build content to be evaluated
|
89
|
-
content = "%p Foo.\n"
|
90
|
-
"- filter(:erb) do\n"
|
91
|
-
" <%= 'abc' + 'xyz' %>\n"
|
89
|
+
content = "%p Foo.\n" \
|
90
|
+
"- filter(:erb) do\n" \
|
91
|
+
" <%= 'abc' + 'xyz' %>\n" \
|
92
92
|
"%p Bar.\n"
|
93
93
|
|
94
94
|
# Mock item and rep
|
@@ -107,8 +107,8 @@ class Nanoc::Helpers::FilteringTest < Nanoc::TestCase
|
|
107
107
|
Nanoc::NotificationCenter.on(:filtering_ended) { notifications << :filtering_ended }
|
108
108
|
|
109
109
|
# Build content to be evaluated
|
110
|
-
content = "<% filter :erb do %>\n"
|
111
|
-
" ... stuff ...\n"
|
110
|
+
content = "<% filter :erb do %>\n" \
|
111
|
+
" ... stuff ...\n" \
|
112
112
|
"<% end %>\n"
|
113
113
|
|
114
114
|
# Mock item and rep
|
@@ -54,10 +54,10 @@ class Nanoc::Helpers::LinkToTest < Nanoc::TestCase
|
|
54
54
|
|
55
55
|
def test_link_to_to_nil_item_or_item_rep
|
56
56
|
obj = Object.new
|
57
|
-
def obj.path
|
57
|
+
def obj.path; nil; end
|
58
58
|
|
59
59
|
assert_raises RuntimeError do
|
60
|
-
link_to(
|
60
|
+
link_to('Some Text', obj)
|
61
61
|
end
|
62
62
|
end
|
63
63
|
|
@@ -210,7 +210,7 @@ class Nanoc::Helpers::LinkToTest < Nanoc::TestCase
|
|
210
210
|
YARD.parse(LIB_DIR + '/nanoc/helpers/link_to.rb')
|
211
211
|
|
212
212
|
# Mock
|
213
|
-
@items = [
|
213
|
+
@items = [mock, mock, mock]
|
214
214
|
@items[0].stubs(:identifier).returns('/about/')
|
215
215
|
@items[0].stubs(:path).returns('/about.html')
|
216
216
|
@items[1].stubs(:identifier).returns('/software/')
|
@@ -76,7 +76,7 @@ class Nanoc::Helpers::RenderingTest < Nanoc::TestCase
|
|
76
76
|
|
77
77
|
_erbout = '[erbout-before]'
|
78
78
|
result = render '/foo/' do
|
79
|
-
_erbout <<
|
79
|
+
_erbout << 'This is some extra content'
|
80
80
|
end
|
81
81
|
|
82
82
|
assert_equal('[erbout-before][partial-before]This is some extra content[partial-after]', _erbout)
|
@@ -17,11 +17,11 @@ class Nanoc::Helpers::TaggingTest < Nanoc::TestCase
|
|
17
17
|
|
18
18
|
def test_tags_for_with_custom_base_url
|
19
19
|
# Create item
|
20
|
-
item = Nanoc::Item.new('content', { :tags => [
|
20
|
+
item = Nanoc::Item.new('content', { :tags => ['foo', 'bar']}, '/path/')
|
21
21
|
|
22
22
|
# Check
|
23
23
|
assert_equal(
|
24
|
-
"#{link_for_tag('foo', 'http://stoneship.org/tag/')}, "
|
24
|
+
"#{link_for_tag('foo', 'http://stoneship.org/tag/')}, " \
|
25
25
|
"#{link_for_tag('bar', 'http://stoneship.org/tag/')}",
|
26
26
|
tags_for(item, :base_url => 'http://stoneship.org/tag/')
|
27
27
|
)
|
@@ -29,7 +29,7 @@ class Nanoc::Helpers::TaggingTest < Nanoc::TestCase
|
|
29
29
|
|
30
30
|
def test_tags_for_with_custom_none_text
|
31
31
|
# Create item
|
32
|
-
item = Nanoc::Item.new('content', { :tags => [
|
32
|
+
item = Nanoc::Item.new('content', { :tags => []}, '/path/')
|
33
33
|
|
34
34
|
# Check
|
35
35
|
assert_equal(
|
@@ -40,11 +40,11 @@ class Nanoc::Helpers::TaggingTest < Nanoc::TestCase
|
|
40
40
|
|
41
41
|
def test_tags_for_with_custom_separator
|
42
42
|
# Create item
|
43
|
-
item = Nanoc::Item.new('content', { :tags => [
|
43
|
+
item = Nanoc::Item.new('content', { :tags => ['foo', 'bar']}, '/path/')
|
44
44
|
|
45
45
|
# Check
|
46
46
|
assert_equal(
|
47
|
-
"#{link_for_tag('foo', 'http://technorati.com/tag/')} ++ "
|
47
|
+
"#{link_for_tag('foo', 'http://technorati.com/tag/')} ++ " \
|
48
48
|
"#{link_for_tag('bar', 'http://technorati.com/tag/')}",
|
49
49
|
tags_for(item, :separator => ' ++ ')
|
50
50
|
)
|
@@ -53,9 +53,9 @@ class Nanoc::Helpers::TaggingTest < Nanoc::TestCase
|
|
53
53
|
def test_items_with_tag
|
54
54
|
# Create items
|
55
55
|
@items = [
|
56
|
-
Nanoc::Item.new('item 1', { :tags => [
|
57
|
-
Nanoc::Item.new('item 2', { :tags => [
|
58
|
-
Nanoc::Item.new('item 3', { :tags => [
|
56
|
+
Nanoc::Item.new('item 1', { :tags => [:foo] }, '/item1/'),
|
57
|
+
Nanoc::Item.new('item 2', { :tags => [:bar] }, '/item2/'),
|
58
|
+
Nanoc::Item.new('item 3', { :tags => [:foo, :bar] }, '/item3/')
|
59
59
|
]
|
60
60
|
|
61
61
|
# Find items
|
@@ -63,21 +63,21 @@ class Nanoc::Helpers::TaggingTest < Nanoc::TestCase
|
|
63
63
|
|
64
64
|
# Check
|
65
65
|
assert_equal(
|
66
|
-
[
|
66
|
+
[@items[0], @items[2]],
|
67
67
|
items_with_foo_tag
|
68
68
|
)
|
69
69
|
end
|
70
70
|
|
71
71
|
def test_link_for_tag
|
72
72
|
assert_equal(
|
73
|
-
%
|
73
|
+
%(<a href="http://stoneship.org/tags/foobar" rel="tag">foobar</a>),
|
74
74
|
link_for_tag('foobar', 'http://stoneship.org/tags/')
|
75
75
|
)
|
76
76
|
end
|
77
77
|
|
78
78
|
def test_link_for_tag_escape
|
79
79
|
assert_equal(
|
80
|
-
%
|
80
|
+
%(<a href="http://stoneship.org/tags&stuff/foo&bar" rel="tag">foo&bar</a>),
|
81
81
|
link_for_tag('foo&bar', 'http://stoneship.org/tags&stuff/')
|
82
82
|
)
|
83
83
|
end
|