nanoc 3.3.7 → 3.4.0

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.
Files changed (53) hide show
  1. data/Gemfile.lock +133 -0
  2. data/NEWS.md +15 -0
  3. data/lib/nanoc.rb +2 -2
  4. data/lib/nanoc/base/compilation/compiler.rb +1 -1
  5. data/lib/nanoc/base/compilation/item_rep_proxy.rb +3 -3
  6. data/lib/nanoc/base/core_ext/string.rb +0 -18
  7. data/lib/nanoc/base/errors.rb +24 -19
  8. data/lib/nanoc/base/plugin_registry.rb +1 -1
  9. data/lib/nanoc/base/result_data/item_rep.rb +1 -2
  10. data/lib/nanoc/base/source_data/site.rb +1 -1
  11. data/lib/nanoc/cli.rb +46 -4
  12. data/lib/nanoc/cli/ansi_string_colorizer.rb +30 -0
  13. data/lib/nanoc/cli/cleaning_stream.rb +91 -0
  14. data/lib/nanoc/cli/command_runner.rb +3 -11
  15. data/lib/nanoc/cli/commands/compile.rb +2 -2
  16. data/lib/nanoc/cli/commands/{create_item.rb → create-item.rb} +6 -7
  17. data/lib/nanoc/cli/commands/{create_layout.rb → create-layout.rb} +9 -10
  18. data/lib/nanoc/cli/commands/{create_site.rb → create-site.rb} +13 -14
  19. data/lib/nanoc/cli/commands/deploy.rb +4 -12
  20. data/lib/nanoc/cli/commands/nanoc.rb +4 -2
  21. data/lib/nanoc/cli/commands/prune.rb +1 -1
  22. data/lib/nanoc/cli/commands/{debug.rb → show-data.rb} +6 -5
  23. data/lib/nanoc/cli/commands/{info.rb → show-plugins.rb} +6 -6
  24. data/lib/nanoc/cli/commands/show-rules.rb +69 -0
  25. data/lib/nanoc/cli/commands/update.rb +1 -2
  26. data/lib/nanoc/cli/commands/validate-css.rb +24 -0
  27. data/lib/nanoc/cli/commands/validate-html.rb +24 -0
  28. data/lib/nanoc/cli/commands/validate-links.rb +35 -0
  29. data/lib/nanoc/cli/commands/watch.rb +3 -3
  30. data/lib/nanoc/cli/error_handler.rb +142 -26
  31. data/lib/nanoc/cli/logger.rb +4 -21
  32. data/lib/nanoc/cli/stream_cleaners.rb +14 -0
  33. data/lib/nanoc/cli/stream_cleaners/abstract.rb +23 -0
  34. data/lib/nanoc/cli/stream_cleaners/ansi_colors.rb +15 -0
  35. data/lib/nanoc/cli/stream_cleaners/utf8.rb +16 -0
  36. data/lib/nanoc/extra/deployers/rsync.rb +2 -7
  37. data/lib/nanoc/extra/pruner.rb +3 -3
  38. data/lib/nanoc/extra/validators/links.rb +14 -3
  39. data/lib/nanoc/filters.rb +4 -0
  40. data/lib/nanoc/filters/handlebars.rb +30 -0
  41. data/lib/nanoc/filters/mustache.rb +2 -2
  42. data/lib/nanoc/filters/pandoc.rb +20 -0
  43. data/lib/nanoc/helpers/filtering.rb +1 -1
  44. data/lib/nanoc/tasks/validate.rake +10 -68
  45. data/nanoc.gemspec +0 -16
  46. data/test/cli/commands/test_create_site.rb +1 -1
  47. data/test/cli/commands/test_deploy.rb +45 -0
  48. data/test/cli/test_cli.rb +1 -1
  49. data/test/extra/validators/test_links.rb +15 -5
  50. data/test/filters/test_handlebars.rb +42 -0
  51. data/test/filters/test_mustache.rb +19 -0
  52. data/test/filters/test_pandoc.rb +18 -0
  53. metadata +23 -33
@@ -49,13 +49,23 @@ class Nanoc::Extra::Validators::LinksTest < MiniTest::Unit::TestCase
49
49
  end
50
50
 
51
51
  def test_fetch_http_status_for
52
- # Create validator
52
+ @app = lambda { |env| [ env['REQUEST_PATH'][1..-1].to_i, {}, [ '... Useless body ...' ] ] }
53
+ @server = nil
54
+
55
+ @thread = Thread.new do
56
+ Rack::Handler::WEBrick.run(@app, :Host => @host='127.0.0.1', :Port => @port=9204) do |server|
57
+ @server = server
58
+ end
59
+ end
60
+
61
+ Thread.pass until @server
62
+
53
63
  validator = Nanoc::Extra::Validators::Links.new('output', [ 'index.html' ])
64
+ assert_equal 200, validator.send(:fetch_http_status_for, URI.parse('http://127.0.0.1:9204/200'))
65
+ assert_equal 404, validator.send(:fetch_http_status_for, URI.parse('http://127.0.0.1:9204/404'))
54
66
 
55
- # Test
56
- assert_equal 200, validator.send(:fetch_http_status_for, URI.parse('http://httpstat.us/200'))
57
- assert_equal 200, validator.send(:fetch_http_status_for, URI.parse('https://httpstat.us/200'))
58
- assert_equal 404, validator.send(:fetch_http_status_for, URI.parse('http://httpstat.us/404'))
67
+ @server.stop
68
+ @thread.kill
59
69
  end
60
70
 
61
71
  end
@@ -0,0 +1,42 @@
1
+ # encoding: utf-8
2
+
3
+ class Nanoc::Filters::HandlebarsTest < MiniTest::Unit::TestCase
4
+
5
+ include Nanoc::TestHelpers
6
+
7
+ def test_filter
8
+ if_have 'handlebars' do
9
+ # Create data
10
+ item = Nanoc::Item.new(
11
+ 'content',
12
+ { :title => 'Max Payne', :protagonist => 'Max Payne', :location => 'here' },
13
+ '/games/max-payne/')
14
+ layout = Nanoc::Layout.new(
15
+ 'layout content',
16
+ { :name => 'Max Payne' },
17
+ '/default/')
18
+ config = { :animals => 'cats and dogs' }
19
+
20
+ # Create filter
21
+ assigns = {
22
+ :item => item,
23
+ :layout => layout,
24
+ :config => config,
25
+ :content => 'No Payne No Gayne'
26
+ }
27
+ Handlebars.register_helper(:upcase) { |b| b.call.upcase }
28
+ filter = ::Nanoc::Filters::Handlebars.new(assigns)
29
+
30
+ # Run filter
31
+ result = filter.run('{{protagonist}} says: {{yield}}.')
32
+ assert_equal('Max Payne says: No Payne No Gayne.', result)
33
+ result = filter.run('We can’t stop {{item.location}}! This is the {{layout.name}} layout!')
34
+ assert_equal('We can’t stop here! This is the Max Payne layout!', result)
35
+ result = filter.run('It’s raining {{config.animals}} here!')
36
+ assert_equal('It’s raining cats and dogs here!', result)
37
+ result = filter.run('I am {{#upcase}}shouting{{/upcase}}!')
38
+ assert_equal('I am SHOUTING!', result)
39
+ end
40
+ end
41
+
42
+ end
@@ -22,4 +22,23 @@ class Nanoc::Filters::MustacheTest < MiniTest::Unit::TestCase
22
22
  end
23
23
  end
24
24
 
25
+ def test_filter_with_yield
26
+ if_have 'mustache' do
27
+ # Create item
28
+ item = Nanoc::Item.new(
29
+ 'content',
30
+ { :title => 'Max Payne', :protagonist => 'Max Payne' },
31
+ '/games/max-payne/'
32
+ )
33
+
34
+ # Create filter
35
+ filter = ::Nanoc::Filters::Mustache.new(
36
+ { :content => 'No Payne No Gayne', :item => item })
37
+
38
+ # Run filter
39
+ result = filter.run('Max says: {{yield}}.')
40
+ assert_equal('Max says: No Payne No Gayne.', result)
41
+ end
42
+ end
43
+
25
44
  end
@@ -0,0 +1,18 @@
1
+ # encoding: utf-8
2
+
3
+ class Nanoc::Filters::PandocTest < MiniTest::Unit::TestCase
4
+
5
+ include Nanoc::TestHelpers
6
+
7
+ def test_filter
8
+ if_have 'pandoc-ruby' do
9
+ # Create filter
10
+ filter = ::Nanoc::Filters::Pandoc.new
11
+
12
+ # Run filter
13
+ result = filter.run("# Heading")
14
+ assert_equal("<h1 id=\"heading\">Heading</h1>", result)
15
+ end
16
+ end
17
+
18
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: nanoc
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.3.7
4
+ version: 3.4.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-05-28 00:00:00.000000000 Z
12
+ date: 2012-06-09 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: cri
@@ -123,6 +123,7 @@ extra_rdoc_files:
123
123
  files:
124
124
  - ChangeLog
125
125
  - Gemfile
126
+ - Gemfile.lock
126
127
  - LICENSE
127
128
  - NEWS.md
128
129
  - Rakefile
@@ -166,22 +167,32 @@ files:
166
167
  - lib/nanoc/base/source_data/site.rb
167
168
  - lib/nanoc/base/store.rb
168
169
  - lib/nanoc/base.rb
170
+ - lib/nanoc/cli/ansi_string_colorizer.rb
171
+ - lib/nanoc/cli/cleaning_stream.rb
169
172
  - lib/nanoc/cli/command_runner.rb
170
173
  - lib/nanoc/cli/commands/autocompile.rb
171
174
  - lib/nanoc/cli/commands/compile.rb
172
- - lib/nanoc/cli/commands/create_item.rb
173
- - lib/nanoc/cli/commands/create_layout.rb
174
- - lib/nanoc/cli/commands/create_site.rb
175
- - lib/nanoc/cli/commands/debug.rb
175
+ - lib/nanoc/cli/commands/create-item.rb
176
+ - lib/nanoc/cli/commands/create-layout.rb
177
+ - lib/nanoc/cli/commands/create-site.rb
176
178
  - lib/nanoc/cli/commands/deploy.rb
177
- - lib/nanoc/cli/commands/info.rb
178
179
  - lib/nanoc/cli/commands/nanoc.rb
179
180
  - lib/nanoc/cli/commands/prune.rb
181
+ - lib/nanoc/cli/commands/show-data.rb
182
+ - lib/nanoc/cli/commands/show-plugins.rb
183
+ - lib/nanoc/cli/commands/show-rules.rb
180
184
  - lib/nanoc/cli/commands/update.rb
185
+ - lib/nanoc/cli/commands/validate-css.rb
186
+ - lib/nanoc/cli/commands/validate-html.rb
187
+ - lib/nanoc/cli/commands/validate-links.rb
181
188
  - lib/nanoc/cli/commands/view.rb
182
189
  - lib/nanoc/cli/commands/watch.rb
183
190
  - lib/nanoc/cli/error_handler.rb
184
191
  - lib/nanoc/cli/logger.rb
192
+ - lib/nanoc/cli/stream_cleaners/abstract.rb
193
+ - lib/nanoc/cli/stream_cleaners/ansi_colors.rb
194
+ - lib/nanoc/cli/stream_cleaners/utf8.rb
195
+ - lib/nanoc/cli/stream_cleaners.rb
185
196
  - lib/nanoc/cli.rb
186
197
  - lib/nanoc/data_sources/deprecated/delicious.rb
187
198
  - lib/nanoc/data_sources/deprecated/last_fm.rb
@@ -221,11 +232,13 @@ files:
221
232
  - lib/nanoc/filters/erb.rb
222
233
  - lib/nanoc/filters/erubis.rb
223
234
  - lib/nanoc/filters/haml.rb
235
+ - lib/nanoc/filters/handlebars.rb
224
236
  - lib/nanoc/filters/kramdown.rb
225
237
  - lib/nanoc/filters/less.rb
226
238
  - lib/nanoc/filters/markaby.rb
227
239
  - lib/nanoc/filters/maruku.rb
228
240
  - lib/nanoc/filters/mustache.rb
241
+ - lib/nanoc/filters/pandoc.rb
229
242
  - lib/nanoc/filters/rainpress.rb
230
243
  - lib/nanoc/filters/rdiscount.rb
231
244
  - lib/nanoc/filters/rdoc.rb
@@ -319,11 +332,13 @@ files:
319
332
  - test/filters/test_erb.rb
320
333
  - test/filters/test_erubis.rb
321
334
  - test/filters/test_haml.rb
335
+ - test/filters/test_handlebars.rb
322
336
  - test/filters/test_kramdown.rb
323
337
  - test/filters/test_less.rb
324
338
  - test/filters/test_markaby.rb
325
339
  - test/filters/test_maruku.rb
326
340
  - test/filters/test_mustache.rb
341
+ - test/filters/test_pandoc.rb
327
342
  - test/filters/test_rainpress.rb
328
343
  - test/filters/test_rdiscount.rb
329
344
  - test/filters/test_rdoc.rb
@@ -354,32 +369,7 @@ files:
354
369
  - .gemtest
355
370
  homepage: http://nanoc.stoneship.org/
356
371
  licenses: []
357
- post_install_message: ! '------------------------------------------------------------------------------
358
-
359
- Thanks for installing nanoc 3.3! Here are some resources to help you get
360
-
361
- started:
362
-
363
-
364
- * The web site at <http://nanoc.stoneship.org/>
365
-
366
- * The tutorial at <http://nanoc.stoneship.org/docs/3-getting-started/>
367
-
368
- * The manual at <http://nanoc.stoneship.org/docs/4-basic-concepts/>
369
-
370
-
371
- If you have questions, issues or simply want to share ideas, join the
372
-
373
- discussion at <http://groups.google.com/group/nanoc> or stop by in the IRC
374
-
375
- channel on irc.freenode.net, channel #nanoc. See you there!
376
-
377
-
378
- Enjoy!
379
-
380
- ------------------------------------------------------------------------------
381
-
382
- '
372
+ post_install_message:
383
373
  rdoc_options:
384
374
  - --main
385
375
  - README.md