nanoc 3.4.3 → 3.5.0b1
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.
- data/CONTRIBUTING.md +25 -0
- data/Gemfile +3 -1
- data/Gemfile.lock +22 -13
- data/NEWS.md +27 -0
- data/README.md +3 -1
- data/lib/nanoc.rb +2 -2
- data/lib/nanoc/base/compilation/compiler_dsl.rb +19 -0
- data/lib/nanoc/base/core_ext/array.rb +18 -8
- data/lib/nanoc/base/core_ext/hash.rb +18 -8
- data/lib/nanoc/base/core_ext/pathname.rb +2 -8
- data/lib/nanoc/base/plugin_registry.rb +57 -19
- data/lib/nanoc/base/result_data/item_rep.rb +3 -15
- data/lib/nanoc/base/source_data/item.rb +1 -1
- data/lib/nanoc/base/source_data/layout.rb +1 -1
- data/lib/nanoc/base/source_data/site.rb +15 -19
- data/lib/nanoc/cli.rb +28 -23
- data/lib/nanoc/cli/command_runner.rb +4 -0
- data/lib/nanoc/cli/commands/autocompile.rb +15 -6
- data/lib/nanoc/cli/commands/check.rb +47 -0
- data/lib/nanoc/cli/commands/compile.rb +271 -195
- data/lib/nanoc/cli/commands/create-site.rb +5 -5
- data/lib/nanoc/cli/commands/deploy.rb +16 -4
- data/lib/nanoc/cli/commands/prune.rb +3 -3
- data/lib/nanoc/cli/commands/show-data.rb +73 -58
- data/lib/nanoc/cli/commands/show-rules.rb +1 -1
- data/lib/nanoc/cli/commands/validate-css.rb +2 -3
- data/lib/nanoc/cli/commands/validate-html.rb +2 -3
- data/lib/nanoc/cli/commands/validate-links.rb +5 -11
- data/lib/nanoc/cli/commands/view.rb +1 -1
- data/lib/nanoc/cli/commands/watch.rb +38 -20
- data/lib/nanoc/cli/error_handler.rb +122 -122
- data/lib/nanoc/data_sources.rb +2 -0
- 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 +60 -0
- data/lib/nanoc/extra.rb +2 -0
- data/lib/nanoc/extra/checking.rb +16 -0
- data/lib/nanoc/extra/checking/check.rb +33 -0
- data/lib/nanoc/extra/checking/checks.rb +19 -0
- data/lib/nanoc/extra/checking/checks/css.rb +23 -0
- data/lib/nanoc/extra/checking/checks/external_links.rb +149 -0
- data/lib/nanoc/extra/checking/checks/html.rb +24 -0
- data/lib/nanoc/extra/checking/checks/internal_links.rb +57 -0
- data/lib/nanoc/extra/checking/checks/stale.rb +23 -0
- data/lib/nanoc/extra/checking/dsl.rb +31 -0
- data/lib/nanoc/extra/checking/issue.rb +19 -0
- data/lib/nanoc/extra/checking/runner.rb +130 -0
- data/lib/nanoc/extra/link_collector.rb +57 -0
- data/lib/nanoc/extra/pruner.rb +1 -1
- data/lib/nanoc/extra/validators/links.rb +5 -262
- data/lib/nanoc/extra/validators/w3c.rb +8 -76
- data/lib/nanoc/filters/colorize_syntax.rb +1 -1
- data/lib/nanoc/filters/handlebars.rb +2 -2
- data/lib/nanoc/filters/less.rb +1 -1
- data/lib/nanoc/filters/redcarpet.rb +1 -1
- data/lib/nanoc/filters/rubypants.rb +1 -1
- data/lib/nanoc/filters/slim.rb +1 -1
- data/lib/nanoc/helpers/blogging.rb +163 -104
- data/lib/nanoc/helpers/xml_sitemap.rb +9 -3
- data/tasks/doc.rake +2 -1
- data/test/base/core_ext/array_spec.rb +4 -4
- data/test/base/core_ext/hash_spec.rb +7 -7
- data/test/base/core_ext/pathname_spec.rb +12 -2
- data/test/base/test_compiler_dsl.rb +24 -0
- data/test/base/test_item_rep.rb +58 -26
- data/test/cli/commands/test_watch.rb +0 -8
- data/test/data_sources/test_static.rb +66 -0
- data/test/extra/checking/checks/test_css.rb +40 -0
- data/test/extra/checking/checks/test_external_links.rb +76 -0
- data/test/extra/checking/checks/test_html.rb +40 -0
- data/test/extra/checking/checks/test_internal_links.rb +46 -0
- data/test/extra/checking/checks/test_stale.rb +49 -0
- data/test/extra/checking/test_check.rb +16 -0
- data/test/extra/checking/test_dsl.rb +20 -0
- data/test/extra/checking/test_runner.rb +15 -0
- data/test/extra/test_link_collector.rb +93 -0
- data/test/extra/validators/test_links.rb +0 -64
- data/test/extra/validators/test_w3c.rb +20 -26
- data/test/filters/test_colorize_syntax.rb +15 -0
- data/test/filters/test_less.rb +14 -0
- data/test/filters/test_pandoc.rb +5 -1
- data/test/helpers/test_blogging.rb +52 -8
- data/test/helpers/test_xml_sitemap.rb +68 -0
- data/test/test_gem.rb +1 -1
- metadata +31 -6
data/test/filters/test_pandoc.rb
CHANGED
@@ -6,11 +6,15 @@ class Nanoc::Filters::PandocTest < MiniTest::Unit::TestCase
|
|
6
6
|
|
7
7
|
def test_filter
|
8
8
|
if_have 'pandoc-ruby' do
|
9
|
+
if `which pandoc`.strip.empty?
|
10
|
+
skip "could not find pandoc"
|
11
|
+
end
|
12
|
+
|
9
13
|
# Create filter
|
10
14
|
filter = ::Nanoc::Filters::Pandoc.new
|
11
15
|
|
12
16
|
# Run filter
|
13
|
-
result = filter.run("# Heading")
|
17
|
+
result = filter.run("# Heading\n")
|
14
18
|
assert_equal("<h1 id=\"heading\">Heading</h1>", result)
|
15
19
|
end
|
16
20
|
end
|
@@ -174,7 +174,7 @@ class Nanoc::Helpers::BloggingTest < MiniTest::Unit::TestCase
|
|
174
174
|
@item.stubs(:[]).with(:author_uri).returns('http://example.com/~jdoe')
|
175
175
|
|
176
176
|
# Check
|
177
|
-
error = assert_raises(
|
177
|
+
error = assert_raises(Nanoc::Errors::GenericTrivial) do
|
178
178
|
atom_feed
|
179
179
|
end
|
180
180
|
assert_equal(
|
@@ -200,7 +200,7 @@ class Nanoc::Helpers::BloggingTest < MiniTest::Unit::TestCase
|
|
200
200
|
@item.stubs(:[]).with(:author_uri).returns('http://example.com/~jdoe')
|
201
201
|
|
202
202
|
# Check
|
203
|
-
error = assert_raises(
|
203
|
+
error = assert_raises(Nanoc::Errors::GenericTrivial) do
|
204
204
|
atom_feed
|
205
205
|
end
|
206
206
|
assert_equal(
|
@@ -226,7 +226,7 @@ class Nanoc::Helpers::BloggingTest < MiniTest::Unit::TestCase
|
|
226
226
|
@item.stubs(:[]).with(:author_uri).returns('http://example.com/~jdoe')
|
227
227
|
|
228
228
|
# Check
|
229
|
-
error = assert_raises(
|
229
|
+
error = assert_raises(Nanoc::Errors::GenericTrivial) do
|
230
230
|
atom_feed
|
231
231
|
end
|
232
232
|
assert_equal(
|
@@ -252,7 +252,7 @@ class Nanoc::Helpers::BloggingTest < MiniTest::Unit::TestCase
|
|
252
252
|
@item.stubs(:[]).with(:author_uri).returns('http://example.com/~jdoe')
|
253
253
|
|
254
254
|
# Check
|
255
|
-
error = assert_raises(
|
255
|
+
error = assert_raises(Nanoc::Errors::GenericTrivial) do
|
256
256
|
atom_feed
|
257
257
|
end
|
258
258
|
assert_equal(
|
@@ -326,7 +326,7 @@ class Nanoc::Helpers::BloggingTest < MiniTest::Unit::TestCase
|
|
326
326
|
@item.stubs(:[]).with(:author_uri).returns(nil)
|
327
327
|
|
328
328
|
# Check
|
329
|
-
error = assert_raises(
|
329
|
+
error = assert_raises(Nanoc::Errors::GenericTrivial) do
|
330
330
|
atom_feed
|
331
331
|
end
|
332
332
|
assert_equal(
|
@@ -354,7 +354,7 @@ class Nanoc::Helpers::BloggingTest < MiniTest::Unit::TestCase
|
|
354
354
|
@item.stubs(:[]).with(:author_uri).returns('http://example.com/~jdoe')
|
355
355
|
|
356
356
|
# Check
|
357
|
-
error = assert_raises(
|
357
|
+
error = assert_raises(Nanoc::Errors::GenericTrivial) do
|
358
358
|
atom_feed
|
359
359
|
end
|
360
360
|
assert_equal(
|
@@ -550,6 +550,50 @@ class Nanoc::Helpers::BloggingTest < MiniTest::Unit::TestCase
|
|
550
550
|
end
|
551
551
|
end
|
552
552
|
|
553
|
+
def test_atom_feed_with_icon_param
|
554
|
+
if_have 'builder' do
|
555
|
+
# Mock article
|
556
|
+
@items = [ mock_article ]
|
557
|
+
|
558
|
+
# Mock site
|
559
|
+
@site = mock
|
560
|
+
@site.stubs(:config).returns({ :base_url => 'http://example.com' })
|
561
|
+
|
562
|
+
# Create feed item
|
563
|
+
@item = mock
|
564
|
+
@item.stubs(:[]).with(:title).returns('My Blog Or Something')
|
565
|
+
@item.stubs(:[]).with(:author_name).returns('J. Doe')
|
566
|
+
@item.stubs(:[]).with(:author_uri).returns('http://example.com/~jdoe')
|
567
|
+
@item.stubs(:[]).with(:feed_url).returns('http://example.com/feed')
|
568
|
+
|
569
|
+
# Check
|
570
|
+
result = atom_feed :icon => 'http://example.com/icon.png'
|
571
|
+
assert_match '<icon>http://example.com/icon.png</icon>', result
|
572
|
+
end
|
573
|
+
end
|
574
|
+
|
575
|
+
def test_atom_feed_with_logo_param
|
576
|
+
if_have 'builder' do
|
577
|
+
# Mock article
|
578
|
+
@items = [ mock_article ]
|
579
|
+
|
580
|
+
# Mock site
|
581
|
+
@site = mock
|
582
|
+
@site.stubs(:config).returns({ :base_url => 'http://example.com' })
|
583
|
+
|
584
|
+
# Create feed item
|
585
|
+
@item = mock
|
586
|
+
@item.stubs(:[]).with(:title).returns('My Blog Or Something')
|
587
|
+
@item.stubs(:[]).with(:author_name).returns('J. Doe')
|
588
|
+
@item.stubs(:[]).with(:author_uri).returns('http://example.com/~jdoe')
|
589
|
+
@item.stubs(:[]).with(:feed_url).returns('http://example.com/feed')
|
590
|
+
|
591
|
+
# Check
|
592
|
+
result = atom_feed :logo => 'http://example.com/logo.png'
|
593
|
+
assert_match '<logo>http://example.com/logo.png</logo>', result
|
594
|
+
end
|
595
|
+
end
|
596
|
+
|
553
597
|
def test_atom_feed_with_item_without_path
|
554
598
|
if_have 'builder' do
|
555
599
|
# Create items
|
@@ -627,7 +671,7 @@ class Nanoc::Helpers::BloggingTest < MiniTest::Unit::TestCase
|
|
627
671
|
@site = Nanoc::Site.new({})
|
628
672
|
|
629
673
|
# Check
|
630
|
-
assert_raises(
|
674
|
+
assert_raises(Nanoc::Errors::GenericTrivial) do
|
631
675
|
url_for(nil)
|
632
676
|
end
|
633
677
|
end
|
@@ -682,7 +726,7 @@ class Nanoc::Helpers::BloggingTest < MiniTest::Unit::TestCase
|
|
682
726
|
@site = Nanoc::Site.new({})
|
683
727
|
|
684
728
|
# Check
|
685
|
-
assert_raises(
|
729
|
+
assert_raises(Nanoc::Errors::GenericTrivial) do
|
686
730
|
feed_url
|
687
731
|
end
|
688
732
|
end
|
@@ -7,6 +7,7 @@ class Nanoc::Helpers::XMLSitemapTest < MiniTest::Unit::TestCase
|
|
7
7
|
include Nanoc::Helpers::XMLSitemap
|
8
8
|
|
9
9
|
def teardown
|
10
|
+
super
|
10
11
|
@items = nil
|
11
12
|
@item = nil
|
12
13
|
@site = nil
|
@@ -106,6 +107,73 @@ class Nanoc::Helpers::XMLSitemapTest < MiniTest::Unit::TestCase
|
|
106
107
|
end
|
107
108
|
end
|
108
109
|
|
110
|
+
def test_filter
|
111
|
+
if_have 'builder', 'nokogiri' do
|
112
|
+
# Create items
|
113
|
+
@items = [ Nanoc::Item.new('some content 1', {}, '/item-one/') ]
|
114
|
+
self.create_item_rep(@items.last, :one_a, '/item-one/a/')
|
115
|
+
self.create_item_rep(@items.last, :one_b, '/item-one/b/')
|
116
|
+
|
117
|
+
# Create sitemap item
|
118
|
+
@item = Nanoc::Item.new('sitemap content', {}, '/sitemap/')
|
119
|
+
|
120
|
+
# Create site
|
121
|
+
@site = Nanoc::Site.new({ :base_url => 'http://example.com' })
|
122
|
+
|
123
|
+
# Build sitemap
|
124
|
+
res = xml_sitemap(:rep_select => lambda { |rep| rep.name == :one_a } )
|
125
|
+
|
126
|
+
# Check
|
127
|
+
doc = Nokogiri::XML(res)
|
128
|
+
urlsets = doc.css('> urlset')
|
129
|
+
assert_equal 1, urlsets.size
|
130
|
+
urls = urlsets.css('> url')
|
131
|
+
assert_equal 1, urls.size
|
132
|
+
assert_equal 'http://example.com/item-one/a/', urls[0].css('> loc').inner_text
|
133
|
+
assert_equal '', urls[0].css('> changefreq').inner_text
|
134
|
+
assert_equal '', urls[0].css('> priority').inner_text
|
135
|
+
assert_equal '', urls[0].css('> lastmod').inner_text
|
136
|
+
end
|
137
|
+
end
|
138
|
+
|
139
|
+
def test_sorted
|
140
|
+
if_have 'builder', 'nokogiri' do
|
141
|
+
# Create items
|
142
|
+
@items = []
|
143
|
+
@items << Nanoc::Item.new('some content 1', {}, '/george/')
|
144
|
+
self.create_item_rep(@items.last, :a_alice, '/george/alice/')
|
145
|
+
self.create_item_rep(@items.last, :b_zoey, '/george/zoey/')
|
146
|
+
@items << Nanoc::Item.new('some content 1', {}, '/walton/')
|
147
|
+
self.create_item_rep(@items.last, :a_eve, '/walton/eve/')
|
148
|
+
self.create_item_rep(@items.last, :b_bob, '/walton/bob/')
|
149
|
+
@items << Nanoc::Item.new('some content 1', {}, '/lucas/')
|
150
|
+
self.create_item_rep(@items.last, :a_trudy, '/lucas/trudy/')
|
151
|
+
self.create_item_rep(@items.last, :b_mallory, '/lucas/mallory/')
|
152
|
+
|
153
|
+
# Create sitemap item
|
154
|
+
@item = Nanoc::Item.new('sitemap content', {}, '/sitemap/')
|
155
|
+
|
156
|
+
# Create site
|
157
|
+
@site = Nanoc::Site.new({ :base_url => 'http://example.com' })
|
158
|
+
|
159
|
+
# Build sitemap
|
160
|
+
res = xml_sitemap(:items => @items)
|
161
|
+
|
162
|
+
# Check
|
163
|
+
doc = Nokogiri::XML(res)
|
164
|
+
urlsets = doc.css('> urlset')
|
165
|
+
assert_equal 1, urlsets.size
|
166
|
+
urls = urlsets.css('> url')
|
167
|
+
assert_equal 6, urls.size
|
168
|
+
assert_equal 'http://example.com/george/alice/', urls[0].css('> loc').inner_text
|
169
|
+
assert_equal 'http://example.com/george/zoey/', urls[1].css('> loc').inner_text
|
170
|
+
assert_equal 'http://example.com/lucas/trudy/', urls[2].css('> loc').inner_text
|
171
|
+
assert_equal 'http://example.com/lucas/mallory/', urls[3].css('> loc').inner_text
|
172
|
+
assert_equal 'http://example.com/walton/eve/', urls[4].css('> loc').inner_text
|
173
|
+
assert_equal 'http://example.com/walton/bob/', urls[5].css('> loc').inner_text
|
174
|
+
end
|
175
|
+
end
|
176
|
+
|
109
177
|
protected
|
110
178
|
|
111
179
|
def create_item_rep(item, name, path)
|
data/test/test_gem.rb
CHANGED
@@ -13,7 +13,7 @@ class Nanoc::GemTest < MiniTest::Unit::TestCase
|
|
13
13
|
require 'systemu'
|
14
14
|
|
15
15
|
# Require clean environment
|
16
|
-
|
16
|
+
Dir['nanoc-*.gem'].each { |f| FileUtils.rm(f) }
|
17
17
|
|
18
18
|
# Build
|
19
19
|
files_before = Set.new Dir['**/*']
|
metadata
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: nanoc
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.
|
5
|
-
prerelease:
|
4
|
+
version: 3.5.0b1
|
5
|
+
prerelease: 5
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Denis Defreyne
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2013-01-12 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: cri
|
@@ -122,6 +122,7 @@ extra_rdoc_files:
|
|
122
122
|
- NEWS.md
|
123
123
|
files:
|
124
124
|
- ChangeLog
|
125
|
+
- CONTRIBUTING.md
|
125
126
|
- Gemfile
|
126
127
|
- Gemfile.lock
|
127
128
|
- LICENSE
|
@@ -171,6 +172,7 @@ files:
|
|
171
172
|
- lib/nanoc/cli/cleaning_stream.rb
|
172
173
|
- lib/nanoc/cli/command_runner.rb
|
173
174
|
- lib/nanoc/cli/commands/autocompile.rb
|
175
|
+
- lib/nanoc/cli/commands/check.rb
|
174
176
|
- lib/nanoc/cli/commands/compile.rb
|
175
177
|
- lib/nanoc/cli/commands/create-item.rb
|
176
178
|
- lib/nanoc/cli/commands/create-layout.rb
|
@@ -200,8 +202,20 @@ files:
|
|
200
202
|
- lib/nanoc/data_sources/filesystem.rb
|
201
203
|
- lib/nanoc/data_sources/filesystem_unified.rb
|
202
204
|
- lib/nanoc/data_sources/filesystem_verbose.rb
|
205
|
+
- lib/nanoc/data_sources/static.rb
|
203
206
|
- lib/nanoc/data_sources.rb
|
204
207
|
- lib/nanoc/extra/auto_compiler.rb
|
208
|
+
- lib/nanoc/extra/checking/check.rb
|
209
|
+
- lib/nanoc/extra/checking/checks/css.rb
|
210
|
+
- lib/nanoc/extra/checking/checks/external_links.rb
|
211
|
+
- lib/nanoc/extra/checking/checks/html.rb
|
212
|
+
- lib/nanoc/extra/checking/checks/internal_links.rb
|
213
|
+
- lib/nanoc/extra/checking/checks/stale.rb
|
214
|
+
- lib/nanoc/extra/checking/checks.rb
|
215
|
+
- lib/nanoc/extra/checking/dsl.rb
|
216
|
+
- lib/nanoc/extra/checking/issue.rb
|
217
|
+
- lib/nanoc/extra/checking/runner.rb
|
218
|
+
- lib/nanoc/extra/checking.rb
|
205
219
|
- lib/nanoc/extra/chick.rb
|
206
220
|
- lib/nanoc/extra/core_ext/enumerable.rb
|
207
221
|
- lib/nanoc/extra/core_ext/pathname.rb
|
@@ -212,6 +226,7 @@ files:
|
|
212
226
|
- lib/nanoc/extra/deployers/rsync.rb
|
213
227
|
- lib/nanoc/extra/deployers.rb
|
214
228
|
- lib/nanoc/extra/file_proxy.rb
|
229
|
+
- lib/nanoc/extra/link_collector.rb
|
215
230
|
- lib/nanoc/extra/pruner.rb
|
216
231
|
- lib/nanoc/extra/validators/links.rb
|
217
232
|
- lib/nanoc/extra/validators/w3c.rb
|
@@ -316,6 +331,15 @@ files:
|
|
316
331
|
- test/data_sources/test_filesystem.rb
|
317
332
|
- test/data_sources/test_filesystem_unified.rb
|
318
333
|
- test/data_sources/test_filesystem_verbose.rb
|
334
|
+
- test/data_sources/test_static.rb
|
335
|
+
- test/extra/checking/checks/test_css.rb
|
336
|
+
- test/extra/checking/checks/test_external_links.rb
|
337
|
+
- test/extra/checking/checks/test_html.rb
|
338
|
+
- test/extra/checking/checks/test_internal_links.rb
|
339
|
+
- test/extra/checking/checks/test_stale.rb
|
340
|
+
- test/extra/checking/test_check.rb
|
341
|
+
- test/extra/checking/test_dsl.rb
|
342
|
+
- test/extra/checking/test_runner.rb
|
319
343
|
- test/extra/core_ext/test_enumerable.rb
|
320
344
|
- test/extra/core_ext/test_pathname.rb
|
321
345
|
- test/extra/core_ext/test_time.rb
|
@@ -323,6 +347,7 @@ files:
|
|
323
347
|
- test/extra/deployers/test_rsync.rb
|
324
348
|
- test/extra/test_auto_compiler.rb
|
325
349
|
- test/extra/test_file_proxy.rb
|
350
|
+
- test/extra/test_link_collector.rb
|
326
351
|
- test/extra/test_vcs.rb
|
327
352
|
- test/extra/validators/test_links.rb
|
328
353
|
- test/extra/validators/test_w3c.rb
|
@@ -386,12 +411,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
386
411
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
387
412
|
none: false
|
388
413
|
requirements:
|
389
|
-
- - ! '
|
414
|
+
- - ! '>'
|
390
415
|
- !ruby/object:Gem::Version
|
391
|
-
version:
|
416
|
+
version: 1.3.1
|
392
417
|
requirements: []
|
393
418
|
rubyforge_project:
|
394
|
-
rubygems_version: 1.8.
|
419
|
+
rubygems_version: 1.8.23
|
395
420
|
signing_key:
|
396
421
|
specification_version: 3
|
397
422
|
summary: a web publishing system written in Ruby for building small to medium-sized
|