gettalong-webgen 0.5.4.20080929
Sign up to get free protection for your applications and to get access to all the features.
- data/AUTHORS +5 -0
- data/COPYING +10 -0
- data/GPL +340 -0
- data/Rakefile +324 -0
- data/THANKS +17 -0
- data/bin/webgen +10 -0
- data/data/webgen/resources.yaml +3 -0
- data/data/webgen/webgui/controller/main.rb +129 -0
- data/data/webgen/webgui/overrides/win32console.rb +0 -0
- data/data/webgen/webgui/public/css/jquery.autocomplete.css +50 -0
- data/data/webgen/webgui/public/css/ramaze_error.css +90 -0
- data/data/webgen/webgui/public/css/style.css +55 -0
- data/data/webgen/webgui/public/img/headerbg.jpg +0 -0
- data/data/webgen/webgui/public/img/webgen_logo.png +0 -0
- data/data/webgen/webgui/public/js/jquery.autocomplete.js +15 -0
- data/data/webgen/webgui/public/js/jquery.js +32 -0
- data/data/webgen/webgui/view/create_website.xhtml +22 -0
- data/data/webgen/webgui/view/error.xhtml +64 -0
- data/data/webgen/webgui/view/index.xhtml +22 -0
- data/data/webgen/webgui/view/manage_website.xhtml +18 -0
- data/data/webgen/webgui/view/page.xhtml +40 -0
- data/data/webgen/website_skeleton/README +10 -0
- data/data/webgen/website_skeleton/Rakefile +40 -0
- data/data/webgen/website_skeleton/config.yaml +17 -0
- data/data/webgen/website_skeleton/ext/init.rb +6 -0
- data/data/webgen/website_styles/1024px/README +13 -0
- data/data/webgen/website_styles/1024px/src/default.css +188 -0
- data/data/webgen/website_styles/1024px/src/default.template +60 -0
- data/data/webgen/website_styles/1024px/src/images/background.gif +0 -0
- data/data/webgen/website_styles/andreas00/README +13 -0
- data/data/webgen/website_styles/andreas00/src/default.css +290 -0
- data/data/webgen/website_styles/andreas00/src/default.template +60 -0
- data/data/webgen/website_styles/andreas00/src/images/bg.gif +0 -0
- data/data/webgen/website_styles/andreas00/src/images/front.jpg +0 -0
- data/data/webgen/website_styles/andreas00/src/images/menubg.gif +0 -0
- data/data/webgen/website_styles/andreas00/src/images/menubg2.gif +0 -0
- data/data/webgen/website_styles/andreas01/README +14 -0
- data/data/webgen/website_styles/andreas01/src/default.css +310 -0
- data/data/webgen/website_styles/andreas01/src/default.template +61 -0
- data/data/webgen/website_styles/andreas01/src/images/bg.gif +0 -0
- data/data/webgen/website_styles/andreas01/src/images/front.jpg +0 -0
- data/data/webgen/website_styles/andreas01/src/print.css +35 -0
- data/data/webgen/website_styles/andreas03/README +14 -0
- data/data/webgen/website_styles/andreas03/src/default.css +223 -0
- data/data/webgen/website_styles/andreas03/src/default.template +58 -0
- data/data/webgen/website_styles/andreas03/src/images/bodybg.png +0 -0
- data/data/webgen/website_styles/andreas03/src/images/contbg.png +0 -0
- data/data/webgen/website_styles/andreas03/src/images/footerbg.png +0 -0
- data/data/webgen/website_styles/andreas03/src/images/gradient1.png +0 -0
- data/data/webgen/website_styles/andreas03/src/images/gradient2.png +0 -0
- data/data/webgen/website_styles/andreas04/README +15 -0
- data/data/webgen/website_styles/andreas04/src/default.css +290 -0
- data/data/webgen/website_styles/andreas04/src/default.template +81 -0
- data/data/webgen/website_styles/andreas04/src/images/blinkarrow.gif +0 -0
- data/data/webgen/website_styles/andreas04/src/images/bodybg.png +0 -0
- data/data/webgen/website_styles/andreas04/src/images/contentbg.png +0 -0
- data/data/webgen/website_styles/andreas04/src/images/entrybg.png +0 -0
- data/data/webgen/website_styles/andreas04/src/images/flash.gif +0 -0
- data/data/webgen/website_styles/andreas04/src/images/flash2.gif +0 -0
- data/data/webgen/website_styles/andreas04/src/images/globe.gif +0 -0
- data/data/webgen/website_styles/andreas04/src/images/globebottom.gif +0 -0
- data/data/webgen/website_styles/andreas04/src/images/linkarrow.gif +0 -0
- data/data/webgen/website_styles/andreas04/src/images/menuhover.png +0 -0
- data/data/webgen/website_styles/andreas05/README +14 -0
- data/data/webgen/website_styles/andreas05/src/default.css +33 -0
- data/data/webgen/website_styles/andreas05/src/default.template +40 -0
- data/data/webgen/website_styles/andreas05/src/images/bodybg.gif +0 -0
- data/data/webgen/website_styles/andreas05/src/images/front.png +0 -0
- data/data/webgen/website_styles/andreas06/README +14 -0
- data/data/webgen/website_styles/andreas06/src/default.css +354 -0
- data/data/webgen/website_styles/andreas06/src/default.template +70 -0
- data/data/webgen/website_styles/andreas06/src/images/bodybg.gif +0 -0
- data/data/webgen/website_styles/andreas06/src/images/boxbg.gif +0 -0
- data/data/webgen/website_styles/andreas06/src/images/greypx.gif +0 -0
- data/data/webgen/website_styles/andreas06/src/images/header.jpg +0 -0
- data/data/webgen/website_styles/andreas06/src/images/innerbg.gif +0 -0
- data/data/webgen/website_styles/andreas06/src/images/leaves.jpg +0 -0
- data/data/webgen/website_styles/andreas06/src/images/tabs.gif +0 -0
- data/data/webgen/website_styles/andreas07/README +15 -0
- data/data/webgen/website_styles/andreas07/src/browserfix.css +7 -0
- data/data/webgen/website_styles/andreas07/src/default.css +92 -0
- data/data/webgen/website_styles/andreas07/src/default.template +42 -0
- data/data/webgen/website_styles/andreas07/src/images/bodybg.gif +0 -0
- data/data/webgen/website_styles/andreas07/src/images/sidebarbg.gif +0 -0
- data/data/webgen/website_styles/andreas08/README +14 -0
- data/data/webgen/website_styles/andreas08/src/default.css +224 -0
- data/data/webgen/website_styles/andreas08/src/default.template +51 -0
- data/data/webgen/website_styles/andreas09/README +14 -0
- data/data/webgen/website_styles/andreas09/src/default.css +308 -0
- data/data/webgen/website_styles/andreas09/src/default.template +68 -0
- data/data/webgen/website_styles/andreas09/src/images/bodybg-black.jpg +0 -0
- data/data/webgen/website_styles/andreas09/src/images/bodybg-green.jpg +0 -0
- data/data/webgen/website_styles/andreas09/src/images/bodybg-orange.jpg +0 -0
- data/data/webgen/website_styles/andreas09/src/images/bodybg-purple.jpg +0 -0
- data/data/webgen/website_styles/andreas09/src/images/bodybg-red.jpg +0 -0
- data/data/webgen/website_styles/andreas09/src/images/bodybg.jpg +0 -0
- data/data/webgen/website_styles/andreas09/src/images/footerbg.jpg +0 -0
- data/data/webgen/website_styles/andreas09/src/images/menuhover-black.jpg +0 -0
- data/data/webgen/website_styles/andreas09/src/images/menuhover-green.jpg +0 -0
- data/data/webgen/website_styles/andreas09/src/images/menuhover-orange.jpg +0 -0
- data/data/webgen/website_styles/andreas09/src/images/menuhover-purple.jpg +0 -0
- data/data/webgen/website_styles/andreas09/src/images/menuhover-red.jpg +0 -0
- data/data/webgen/website_styles/andreas09/src/images/menuhover.jpg +0 -0
- data/data/webgen/website_styles/simple/README +6 -0
- data/data/webgen/website_styles/simple/src/default.css +84 -0
- data/data/webgen/website_styles/simple/src/default.template +36 -0
- data/data/webgen/website_templates/default/README +6 -0
- data/data/webgen/website_templates/default/src/index.page +8 -0
- data/data/webgen/website_templates/project/README +5 -0
- data/data/webgen/website_templates/project/src/about.page +12 -0
- data/data/webgen/website_templates/project/src/download.page +15 -0
- data/data/webgen/website_templates/project/src/features.page +8 -0
- data/data/webgen/website_templates/project/src/index.page +9 -0
- data/data/webgen/website_templates/project/src/screenshots.page +18 -0
- data/doc/contentprocessor.template +11 -0
- data/doc/contentprocessor/blocks.page +66 -0
- data/doc/contentprocessor/builder.page +80 -0
- data/doc/contentprocessor/erb.page +56 -0
- data/doc/contentprocessor/erubis.page +46 -0
- data/doc/contentprocessor/haml.page +47 -0
- data/doc/contentprocessor/maruku.page +41 -0
- data/doc/contentprocessor/rdiscount.page +37 -0
- data/doc/contentprocessor/rdoc.page +36 -0
- data/doc/contentprocessor/redcloth.page +39 -0
- data/doc/contentprocessor/sass.page +31 -0
- data/doc/contentprocessor/tags.page +73 -0
- data/doc/extensions.metainfo +29 -0
- data/doc/extensions.page +16 -0
- data/doc/extensions.template +17 -0
- data/doc/faq.page +214 -0
- data/doc/getting_started.page +134 -0
- data/doc/index.page +65 -0
- data/doc/manual.page +532 -0
- data/doc/reference_configuration.page +646 -0
- data/doc/reference_metainfo.page +213 -0
- data/doc/sourcehandler.template +21 -0
- data/doc/sourcehandler/copy.page +19 -0
- data/doc/sourcehandler/directory.page +27 -0
- data/doc/sourcehandler/feed.page +82 -0
- data/doc/sourcehandler/metainfo.page +41 -0
- data/doc/sourcehandler/page.page +30 -0
- data/doc/sourcehandler/sitemap.page +46 -0
- data/doc/sourcehandler/template.page +45 -0
- data/doc/sourcehandler/virtual.page +49 -0
- data/doc/tag.template +25 -0
- data/doc/tag/breadcrumbtrail.page +40 -0
- data/doc/tag/coderay.page +49 -0
- data/doc/tag/date.page +31 -0
- data/doc/tag/executecommand.page +26 -0
- data/doc/tag/includefile.page +32 -0
- data/doc/tag/langbar.page +22 -0
- data/doc/tag/menu.page +92 -0
- data/doc/tag/metainfo.page +29 -0
- data/doc/tag/relocatable.page +38 -0
- data/doc/tag/sitemap.page +31 -0
- data/doc/upgrading.page +139 -0
- data/doc/webgen_page_format.page +128 -0
- data/lib/webgen/blackboard.rb +73 -0
- data/lib/webgen/cache.rb +85 -0
- data/lib/webgen/cli.rb +118 -0
- data/lib/webgen/cli/create_command.rb +64 -0
- data/lib/webgen/cli/run_command.rb +20 -0
- data/lib/webgen/cli/utils.rb +86 -0
- data/lib/webgen/cli/webgui_command.rb +49 -0
- data/lib/webgen/common.rb +10 -0
- data/lib/webgen/common/sitemap.rb +76 -0
- data/lib/webgen/configuration.rb +147 -0
- data/lib/webgen/contentprocessor.rb +96 -0
- data/lib/webgen/contentprocessor/blocks.rb +46 -0
- data/lib/webgen/contentprocessor/builder.rb +26 -0
- data/lib/webgen/contentprocessor/context.rb +90 -0
- data/lib/webgen/contentprocessor/erb.rb +24 -0
- data/lib/webgen/contentprocessor/erubis.rb +40 -0
- data/lib/webgen/contentprocessor/haml.rb +25 -0
- data/lib/webgen/contentprocessor/maruku.rb +18 -0
- data/lib/webgen/contentprocessor/rdiscount.rb +15 -0
- data/lib/webgen/contentprocessor/rdoc.rb +17 -0
- data/lib/webgen/contentprocessor/redcloth.rb +15 -0
- data/lib/webgen/contentprocessor/sass.rb +18 -0
- data/lib/webgen/contentprocessor/tags.rb +134 -0
- data/lib/webgen/coreext.rb +10 -0
- data/lib/webgen/default_config.rb +198 -0
- data/lib/webgen/languages.rb +578 -0
- data/lib/webgen/loggable.rb +23 -0
- data/lib/webgen/logger.rb +78 -0
- data/lib/webgen/node.rb +347 -0
- data/lib/webgen/output.rb +37 -0
- data/lib/webgen/output/filesystem.rb +67 -0
- data/lib/webgen/page.rb +133 -0
- data/lib/webgen/path.rb +182 -0
- data/lib/webgen/source.rb +24 -0
- data/lib/webgen/source/filesystem.rb +58 -0
- data/lib/webgen/source/resource.rb +42 -0
- data/lib/webgen/source/stacked.rb +53 -0
- data/lib/webgen/sourcehandler.rb +202 -0
- data/lib/webgen/sourcehandler/base.rb +211 -0
- data/lib/webgen/sourcehandler/copy.rb +41 -0
- data/lib/webgen/sourcehandler/directory.rb +31 -0
- data/lib/webgen/sourcehandler/feed.rb +121 -0
- data/lib/webgen/sourcehandler/fragment.rb +71 -0
- data/lib/webgen/sourcehandler/metainfo.rb +117 -0
- data/lib/webgen/sourcehandler/page.rb +77 -0
- data/lib/webgen/sourcehandler/sitemap.rb +60 -0
- data/lib/webgen/sourcehandler/template.rb +68 -0
- data/lib/webgen/sourcehandler/virtual.rb +75 -0
- data/lib/webgen/tag.rb +23 -0
- data/lib/webgen/tag/base.rb +162 -0
- data/lib/webgen/tag/breadcrumbtrail.rb +71 -0
- data/lib/webgen/tag/coderay.rb +32 -0
- data/lib/webgen/tag/date.rb +18 -0
- data/lib/webgen/tag/executecommand.rb +29 -0
- data/lib/webgen/tag/includefile.rb +42 -0
- data/lib/webgen/tag/langbar.rb +52 -0
- data/lib/webgen/tag/menu.rb +186 -0
- data/lib/webgen/tag/metainfo.rb +25 -0
- data/lib/webgen/tag/relocatable.rb +53 -0
- data/lib/webgen/tag/sitemap.rb +42 -0
- data/lib/webgen/tree.rb +80 -0
- data/lib/webgen/version.rb +6 -0
- data/lib/webgen/webgentask.rb +148 -0
- data/lib/webgen/website.rb +214 -0
- data/lib/webgen/websiteaccess.rb +29 -0
- data/lib/webgen/websitemanager.rb +125 -0
- data/man/man1/webgen.1 +67 -0
- data/misc/default.css +360 -0
- data/misc/default.template +75 -0
- data/misc/htmldoc.metainfo +25 -0
- data/misc/htmldoc.virtual +5 -0
- data/misc/images/arrow.gif +0 -0
- data/misc/images/error.gif +0 -0
- data/misc/images/exclamation.gif +0 -0
- data/misc/images/headerbg.jpg +0 -0
- data/misc/images/information.gif +0 -0
- data/misc/images/quote.gif +0 -0
- data/setup.rb +1585 -0
- data/test/helper.rb +41 -0
- data/test/test_blackboard.rb +58 -0
- data/test/test_cache.rb +57 -0
- data/test/test_common_sitemap.rb +56 -0
- data/test/test_configuration.rb +66 -0
- data/test/test_contentprocessor.rb +31 -0
- data/test/test_contentprocessor_blocks.rb +34 -0
- data/test/test_contentprocessor_builder.rb +19 -0
- data/test/test_contentprocessor_context.rb +38 -0
- data/test/test_contentprocessor_erb.rb +20 -0
- data/test/test_contentprocessor_erubis.rb +47 -0
- data/test/test_contentprocessor_haml.rb +20 -0
- data/test/test_contentprocessor_maruku.rb +27 -0
- data/test/test_contentprocessor_rdiscount.rb +15 -0
- data/test/test_contentprocessor_rdoc.rb +16 -0
- data/test/test_contentprocessor_redcloth.rb +12 -0
- data/test/test_contentprocessor_sass.rb +20 -0
- data/test/test_contentprocessor_tags.rb +97 -0
- data/test/test_languages.rb +53 -0
- data/test/test_loggable.rb +30 -0
- data/test/test_logger.rb +73 -0
- data/test/test_node.rb +339 -0
- data/test/test_output_filesystem.rb +58 -0
- data/test/test_page.rb +203 -0
- data/test/test_path.rb +131 -0
- data/test/test_source_filesystem.rb +59 -0
- data/test/test_source_resource.rb +26 -0
- data/test/test_source_stacked.rb +34 -0
- data/test/test_sourcehandler_base.rb +92 -0
- data/test/test_sourcehandler_copy.rb +45 -0
- data/test/test_sourcehandler_directory.rb +25 -0
- data/test/test_sourcehandler_feed.rb +74 -0
- data/test/test_sourcehandler_fragment.rb +67 -0
- data/test/test_sourcehandler_metainfo.rb +93 -0
- data/test/test_sourcehandler_page.rb +70 -0
- data/test/test_sourcehandler_sitemap.rb +47 -0
- data/test/test_sourcehandler_template.rb +63 -0
- data/test/test_sourcehandler_virtual.rb +56 -0
- data/test/test_tag_base.rb +82 -0
- data/test/test_tag_breadcrumbtrail.rb +89 -0
- data/test/test_tag_coderay.rb +30 -0
- data/test/test_tag_date.rb +16 -0
- data/test/test_tag_executecommand.rb +39 -0
- data/test/test_tag_includefile.rb +48 -0
- data/test/test_tag_langbar.rb +60 -0
- data/test/test_tag_menu.rb +195 -0
- data/test/test_tag_metainfo.rb +17 -0
- data/test/test_tag_relocatable.rb +57 -0
- data/test/test_tag_sitemap.rb +44 -0
- data/test/test_tree.rb +69 -0
- data/test/test_webgentask.rb +21 -0
- data/test/test_website.rb +96 -0
- data/test/test_websiteaccess.rb +23 -0
- data/test/test_websitemanager.rb +68 -0
- metadata +575 -0
@@ -0,0 +1,26 @@
|
|
1
|
+
require 'test/unit'
|
2
|
+
require 'helper'
|
3
|
+
require 'webgen/source'
|
4
|
+
|
5
|
+
class TestSourceResource < Test::Unit::TestCase
|
6
|
+
|
7
|
+
include Test::WebsiteHelper
|
8
|
+
|
9
|
+
def test_initialize
|
10
|
+
source = Webgen::Source::Resource.new('test-glob-*')
|
11
|
+
assert_equal('test-glob-*', source.glob)
|
12
|
+
end
|
13
|
+
|
14
|
+
def test_paths
|
15
|
+
@website.config['resources']['test-resource'] = ['Webgen::Source::FileSystem', '.', File.basename(__FILE__)]
|
16
|
+
@website.config['resources']['other-resource'] = ['Webgen::Source::FileSystem', '../lib']
|
17
|
+
|
18
|
+
source = Webgen::Source::Resource.new('test-*')
|
19
|
+
assert_equal(1, source.paths.length)
|
20
|
+
assert(source.paths.include?(Webgen::Path.new('/test_source_resource.rb')))
|
21
|
+
|
22
|
+
source = Webgen::Source::Resource.new('other-*', '/webgen/**/*', '/webgen/')
|
23
|
+
assert(source.paths.include?(Webgen::Path.new('/source/resource.rb')))
|
24
|
+
end
|
25
|
+
|
26
|
+
end
|
@@ -0,0 +1,34 @@
|
|
1
|
+
require 'test/unit'
|
2
|
+
require 'helper'
|
3
|
+
require 'webgen/source/stacked'
|
4
|
+
|
5
|
+
class TestSourceFileSystemStacked < Test::Unit::TestCase
|
6
|
+
|
7
|
+
class TestSource
|
8
|
+
def initialize(paths); @paths = paths; end
|
9
|
+
def paths; Set.new(@paths); end
|
10
|
+
end
|
11
|
+
|
12
|
+
def test_initialize
|
13
|
+
source = Webgen::Source::Stacked.new
|
14
|
+
assert_equal([], source.stack)
|
15
|
+
source = Webgen::Source::Stacked.new('/dir' => 6)
|
16
|
+
assert_equal([['/dir', 6]], source.stack)
|
17
|
+
end
|
18
|
+
|
19
|
+
def test_add
|
20
|
+
source = Webgen::Source::Stacked.new
|
21
|
+
assert_raise(RuntimeError) { source.add(['dir', 6])}
|
22
|
+
source.add('/temp' => :source)
|
23
|
+
assert_equal([['/temp', :source]], source.stack)
|
24
|
+
end
|
25
|
+
|
26
|
+
def test_paths
|
27
|
+
source = Webgen::Source::Stacked.new
|
28
|
+
source.add('/' => TestSource.new([Webgen::Path.new('/hallo/dir'), Webgen::Path.new('/other')]))
|
29
|
+
source.add('/hallo' => TestSource.new([Webgen::Path.new('/dir'), Webgen::Path.new('/other')]))
|
30
|
+
assert_equal(Set.new([Webgen::Path.new('/hallo/dir'), Webgen::Path.new('/other'),
|
31
|
+
Webgen::Path.new('/hallo/other')]), source.paths)
|
32
|
+
end
|
33
|
+
|
34
|
+
end
|
@@ -0,0 +1,92 @@
|
|
1
|
+
require 'test/unit'
|
2
|
+
require 'helper'
|
3
|
+
require 'webgen/tree'
|
4
|
+
require 'webgen/node'
|
5
|
+
require 'webgen/path'
|
6
|
+
require 'webgen/sourcehandler/base'
|
7
|
+
require 'time'
|
8
|
+
|
9
|
+
class TestSourceHandlerBase < Test::Unit::TestCase
|
10
|
+
|
11
|
+
include Test::WebsiteHelper
|
12
|
+
|
13
|
+
def setup
|
14
|
+
super
|
15
|
+
@obj = Object.new
|
16
|
+
@obj.extend(Webgen::SourceHandler::Base)
|
17
|
+
end
|
18
|
+
|
19
|
+
def test_node_exists
|
20
|
+
@tree = Webgen::Tree.new
|
21
|
+
node = Webgen::Node.new(@tree.dummy_root, 'test/', 'test', {'lang' => 'de', :test => :value})
|
22
|
+
child_de = Webgen::Node.new(node, 'test/somename.html', 'somename.page', {'lang' => 'de'})
|
23
|
+
frag_de = Webgen::Node.new(child_de, '#data1', '#othertest')
|
24
|
+
|
25
|
+
assert_equal(child_de, @obj.node_exists?(node, path_with_meta_info('somename.de.page')))
|
26
|
+
assert_equal(child_de, @obj.node_exists?(node, path_with_meta_info('other.page'), @obj.output_path(node, path_with_meta_info('somename.html'))))
|
27
|
+
assert_equal(false, @obj.node_exists?(node, path_with_meta_info('somename.en.page', {'no_output' => true}),
|
28
|
+
@obj.output_path(node, path_with_meta_info('somename.html'))))
|
29
|
+
assert_equal(frag_de, @obj.node_exists?(child_de, path_with_meta_info('#othertest')))
|
30
|
+
assert_equal(nil, @obj.node_exists?(node, path_with_meta_info('unknown')))
|
31
|
+
end
|
32
|
+
|
33
|
+
def test_output_path
|
34
|
+
node = Webgen::Node.new(Webgen::Tree.new.dummy_root, 'test/', 'test')
|
35
|
+
assert_raise(RuntimeError) { @obj.output_path(node, path_with_meta_info('test.page', 'output_path' => 'non'))}
|
36
|
+
end
|
37
|
+
|
38
|
+
def test_standard_output_path
|
39
|
+
@tree = Webgen::Tree.new
|
40
|
+
node = Webgen::Node.new(@tree.dummy_root, 'test/', 'test', {'lang' => 'de', :test => :value})
|
41
|
+
|
42
|
+
path = path_with_meta_info('path.html')
|
43
|
+
assert_equal('test/path.html', @obj.output_path(node, path))
|
44
|
+
path = path_with_meta_info('path.en.html')
|
45
|
+
assert_equal('test/path.html', @obj.output_path(node, path))
|
46
|
+
path = path_with_meta_info('path.eo.html')
|
47
|
+
assert_equal('test/path.eo.html', @obj.output_path(node, path))
|
48
|
+
path = path_with_meta_info('dir/')
|
49
|
+
assert_equal('test/dir/', @obj.output_path(node, path))
|
50
|
+
|
51
|
+
other = Webgen::Node.new(node, 'test/path.html', 'other.page')
|
52
|
+
path = path_with_meta_info('path.html')
|
53
|
+
assert_equal('test/path.html', @obj.output_path(node, path))
|
54
|
+
path = path_with_meta_info('path.en.html')
|
55
|
+
assert_equal('test/path.en.html', @obj.output_path(node, path))
|
56
|
+
|
57
|
+
path = path_with_meta_info('#frag')
|
58
|
+
assert_equal('test/path.html#frag', @obj.output_path(other, path))
|
59
|
+
frag = Webgen::Node.new(other, 'test/path.html#frag', '#frag')
|
60
|
+
path = path_with_meta_info('#frag1')
|
61
|
+
assert_equal('test/path.html#frag1', @obj.output_path(frag, path))
|
62
|
+
|
63
|
+
path = path_with_meta_info('/')
|
64
|
+
assert_equal('/', @obj.output_path(@tree.dummy_root, path))
|
65
|
+
path = path_with_meta_info('/', 'output_path_style' => [:parent, 'hallo', 56])
|
66
|
+
assert_equal('hallo/', @obj.output_path(@tree.dummy_root, path))
|
67
|
+
|
68
|
+
assert_raise(RuntimeError) do
|
69
|
+
path = path_with_meta_info('path.html', 'output_path_style' => [:parent, :year, '/', :month, '/', :cnbase, :ext])
|
70
|
+
@obj.output_path(node, path)
|
71
|
+
end
|
72
|
+
time = Time.parse('2008-09-04 08:15')
|
73
|
+
path = path_with_meta_info('path.html', 'output_path_style' => [:parent, :year, '/', :month, '/', :day, '-', :cnbase, :ext],
|
74
|
+
'created_at' => time)
|
75
|
+
assert_equal('test/2008/09/04-path.html', @obj.output_path(node, path))
|
76
|
+
end
|
77
|
+
|
78
|
+
def test_content
|
79
|
+
assert_nil(@obj.content(nil))
|
80
|
+
end
|
81
|
+
|
82
|
+
def test_page_from_path
|
83
|
+
path = path_with_meta_info('/other.page', {'key' => 'value'}) { StringIO.new("---\nkey: value1\n---\ncontent")}
|
84
|
+
page = @obj.page_from_path(path)
|
85
|
+
assert_equal('content', page.blocks['content'].content)
|
86
|
+
assert_equal('value1', path.meta_info['key'])
|
87
|
+
|
88
|
+
path = path_with_meta_info('/other.page') { StringIO.new("---\:dfk")}
|
89
|
+
assert_raise(RuntimeError) { @obj.page_from_path(path) }
|
90
|
+
end
|
91
|
+
|
92
|
+
end
|
@@ -0,0 +1,45 @@
|
|
1
|
+
require 'test/unit'
|
2
|
+
require 'helper'
|
3
|
+
require 'webgen/sourcehandler/copy'
|
4
|
+
require 'stringio'
|
5
|
+
|
6
|
+
class TestSourceHandlerCopy < Test::Unit::TestCase
|
7
|
+
|
8
|
+
include Test::WebsiteHelper
|
9
|
+
|
10
|
+
class TestCP
|
11
|
+
def call(context); context.content = context.content.reverse; end
|
12
|
+
end
|
13
|
+
|
14
|
+
def setup
|
15
|
+
super
|
16
|
+
@website.config['contentprocessor.map']['test'] = 'TestSourceHandlerCopy::TestCP'
|
17
|
+
@obj = Webgen::SourceHandler::Copy.new
|
18
|
+
@root = Webgen::Node.new(Webgen::Tree.new.dummy_root, 'test/', 'test')
|
19
|
+
@without = @obj.create_node(@root, path_with_meta_info('/default.css') {StringIO.new('# header')})
|
20
|
+
@with = @obj.create_node(@root, path_with_meta_info('/other.test.css') {StringIO.new('# header')})
|
21
|
+
end
|
22
|
+
|
23
|
+
def test_create_node
|
24
|
+
assert_not_nil(@without)
|
25
|
+
assert_equal(nil, @without.node_info[:preprocessor])
|
26
|
+
assert_equal('test/default.css', @without.path)
|
27
|
+
|
28
|
+
assert_not_nil(@with)
|
29
|
+
assert_equal('test', @with.node_info[:preprocessor])
|
30
|
+
assert_equal('test/other.css', @with.path)
|
31
|
+
|
32
|
+
node = @obj.create_node(@root, path_with_meta_info('/other.unknown.css') {StringIO.new('# header')})
|
33
|
+
assert_equal(nil, node.node_info[:preprocessor])
|
34
|
+
end
|
35
|
+
|
36
|
+
def test_content
|
37
|
+
@website.blackboard.add_service(:source_paths) do
|
38
|
+
{'/default.css' => path_with_meta_info('/default.css') {StringIO.new('# header')}}
|
39
|
+
end
|
40
|
+
@without.node_info[:src] = @with.node_info[:src] = '/default.css'
|
41
|
+
assert_kind_of(Webgen::Path::SourceIO, @without.content)
|
42
|
+
assert_equal('# header'.reverse, @with.content)
|
43
|
+
end
|
44
|
+
|
45
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
require 'test/unit'
|
2
|
+
require 'helper'
|
3
|
+
require 'webgen/sourcehandler/directory'
|
4
|
+
require 'stringio'
|
5
|
+
|
6
|
+
class TestSourceHandlerDirectory < Test::Unit::TestCase
|
7
|
+
|
8
|
+
include Test::WebsiteHelper
|
9
|
+
|
10
|
+
def test_create_node
|
11
|
+
@obj = Webgen::SourceHandler::Directory.new
|
12
|
+
root = Webgen::Node.new(Webgen::Tree.new.dummy_root, 'test/', 'test')
|
13
|
+
node = @obj.create_node(root, path_with_meta_info('/dir/', {:key => :value}) {StringIO.new('')})
|
14
|
+
assert_not_nil(node)
|
15
|
+
assert_equal(:value, node[:key])
|
16
|
+
|
17
|
+
assert_equal(node, @obj.create_node(root, path_with_meta_info('/dir/', {:key => :other}) {StringIO.new('')}))
|
18
|
+
assert_equal(:other, node[:key])
|
19
|
+
end
|
20
|
+
|
21
|
+
def test_content
|
22
|
+
assert_equal('', Webgen::SourceHandler::Directory.new.content(nil))
|
23
|
+
end
|
24
|
+
|
25
|
+
end
|
@@ -0,0 +1,74 @@
|
|
1
|
+
require 'test/unit'
|
2
|
+
require 'helper'
|
3
|
+
require 'webgen/sourcehandler/feed'
|
4
|
+
require 'stringio'
|
5
|
+
|
6
|
+
class TestSourceHandlerFeed < Test::Unit::TestCase
|
7
|
+
|
8
|
+
include Test::WebsiteHelper
|
9
|
+
|
10
|
+
FEED_CONTENT = <<EOF
|
11
|
+
---
|
12
|
+
site_url: http://example.com
|
13
|
+
entries: *.html
|
14
|
+
author: Thomas Leitner
|
15
|
+
--- name:rss_template
|
16
|
+
hallo
|
17
|
+
EOF
|
18
|
+
def setup
|
19
|
+
super
|
20
|
+
@nodes = {
|
21
|
+
:root => root = Webgen::Node.new(Webgen::Tree.new.dummy_root, '/', '/', {'index_path' => 'index.html'}),
|
22
|
+
:file1_en => Webgen::Node.new(root, '/file1.en.html', 'file1.html', {'lang' => 'en', 'in_menu' => true, 'modified_at' => Time.now}),
|
23
|
+
:index_en => Webgen::Node.new(root, '/index.en.html', 'index.html', {'lang' => 'en', 'modified_at' => Time.now - 1, 'author' => 'test'}),
|
24
|
+
}
|
25
|
+
@nodes[:index_en].node_info[:page] = Webgen::Page.from_data("hallo")
|
26
|
+
@obj = Webgen::SourceHandler::Feed.new
|
27
|
+
@path = path_with_meta_info('/test.feed', {}, @obj.class.name) {StringIO.new(FEED_CONTENT)}
|
28
|
+
end
|
29
|
+
|
30
|
+
def test_create_node
|
31
|
+
atom_node, rss_node = @obj.create_node(@nodes[:root], @path)
|
32
|
+
|
33
|
+
assert_not_nil(atom_node)
|
34
|
+
assert_not_nil(rss_node)
|
35
|
+
assert_kind_of(Webgen::Page, atom_node.node_info[:feed])
|
36
|
+
assert_equal('atom', atom_node.node_info[:feed_type])
|
37
|
+
assert_equal('rss', rss_node.node_info[:feed_type])
|
38
|
+
|
39
|
+
assert_equal([nil, nil], @obj.create_node(@nodes[:root], @path))
|
40
|
+
end
|
41
|
+
|
42
|
+
def test_content
|
43
|
+
atom_node, rss_node = @obj.create_node(@nodes[:root], @path)
|
44
|
+
assert_equal('hallo', rss_node.content)
|
45
|
+
assert(atom_node.content =~ /Thomas Leitner/)
|
46
|
+
end
|
47
|
+
|
48
|
+
def test_feed_entries
|
49
|
+
atom_node, rss_node = @obj.create_node(@nodes[:root], @path)
|
50
|
+
assert_equal([@nodes[:index_en]], atom_node.feed_entries)
|
51
|
+
assert_equal([@nodes[:index_en]], rss_node.feed_entries)
|
52
|
+
end
|
53
|
+
|
54
|
+
def test_node_changed
|
55
|
+
atom_node, rss_node = @obj.create_node(@nodes[:root], @path)
|
56
|
+
assert(atom_node.changed?)
|
57
|
+
|
58
|
+
atom_node.content # populate cache
|
59
|
+
@website.cache.old_data.update(@website.cache.new_data)
|
60
|
+
|
61
|
+
atom_node.dirty = false
|
62
|
+
assert(atom_node.changed?)
|
63
|
+
|
64
|
+
atom_node.dirty = false
|
65
|
+
@nodes[:file1_en].dirty = false
|
66
|
+
@nodes[:index_en].dirty = false
|
67
|
+
assert(!atom_node.changed?)
|
68
|
+
|
69
|
+
atom_node.dirty = false
|
70
|
+
atom_node['entries'] = 'file.*.html'
|
71
|
+
assert(atom_node.changed?)
|
72
|
+
end
|
73
|
+
|
74
|
+
end
|
@@ -0,0 +1,67 @@
|
|
1
|
+
require 'test/unit'
|
2
|
+
require 'helper'
|
3
|
+
require 'webgen/sourcehandler/fragment'
|
4
|
+
require 'stringio'
|
5
|
+
|
6
|
+
class TestSourceHandlerFragment < Test::Unit::TestCase
|
7
|
+
|
8
|
+
include Test::WebsiteHelper
|
9
|
+
|
10
|
+
TEST_CONTENT=<<EOF
|
11
|
+
- data: |
|
12
|
+
<h1 id="test">Test</h1>
|
13
|
+
<h2 id="other">test</h2>
|
14
|
+
<h1>nothing</h1>
|
15
|
+
<h1 id="third">test</h1>
|
16
|
+
sections:
|
17
|
+
- [1, test, Test]
|
18
|
+
- [2, other, test]
|
19
|
+
- [1, third, test]
|
20
|
+
|
21
|
+
- data: |
|
22
|
+
<h1 id="test">Test</h1>
|
23
|
+
<h2 id="other">test</h2>
|
24
|
+
<h3 id='non'>other</h3>
|
25
|
+
<h1 id="third">test</h1>
|
26
|
+
<h3 id='four'>fourth</h3>
|
27
|
+
sections:
|
28
|
+
- [1, test, Test]
|
29
|
+
- [2, other, test]
|
30
|
+
- [3, non, other]
|
31
|
+
- [1, third, test]
|
32
|
+
- [3, four, fourth]
|
33
|
+
EOF
|
34
|
+
|
35
|
+
def test_parse_html_headers
|
36
|
+
@obj = Webgen::SourceHandler::Fragment.new
|
37
|
+
YAML::load(TEST_CONTENT).each do |data|
|
38
|
+
sections = @obj.parse_html_headers(data['data'])
|
39
|
+
check_sections(sections, data['sections'])
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
def test_create_fragment_nodes
|
44
|
+
@obj = Webgen::SourceHandler::Fragment.new
|
45
|
+
root = Webgen::Node.new(Webgen::Tree.new.dummy_root, 'test/', 'test')
|
46
|
+
path = path_with_meta_info('hallo.html') {StringIO.new('')}
|
47
|
+
node = @obj.create_node(root, path)
|
48
|
+
@website.blackboard.add_service(:create_nodes, method(:create_nodes_service))
|
49
|
+
|
50
|
+
sections = @obj.parse_html_headers(YAML::load(TEST_CONTENT).first['data'])
|
51
|
+
@obj.create_fragment_nodes(sections, node, path, 'true')
|
52
|
+
assert_equal(node, node.resolve('#test').parent)
|
53
|
+
assert_equal(node.resolve('#test'), node.resolve('#other').parent)
|
54
|
+
end
|
55
|
+
|
56
|
+
def create_nodes_service(tree, alcn, path, sh)
|
57
|
+
[yield(tree[alcn], path_with_meta_info(path.path))]
|
58
|
+
end
|
59
|
+
|
60
|
+
def check_sections(sections, valid)
|
61
|
+
sections.each do |level, id, title, subsecs|
|
62
|
+
assert_equal(valid.shift, [level, id, title])
|
63
|
+
check_sections(subsecs, valid)
|
64
|
+
end
|
65
|
+
end
|
66
|
+
|
67
|
+
end
|
@@ -0,0 +1,93 @@
|
|
1
|
+
require 'test/unit'
|
2
|
+
require 'helper'
|
3
|
+
require 'webgen/sourcehandler/metainfo'
|
4
|
+
require 'stringio'
|
5
|
+
|
6
|
+
class TestSourceHandlerMetainfo < Test::Unit::TestCase
|
7
|
+
|
8
|
+
include Test::WebsiteHelper
|
9
|
+
|
10
|
+
class TestSH; include Webgen::SourceHandler::Base; end
|
11
|
+
|
12
|
+
CONTENT=<<EOF
|
13
|
+
**/*:
|
14
|
+
title: new title
|
15
|
+
before: valbef
|
16
|
+
---
|
17
|
+
**/*/:
|
18
|
+
after: valaft
|
19
|
+
EOF
|
20
|
+
|
21
|
+
def setup
|
22
|
+
super
|
23
|
+
@website.blackboard.add_service(:source_paths) do
|
24
|
+
{'/default.css' => path_with_meta_info('/default.css') {StringIO.new('# header')}}
|
25
|
+
end
|
26
|
+
|
27
|
+
@obj = Webgen::SourceHandler::Metainfo.new
|
28
|
+
@root = Webgen::Node.new(Webgen::Tree.new.dummy_root, 'test/', '/')
|
29
|
+
@node = @obj.create_node(@root, path_with_meta_info('/metainfo', {}, @obj.class.name) {StringIO.new(CONTENT)})
|
30
|
+
end
|
31
|
+
|
32
|
+
def test_create_node
|
33
|
+
assert_equal({'/**/*' => {'title' => 'new title', 'before' => 'valbef'}}, @node.node_info[:mi_paths])
|
34
|
+
assert_equal({'/**/*' => {'after' => 'valaft'}}, @node.node_info[:mi_alcn])
|
35
|
+
end
|
36
|
+
|
37
|
+
def test_meta_info_changed
|
38
|
+
other = TestSH.new.create_node(@root, path_with_meta_info('/default.css'))
|
39
|
+
assert(@obj.send(:meta_info_changed?, @node, other))
|
40
|
+
@website.cache.old_data.update(@website.cache.new_data)
|
41
|
+
assert(!@obj.send(:meta_info_changed?, @node, other))
|
42
|
+
end
|
43
|
+
|
44
|
+
def test_mark_all_matched_dirty
|
45
|
+
other = TestSH.new.create_node(@root, path_with_meta_info('/default.css'))
|
46
|
+
other.dirty_meta_info = false
|
47
|
+
@obj.send(:mark_all_matched_dirty, @node)
|
48
|
+
assert(other.dirty_meta_info)
|
49
|
+
end
|
50
|
+
|
51
|
+
def test_before_node_created
|
52
|
+
path = path_with_meta_info('/default.css')
|
53
|
+
@website.blackboard.dispatch_msg(:before_node_created, @root, path)
|
54
|
+
assert('valbef', path.meta_info['before'])
|
55
|
+
end
|
56
|
+
|
57
|
+
def test_after_node_created
|
58
|
+
other = TestSH.new.create_node(@root, path_with_meta_info('/default.css'))
|
59
|
+
@website.blackboard.dispatch_msg(:after_node_created, @node)
|
60
|
+
assert('valaft', other['after'])
|
61
|
+
end
|
62
|
+
|
63
|
+
def test_before_node_deleted
|
64
|
+
other = TestSH.new.create_node(@root, path_with_meta_info('/default.css'))
|
65
|
+
other.dirty_meta_info = false
|
66
|
+
|
67
|
+
@website.blackboard.del_service(:source_paths)
|
68
|
+
@website.blackboard.add_service(:source_paths) { {'/metainfo' => ''} }
|
69
|
+
@website.blackboard.dispatch_msg(:before_node_deleted, @node)
|
70
|
+
assert(!other.dirty_meta_info)
|
71
|
+
|
72
|
+
@website.blackboard.del_service(:source_paths)
|
73
|
+
@website.blackboard.add_service(:source_paths) { {} }
|
74
|
+
@website.blackboard.dispatch_msg(:before_node_deleted, @node)
|
75
|
+
assert(other.dirty_meta_info)
|
76
|
+
end
|
77
|
+
|
78
|
+
def test_node_meta_info_changed
|
79
|
+
@node.dirty_meta_info = false
|
80
|
+
@website.blackboard.dispatch_msg(:node_meta_info_changed?, @node)
|
81
|
+
assert(!@node.dirty_meta_info)
|
82
|
+
|
83
|
+
other = TestSH.new.create_node(@root, path_with_meta_info('/default.css'))
|
84
|
+
other.dirty_meta_info = false
|
85
|
+
@website.blackboard.dispatch_msg(:node_meta_info_changed?, other)
|
86
|
+
assert(other.dirty_meta_info)
|
87
|
+
end
|
88
|
+
|
89
|
+
def test_content
|
90
|
+
assert_nil(@obj.content(nil))
|
91
|
+
end
|
92
|
+
|
93
|
+
end
|