nanoc3 3.2.4 → 3.3.0
Sign up to get free protection for your applications and to get access to all the features.
- metadata +14 -313
- data/.gemtest +0 -0
- data/ChangeLog +0 -3
- data/Gemfile +0 -29
- data/LICENSE +0 -19
- data/NEWS.md +0 -449
- data/README.md +0 -108
- data/Rakefile +0 -14
- data/bin/nanoc3 +0 -12
- data/doc/yardoc_templates/default/layout/html/footer.erb +0 -10
- data/lib/nanoc3.rb +0 -28
- data/lib/nanoc3/base.rb +0 -49
- data/lib/nanoc3/base/compilation/checksum_store.rb +0 -57
- data/lib/nanoc3/base/compilation/compiled_content_cache.rb +0 -62
- data/lib/nanoc3/base/compilation/compiler.rb +0 -455
- data/lib/nanoc3/base/compilation/compiler_dsl.rb +0 -214
- data/lib/nanoc3/base/compilation/dependency_tracker.rb +0 -196
- data/lib/nanoc3/base/compilation/filter.rb +0 -165
- data/lib/nanoc3/base/compilation/item_rep_proxy.rb +0 -102
- data/lib/nanoc3/base/compilation/item_rep_recorder_proxy.rb +0 -88
- data/lib/nanoc3/base/compilation/outdatedness_checker.rb +0 -223
- data/lib/nanoc3/base/compilation/outdatedness_reasons.rb +0 -46
- data/lib/nanoc3/base/compilation/rule.rb +0 -73
- data/lib/nanoc3/base/compilation/rule_context.rb +0 -84
- data/lib/nanoc3/base/compilation/rule_memory_calculator.rb +0 -40
- data/lib/nanoc3/base/compilation/rule_memory_store.rb +0 -53
- data/lib/nanoc3/base/compilation/rules_collection.rb +0 -231
- data/lib/nanoc3/base/context.rb +0 -47
- data/lib/nanoc3/base/core_ext.rb +0 -6
- data/lib/nanoc3/base/core_ext/array.rb +0 -62
- data/lib/nanoc3/base/core_ext/hash.rb +0 -63
- data/lib/nanoc3/base/core_ext/pathname.rb +0 -26
- data/lib/nanoc3/base/core_ext/string.rb +0 -46
- data/lib/nanoc3/base/directed_graph.rb +0 -275
- data/lib/nanoc3/base/errors.rb +0 -174
- data/lib/nanoc3/base/memoization.rb +0 -67
- data/lib/nanoc3/base/notification_center.rb +0 -84
- data/lib/nanoc3/base/ordered_hash.rb +0 -200
- data/lib/nanoc3/base/plugin_registry.rb +0 -165
- data/lib/nanoc3/base/result_data/item_rep.rb +0 -488
- data/lib/nanoc3/base/source_data/code_snippet.rb +0 -58
- data/lib/nanoc3/base/source_data/configuration.rb +0 -24
- data/lib/nanoc3/base/source_data/data_source.rb +0 -234
- data/lib/nanoc3/base/source_data/item.rb +0 -301
- data/lib/nanoc3/base/source_data/layout.rb +0 -130
- data/lib/nanoc3/base/source_data/site.rb +0 -361
- data/lib/nanoc3/base/store.rb +0 -135
- data/lib/nanoc3/cli.rb +0 -133
- data/lib/nanoc3/cli/command.rb +0 -139
- data/lib/nanoc3/cli/commands/autocompile.rb +0 -60
- data/lib/nanoc3/cli/commands/compile.rb +0 -280
- data/lib/nanoc3/cli/commands/create_item.rb +0 -62
- data/lib/nanoc3/cli/commands/create_layout.rb +0 -75
- data/lib/nanoc3/cli/commands/create_site.rb +0 -410
- data/lib/nanoc3/cli/commands/debug.rb +0 -119
- data/lib/nanoc3/cli/commands/info.rb +0 -98
- data/lib/nanoc3/cli/commands/nanoc.rb +0 -37
- data/lib/nanoc3/cli/commands/update.rb +0 -72
- data/lib/nanoc3/cli/commands/view.rb +0 -84
- data/lib/nanoc3/cli/commands/watch.rb +0 -125
- data/lib/nanoc3/cli/error_handler.rb +0 -193
- data/lib/nanoc3/cli/logger.rb +0 -91
- data/lib/nanoc3/data_sources.rb +0 -29
- data/lib/nanoc3/data_sources/deprecated/delicious.rb +0 -42
- data/lib/nanoc3/data_sources/deprecated/last_fm.rb +0 -87
- data/lib/nanoc3/data_sources/deprecated/twitter.rb +0 -38
- data/lib/nanoc3/data_sources/filesystem.rb +0 -299
- data/lib/nanoc3/data_sources/filesystem_unified.rb +0 -116
- data/lib/nanoc3/data_sources/filesystem_verbose.rb +0 -86
- data/lib/nanoc3/extra.rb +0 -22
- data/lib/nanoc3/extra/auto_compiler.rb +0 -103
- data/lib/nanoc3/extra/chick.rb +0 -125
- data/lib/nanoc3/extra/core_ext.rb +0 -4
- data/lib/nanoc3/extra/core_ext/enumerable.rb +0 -33
- data/lib/nanoc3/extra/core_ext/time.rb +0 -19
- data/lib/nanoc3/extra/deployers.rb +0 -11
- data/lib/nanoc3/extra/deployers/rsync.rb +0 -114
- data/lib/nanoc3/extra/file_proxy.rb +0 -40
- data/lib/nanoc3/extra/validators.rb +0 -12
- data/lib/nanoc3/extra/validators/links.rb +0 -264
- data/lib/nanoc3/extra/validators/w3c.rb +0 -95
- data/lib/nanoc3/extra/vcs.rb +0 -66
- data/lib/nanoc3/extra/vcses.rb +0 -17
- data/lib/nanoc3/extra/vcses/bazaar.rb +0 -25
- data/lib/nanoc3/extra/vcses/dummy.rb +0 -24
- data/lib/nanoc3/extra/vcses/git.rb +0 -25
- data/lib/nanoc3/extra/vcses/mercurial.rb +0 -25
- data/lib/nanoc3/extra/vcses/subversion.rb +0 -25
- data/lib/nanoc3/filters.rb +0 -53
- data/lib/nanoc3/filters/asciidoc.rb +0 -38
- data/lib/nanoc3/filters/bluecloth.rb +0 -19
- data/lib/nanoc3/filters/coderay.rb +0 -21
- data/lib/nanoc3/filters/colorize_syntax.rb +0 -261
- data/lib/nanoc3/filters/erb.rb +0 -35
- data/lib/nanoc3/filters/erubis.rb +0 -27
- data/lib/nanoc3/filters/haml.rb +0 -27
- data/lib/nanoc3/filters/kramdown.rb +0 -20
- data/lib/nanoc3/filters/less.rb +0 -53
- data/lib/nanoc3/filters/markaby.rb +0 -20
- data/lib/nanoc3/filters/maruku.rb +0 -20
- data/lib/nanoc3/filters/mustache.rb +0 -24
- data/lib/nanoc3/filters/rainpress.rb +0 -19
- data/lib/nanoc3/filters/rdiscount.rb +0 -22
- data/lib/nanoc3/filters/rdoc.rb +0 -33
- data/lib/nanoc3/filters/redcarpet.rb +0 -27
- data/lib/nanoc3/filters/redcloth.rb +0 -47
- data/lib/nanoc3/filters/relativize_paths.rb +0 -45
- data/lib/nanoc3/filters/rubypants.rb +0 -20
- data/lib/nanoc3/filters/sass.rb +0 -66
- data/lib/nanoc3/filters/slim.rb +0 -25
- data/lib/nanoc3/filters/typogruby.rb +0 -23
- data/lib/nanoc3/filters/uglify_js.rb +0 -42
- data/lib/nanoc3/helpers.rb +0 -16
- data/lib/nanoc3/helpers/blogging.rb +0 -319
- data/lib/nanoc3/helpers/breadcrumbs.rb +0 -40
- data/lib/nanoc3/helpers/capturing.rb +0 -138
- data/lib/nanoc3/helpers/filtering.rb +0 -50
- data/lib/nanoc3/helpers/html_escape.rb +0 -55
- data/lib/nanoc3/helpers/link_to.rb +0 -151
- data/lib/nanoc3/helpers/rendering.rb +0 -140
- data/lib/nanoc3/helpers/tagging.rb +0 -71
- data/lib/nanoc3/helpers/text.rb +0 -44
- data/lib/nanoc3/helpers/xml_sitemap.rb +0 -76
- data/lib/nanoc3/tasks.rb +0 -10
- data/lib/nanoc3/tasks/clean.rake +0 -16
- data/lib/nanoc3/tasks/clean.rb +0 -29
- data/lib/nanoc3/tasks/deploy/rsync.rake +0 -14
- data/lib/nanoc3/tasks/validate.rake +0 -92
- data/nanoc3.gemspec +0 -49
- data/tasks/doc.rake +0 -16
- data/tasks/test.rake +0 -44
- data/test/base/core_ext/array_spec.rb +0 -73
- data/test/base/core_ext/hash_spec.rb +0 -98
- data/test/base/core_ext/pathname_spec.rb +0 -27
- data/test/base/core_ext/string_spec.rb +0 -37
- data/test/base/test_checksum_store.rb +0 -35
- data/test/base/test_code_snippet.rb +0 -31
- data/test/base/test_compiler.rb +0 -316
- data/test/base/test_compiler_dsl.rb +0 -161
- data/test/base/test_context.rb +0 -31
- data/test/base/test_data_source.rb +0 -46
- data/test/base/test_dependency_tracker.rb +0 -262
- data/test/base/test_directed_graph.rb +0 -283
- data/test/base/test_filter.rb +0 -83
- data/test/base/test_item.rb +0 -179
- data/test/base/test_item_rep.rb +0 -553
- data/test/base/test_layout.rb +0 -59
- data/test/base/test_memoization.rb +0 -90
- data/test/base/test_notification_center.rb +0 -34
- data/test/base/test_outdatedness_checker.rb +0 -394
- data/test/base/test_plugin.rb +0 -30
- data/test/base/test_rule.rb +0 -19
- data/test/base/test_rule_context.rb +0 -65
- data/test/base/test_site.rb +0 -190
- data/test/cli/commands/test_compile.rb +0 -33
- data/test/cli/commands/test_create_item.rb +0 -14
- 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 -11
- data/test/cli/commands/test_update.rb +0 -10
- data/test/cli/test_cli.rb +0 -102
- data/test/cli/test_error_handler.rb +0 -29
- data/test/cli/test_logger.rb +0 -10
- data/test/data_sources/test_filesystem.rb +0 -433
- data/test/data_sources/test_filesystem_unified.rb +0 -536
- data/test/data_sources/test_filesystem_verbose.rb +0 -357
- data/test/extra/core_ext/test_enumerable.rb +0 -30
- data/test/extra/core_ext/test_time.rb +0 -15
- data/test/extra/deployers/test_rsync.rb +0 -232
- data/test/extra/test_auto_compiler.rb +0 -417
- data/test/extra/test_file_proxy.rb +0 -19
- data/test/extra/test_vcs.rb +0 -22
- data/test/extra/validators/test_links.rb +0 -51
- data/test/extra/validators/test_w3c.rb +0 -47
- data/test/filters/test_asciidoc.rb +0 -22
- data/test/filters/test_bluecloth.rb +0 -18
- data/test/filters/test_coderay.rb +0 -44
- data/test/filters/test_colorize_syntax.rb +0 -283
- data/test/filters/test_erb.rb +0 -99
- data/test/filters/test_erubis.rb +0 -70
- data/test/filters/test_haml.rb +0 -96
- data/test/filters/test_kramdown.rb +0 -18
- data/test/filters/test_less.rb +0 -113
- data/test/filters/test_markaby.rb +0 -24
- data/test/filters/test_maruku.rb +0 -18
- data/test/filters/test_mustache.rb +0 -25
- data/test/filters/test_rainpress.rb +0 -29
- data/test/filters/test_rdiscount.rb +0 -31
- data/test/filters/test_rdoc.rb +0 -18
- data/test/filters/test_redcarpet.rb +0 -63
- data/test/filters/test_redcloth.rb +0 -33
- data/test/filters/test_relativize_paths.rb +0 -332
- data/test/filters/test_rubypants.rb +0 -18
- data/test/filters/test_sass.rb +0 -229
- data/test/filters/test_slim.rb +0 -35
- data/test/filters/test_typogruby.rb +0 -21
- data/test/filters/test_uglify_js.rb +0 -30
- data/test/gem_loader.rb +0 -11
- data/test/helper.rb +0 -179
- data/test/helpers/test_blogging.rb +0 -754
- data/test/helpers/test_breadcrumbs.rb +0 -81
- data/test/helpers/test_capturing.rb +0 -41
- data/test/helpers/test_filtering.rb +0 -106
- data/test/helpers/test_html_escape.rb +0 -32
- data/test/helpers/test_link_to.rb +0 -249
- data/test/helpers/test_rendering.rb +0 -89
- data/test/helpers/test_tagging.rb +0 -87
- data/test/helpers/test_text.rb +0 -24
- data/test/helpers/test_xml_sitemap.rb +0 -103
- data/test/tasks/test_clean.rb +0 -67
data/test/base/test_plugin.rb
DELETED
@@ -1,30 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
|
3
|
-
class Nanoc3::PluginTest < MiniTest::Unit::TestCase
|
4
|
-
|
5
|
-
include Nanoc3::TestHelpers
|
6
|
-
|
7
|
-
class SampleFilter < Nanoc3::Filter
|
8
|
-
identifier :_plugin_test_sample_filter
|
9
|
-
end
|
10
|
-
|
11
|
-
def test_named
|
12
|
-
# Find existant filter
|
13
|
-
filter = Nanoc3::Filter.named(:erb)
|
14
|
-
assert(!filter.nil?)
|
15
|
-
|
16
|
-
# Find non-existant filter
|
17
|
-
filter = Nanoc3::Filter.named(:lksdaffhdlkashlgkskahf)
|
18
|
-
assert(filter.nil?)
|
19
|
-
end
|
20
|
-
|
21
|
-
def test_register
|
22
|
-
SampleFilter.send(:identifier, :_plugin_test_sample_filter)
|
23
|
-
|
24
|
-
registry = Nanoc3::PluginRegistry.instance
|
25
|
-
filter = registry.find(Nanoc3::Filter, :_plugin_test_sample_filter)
|
26
|
-
|
27
|
-
refute_nil filter
|
28
|
-
end
|
29
|
-
|
30
|
-
end
|
data/test/base/test_rule.rb
DELETED
@@ -1,19 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
|
3
|
-
class Nanoc3::RuleTest < MiniTest::Unit::TestCase
|
4
|
-
|
5
|
-
include Nanoc3::TestHelpers
|
6
|
-
|
7
|
-
def test_initialize
|
8
|
-
# TODO implement
|
9
|
-
end
|
10
|
-
|
11
|
-
def test_applicable_to
|
12
|
-
# TODO implement
|
13
|
-
end
|
14
|
-
|
15
|
-
def test_apply_to
|
16
|
-
# TODO implement
|
17
|
-
end
|
18
|
-
|
19
|
-
end
|
@@ -1,65 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
|
3
|
-
class Nanoc3::RuleContextTest < MiniTest::Unit::TestCase
|
4
|
-
|
5
|
-
include Nanoc3::TestHelpers
|
6
|
-
|
7
|
-
def test_objects
|
8
|
-
# Mock everything
|
9
|
-
config = mock
|
10
|
-
items = mock
|
11
|
-
layouts = mock
|
12
|
-
site = mock
|
13
|
-
site.stubs(:config).returns(config)
|
14
|
-
site.stubs(:items).returns(items)
|
15
|
-
site.stubs(:layouts).returns(layouts)
|
16
|
-
item = mock
|
17
|
-
item.stubs(:site).returns(site)
|
18
|
-
rep = mock
|
19
|
-
rep.stubs(:item).returns(item)
|
20
|
-
compiler = Nanoc3::Compiler.new(site)
|
21
|
-
|
22
|
-
# Create context
|
23
|
-
@rule_context = Nanoc3::RuleContext.new(:rep => rep, :compiler => compiler)
|
24
|
-
|
25
|
-
# Check
|
26
|
-
assert_equal rep, @rule_context.rep
|
27
|
-
assert_equal item, @rule_context.item
|
28
|
-
assert_equal site, @rule_context.site
|
29
|
-
assert_equal config, @rule_context.config
|
30
|
-
assert_equal layouts, @rule_context.layouts
|
31
|
-
assert_equal items, @rule_context.items
|
32
|
-
end
|
33
|
-
|
34
|
-
def test_actions
|
35
|
-
# Mock everything
|
36
|
-
config = mock
|
37
|
-
items = mock
|
38
|
-
layouts = mock
|
39
|
-
site = mock
|
40
|
-
site.stubs(:config).returns(config)
|
41
|
-
site.stubs(:items).returns(items)
|
42
|
-
site.stubs(:layouts).returns(layouts)
|
43
|
-
item = mock
|
44
|
-
item.stubs(:site).returns(site)
|
45
|
-
|
46
|
-
# Mock rep
|
47
|
-
rep = mock
|
48
|
-
rep.stubs(:item).returns(item)
|
49
|
-
rep.expects(:filter).with(:foo, { :bar => 'baz' })
|
50
|
-
rep.expects(:layout).with('foo')
|
51
|
-
rep.expects(:snapshot).with('awesome')
|
52
|
-
|
53
|
-
# Mock compiler
|
54
|
-
compiler = Nanoc3::Compiler.new(site)
|
55
|
-
|
56
|
-
# Create context
|
57
|
-
@rule_context = Nanoc3::RuleContext.new(:rep => rep, :compiler => compiler)
|
58
|
-
|
59
|
-
# Check
|
60
|
-
rep.filter :foo, :bar => 'baz'
|
61
|
-
rep.layout 'foo'
|
62
|
-
rep.snapshot 'awesome'
|
63
|
-
end
|
64
|
-
|
65
|
-
end
|
data/test/base/test_site.rb
DELETED
@@ -1,190 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
|
3
|
-
class Nanoc3::SiteTest < MiniTest::Unit::TestCase
|
4
|
-
|
5
|
-
include Nanoc3::TestHelpers
|
6
|
-
|
7
|
-
def test_initialize_with_dir_without_config_yaml
|
8
|
-
assert_raises(Errno::ENOENT) do
|
9
|
-
site = Nanoc3::Site.new('.')
|
10
|
-
end
|
11
|
-
end
|
12
|
-
|
13
|
-
def test_initialize_with_dir_with_config_yaml
|
14
|
-
File.open('config.yaml', 'w') { |io| io.write('output_dir: public_html') }
|
15
|
-
site = Nanoc3::Site.new('.')
|
16
|
-
assert_equal 'public_html', site.config[:output_dir]
|
17
|
-
end
|
18
|
-
|
19
|
-
def test_initialize_with_config_hash
|
20
|
-
site = Nanoc3::Site.new(:foo => 'bar')
|
21
|
-
assert_equal 'bar', site.config[:foo]
|
22
|
-
end
|
23
|
-
|
24
|
-
def test_initialize_with_incomplete_data_source_config
|
25
|
-
site = Nanoc3::Site.new(:data_sources => [ { :type => 'foo', :items_root => '/bar/' } ])
|
26
|
-
assert_equal('foo', site.config[:data_sources][0][:type])
|
27
|
-
assert_equal('/bar/', site.config[:data_sources][0][:items_root])
|
28
|
-
assert_equal('/', site.config[:data_sources][0][:layouts_root])
|
29
|
-
assert_equal({}, site.config[:data_sources][0][:config])
|
30
|
-
end
|
31
|
-
|
32
|
-
def test_load_rules_with_existing_rules_file
|
33
|
-
# Mock DSL
|
34
|
-
dsl = mock
|
35
|
-
dsl.expects(:compile).with('*')
|
36
|
-
|
37
|
-
# Create site
|
38
|
-
site = Nanoc3::Site.new({})
|
39
|
-
site.compiler.rules_collection.expects(:dsl).returns(dsl)
|
40
|
-
|
41
|
-
# Create rules file
|
42
|
-
File.open('Rules', 'w') do |io|
|
43
|
-
io.write <<-EOF
|
44
|
-
compile '*' do
|
45
|
-
# ... do nothing ...
|
46
|
-
end
|
47
|
-
EOF
|
48
|
-
end
|
49
|
-
|
50
|
-
# Load rules
|
51
|
-
site.compiler.rules_collection.load
|
52
|
-
end
|
53
|
-
|
54
|
-
def test_load_data_sources_first
|
55
|
-
# Create site
|
56
|
-
Nanoc3::CLI.run %w( create_site bar)
|
57
|
-
|
58
|
-
FileUtils.cd('bar') do
|
59
|
-
# Create data source code
|
60
|
-
File.open('lib/some_data_source.rb', 'w') do |io|
|
61
|
-
io.write "class FooDataSource < Nanoc3::DataSource\n"
|
62
|
-
io.write " identifier :site_test_foo\n"
|
63
|
-
io.write " def items ; [ Nanoc3::Item.new('content', {}, '/foo/') ] ; end\n"
|
64
|
-
io.write "end\n"
|
65
|
-
end
|
66
|
-
|
67
|
-
# Update configuration
|
68
|
-
File.open('config.yaml', 'w') do |io|
|
69
|
-
io.write "data_sources:\n"
|
70
|
-
io.write " - type: site_test_foo"
|
71
|
-
end
|
72
|
-
|
73
|
-
# Create site
|
74
|
-
site = Nanoc3::Site.new('.')
|
75
|
-
site.load_data
|
76
|
-
|
77
|
-
# Check
|
78
|
-
assert_equal 1, site.data_sources.size
|
79
|
-
assert_equal '/foo/', site.items[0].identifier
|
80
|
-
end
|
81
|
-
end
|
82
|
-
|
83
|
-
def test_setup_child_parent_links
|
84
|
-
Nanoc3::CLI.run %w( create_site bar)
|
85
|
-
FileUtils.cd('bar') do
|
86
|
-
Nanoc3::CLI.run %w( create_item /parent/ )
|
87
|
-
Nanoc3::CLI.run %w( create_item /parent/foo/ )
|
88
|
-
Nanoc3::CLI.run %w( create_item /parent/bar/ )
|
89
|
-
Nanoc3::CLI.run %w( create_item /parent/bar/qux/ )
|
90
|
-
|
91
|
-
site = Nanoc3::Site.new('.')
|
92
|
-
|
93
|
-
root = site.items.find { |i| i.identifier == '/' }
|
94
|
-
style = site.items.find { |i| i.identifier == '/stylesheet/' }
|
95
|
-
parent = site.items.find { |i| i.identifier == '/parent/' }
|
96
|
-
foo = site.items.find { |i| i.identifier == '/parent/foo/' }
|
97
|
-
bar = site.items.find { |i| i.identifier == '/parent/bar/' }
|
98
|
-
qux = site.items.find { |i| i.identifier == '/parent/bar/qux/' }
|
99
|
-
|
100
|
-
assert_equal Set.new([ parent, style ]), Set.new(root.children)
|
101
|
-
assert_equal Set.new([ foo, bar ]), Set.new(parent.children)
|
102
|
-
assert_equal Set.new([ qux ]), Set.new(bar.children)
|
103
|
-
|
104
|
-
assert_equal nil, root.parent
|
105
|
-
assert_equal root, parent.parent
|
106
|
-
assert_equal parent, foo.parent
|
107
|
-
assert_equal parent, bar.parent
|
108
|
-
assert_equal bar, qux.parent
|
109
|
-
end
|
110
|
-
end
|
111
|
-
|
112
|
-
end
|
113
|
-
|
114
|
-
describe 'Nanoc3::Site#initialize' do
|
115
|
-
|
116
|
-
include Nanoc3::TestHelpers
|
117
|
-
|
118
|
-
it 'should merge default config' do
|
119
|
-
site = Nanoc3::Site.new(:foo => 'bar')
|
120
|
-
site.config[:foo].must_equal 'bar'
|
121
|
-
site.config[:output_dir].must_equal 'output'
|
122
|
-
end
|
123
|
-
|
124
|
-
it 'should not raise under normal circumstances' do
|
125
|
-
Nanoc3::Site.new({})
|
126
|
-
end
|
127
|
-
|
128
|
-
it 'should not raise for non-existant output directory' do
|
129
|
-
Nanoc3::Site.new(:output_dir => 'fklsdhailfdjalghlkasdflhagjskajdf')
|
130
|
-
end
|
131
|
-
|
132
|
-
it 'should not raise for unknown data sources' do
|
133
|
-
proc do
|
134
|
-
Nanoc3::Site.new(:data_source => 'fklsdhailfdjalghlkasdflhagjskajdf')
|
135
|
-
end
|
136
|
-
end
|
137
|
-
|
138
|
-
end
|
139
|
-
|
140
|
-
describe 'Nanoc3::Site#compiler' do
|
141
|
-
|
142
|
-
include Nanoc3::TestHelpers
|
143
|
-
|
144
|
-
it 'should not raise under normal circumstances' do
|
145
|
-
site = Nanoc3::Site.new({})
|
146
|
-
site.compiler
|
147
|
-
end
|
148
|
-
|
149
|
-
end
|
150
|
-
|
151
|
-
describe 'Nanoc3::Site#data_sources' do
|
152
|
-
|
153
|
-
include Nanoc3::TestHelpers
|
154
|
-
|
155
|
-
it 'should not raise for known data sources' do
|
156
|
-
site = Nanoc3::Site.new({})
|
157
|
-
site.data_sources
|
158
|
-
end
|
159
|
-
|
160
|
-
it 'should raise for unknown data sources' do
|
161
|
-
proc do
|
162
|
-
site = Nanoc3::Site.new(
|
163
|
-
:data_sources => [
|
164
|
-
{ :type => 'fklsdhailfdjalghlkasdflhagjskajdf' }
|
165
|
-
]
|
166
|
-
)
|
167
|
-
site.data_sources
|
168
|
-
end.must_raise Nanoc3::Errors::UnknownDataSource
|
169
|
-
end
|
170
|
-
|
171
|
-
it 'should also use the toplevel config for data sources' do
|
172
|
-
with_site do
|
173
|
-
File.open('config.yaml', 'w') do |io|
|
174
|
-
io.write "data_sources:\n"
|
175
|
-
io.write " -\n"
|
176
|
-
io.write " type: filesystem_unified\n"
|
177
|
-
io.write " aaa: one\n"
|
178
|
-
io.write " config:\n"
|
179
|
-
io.write " bbb: two\n"
|
180
|
-
end
|
181
|
-
|
182
|
-
site = Nanoc3::Site.new('.')
|
183
|
-
data_sources = site.data_sources
|
184
|
-
|
185
|
-
assert data_sources.first.config[:aaa] = 'one'
|
186
|
-
assert data_sources.first.config[:bbb] = 'two'
|
187
|
-
end
|
188
|
-
end
|
189
|
-
|
190
|
-
end
|
@@ -1,33 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
|
3
|
-
class Nanoc3::CLI::Commands::CompileTest < MiniTest::Unit::TestCase
|
4
|
-
|
5
|
-
include Nanoc3::TestHelpers
|
6
|
-
|
7
|
-
def test_profiling_information
|
8
|
-
with_site do |site|
|
9
|
-
Nanoc3::CLI.run %w( create_item foo )
|
10
|
-
Nanoc3::CLI.run %w( create_item bar )
|
11
|
-
Nanoc3::CLI.run %w( create_item baz )
|
12
|
-
|
13
|
-
File.open('Rules', 'w') do |io|
|
14
|
-
io.write "compile '*' do\n"
|
15
|
-
io.write " filter :erb\n"
|
16
|
-
io.write "end\n"
|
17
|
-
io.write "\n"
|
18
|
-
io.write "route '*' do\n"
|
19
|
-
io.write " if item.binary?\n"
|
20
|
-
io.write " item.identifier.chop + '.' + item[:extension]\n"
|
21
|
-
io.write " else\n"
|
22
|
-
io.write " item.identifier + 'index.html'\n"
|
23
|
-
io.write " end\n"
|
24
|
-
io.write "end\n"
|
25
|
-
io.write "\n"
|
26
|
-
io.write "layout '*', :erb\n"
|
27
|
-
end
|
28
|
-
|
29
|
-
Nanoc3::CLI.run %w( compile --verbose )
|
30
|
-
end
|
31
|
-
end
|
32
|
-
|
33
|
-
end
|
@@ -1,14 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
|
3
|
-
class Nanoc3::CLI::Commands::CreateItemTest < MiniTest::Unit::TestCase
|
4
|
-
|
5
|
-
include Nanoc3::TestHelpers
|
6
|
-
|
7
|
-
def test_run
|
8
|
-
with_site do |site|
|
9
|
-
Nanoc3::CLI.run %w( create_item /blah/ )
|
10
|
-
assert File.file?('content/blah.html')
|
11
|
-
end
|
12
|
-
end
|
13
|
-
|
14
|
-
end
|
@@ -1,28 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
|
3
|
-
class Nanoc3::CLI::Commands::CreateLayoutTest < MiniTest::Unit::TestCase
|
4
|
-
|
5
|
-
include Nanoc3::TestHelpers
|
6
|
-
|
7
|
-
def test_can_compile_new_layout
|
8
|
-
require 'nanoc3/cli'
|
9
|
-
|
10
|
-
Nanoc3::CLI.run %w( create_site foo )
|
11
|
-
|
12
|
-
FileUtils.cd('foo') do
|
13
|
-
# Create new layout
|
14
|
-
Nanoc3::CLI.run %w( create_layout moo )
|
15
|
-
|
16
|
-
# Makes rules use new layout
|
17
|
-
rules_raw = File.read('Rules')
|
18
|
-
File.open('Rules', 'w') do |io|
|
19
|
-
io.write rules_raw.sub("layout 'default'", "layout 'moo'")
|
20
|
-
end
|
21
|
-
|
22
|
-
site = Nanoc3::Site.new('.')
|
23
|
-
site.load_data
|
24
|
-
site.compile
|
25
|
-
end
|
26
|
-
end
|
27
|
-
|
28
|
-
end
|
@@ -1,24 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
|
3
|
-
class Nanoc3::CLI::Commands::CreateSiteTest < MiniTest::Unit::TestCase
|
4
|
-
|
5
|
-
include Nanoc3::TestHelpers
|
6
|
-
|
7
|
-
def test_create_site_with_existing_name
|
8
|
-
Nanoc3::CLI.run %w( create_site foo )
|
9
|
-
assert_raises(SystemExit) do
|
10
|
-
Nanoc3::CLI.run %w( create_site foo )
|
11
|
-
end
|
12
|
-
end
|
13
|
-
|
14
|
-
def test_can_compile_new_site
|
15
|
-
Nanoc3::CLI.run %w( create_site foo )
|
16
|
-
|
17
|
-
FileUtils.cd('foo') do
|
18
|
-
site = Nanoc3::Site.new('.')
|
19
|
-
site.load_data
|
20
|
-
site.compile
|
21
|
-
end
|
22
|
-
end
|
23
|
-
|
24
|
-
end
|