webgen 0.5.5 → 0.5.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (101) hide show
  1. data/ChangeLog +3662 -0
  2. data/Rakefile +8 -1
  3. data/VERSION +1 -1
  4. data/data/webgen/website_styles/1024px/src/default.template +1 -1
  5. data/data/webgen/website_styles/andreas00/src/default.template +1 -1
  6. data/data/webgen/website_styles/andreas01/src/default.template +2 -1
  7. data/data/webgen/website_styles/andreas03/src/default.template +1 -1
  8. data/data/webgen/website_styles/andreas04/src/default.template +1 -1
  9. data/data/webgen/website_styles/andreas05/src/default.template +1 -1
  10. data/data/webgen/website_styles/andreas06/src/default.template +1 -1
  11. data/data/webgen/website_styles/andreas07/src/default.template +1 -1
  12. data/data/webgen/website_styles/andreas08/src/default.template +1 -1
  13. data/data/webgen/website_styles/andreas09/src/default.template +1 -1
  14. data/data/webgen/website_styles/simple/src/default.template +1 -1
  15. data/doc/contentprocessor/fragments.page +25 -0
  16. data/doc/extensions.page +1 -1
  17. data/doc/manual.page +33 -15
  18. data/doc/reference_configuration.page +339 -62
  19. data/doc/reference_metainfo.page +11 -2
  20. data/doc/sourcehandler/feed.page +19 -4
  21. data/doc/sourcehandler/page.page +0 -16
  22. data/doc/tag/langbar.page +8 -1
  23. data/doc/tag/link.page +44 -0
  24. data/doc/tag/tikz.page +158 -0
  25. data/lib/webgen/cli.rb +4 -4
  26. data/lib/webgen/common/sitemap.rb +2 -3
  27. data/lib/webgen/configuration.rb +3 -1
  28. data/lib/webgen/contentprocessor.rb +1 -0
  29. data/lib/webgen/contentprocessor/blocks.rb +0 -2
  30. data/lib/webgen/contentprocessor/context.rb +0 -3
  31. data/lib/webgen/contentprocessor/erubis.rb +0 -2
  32. data/lib/webgen/contentprocessor/fragments.rb +23 -0
  33. data/lib/webgen/default_config.rb +15 -2
  34. data/lib/webgen/languages.rb +9 -0
  35. data/lib/webgen/logger.rb +18 -1
  36. data/lib/webgen/node.rb +50 -25
  37. data/lib/webgen/page.rb +26 -16
  38. data/lib/webgen/path.rb +20 -10
  39. data/lib/webgen/sourcehandler.rb +85 -69
  40. data/lib/webgen/sourcehandler/base.rb +38 -15
  41. data/lib/webgen/sourcehandler/copy.rb +2 -2
  42. data/lib/webgen/sourcehandler/directory.rb +16 -13
  43. data/lib/webgen/sourcehandler/feed.rb +6 -12
  44. data/lib/webgen/sourcehandler/fragment.rb +6 -11
  45. data/lib/webgen/sourcehandler/memory.rb +41 -0
  46. data/lib/webgen/sourcehandler/metainfo.rb +21 -21
  47. data/lib/webgen/sourcehandler/page.rb +7 -27
  48. data/lib/webgen/sourcehandler/sitemap.rb +0 -2
  49. data/lib/webgen/sourcehandler/template.rb +0 -4
  50. data/lib/webgen/sourcehandler/virtual.rb +18 -18
  51. data/lib/webgen/tag.rb +2 -0
  52. data/lib/webgen/tag/breadcrumbtrail.rb +1 -4
  53. data/lib/webgen/tag/coderay.rb +0 -3
  54. data/lib/webgen/tag/date.rb +0 -2
  55. data/lib/webgen/tag/executecommand.rb +1 -2
  56. data/lib/webgen/tag/includefile.rb +1 -3
  57. data/lib/webgen/tag/langbar.rb +2 -5
  58. data/lib/webgen/tag/link.rb +23 -0
  59. data/lib/webgen/tag/menu.rb +1 -4
  60. data/lib/webgen/tag/metainfo.rb +0 -2
  61. data/lib/webgen/tag/relocatable.rb +2 -3
  62. data/lib/webgen/tag/sitemap.rb +0 -3
  63. data/lib/webgen/tag/tikz.rb +117 -0
  64. data/lib/webgen/tree.rb +11 -6
  65. data/lib/webgen/version.rb +1 -1
  66. data/lib/webgen/website.rb +2 -1
  67. data/test/test_cli.rb +14 -0
  68. data/test/test_common_sitemap.rb +4 -4
  69. data/test/test_contentprocessor_context.rb +1 -1
  70. data/test/test_contentprocessor_fragments.rb +40 -0
  71. data/test/test_contentprocessor_redcloth.rb +1 -0
  72. data/test/test_contentprocessor_tags.rb +1 -1
  73. data/test/test_languages.rb +12 -0
  74. data/test/test_logger.rb +19 -0
  75. data/test/test_node.rb +35 -15
  76. data/test/test_output_filesystem.rb +1 -1
  77. data/test/test_page.rb +15 -6
  78. data/test/test_path.rb +37 -5
  79. data/test/test_source_filesystem.rb +1 -1
  80. data/test/test_source_stacked.rb +1 -1
  81. data/test/test_sourcehandler_base.rb +30 -1
  82. data/test/test_sourcehandler_copy.rb +1 -1
  83. data/test/test_sourcehandler_directory.rb +16 -1
  84. data/test/test_sourcehandler_feed.rb +9 -8
  85. data/test/test_sourcehandler_fragment.rb +1 -1
  86. data/test/test_sourcehandler_memory.rb +42 -0
  87. data/test/test_sourcehandler_metainfo.rb +23 -21
  88. data/test/test_sourcehandler_page.rb +5 -12
  89. data/test/test_sourcehandler_template.rb +1 -1
  90. data/test/test_sourcehandler_virtual.rb +2 -2
  91. data/test/test_tag_base.rb +0 -1
  92. data/test/test_tag_breadcrumbtrail.rb +4 -4
  93. data/test/test_tag_includefile.rb +3 -3
  94. data/test/test_tag_langbar.rb +12 -7
  95. data/test/test_tag_link.rb +61 -0
  96. data/test/test_tag_menu.rb +7 -7
  97. data/test/test_tag_metainfo.rb +1 -1
  98. data/test/test_tag_relocatable.rb +1 -1
  99. data/test/test_tag_tikz.rb +66 -0
  100. data/test/test_tree.rb +8 -9
  101. 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, value|
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
- temp_path = Webgen::Path.new(key)
26
- temp_path.meta_info.update(value || {})
27
- temp_path.meta_info['modified_at'] = path.meta_info['modified_at']
28
- temp_path.meta_info['no_output'] = true
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, temp_path.meta_info)
31
+ nodes << create_directory(temp_parent, key, path, meta_info)
35
32
  else
36
- nodes << super(temp_parent, temp_path, output_path) {|n| n.node_info[:src] = path.path}
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
- node = nil
61
- if (node = dir_handler.node_exists?(par, temp_path)) && (!meta_info || node.node_info[:src] != path.path)
62
- parent, node = node, nil
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 = node = dir_handler.create_node(par, temp_path)
66
- parent.node_info[:src] = path.path
65
+ parent.flag(:reinit) if parent
66
+ parent = dir_handler.create_node(par, temp_path)
67
67
  end
68
- node
68
+ parent
69
69
  end
70
70
  parent
71
71
  end
@@ -17,6 +17,8 @@ module Webgen
17
17
  autoload :Coderay, 'webgen/tag/coderay'
18
18
  autoload :Date, 'webgen/tag/date'
19
19
  autoload :Sitemap, 'webgen/tag/sitemap'
20
+ autoload :TikZ, 'webgen/tag/tikz'
21
+ autoload :Link, 'webgen/tag/link'
20
22
 
21
23
  end
22
24
 
@@ -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 = true
60
+ node.flag(:dirty)
64
61
  break
65
62
  end
66
63
  end
@@ -1,6 +1,3 @@
1
- require 'webgen/websiteaccess'
2
- require 'webgen/tag'
3
-
4
1
  module Webgen::Tag
5
2
 
6
3
  # Provides syntax highlighting via the +coderay+ library.
@@ -1,5 +1,3 @@
1
- require 'webgen/tag'
2
-
3
1
  module Webgen::Tag
4
2
 
5
3
  # Prints out the date using a format string which will be passed to Time#strftime. Therefore you
@@ -1,6 +1,5 @@
1
- require 'webgen/tag'
2
1
  require 'cgi'
3
- require "tempfile"
2
+ require 'tempfile'
4
3
  require 'rbconfig'
5
4
 
6
5
  module Webgen::Tag
@@ -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 = true if filenames.any? {|f, mtime| File.mtime(f) > mtime}
34
+ node.flag(:dirty) if filenames.any? {|f, mtime| File.mtime(f) > mtime}
37
35
  end
38
36
  end
39
37
 
@@ -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 = true
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
@@ -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 = true
90
+ node.flag(:dirty)
94
91
  break
95
92
  end
96
93
  end
@@ -1,5 +1,3 @@
1
- require 'webgen/tag'
2
-
3
1
  module Webgen::Tag
4
2
 
5
3
  # Provides easy access to the meta information of a node.
@@ -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 = true
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 = true
33
+ context.dest_node.flag(:dirty)
35
34
  end
36
35
  end
37
36
  result
@@ -1,6 +1,3 @@
1
- require 'webgen/websiteaccess'
2
- require 'webgen/tag'
3
-
4
1
  module Webgen::Tag
5
2
 
6
3
  # Generates a sitemap. The sitemap contains the hierarchy of all pages on the web site.
@@ -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
@@ -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}" unless node['no_output']
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
- # tree. Directories are only deleted if +delete_dir+ is +true+.
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 || (n.is_directory? && !delete_dir)
70
+ return if n.nil? || n == @dummy_root
66
71
 
67
- n.children.dup.each {|child| delete_node(child, delete_dir)}
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)
@@ -1,6 +1,6 @@
1
1
  module Webgen
2
2
 
3
3
  # The version of webgen.
4
- VERSION = '0.5.5'
4
+ VERSION = '0.5.6'
5
5
 
6
6
  end
@@ -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
@@ -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
@@ -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 = false
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 = true
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
@@ -1,6 +1,6 @@
1
1
  require 'test/unit'
2
2
  require 'helper'
3
- require 'webgen/contentprocessor/context'
3
+ require 'webgen/contentprocessor'
4
4
 
5
5
  class TestContentProcessorContext < Test::Unit::TestCase
6
6