webgen 0.5.5 → 0.5.6
Sign up to get free protection for your applications and to get access to all the features.
- data/ChangeLog +3662 -0
- data/Rakefile +8 -1
- data/VERSION +1 -1
- data/data/webgen/website_styles/1024px/src/default.template +1 -1
- data/data/webgen/website_styles/andreas00/src/default.template +1 -1
- data/data/webgen/website_styles/andreas01/src/default.template +2 -1
- data/data/webgen/website_styles/andreas03/src/default.template +1 -1
- data/data/webgen/website_styles/andreas04/src/default.template +1 -1
- data/data/webgen/website_styles/andreas05/src/default.template +1 -1
- data/data/webgen/website_styles/andreas06/src/default.template +1 -1
- data/data/webgen/website_styles/andreas07/src/default.template +1 -1
- data/data/webgen/website_styles/andreas08/src/default.template +1 -1
- data/data/webgen/website_styles/andreas09/src/default.template +1 -1
- data/data/webgen/website_styles/simple/src/default.template +1 -1
- data/doc/contentprocessor/fragments.page +25 -0
- data/doc/extensions.page +1 -1
- data/doc/manual.page +33 -15
- data/doc/reference_configuration.page +339 -62
- data/doc/reference_metainfo.page +11 -2
- data/doc/sourcehandler/feed.page +19 -4
- data/doc/sourcehandler/page.page +0 -16
- data/doc/tag/langbar.page +8 -1
- data/doc/tag/link.page +44 -0
- data/doc/tag/tikz.page +158 -0
- data/lib/webgen/cli.rb +4 -4
- data/lib/webgen/common/sitemap.rb +2 -3
- data/lib/webgen/configuration.rb +3 -1
- data/lib/webgen/contentprocessor.rb +1 -0
- data/lib/webgen/contentprocessor/blocks.rb +0 -2
- data/lib/webgen/contentprocessor/context.rb +0 -3
- data/lib/webgen/contentprocessor/erubis.rb +0 -2
- data/lib/webgen/contentprocessor/fragments.rb +23 -0
- data/lib/webgen/default_config.rb +15 -2
- data/lib/webgen/languages.rb +9 -0
- data/lib/webgen/logger.rb +18 -1
- data/lib/webgen/node.rb +50 -25
- data/lib/webgen/page.rb +26 -16
- data/lib/webgen/path.rb +20 -10
- data/lib/webgen/sourcehandler.rb +85 -69
- data/lib/webgen/sourcehandler/base.rb +38 -15
- data/lib/webgen/sourcehandler/copy.rb +2 -2
- data/lib/webgen/sourcehandler/directory.rb +16 -13
- data/lib/webgen/sourcehandler/feed.rb +6 -12
- data/lib/webgen/sourcehandler/fragment.rb +6 -11
- data/lib/webgen/sourcehandler/memory.rb +41 -0
- data/lib/webgen/sourcehandler/metainfo.rb +21 -21
- data/lib/webgen/sourcehandler/page.rb +7 -27
- data/lib/webgen/sourcehandler/sitemap.rb +0 -2
- data/lib/webgen/sourcehandler/template.rb +0 -4
- data/lib/webgen/sourcehandler/virtual.rb +18 -18
- data/lib/webgen/tag.rb +2 -0
- data/lib/webgen/tag/breadcrumbtrail.rb +1 -4
- data/lib/webgen/tag/coderay.rb +0 -3
- data/lib/webgen/tag/date.rb +0 -2
- data/lib/webgen/tag/executecommand.rb +1 -2
- data/lib/webgen/tag/includefile.rb +1 -3
- data/lib/webgen/tag/langbar.rb +2 -5
- data/lib/webgen/tag/link.rb +23 -0
- data/lib/webgen/tag/menu.rb +1 -4
- data/lib/webgen/tag/metainfo.rb +0 -2
- data/lib/webgen/tag/relocatable.rb +2 -3
- data/lib/webgen/tag/sitemap.rb +0 -3
- data/lib/webgen/tag/tikz.rb +117 -0
- data/lib/webgen/tree.rb +11 -6
- data/lib/webgen/version.rb +1 -1
- data/lib/webgen/website.rb +2 -1
- data/test/test_cli.rb +14 -0
- data/test/test_common_sitemap.rb +4 -4
- data/test/test_contentprocessor_context.rb +1 -1
- data/test/test_contentprocessor_fragments.rb +40 -0
- data/test/test_contentprocessor_redcloth.rb +1 -0
- data/test/test_contentprocessor_tags.rb +1 -1
- data/test/test_languages.rb +12 -0
- data/test/test_logger.rb +19 -0
- data/test/test_node.rb +35 -15
- data/test/test_output_filesystem.rb +1 -1
- data/test/test_page.rb +15 -6
- data/test/test_path.rb +37 -5
- data/test/test_source_filesystem.rb +1 -1
- data/test/test_source_stacked.rb +1 -1
- data/test/test_sourcehandler_base.rb +30 -1
- data/test/test_sourcehandler_copy.rb +1 -1
- data/test/test_sourcehandler_directory.rb +16 -1
- data/test/test_sourcehandler_feed.rb +9 -8
- data/test/test_sourcehandler_fragment.rb +1 -1
- data/test/test_sourcehandler_memory.rb +42 -0
- data/test/test_sourcehandler_metainfo.rb +23 -21
- data/test/test_sourcehandler_page.rb +5 -12
- data/test/test_sourcehandler_template.rb +1 -1
- data/test/test_sourcehandler_virtual.rb +2 -2
- data/test/test_tag_base.rb +0 -1
- data/test/test_tag_breadcrumbtrail.rb +4 -4
- data/test/test_tag_includefile.rb +3 -3
- data/test/test_tag_langbar.rb +12 -7
- data/test/test_tag_link.rb +61 -0
- data/test/test_tag_menu.rb +7 -7
- data/test/test_tag_metainfo.rb +1 -1
- data/test/test_tag_relocatable.rb +1 -1
- data/test/test_tag_tikz.rb +66 -0
- data/test/test_tree.rb +8 -9
- metadata +15 -2
@@ -1,7 +1,5 @@
|
|
1
1
|
require 'uri'
|
2
2
|
require 'yaml'
|
3
|
-
require 'webgen/sourcehandler/base'
|
4
|
-
require 'webgen/websiteaccess'
|
5
3
|
|
6
4
|
module Webgen::SourceHandler
|
7
5
|
|
@@ -18,22 +16,25 @@ module Webgen::SourceHandler
|
|
18
16
|
def create_node(parent, path)
|
19
17
|
page = page_from_path(path)
|
20
18
|
nodes = []
|
21
|
-
YAML::load(page.blocks['content'].content).each do |key,
|
19
|
+
YAML::load(page.blocks['content'].content).each do |key, meta_info|
|
22
20
|
key = (key =~ /^\// ? key : File.join(parent.absolute_lcn, key))
|
23
21
|
temp_parent = create_directories(parent.tree.root, File.dirname(key), path)
|
24
22
|
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
output_path = temp_path.meta_info.delete('url') || key
|
23
|
+
meta_info ||= {}
|
24
|
+
meta_info['modified_at'] = path.meta_info['modified_at']
|
25
|
+
meta_info['no_output'] = true
|
26
|
+
output_path = meta_info.delete('url') || key
|
30
27
|
output_path = (URI::parse(output_path).absolute? || output_path =~ /^\// ?
|
31
28
|
output_path : File.join(temp_parent.absolute_lcn, output_path))
|
32
29
|
|
33
30
|
if key =~ /\/$/
|
34
|
-
nodes << create_directory(temp_parent, key, path,
|
31
|
+
nodes << create_directory(temp_parent, key, path, meta_info)
|
35
32
|
else
|
36
|
-
nodes
|
33
|
+
nodes += website.blackboard.invoke(:create_nodes, parent.tree, temp_parent.absolute_lcn,
|
34
|
+
Webgen::Path.new(key, path.source_path), self) do |cn_parent, cn_path|
|
35
|
+
cn_path.meta_info.update(meta_info)
|
36
|
+
super(cn_parent, cn_path, output_path)
|
37
|
+
end
|
37
38
|
end
|
38
39
|
end if page.blocks.has_key?('content')
|
39
40
|
nodes.compact
|
@@ -55,17 +56,16 @@ module Webgen::SourceHandler
|
|
55
56
|
def create_directory(parent, dir, path, meta_info = nil)
|
56
57
|
dir_handler = website.cache.instance('Webgen::SourceHandler::Directory')
|
57
58
|
website.blackboard.invoke(:create_nodes, parent.tree, parent.absolute_lcn,
|
58
|
-
Webgen::Path.new(File.join(dir, '/')),
|
59
|
+
Webgen::Path.new(File.join(dir, '/'), path.source_path),
|
59
60
|
dir_handler) do |par, temp_path|
|
60
|
-
|
61
|
-
if (
|
62
|
-
|
63
|
-
else
|
61
|
+
parent = dir_handler.node_exists?(par, temp_path)
|
62
|
+
if (parent && (parent.node_info[:src] == path.source_path) && !meta_info.nil?) ||
|
63
|
+
!parent
|
64
64
|
temp_path.meta_info.update(meta_info) if meta_info
|
65
|
-
parent
|
66
|
-
parent
|
65
|
+
parent.flag(:reinit) if parent
|
66
|
+
parent = dir_handler.create_node(par, temp_path)
|
67
67
|
end
|
68
|
-
|
68
|
+
parent
|
69
69
|
end
|
70
70
|
parent
|
71
71
|
end
|
data/lib/webgen/tag.rb
CHANGED
@@ -1,6 +1,3 @@
|
|
1
|
-
require 'webgen/websiteaccess'
|
2
|
-
require 'webgen/tag'
|
3
|
-
|
4
1
|
module Webgen::Tag
|
5
2
|
|
6
3
|
# Generates a breadcrumb trail for the page. This is especially useful when pages are in deep
|
@@ -60,7 +57,7 @@ module Webgen::Tag
|
|
60
57
|
|
61
58
|
if (list.map {|n| n.absolute_lcn} != cached_list) ||
|
62
59
|
list.any? {|n| (r = n.routing_node(cn.lang)) && r != node && r.meta_info_changed?}
|
63
|
-
node.dirty
|
60
|
+
node.flag(:dirty)
|
64
61
|
break
|
65
62
|
end
|
66
63
|
end
|
data/lib/webgen/tag/coderay.rb
CHANGED
data/lib/webgen/tag/date.rb
CHANGED
@@ -1,5 +1,3 @@
|
|
1
|
-
require 'webgen/websiteaccess'
|
2
|
-
require 'webgen/tag'
|
3
1
|
require 'cgi'
|
4
2
|
|
5
3
|
module Webgen::Tag
|
@@ -33,7 +31,7 @@ module Webgen::Tag
|
|
33
31
|
|
34
32
|
def node_changed?(node)
|
35
33
|
if filenames = node.node_info[:tag_includefile_filenames]
|
36
|
-
node.dirty
|
34
|
+
node.flag(:dirty) if filenames.any? {|f, mtime| File.mtime(f) > mtime}
|
37
35
|
end
|
38
36
|
end
|
39
37
|
|
data/lib/webgen/tag/langbar.rb
CHANGED
@@ -1,6 +1,3 @@
|
|
1
|
-
require 'webgen/tag'
|
2
|
-
require 'webgen/websiteaccess'
|
3
|
-
|
4
1
|
module Webgen::Tag
|
5
2
|
|
6
3
|
# Generates a list with all the languages of the page.
|
@@ -20,7 +17,7 @@ module Webgen::Tag
|
|
20
17
|
result = lang_nodes.
|
21
18
|
reject {|n| (context.content_node.lang == n.lang && !param('tag.langbar.show_own_lang'))}.
|
22
19
|
sort {|a, b| a.lang <=> b.lang}.
|
23
|
-
collect {|n| context.dest_node.link_to(n, :link_text => n.lang, :lang => n.lang)}.
|
20
|
+
collect {|n| context.dest_node.link_to(n, :link_text => (param('tag.langbar.lang_names')[n.lang] || n.lang), :lang => n.lang)}.
|
24
21
|
join(param('tag.langbar.separator'))
|
25
22
|
(param('tag.langbar.show_single_lang') || lang_nodes.length > 1 ? result : "")
|
26
23
|
end
|
@@ -41,7 +38,7 @@ module Webgen::Tag
|
|
41
38
|
lang_nodes = all_lang_nodes(node.tree[acn, :acn]) rescue nil
|
42
39
|
if !lang_nodes || lang_nodes.length != clang_nodes.length ||
|
43
40
|
lang_nodes.any? {|n| n.meta_info_changed?}
|
44
|
-
node.dirty
|
41
|
+
node.flag(:dirty)
|
45
42
|
break
|
46
43
|
end
|
47
44
|
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
module Webgen::Tag
|
2
|
+
|
3
|
+
# Create a link to a given (A)LCN.
|
4
|
+
class Link
|
5
|
+
|
6
|
+
include Webgen::Tag::Base
|
7
|
+
|
8
|
+
# Return a HTML link to the given (A)LCN.
|
9
|
+
def call(tag, body, context)
|
10
|
+
if (dest_node = context.ref_node.resolve(param('tag.link.path'), context.dest_node.lang))
|
11
|
+
context.dest_node.link_to(dest_node, param('tag.link.attr').merge(:lang => context.content_node.lang))
|
12
|
+
else
|
13
|
+
raise ArgumentError, 'Resolving of path failed'
|
14
|
+
end
|
15
|
+
rescue ArgumentError, URI::InvalidURIError => e
|
16
|
+
log(:error) { "Could not link to path '#{param('tag.link.path')}' in <#{context.ref_node.absolute_lcn}>: #{e.message}" }
|
17
|
+
context.dest_node.flag(:dirty)
|
18
|
+
''
|
19
|
+
end
|
20
|
+
|
21
|
+
end
|
22
|
+
|
23
|
+
end
|
data/lib/webgen/tag/menu.rb
CHANGED
@@ -1,6 +1,3 @@
|
|
1
|
-
require 'webgen/websiteaccess'
|
2
|
-
require 'webgen/tag'
|
3
|
-
|
4
1
|
module Webgen::Tag
|
5
2
|
|
6
3
|
# Generates a menu that can be configured extensively.
|
@@ -90,7 +87,7 @@ module Webgen::Tag
|
|
90
87
|
(tree_list && tree_list.flatten.any? do |alcn|
|
91
88
|
(n = node.tree[alcn]) && (r = n.routing_node(cn.lang)) && r != node && r.meta_info_changed?
|
92
89
|
end)
|
93
|
-
node.dirty
|
90
|
+
node.flag(:dirty)
|
94
91
|
break
|
95
92
|
end
|
96
93
|
end
|
data/lib/webgen/tag/metainfo.rb
CHANGED
@@ -1,4 +1,3 @@
|
|
1
|
-
require 'webgen/tag'
|
2
1
|
require 'uri'
|
3
2
|
|
4
3
|
module Webgen::Tag
|
@@ -27,11 +26,11 @@ module Webgen::Tag
|
|
27
26
|
end
|
28
27
|
if result.empty?
|
29
28
|
log(:error) { "Could not resolve path '#{uri_string}' in <#{context.ref_node.absolute_lcn}>" }
|
30
|
-
context.dest_node.dirty
|
29
|
+
context.dest_node.flag(:dirty)
|
31
30
|
end
|
32
31
|
rescue URI::InvalidURIError => e
|
33
32
|
log(:error) { "Error while parsing path for tag relocatable in <#{context.ref_node.absolute_lcn}>: #{e.message}" }
|
34
|
-
context.dest_node.dirty
|
33
|
+
context.dest_node.flag(:dirty)
|
35
34
|
end
|
36
35
|
end
|
37
36
|
result
|
data/lib/webgen/tag/sitemap.rb
CHANGED
@@ -0,0 +1,117 @@
|
|
1
|
+
require 'erb'
|
2
|
+
require 'tempfile'
|
3
|
+
require 'fileutils'
|
4
|
+
|
5
|
+
module Webgen::Tag
|
6
|
+
|
7
|
+
# This tag allows the creation and inclusion of complex graphics using the PGF/TikZ library of
|
8
|
+
# LaTeX. You will need a current LaTeX distribution and the +convert+ utility from ImageMagick.
|
9
|
+
class TikZ
|
10
|
+
|
11
|
+
include Webgen::Tag::Base
|
12
|
+
include Webgen::WebsiteAccess
|
13
|
+
|
14
|
+
LATEX_TEMPLATE = <<EOF
|
15
|
+
\\nonstopmode \\documentclass{article} \\usepackage{tikz} \\pagestyle{empty}
|
16
|
+
<% if param('tag.tikz.libraries') %>
|
17
|
+
\\usetikzlibrary{<%= param('tag.tikz.libraries').join(',') %>}
|
18
|
+
<% end %>
|
19
|
+
\\begin{document}
|
20
|
+
<% if param('tag.tikz.opts') %>
|
21
|
+
\\begin{tikzpicture}[<%= param('tag.tikz.opts') %>]
|
22
|
+
<% else %>
|
23
|
+
\\begin{tikzpicture}
|
24
|
+
<% end %>
|
25
|
+
<%= body %>
|
26
|
+
\\end{tikzpicture}
|
27
|
+
\\end{document}
|
28
|
+
EOF
|
29
|
+
|
30
|
+
# Create a graphic from the commands in the body of the tag.
|
31
|
+
def call(tag, body, context)
|
32
|
+
path = param('tag.tikz.path')
|
33
|
+
path = Pathname.new(path =~ /^\// ? path : File.join(context.ref_node.parent.absolute_lcn, path)).cleanpath.to_s
|
34
|
+
|
35
|
+
mem_handler = website.cache.instance('Webgen::SourceHandler::Memory')
|
36
|
+
src_path = context.ref_node.node_info[:src]
|
37
|
+
parent = website.blackboard.invoke(:create_directories, context.ref_node.tree.root, File.dirname(path), src_path)
|
38
|
+
params = @params
|
39
|
+
|
40
|
+
node = website.blackboard.invoke(:create_nodes, parent.tree, parent.absolute_lcn,
|
41
|
+
Webgen::Path.new(path, src_path), mem_handler) do |node_parent, node_path|
|
42
|
+
mem_handler.create_node(node_parent, node_path, context.ref_node.absolute_lcn) do |pic_node|
|
43
|
+
set_params(params)
|
44
|
+
document = ERB.new(LATEX_TEMPLATE).result(binding)
|
45
|
+
pic_path = compile(document, File.extname(path), context)
|
46
|
+
set_params(nil)
|
47
|
+
if pic_path
|
48
|
+
io = Webgen::Path::SourceIO.new { File.open(pic_path, 'rb') }
|
49
|
+
else
|
50
|
+
pic_node.flag(:dirty)
|
51
|
+
nil
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end.first
|
55
|
+
attrs = param('tag.tikz.img_attr').collect {|name,value| "#{name.to_s}=\"#{value}\"" }.sort.unshift('').join(' ')
|
56
|
+
"<img src=\"#{context.dest_node.route_to(node)}\"#{attrs} />"
|
57
|
+
end
|
58
|
+
|
59
|
+
#######
|
60
|
+
private
|
61
|
+
#######
|
62
|
+
|
63
|
+
# Compile the LaTeX +document+ and convert the resulting PDF to the correct output image format
|
64
|
+
# specified by +ext+ (the extension needs to include the dot).
|
65
|
+
def compile(document, ext, context)
|
66
|
+
file = Tempfile.new('webgen-tikz')
|
67
|
+
file.write(document)
|
68
|
+
file.close
|
69
|
+
|
70
|
+
FileUtils.mv(file.path, file.path + '.tex')
|
71
|
+
cmd_prefix = "cd #{File.dirname(file.path)}; "
|
72
|
+
output = `#{cmd_prefix} pdflatex --shell-escape -interaction=batchmode #{File.basename(file.path)}.tex`
|
73
|
+
if $?.exitstatus != 0
|
74
|
+
errors = output.scan(/^!(.*\n.*)/).join("\n")
|
75
|
+
log(:error) { "There was an error creating a TikZ picture in <#{context.ref_node.absolute_lcn}>: #{errors}"}
|
76
|
+
context.dest_node.flag(:dirty)
|
77
|
+
nil
|
78
|
+
else
|
79
|
+
cmd = cmd_prefix + "pdfcrop #{File.basename(file.path)}.pdf #{File.basename(file.path)}.pdf; "
|
80
|
+
return unless run_command(cmd, context)
|
81
|
+
|
82
|
+
render_res, output_res = param('tag.tikz.resolution').split(' ')
|
83
|
+
if param('tag.tikz.transparent') && ext =~ /\.png/i
|
84
|
+
cmd = cmd_prefix +
|
85
|
+
"gs -dSAFER -dBATCH -dNOPAUSE -r#{render_res} -sDEVICE=pngalpha -dGraphicsAlphaBits=4 -dTextAlphaBits=4 " +
|
86
|
+
"-sOutputFile=#{File.basename(file.path)}#{ext} #{File.basename(file.path)}.pdf"
|
87
|
+
else
|
88
|
+
cmd = cmd_prefix + "convert -density #{render_res} #{File.basename(file.path)}.pdf #{File.basename(file.path)}#{ext}"
|
89
|
+
end
|
90
|
+
return unless run_command(cmd, context)
|
91
|
+
|
92
|
+
if render_res != output_res
|
93
|
+
cmd = cmd_prefix + "identify #{File.basename(file.path)}#{ext}"
|
94
|
+
return unless (output = run_command(cmd, context))
|
95
|
+
width, height = output.scan(/\s\d+x\d+\s/).first.strip.split('x').collect {|s| s.to_f * output_res.to_f / render_res.to_f }
|
96
|
+
cmd = cmd_prefix + "convert -resize #{width}x#{height} #{File.basename(file.path)}#{ext} #{File.basename(file.path)}#{ext}"
|
97
|
+
return unless run_command(cmd, context)
|
98
|
+
end
|
99
|
+
file.path + ext
|
100
|
+
end
|
101
|
+
end
|
102
|
+
|
103
|
+
# Runs the command +cmd+ and returns it's output if successful or +nil+ otherwise.
|
104
|
+
def run_command(cmd, context)
|
105
|
+
output = `#{cmd}`
|
106
|
+
if $?.exitstatus != 0
|
107
|
+
log(:error) { "There was an error running a command for a TikZ picture in <#{context.ref_node.absolute_lcn}>: #{output}"}
|
108
|
+
context.dest_node.flag(:dirty)
|
109
|
+
nil
|
110
|
+
else
|
111
|
+
output
|
112
|
+
end
|
113
|
+
end
|
114
|
+
|
115
|
+
end
|
116
|
+
|
117
|
+
end
|
data/lib/webgen/tree.rb
CHANGED
@@ -51,20 +51,25 @@ module Webgen
|
|
51
51
|
@node_access[:alcn][node.absolute_lcn] = node
|
52
52
|
end
|
53
53
|
(@node_access[:acn][node.absolute_cn] ||= []) << node
|
54
|
+
register_path(node)
|
55
|
+
end
|
56
|
+
|
57
|
+
# A utility method called by Node#reinit. This method should not be used directly!
|
58
|
+
def register_path(node)
|
59
|
+
return if node['no_output']
|
54
60
|
if @node_access[:path].has_key?(node.path)
|
55
|
-
raise "Can't have two nodes with same output path: #{node.path}"
|
61
|
+
raise "Can't have two nodes with same output path: #{node.path}"
|
56
62
|
else
|
57
63
|
@node_access[:path][node.path] = node
|
58
64
|
end
|
59
65
|
end
|
60
66
|
|
61
|
-
# Delete the node identified by +node_or_alcn+ and all of its children from the
|
62
|
-
|
63
|
-
def delete_node(node_or_alcn, delete_dir = false)
|
67
|
+
# Delete the node identified by +node_or_alcn+ and all of its children from the tree.
|
68
|
+
def delete_node(node_or_alcn)
|
64
69
|
n = node_or_alcn.kind_of?(Node) ? node_or_alcn : @node_access[:alcn][node_or_alcn]
|
65
|
-
return if n.nil? || n == @dummy_root
|
70
|
+
return if n.nil? || n == @dummy_root
|
66
71
|
|
67
|
-
n.children.dup.each {|child| delete_node(child
|
72
|
+
n.children.dup.each {|child| delete_node(child)}
|
68
73
|
|
69
74
|
website.blackboard.dispatch_msg(:before_node_deleted, n)
|
70
75
|
n.parent.children.delete(n)
|
data/lib/webgen/version.rb
CHANGED
data/lib/webgen/website.rb
CHANGED
@@ -2,6 +2,7 @@
|
|
2
2
|
require 'logger'
|
3
3
|
require 'set'
|
4
4
|
require 'fileutils'
|
5
|
+
require 'facets/symbol/to_proc'
|
5
6
|
|
6
7
|
# Requirements for Website
|
7
8
|
require 'webgen/coreext'
|
@@ -197,7 +198,7 @@ module Webgen
|
|
197
198
|
raise 'Structure of config file is not valid, has to be a Hash' if !config.kind_of?(Hash)
|
198
199
|
config.each do |key, value|
|
199
200
|
case key
|
200
|
-
when *Webgen::Configuration::Helpers.public_instance_methods(false) then @config.send(key, value)
|
201
|
+
when *Webgen::Configuration::Helpers.public_instance_methods(false).map(&:to_s) then @config.send(key, value)
|
201
202
|
else @config[key] = value
|
202
203
|
end
|
203
204
|
end
|
data/test/test_cli.rb
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
require 'test/unit'
|
2
|
+
require 'webgen/cli'
|
3
|
+
|
4
|
+
class TestCLICommandParser < Test::Unit::TestCase
|
5
|
+
|
6
|
+
def test_initialize
|
7
|
+
cli = Webgen::CLI::CommandParser.new
|
8
|
+
assert_equal('render', cli.main_command.default_command)
|
9
|
+
assert_equal(:normal, cli.verbosity)
|
10
|
+
assert_equal(Logger::WARN, cli.log_level)
|
11
|
+
assert_equal(Dir.pwd, cli.directory)
|
12
|
+
end
|
13
|
+
|
14
|
+
end
|
data/test/test_common_sitemap.rb
CHANGED
@@ -44,13 +44,13 @@ class TestCommonSitemap < Test::Unit::TestCase
|
|
44
44
|
do_assert(@nodes[:file1_de], 'de', false, true, ['page'],
|
45
45
|
[:dir1, :file11_en, :file1_de, :index_en])
|
46
46
|
|
47
|
-
@nodes[:file11_en].dirty
|
47
|
+
@nodes[:file11_en].unflag(:dirty)
|
48
48
|
@website.blackboard.dispatch_msg(:node_changed?, @nodes[:file11_en])
|
49
|
-
assert(!@nodes[:file11_en].dirty)
|
49
|
+
assert(!@nodes[:file11_en].flagged(:dirty))
|
50
50
|
|
51
|
-
@nodes[:file11_en].dirty_meta_info
|
51
|
+
@nodes[:file11_en].flag(:dirty_meta_info)
|
52
52
|
@website.blackboard.dispatch_msg(:node_changed?, @nodes[:file11_en])
|
53
|
-
assert(@nodes[:file11_en].dirty)
|
53
|
+
assert(@nodes[:file11_en].flagged(:dirty))
|
54
54
|
end
|
55
55
|
|
56
56
|
end
|