nanoc 3.5.0 → 3.6.0
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +1 -0
- data/Gemfile.lock +20 -12
- data/NEWS.md +23 -0
- data/README.md +6 -3
- data/doc/yardoc_templates/default/layout/html/footer.erb +16 -7
- data/lib/nanoc.rb +1 -1
- data/lib/nanoc/base.rb +1 -0
- data/lib/nanoc/base/compilation/compiler_dsl.rb +31 -0
- data/lib/nanoc/base/compilation/filter.rb +34 -0
- data/lib/nanoc/base/result_data/item_rep.rb +3 -3
- data/lib/nanoc/base/source_data/code_snippet.rb +1 -1
- data/lib/nanoc/base/source_data/data_source.rb +12 -0
- data/lib/nanoc/base/source_data/item.rb +1 -1
- data/lib/nanoc/base/source_data/item_array.rb +62 -0
- data/lib/nanoc/base/source_data/layout.rb +1 -1
- data/lib/nanoc/base/source_data/site.rb +24 -3
- data/lib/nanoc/cli/cleaning_stream.rb +10 -0
- data/lib/nanoc/cli/command_runner.rb +25 -12
- data/lib/nanoc/cli/commands/autocompile.rb +5 -3
- data/lib/nanoc/cli/commands/check.rb +9 -1
- data/lib/nanoc/cli/commands/compile.rb +1 -1
- data/lib/nanoc/cli/commands/create-site.rb +5 -5
- data/lib/nanoc/cli/commands/prune.rb +1 -1
- data/lib/nanoc/cli/commands/shell.rb +37 -0
- data/lib/nanoc/cli/commands/show-data.rb +1 -1
- data/lib/nanoc/cli/commands/sync.rb +34 -0
- data/lib/nanoc/cli/error_handler.rb +11 -2
- data/lib/nanoc/extra/checking/checks/stale.rb +10 -2
- data/lib/nanoc/extra/pruner.rb +14 -11
- data/lib/nanoc/filters/asciidoc.rb +2 -2
- data/lib/nanoc/filters/bluecloth.rb +2 -2
- data/lib/nanoc/filters/coderay.rb +2 -2
- data/lib/nanoc/filters/coffeescript.rb +2 -2
- data/lib/nanoc/filters/colorize_syntax.rb +2 -4
- data/lib/nanoc/filters/erb.rb +2 -2
- data/lib/nanoc/filters/erubis.rb +2 -2
- data/lib/nanoc/filters/haml.rb +2 -2
- data/lib/nanoc/filters/handlebars.rb +2 -2
- data/lib/nanoc/filters/kramdown.rb +2 -2
- data/lib/nanoc/filters/less.rb +2 -2
- data/lib/nanoc/filters/markaby.rb +2 -2
- data/lib/nanoc/filters/maruku.rb +2 -2
- data/lib/nanoc/filters/mustache.rb +2 -2
- data/lib/nanoc/filters/pandoc.rb +2 -2
- data/lib/nanoc/filters/rainpress.rb +2 -2
- data/lib/nanoc/filters/rdiscount.rb +2 -2
- data/lib/nanoc/filters/rdoc.rb +3 -17
- data/lib/nanoc/filters/redcarpet.rb +7 -3
- data/lib/nanoc/filters/redcloth.rb +2 -2
- data/lib/nanoc/filters/rubypants.rb +2 -2
- data/lib/nanoc/filters/sass.rb +2 -3
- data/lib/nanoc/filters/slim.rb +2 -2
- data/lib/nanoc/filters/typogruby.rb +2 -2
- data/lib/nanoc/filters/uglify_js.rb +2 -2
- data/lib/nanoc/filters/xsl.rb +2 -1
- data/lib/nanoc/filters/yui_compressor.rb +2 -2
- data/lib/nanoc/helpers/blogging.rb +1 -1
- data/lib/nanoc/helpers/filtering.rb +1 -1
- data/lib/nanoc/helpers/rendering.rb +1 -1
- data/nanoc.gemspec +2 -2
- data/test/base/core_ext/array_spec.rb +4 -12
- data/test/base/core_ext/hash_spec.rb +4 -12
- data/test/base/test_compiler_dsl.rb +63 -0
- data/test/base/test_item.rb +3 -18
- data/test/base/test_item_array.rb +336 -0
- data/test/base/test_item_rep.rb +2 -12
- data/test/base/test_layout.rb +1 -6
- data/test/base/test_outdatedness_checker.rb +1 -1
- data/test/base/test_site.rb +9 -3
- data/test/cli/commands/test_check.rb +22 -0
- data/test/cli/commands/test_compile.rb +2 -2
- data/test/cli/commands/test_deploy.rb +6 -6
- data/test/cli/commands/test_prune.rb +23 -4
- data/test/cli/commands/test_sync.rb +31 -0
- data/test/cli/test_error_handler.rb +16 -11
- data/test/extra/checking/checks/test_stale.rb +24 -1
- data/test/extra/test_auto_compiler.rb +4 -4
- data/test/filters/test_asciidoc.rb +1 -1
- data/test/filters/test_bluecloth.rb +1 -1
- data/test/filters/test_coderay.rb +3 -3
- data/test/filters/test_coffeescript.rb +1 -1
- data/test/filters/test_colorize_syntax.rb +20 -20
- data/test/filters/test_erb.rb +10 -10
- data/test/filters/test_erubis.rb +6 -6
- data/test/filters/test_haml.rb +10 -10
- data/test/filters/test_handlebars.rb +3 -3
- data/test/filters/test_kramdown.rb +1 -1
- data/test/filters/test_less.rb +4 -4
- data/test/filters/test_markaby.rb +1 -1
- data/test/filters/test_maruku.rb +1 -1
- data/test/filters/test_mustache.rb +2 -2
- data/test/filters/test_pandoc.rb +1 -1
- data/test/filters/test_rainpress.rb +2 -2
- data/test/filters/test_rdiscount.rb +2 -2
- data/test/filters/test_rdoc.rb +1 -1
- data/test/filters/test_redcarpet.rb +21 -6
- data/test/filters/test_redcloth.rb +3 -3
- data/test/filters/test_relativize_paths.rb +27 -27
- data/test/filters/test_rubypants.rb +1 -1
- data/test/filters/test_sass.rb +8 -8
- data/test/filters/test_slim.rb +4 -4
- data/test/filters/test_typogruby.rb +1 -1
- data/test/filters/test_uglify_js.rb +2 -2
- data/test/filters/test_xsl.rb +2 -2
- data/test/filters/test_yui_compressor.rb +3 -3
- data/test/helper.rb +6 -1
- metadata +12 -6
data/lib/nanoc/filters/erb.rb
CHANGED
@@ -1,10 +1,10 @@
|
|
1
1
|
# encoding: utf-8
|
2
2
|
|
3
|
-
require 'erb'
|
4
|
-
|
5
3
|
module Nanoc::Filters
|
6
4
|
class ERB < Nanoc::Filter
|
7
5
|
|
6
|
+
requires 'erb'
|
7
|
+
|
8
8
|
# Runs the content through [ERB](http://ruby-doc.org/stdlib/libdoc/erb/rdoc/classes/ERB.html).
|
9
9
|
#
|
10
10
|
# @param [String] content The content to filter
|
data/lib/nanoc/filters/erubis.rb
CHANGED
@@ -1,10 +1,10 @@
|
|
1
1
|
# encoding: utf-8
|
2
2
|
|
3
|
-
require 'erubis'
|
4
|
-
|
5
3
|
module Nanoc::Filters
|
6
4
|
class Erubis < Nanoc::Filter
|
7
5
|
|
6
|
+
requires 'erubis'
|
7
|
+
|
8
8
|
# The same as `::Erubis::Eruby` but adds `_erbout` as an alias for the
|
9
9
|
# `_buf` variable, making it compatible with nanoc’s helpers that rely
|
10
10
|
# on `_erbout`, such as {Nanoc::Helpers::Capturing}.
|
data/lib/nanoc/filters/haml.rb
CHANGED
@@ -1,12 +1,12 @@
|
|
1
1
|
# encoding: utf-8
|
2
2
|
|
3
|
-
require 'handlebars'
|
4
|
-
|
5
3
|
module Nanoc::Filters
|
6
4
|
|
7
5
|
# @since 3.4.0
|
8
6
|
class Handlebars < Nanoc::Filter
|
9
7
|
|
8
|
+
requires 'handlebars'
|
9
|
+
|
10
10
|
# Runs the content through
|
11
11
|
# [Handlebars](http://handlebarsjs.com/) using
|
12
12
|
# [Handlebars.rb](https://github.com/cowboyd/handlebars.rb).
|
@@ -1,10 +1,10 @@
|
|
1
1
|
# encoding: utf-8
|
2
2
|
|
3
|
-
require 'kramdown'
|
4
|
-
|
5
3
|
module Nanoc::Filters
|
6
4
|
class Kramdown < Nanoc::Filter
|
7
5
|
|
6
|
+
requires 'kramdown'
|
7
|
+
|
8
8
|
# Runs the content through [Kramdown](http://kramdown.rubyforge.org/).
|
9
9
|
# Parameters passed to this filter will be passed on to Kramdown.
|
10
10
|
#
|
data/lib/nanoc/filters/less.rb
CHANGED
data/lib/nanoc/filters/maruku.rb
CHANGED
@@ -1,10 +1,10 @@
|
|
1
1
|
# encoding: utf-8
|
2
2
|
|
3
|
-
require 'maruku'
|
4
|
-
|
5
3
|
module Nanoc::Filters
|
6
4
|
class Maruku < Nanoc::Filter
|
7
5
|
|
6
|
+
requires 'maruku'
|
7
|
+
|
8
8
|
# Runs the content through [Maruku](http://maruku.rubyforge.org/).
|
9
9
|
# Parameters passed to this filter will be passed on to Maruku.
|
10
10
|
#
|
@@ -1,12 +1,12 @@
|
|
1
1
|
# encoding: utf-8
|
2
2
|
|
3
|
-
require 'mustache'
|
4
|
-
|
5
3
|
module Nanoc::Filters
|
6
4
|
|
7
5
|
# @since 3.2.0
|
8
6
|
class Mustache < Nanoc::Filter
|
9
7
|
|
8
|
+
requires 'mustache'
|
9
|
+
|
10
10
|
# Runs the content through
|
11
11
|
# [Mustache](http://github.com/defunkt/mustache). This method takes no
|
12
12
|
# options.
|
data/lib/nanoc/filters/pandoc.rb
CHANGED
@@ -1,10 +1,10 @@
|
|
1
1
|
# encoding: utf-8
|
2
2
|
|
3
|
-
require 'pandoc-ruby'
|
4
|
-
|
5
3
|
module Nanoc::Filters
|
6
4
|
class Pandoc < Nanoc::Filter
|
7
5
|
|
6
|
+
requires 'pandoc-ruby'
|
7
|
+
|
8
8
|
# Runs the content through [Pandoc](http://johnmacfarlane.net/pandoc/)
|
9
9
|
# using [PandocRuby](https://github.com/alphabetum/pandoc-ruby). Options
|
10
10
|
# are passed on to PandocRuby.
|
@@ -1,10 +1,10 @@
|
|
1
1
|
# encoding: utf-8
|
2
2
|
|
3
|
-
require 'rainpress'
|
4
|
-
|
5
3
|
module Nanoc::Filters
|
6
4
|
class Rainpress < Nanoc::Filter
|
7
5
|
|
6
|
+
requires 'rainpress'
|
7
|
+
|
8
8
|
# Runs the content through [Rainpress](http://code.google.com/p/rainpress/).
|
9
9
|
# Parameters passed to this filter will be passed on to Rainpress.
|
10
10
|
#
|
@@ -1,10 +1,10 @@
|
|
1
1
|
# encoding: utf-8
|
2
2
|
|
3
|
-
require 'rdiscount'
|
4
|
-
|
5
3
|
module Nanoc::Filters
|
6
4
|
class RDiscount < Nanoc::Filter
|
7
5
|
|
6
|
+
requires 'rdiscount'
|
7
|
+
|
8
8
|
# Runs the content through [RDiscount](http://github.com/rtomayko/rdiscount).
|
9
9
|
#
|
10
10
|
# @option params [Array] symbol ([]) A list of RDiscount extensions
|
data/lib/nanoc/filters/rdoc.rb
CHANGED
@@ -1,18 +1,10 @@
|
|
1
1
|
# encoding: utf-8
|
2
2
|
|
3
|
-
begin
|
4
|
-
# new RDoc
|
5
|
-
require 'rdoc/markup'
|
6
|
-
require 'rdoc/markup/to_html'
|
7
|
-
rescue LoadError
|
8
|
-
# old RDoc
|
9
|
-
require 'rdoc/markup/simple_markup'
|
10
|
-
require 'rdoc/markup/simple_markup/to_html'
|
11
|
-
end
|
12
|
-
|
13
3
|
module Nanoc::Filters
|
14
4
|
class RDoc < Nanoc::Filter
|
15
5
|
|
6
|
+
requires 'rdoc/markup', 'rdoc/markup/to_html'
|
7
|
+
|
16
8
|
# Runs the content through [RDoc::Markup](http://rdoc.rubyforge.org/RDoc/Markup.html).
|
17
9
|
# This method takes no options.
|
18
10
|
#
|
@@ -20,13 +12,7 @@ module Nanoc::Filters
|
|
20
12
|
#
|
21
13
|
# @return [String] The filtered content
|
22
14
|
def run(content, params={})
|
23
|
-
|
24
|
-
# new RDoc
|
25
|
-
::RDoc::Markup.new.convert(content, ::RDoc::Markup::ToHtml.new)
|
26
|
-
rescue LoadError
|
27
|
-
# old RDoc
|
28
|
-
::SM::SimpleMarkup.new.convert(content, ::SM::ToHtml.new)
|
29
|
-
end
|
15
|
+
::RDoc::Markup.new.convert(content, ::RDoc::Markup::ToHtml.new)
|
30
16
|
end
|
31
17
|
|
32
18
|
end
|
@@ -1,12 +1,12 @@
|
|
1
1
|
# encoding: utf-8
|
2
2
|
|
3
|
-
require 'redcarpet'
|
4
|
-
|
5
3
|
module Nanoc::Filters
|
6
4
|
|
7
5
|
# @since 3.2.0
|
8
6
|
class Redcarpet < Nanoc::Filter
|
9
7
|
|
8
|
+
requires 'redcarpet'
|
9
|
+
|
10
10
|
# Runs the content through [Redcarpet](https://github.com/vmg/redcarpet).
|
11
11
|
# This method optionally takes processing options to pass on to Redcarpet.
|
12
12
|
#
|
@@ -49,7 +49,11 @@ module Nanoc::Filters
|
|
49
49
|
warn 'WARNING: You are passing an array of options to the :redcarpet filter, but Redcarpet 2.x expects a hash instead. This will likely fail.'
|
50
50
|
end
|
51
51
|
|
52
|
-
|
52
|
+
if renderer_class == ::Redcarpet::Render::HTML_TOC
|
53
|
+
renderer = renderer_class.new
|
54
|
+
else
|
55
|
+
renderer = renderer_class.new(renderer_options)
|
56
|
+
end
|
53
57
|
::Redcarpet::Markdown.new(renderer, options).render(content)
|
54
58
|
else
|
55
59
|
options = params[:options] || []
|
data/lib/nanoc/filters/sass.rb
CHANGED
data/lib/nanoc/filters/slim.rb
CHANGED
@@ -1,12 +1,12 @@
|
|
1
1
|
# encoding: utf-8
|
2
2
|
|
3
|
-
require 'typogruby'
|
4
|
-
|
5
3
|
module Nanoc::Filters
|
6
4
|
|
7
5
|
# @since 3.2.0
|
8
6
|
class Typogruby < Nanoc::Filter
|
9
7
|
|
8
|
+
requires 'typogruby'
|
9
|
+
|
10
10
|
# Runs the content through [Typogruby](http://avdgaag.github.com/typogruby/).
|
11
11
|
# This method takes no options.
|
12
12
|
#
|
@@ -1,10 +1,10 @@
|
|
1
1
|
# encoding: utf-8
|
2
2
|
|
3
|
-
require 'uglifier'
|
4
|
-
|
5
3
|
module Nanoc::Filters
|
6
4
|
class UglifyJS < Nanoc::Filter
|
7
5
|
|
6
|
+
requires 'uglifier'
|
7
|
+
|
8
8
|
# Runs the content through [UglifyJS](https://github.com/mishoo/UglifyJS/).
|
9
9
|
# This method optionally takes options to pass directly to Uglifier:
|
10
10
|
#
|
data/lib/nanoc/filters/xsl.rb
CHANGED
@@ -1,11 +1,12 @@
|
|
1
1
|
# encoding: utf-8
|
2
|
-
require 'nokogiri'
|
3
2
|
|
4
3
|
module Nanoc::Filters
|
5
4
|
|
6
5
|
# @since 3.3.0
|
7
6
|
class XSL < Nanoc::Filter
|
8
7
|
|
8
|
+
requires 'nokogiri'
|
9
|
+
|
9
10
|
# Runs the item content through an [XSLT](http://www.w3.org/TR/xslt)
|
10
11
|
# stylesheet using [Nokogiri](http://nokogiri.org/).
|
11
12
|
#
|
@@ -1,10 +1,10 @@
|
|
1
|
-
require 'yuicompressor'
|
2
|
-
|
3
1
|
module Nanoc::Filters
|
4
2
|
|
5
3
|
# @since 3.3.0
|
6
4
|
class YUICompressor < Nanoc::Filter
|
7
5
|
|
6
|
+
requires 'yuicompressor'
|
7
|
+
|
8
8
|
# Compress Javascript or CSS using [YUICompressor](http://rubydoc.info/gems/yuicompressor).
|
9
9
|
# This method optionally takes options to pass directly to the
|
10
10
|
# YUICompressor gem.
|
@@ -350,7 +350,7 @@ module Nanoc::Helpers
|
|
350
350
|
# used in the Atom feed to uniquely identify articles. These IDs are
|
351
351
|
# created using a procedure suggested by Mark Pilgrim and described in his
|
352
352
|
# ["How to make a good ID in Atom" blog post]
|
353
|
-
# (http://diveintomark.org/archives/2004/05/28/howto-atom-id).
|
353
|
+
# (http://web.archive.org/web/20110915110202/http://diveintomark.org/archives/2004/05/28/howto-atom-id).
|
354
354
|
#
|
355
355
|
# @param [Nanoc::Item] item The item for which to create an atom tag
|
356
356
|
#
|
@@ -39,7 +39,7 @@ module Nanoc::Helpers
|
|
39
39
|
|
40
40
|
# Filter captured data
|
41
41
|
Nanoc::NotificationCenter.post(:filtering_started, @item_rep, filter_name)
|
42
|
-
filtered_data = filter.
|
42
|
+
filtered_data = filter.setup_and_run(data, arguments)
|
43
43
|
Nanoc::NotificationCenter.post(:filtering_ended, @item_rep, filter_name)
|
44
44
|
|
45
45
|
# Append filtered data to buffer
|
@@ -117,7 +117,7 @@ module Nanoc::Helpers
|
|
117
117
|
Nanoc::NotificationCenter.post(:processing_started, layout)
|
118
118
|
|
119
119
|
# Layout
|
120
|
-
result = filter.
|
120
|
+
result = filter.setup_and_run(layout.raw_content, filter_args)
|
121
121
|
|
122
122
|
# Append to erbout if we have a block
|
123
123
|
if block_given?
|
data/nanoc.gemspec
CHANGED
@@ -6,7 +6,7 @@ require 'nanoc'
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = 'nanoc'
|
8
8
|
s.version = Nanoc::VERSION
|
9
|
-
s.homepage = 'http://nanoc.
|
9
|
+
s.homepage = 'http://nanoc.ws/'
|
10
10
|
s.summary = 'a web publishing system written in Ruby for building small to medium-sized websites.'
|
11
11
|
s.description = 'nanoc is a simple but very flexible static site generator written in Ruby. It operates on local files, and therefore does not run on the server. nanoc “compiles” the local source files into HTML (usually), by evaluating eRuby, Markdown, etc.'
|
12
12
|
|
@@ -23,7 +23,7 @@ Gem::Specification.new do |s|
|
|
23
23
|
s.rdoc_options = [ '--main', 'README.md' ]
|
24
24
|
s.extra_rdoc_files = [ 'ChangeLog', 'LICENSE', 'README.md', 'NEWS.md' ]
|
25
25
|
|
26
|
-
s.add_runtime_dependency('cri', '~> 2.
|
26
|
+
s.add_runtime_dependency('cri', '~> 2.3')
|
27
27
|
|
28
28
|
s.add_development_dependency('minitest')
|
29
29
|
s.add_development_dependency('mocha')
|
@@ -22,32 +22,24 @@ end
|
|
22
22
|
|
23
23
|
describe 'Array#freeze_recursively' do
|
24
24
|
|
25
|
+
include Nanoc::TestHelpers
|
26
|
+
|
25
27
|
it 'should prevent first-level elements from being modified' do
|
26
28
|
array = [ :a, [ :b, :c ], :d ]
|
27
29
|
array.freeze_recursively
|
28
30
|
|
29
|
-
|
30
|
-
begin
|
31
|
+
assert_raises_frozen_error do
|
31
32
|
array[0] = 123
|
32
|
-
rescue => e
|
33
|
-
raised = true
|
34
|
-
assert_match(/(^can't modify frozen |^unable to modify frozen object$)/, e.message)
|
35
33
|
end
|
36
|
-
assert raised
|
37
34
|
end
|
38
35
|
|
39
36
|
it 'should prevent second-level elements from being modified' do
|
40
37
|
array = [ :a, [ :b, :c ], :d ]
|
41
38
|
array.freeze_recursively
|
42
39
|
|
43
|
-
|
44
|
-
begin
|
40
|
+
assert_raises_frozen_error do
|
45
41
|
array[1][0] = 123
|
46
|
-
rescue => e
|
47
|
-
raised = true
|
48
|
-
assert_match(/(^can't modify frozen |^unable to modify frozen object$)/, e.message)
|
49
42
|
end
|
50
|
-
assert raised
|
51
43
|
end
|
52
44
|
|
53
45
|
it 'should not freeze infinitely' do
|
@@ -40,32 +40,24 @@ end
|
|
40
40
|
|
41
41
|
describe 'Hash#freeze_recursively' do
|
42
42
|
|
43
|
+
include Nanoc::TestHelpers
|
44
|
+
|
43
45
|
it 'should prevent first-level elements from being modified' do
|
44
46
|
hash = { :a => { :b => :c } }
|
45
47
|
hash.freeze_recursively
|
46
48
|
|
47
|
-
|
48
|
-
begin
|
49
|
+
assert_raises_frozen_error do
|
49
50
|
hash[:a] = 123
|
50
|
-
rescue => e
|
51
|
-
raised = true
|
52
|
-
assert_match(/(^can't modify frozen |^unable to modify frozen object$)/, e.message)
|
53
51
|
end
|
54
|
-
assert raised
|
55
52
|
end
|
56
53
|
|
57
54
|
it 'should prevent second-level elements from being modified' do
|
58
55
|
hash = { :a => { :b => :c } }
|
59
56
|
hash.freeze_recursively
|
60
57
|
|
61
|
-
|
62
|
-
begin
|
58
|
+
assert_raises_frozen_error do
|
63
59
|
hash[:a][:b] = 123
|
64
|
-
rescue => e
|
65
|
-
raised = true
|
66
|
-
assert_match(/(^can't modify frozen |^unable to modify frozen object$)/, e.message)
|
67
60
|
end
|
68
|
-
assert raised
|
69
61
|
end
|
70
62
|
|
71
63
|
it 'should not freeze infinitely' do
|