nanoc3 3.1.9 → 3.2.0a1
Sign up to get free protection for your applications and to get access to all the features.
- data/LICENSE +1 -1
- data/NEWS.md +0 -50
- data/README.md +3 -15
- data/bin/nanoc3 +2 -0
- data/lib/nanoc3/base/checksummer.rb +40 -0
- data/lib/nanoc3/base/code_snippet.rb +30 -12
- data/lib/nanoc3/base/compiled_content_cache.rb +86 -0
- data/lib/nanoc3/base/compiler.rb +134 -95
- data/lib/nanoc3/base/compiler_dsl.rb +12 -11
- data/lib/nanoc3/base/core_ext/string.rb +2 -2
- data/lib/nanoc3/base/data_source.rb +17 -16
- data/lib/nanoc3/base/dependency_tracker.rb +102 -121
- data/lib/nanoc3/base/directed_graph.rb +65 -3
- data/lib/nanoc3/base/errors.rb +20 -16
- data/lib/nanoc3/base/item.rb +58 -50
- data/lib/nanoc3/base/item_rep.rb +177 -150
- data/lib/nanoc3/base/layout.rb +51 -18
- data/lib/nanoc3/base/notification_center.rb +8 -8
- data/lib/nanoc3/base/plugin_registry.rb +9 -9
- data/lib/nanoc3/base/rule.rb +18 -9
- data/lib/nanoc3/base/rule_context.rb +5 -5
- data/lib/nanoc3/base/site.rb +135 -47
- data/lib/nanoc3/base.rb +21 -19
- data/lib/nanoc3/cli/base.rb +51 -74
- data/lib/nanoc3/cli/commands/autocompile.rb +3 -0
- data/lib/nanoc3/cli/commands/compile.rb +35 -74
- data/lib/nanoc3/cli/commands/create_site.rb +17 -5
- data/lib/nanoc3/cli/commands/debug.rb +11 -4
- data/lib/nanoc3/cli/commands/view.rb +0 -1
- data/lib/nanoc3/cli/commands/watch.rb +148 -0
- data/lib/nanoc3/cli/commands.rb +1 -0
- data/lib/nanoc3/cli/logger.rb +15 -21
- data/lib/nanoc3/data_sources/deprecated/twitter.rb +0 -1
- data/lib/nanoc3/data_sources/filesystem.rb +11 -40
- data/lib/nanoc3/data_sources/filesystem_unified.rb +22 -22
- data/lib/nanoc3/extra/auto_compiler.rb +1 -1
- data/lib/nanoc3/extra/chick.rb +8 -8
- data/lib/nanoc3/extra/deployers/rsync.rb +2 -3
- data/lib/nanoc3/extra/validators/links.rb +32 -51
- data/lib/nanoc3/extra/validators/w3c.rb +2 -2
- data/lib/nanoc3/extra/vcs.rb +1 -1
- data/lib/nanoc3/filters/colorize_syntax.rb +15 -19
- data/lib/nanoc3/filters/erb.rb +1 -5
- data/lib/nanoc3/filters/erubis.rb +1 -5
- data/lib/nanoc3/filters/haml.rb +1 -2
- data/lib/nanoc3/filters/less.rb +2 -51
- data/lib/nanoc3/filters/mustache.rb +21 -0
- data/lib/nanoc3/filters/rdiscount.rb +1 -2
- data/lib/nanoc3/filters/relativize_paths.rb +3 -2
- data/lib/nanoc3/filters/sass.rb +50 -56
- data/lib/nanoc3/filters.rb +2 -0
- data/lib/nanoc3/helpers/blogging.rb +22 -29
- data/lib/nanoc3/helpers/breadcrumbs.rb +1 -1
- data/lib/nanoc3/helpers/capturing.rb +1 -1
- data/lib/nanoc3/helpers/filtering.rb +1 -1
- data/lib/nanoc3/helpers/link_to.rb +10 -21
- data/lib/nanoc3/helpers/rendering.rb +5 -24
- data/lib/nanoc3/helpers/tagging.rb +6 -6
- data/lib/nanoc3/helpers/text.rb +2 -2
- data/lib/nanoc3.rb +1 -1
- metadata +35 -93
- data/.gemtest +0 -0
- data/doc/yardoc_templates/default/layout/html/footer.erb +0 -10
- data/nanoc3.gemspec +0 -41
- data/tasks/clean.rake +0 -11
- data/tasks/doc.rake +0 -14
- data/tasks/gem.rake +0 -13
- data/tasks/test.rake +0 -38
- data/test/base/core_ext/array_spec.rb +0 -23
- data/test/base/core_ext/hash_spec.rb +0 -41
- data/test/base/core_ext/string_spec.rb +0 -27
- data/test/base/test_code_snippet.rb +0 -33
- data/test/base/test_compiler.rb +0 -410
- data/test/base/test_compiler_dsl.rb +0 -121
- data/test/base/test_context.rb +0 -33
- data/test/base/test_data_source.rb +0 -48
- data/test/base/test_dependency_tracker.rb +0 -510
- data/test/base/test_directed_graph.rb +0 -91
- data/test/base/test_filter.rb +0 -85
- data/test/base/test_item.rb +0 -141
- data/test/base/test_item_rep.rb +0 -953
- data/test/base/test_layout.rb +0 -44
- data/test/base/test_notification_center.rb +0 -36
- data/test/base/test_plugin.rb +0 -32
- data/test/base/test_rule.rb +0 -21
- data/test/base/test_rule_context.rb +0 -63
- data/test/base/test_site.rb +0 -366
- data/test/cli/commands/test_compile.rb +0 -12
- data/test/cli/commands/test_create_item.rb +0 -12
- data/test/cli/commands/test_create_layout.rb +0 -28
- data/test/cli/commands/test_create_site.rb +0 -24
- data/test/cli/commands/test_help.rb +0 -12
- data/test/cli/commands/test_info.rb +0 -12
- data/test/cli/commands/test_update.rb +0 -12
- data/test/cli/test_logger.rb +0 -12
- data/test/data_sources/test_filesystem.rb +0 -420
- data/test/data_sources/test_filesystem_unified.rb +0 -538
- data/test/data_sources/test_filesystem_verbose.rb +0 -359
- data/test/extra/core_ext/test_enumerable.rb +0 -32
- data/test/extra/core_ext/test_time.rb +0 -17
- data/test/extra/deployers/test_rsync.rb +0 -234
- data/test/extra/test_auto_compiler.rb +0 -482
- data/test/extra/test_file_proxy.rb +0 -21
- data/test/extra/test_vcs.rb +0 -24
- data/test/extra/validators/test_links.rb +0 -53
- data/test/extra/validators/test_w3c.rb +0 -49
- data/test/filters/test_bluecloth.rb +0 -20
- data/test/filters/test_coderay.rb +0 -46
- data/test/filters/test_colorize_syntax.rb +0 -84
- data/test/filters/test_erb.rb +0 -72
- data/test/filters/test_erubis.rb +0 -72
- data/test/filters/test_haml.rb +0 -98
- data/test/filters/test_kramdown.rb +0 -20
- data/test/filters/test_less.rb +0 -118
- data/test/filters/test_markaby.rb +0 -26
- data/test/filters/test_maruku.rb +0 -20
- data/test/filters/test_rainpress.rb +0 -31
- data/test/filters/test_rdiscount.rb +0 -33
- data/test/filters/test_rdoc.rb +0 -18
- data/test/filters/test_redcloth.rb +0 -20
- data/test/filters/test_relativize_paths.rb +0 -231
- data/test/filters/test_rubypants.rb +0 -20
- data/test/filters/test_sass.rb +0 -235
- data/test/gem_loader.rb +0 -11
- data/test/helper.rb +0 -99
- data/test/helpers/test_blogging.rb +0 -808
- data/test/helpers/test_breadcrumbs.rb +0 -83
- data/test/helpers/test_capturing.rb +0 -42
- data/test/helpers/test_filtering.rb +0 -108
- data/test/helpers/test_html_escape.rb +0 -18
- data/test/helpers/test_link_to.rb +0 -251
- data/test/helpers/test_rendering.rb +0 -109
- data/test/helpers/test_tagging.rb +0 -89
- data/test/helpers/test_text.rb +0 -26
- data/test/helpers/test_xml_sitemap.rb +0 -69
- data/test/tasks/test_clean.rb +0 -71
data/test/helpers/test_text.rb
DELETED
@@ -1,26 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
|
3
|
-
require 'test/helper'
|
4
|
-
|
5
|
-
class Nanoc3::Helpers::TextTest < MiniTest::Unit::TestCase
|
6
|
-
|
7
|
-
include Nanoc3::TestHelpers
|
8
|
-
|
9
|
-
include Nanoc3::Helpers::Text
|
10
|
-
|
11
|
-
def test_excerpt_length
|
12
|
-
assert_equal('...', excerptize('Foo bar baz quux meow woof', :length => 3))
|
13
|
-
assert_equal('Foo ...', excerptize('Foo bar baz quux meow woof', :length => 7))
|
14
|
-
assert_equal('Foo bar baz quux meow woof', excerptize('Foo bar baz quux meow woof', :length => 26))
|
15
|
-
assert_equal('Foo bar baz quux meow woof', excerptize('Foo bar baz quux meow woof', :length => 8623785))
|
16
|
-
end
|
17
|
-
|
18
|
-
def test_excerpt_omission
|
19
|
-
assert_equal('Foo [continued]', excerptize('Foo bar baz quux meow woof', :length => 15, :omission => '[continued]'))
|
20
|
-
end
|
21
|
-
|
22
|
-
def test_strip_html
|
23
|
-
# TODO implement
|
24
|
-
end
|
25
|
-
|
26
|
-
end
|
@@ -1,69 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
|
3
|
-
require 'test/helper'
|
4
|
-
|
5
|
-
class Nanoc3::Helpers::XMLSitemapTest < MiniTest::Unit::TestCase
|
6
|
-
|
7
|
-
include Nanoc3::TestHelpers
|
8
|
-
|
9
|
-
include Nanoc3::Helpers::XMLSitemap
|
10
|
-
|
11
|
-
def test_xml_sitemap
|
12
|
-
if_have 'builder' do
|
13
|
-
require 'time'
|
14
|
-
|
15
|
-
# Create items
|
16
|
-
@items = [ mock, mock, mock, mock ]
|
17
|
-
|
18
|
-
# Create item 0
|
19
|
-
@items[0].expects(:[]).with(:is_hidden).returns(false)
|
20
|
-
@items[0].expects(:mtime).times(2).returns(nil)
|
21
|
-
@items[0].expects(:[]).times(2).with(:changefreq).returns(nil)
|
22
|
-
@items[0].expects(:[]).times(2).with(:priority).returns(nil)
|
23
|
-
item_reps = [ mock, mock ]
|
24
|
-
item_reps[0].expects(:path).returns('/kkk/')
|
25
|
-
item_reps[0].expects(:raw_path).returns('output/kkk/index.html')
|
26
|
-
item_reps[1].expects(:path).returns('/lll/')
|
27
|
-
item_reps[1].expects(:raw_path).returns('output/lll/index.html')
|
28
|
-
@items[0].expects(:reps).returns(item_reps)
|
29
|
-
|
30
|
-
# Create item 1
|
31
|
-
@items[1].expects(:[]).with(:is_hidden).returns(true)
|
32
|
-
|
33
|
-
# Create item 2
|
34
|
-
@items[2].expects(:[]).with(:is_hidden).returns(false)
|
35
|
-
@items[2].expects(:mtime).times(4).returns(Time.parse('12/07/2004'))
|
36
|
-
@items[2].expects(:[]).with(:changefreq).times(4).returns('daily')
|
37
|
-
@items[2].expects(:[]).with(:priority).times(4).returns(0.5)
|
38
|
-
item_reps = [ mock, mock ]
|
39
|
-
item_reps[0].expects(:path).returns('/aaa/')
|
40
|
-
item_reps[0].expects(:raw_path).returns('output/aaa/index.html')
|
41
|
-
item_reps[1].expects(:path).returns('/bbb/')
|
42
|
-
item_reps[1].expects(:raw_path).returns('output/bbb/index.html')
|
43
|
-
@items[2].expects(:reps).returns(item_reps)
|
44
|
-
|
45
|
-
# Create item 3
|
46
|
-
@items[3].expects(:[]).with(:is_hidden).returns(false)
|
47
|
-
item_rep = mock
|
48
|
-
item_rep.expects(:raw_path).returns(nil)
|
49
|
-
@items[3].expects(:reps).returns([ item_rep ])
|
50
|
-
|
51
|
-
# Create sitemap item
|
52
|
-
@item = mock
|
53
|
-
|
54
|
-
# Create site
|
55
|
-
config = mock
|
56
|
-
config.expects(:[]).with(:base_url).at_least_once.returns('http://example.com')
|
57
|
-
@site = mock
|
58
|
-
@site.expects(:config).at_least_once.returns(config)
|
59
|
-
|
60
|
-
# Check
|
61
|
-
xml_sitemap
|
62
|
-
end
|
63
|
-
ensure
|
64
|
-
@items = nil
|
65
|
-
@item = nil
|
66
|
-
@site = nil
|
67
|
-
end
|
68
|
-
|
69
|
-
end
|
data/test/tasks/test_clean.rb
DELETED
@@ -1,71 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
|
3
|
-
require 'test/helper'
|
4
|
-
|
5
|
-
class Nanoc3::Tasks::CleanTest < MiniTest::Unit::TestCase
|
6
|
-
|
7
|
-
include Nanoc3::TestHelpers
|
8
|
-
|
9
|
-
def test_simple
|
10
|
-
if_have 'w3c_validators' do
|
11
|
-
# Stub items
|
12
|
-
items = [ mock, mock ]
|
13
|
-
reps = [ [ mock, mock ], [ mock, mock ] ]
|
14
|
-
items[0].expects(:reps).returns(reps[0])
|
15
|
-
items[1].expects(:reps).returns(reps[1])
|
16
|
-
|
17
|
-
# Create sample files
|
18
|
-
[ 0, 1 ].each do |item_id|
|
19
|
-
[ 0, 1 ].each do |rep_id|
|
20
|
-
filename = "item-#{item_id}-rep-#{rep_id}.txt"
|
21
|
-
reps[item_id][rep_id].expects(:raw_path).returns(filename)
|
22
|
-
File.open(filename, 'w') { |io| io.write('hello') }
|
23
|
-
assert File.file?(filename)
|
24
|
-
end
|
25
|
-
end
|
26
|
-
|
27
|
-
# Stub site
|
28
|
-
site = mock
|
29
|
-
site.expects(:load_data)
|
30
|
-
site.expects(:items).returns(items)
|
31
|
-
|
32
|
-
# Create clean task
|
33
|
-
clean = ::Nanoc3::Tasks::Clean.new(site)
|
34
|
-
|
35
|
-
# Run
|
36
|
-
clean.run
|
37
|
-
|
38
|
-
# Check
|
39
|
-
[ 0, 1 ].each do |item_id|
|
40
|
-
[ 0, 1 ].each do |rep_id|
|
41
|
-
filename = "item-#{item_id}-rep-#{rep_id}.txt"
|
42
|
-
assert !File.file?(filename)
|
43
|
-
end
|
44
|
-
end
|
45
|
-
end
|
46
|
-
end
|
47
|
-
|
48
|
-
def test_with_nil_raw_path
|
49
|
-
if_have 'w3c_validators' do
|
50
|
-
# Stub items
|
51
|
-
item = mock
|
52
|
-
rep = mock
|
53
|
-
item.expects(:reps).returns([ rep ])
|
54
|
-
|
55
|
-
# Create sample file
|
56
|
-
rep.expects(:raw_path).returns(nil)
|
57
|
-
|
58
|
-
# Stub site
|
59
|
-
site = mock
|
60
|
-
site.expects(:load_data)
|
61
|
-
site.expects(:items).returns([ item ])
|
62
|
-
|
63
|
-
# Create clean task
|
64
|
-
clean = ::Nanoc3::Tasks::Clean.new(site)
|
65
|
-
|
66
|
-
# Run
|
67
|
-
clean.run
|
68
|
-
end
|
69
|
-
end
|
70
|
-
|
71
|
-
end
|