webgen 0.5.6 → 0.5.7

Sign up to get free protection for your applications and to get access to all the features.
Files changed (167) hide show
  1. data/AUTHORS +3 -0
  2. data/ChangeLog +426 -0
  3. data/THANKS +1 -0
  4. data/VERSION +1 -1
  5. data/bin/webgen +2 -0
  6. data/data/webgen/webgui/controller/main.rb +2 -0
  7. data/data/webgen/website_skeleton/ext/init.rb +4 -0
  8. data/doc/contentprocessor/blocks.page +44 -14
  9. data/doc/contentprocessor/builder.page +1 -1
  10. data/doc/contentprocessor/erb.page +1 -1
  11. data/doc/contentprocessor/erubis.page +1 -1
  12. data/doc/contentprocessor/fragments.page +1 -1
  13. data/doc/contentprocessor/haml.page +1 -1
  14. data/doc/contentprocessor/rdiscount.page +1 -1
  15. data/doc/contentprocessor/rdoc.page +1 -1
  16. data/doc/contentprocessor/redcloth.page +1 -1
  17. data/doc/contentprocessor/sass.page +1 -1
  18. data/doc/faq.page +7 -2
  19. data/doc/manual.page +6 -5
  20. data/doc/reference_metainfo.page +1 -1
  21. data/doc/sourcehandler/feed.page +9 -1
  22. data/doc/sourcehandler/sitemap.page +1 -1
  23. data/doc/tag/coderay.page +1 -1
  24. data/doc/tag/langbar.page +15 -0
  25. data/doc/tag/menu.page +1 -1
  26. data/doc/tag/relocatable.page +2 -2
  27. data/lib/webgen/blackboard.rb +9 -4
  28. data/lib/webgen/cache.rb +2 -0
  29. data/lib/webgen/cli.rb +6 -1
  30. data/lib/webgen/cli/create_command.rb +2 -0
  31. data/lib/webgen/cli/run_command.rb +2 -0
  32. data/lib/webgen/cli/utils.rb +2 -0
  33. data/lib/webgen/cli/webgui_command.rb +2 -0
  34. data/lib/webgen/common.rb +12 -1
  35. data/lib/webgen/common/sitemap.rb +12 -4
  36. data/lib/webgen/configuration.rb +2 -0
  37. data/lib/webgen/contentprocessor.rb +2 -0
  38. data/lib/webgen/contentprocessor/blocks.rb +22 -8
  39. data/lib/webgen/contentprocessor/builder.rb +2 -0
  40. data/lib/webgen/contentprocessor/context.rb +2 -0
  41. data/lib/webgen/contentprocessor/erb.rb +2 -0
  42. data/lib/webgen/contentprocessor/erubis.rb +2 -0
  43. data/lib/webgen/contentprocessor/fragments.rb +2 -0
  44. data/lib/webgen/contentprocessor/haml.rb +2 -0
  45. data/lib/webgen/contentprocessor/maruku.rb +2 -0
  46. data/lib/webgen/contentprocessor/rdiscount.rb +2 -0
  47. data/lib/webgen/contentprocessor/rdoc.rb +2 -0
  48. data/lib/webgen/contentprocessor/redcloth.rb +2 -0
  49. data/lib/webgen/contentprocessor/sass.rb +2 -0
  50. data/lib/webgen/contentprocessor/tags.rb +2 -0
  51. data/lib/webgen/coreext.rb +2 -0
  52. data/lib/webgen/default_config.rb +4 -1
  53. data/lib/webgen/languages.rb +2 -0
  54. data/lib/webgen/loggable.rb +2 -0
  55. data/lib/webgen/logger.rb +2 -0
  56. data/lib/webgen/node.rb +22 -8
  57. data/lib/webgen/output.rb +3 -1
  58. data/lib/webgen/output/filesystem.rb +2 -0
  59. data/lib/webgen/page.rb +2 -0
  60. data/lib/webgen/path.rb +3 -1
  61. data/lib/webgen/source.rb +2 -0
  62. data/lib/webgen/source/filesystem.rb +5 -2
  63. data/lib/webgen/source/resource.rb +2 -0
  64. data/lib/webgen/source/stacked.rb +2 -0
  65. data/lib/webgen/sourcehandler.rb +8 -0
  66. data/lib/webgen/sourcehandler/base.rb +2 -0
  67. data/lib/webgen/sourcehandler/copy.rb +2 -0
  68. data/lib/webgen/sourcehandler/directory.rb +2 -0
  69. data/lib/webgen/sourcehandler/feed.rb +3 -1
  70. data/lib/webgen/sourcehandler/fragment.rb +2 -0
  71. data/lib/webgen/sourcehandler/memory.rb +2 -0
  72. data/lib/webgen/sourcehandler/metainfo.rb +3 -1
  73. data/lib/webgen/sourcehandler/page.rb +2 -0
  74. data/lib/webgen/sourcehandler/sitemap.rb +2 -0
  75. data/lib/webgen/sourcehandler/template.rb +2 -0
  76. data/lib/webgen/sourcehandler/virtual.rb +3 -1
  77. data/lib/webgen/tag.rb +2 -0
  78. data/lib/webgen/tag/base.rb +2 -0
  79. data/lib/webgen/tag/breadcrumbtrail.rb +2 -0
  80. data/lib/webgen/tag/coderay.rb +2 -0
  81. data/lib/webgen/tag/date.rb +2 -0
  82. data/lib/webgen/tag/executecommand.rb +2 -0
  83. data/lib/webgen/tag/includefile.rb +2 -0
  84. data/lib/webgen/tag/langbar.rb +4 -1
  85. data/lib/webgen/tag/link.rb +2 -0
  86. data/lib/webgen/tag/menu.rb +2 -0
  87. data/lib/webgen/tag/metainfo.rb +2 -0
  88. data/lib/webgen/tag/relocatable.rb +2 -0
  89. data/lib/webgen/tag/sitemap.rb +2 -0
  90. data/lib/webgen/tag/tikz.rb +3 -1
  91. data/lib/webgen/tree.rb +5 -0
  92. data/lib/webgen/version.rb +3 -1
  93. data/lib/webgen/webgentask.rb +2 -0
  94. data/lib/webgen/website.rb +104 -3
  95. data/lib/webgen/websiteaccess.rb +2 -0
  96. data/lib/webgen/websitemanager.rb +2 -0
  97. data/man/man1/webgen.1 +6 -0
  98. data/misc/default.css +36 -12
  99. data/misc/default.template +1 -1
  100. data/misc/images/error.png +0 -0
  101. data/misc/images/important.png +0 -0
  102. data/misc/images/information.png +0 -0
  103. data/misc/images/warning.png +0 -0
  104. data/test/helper.rb +4 -0
  105. data/test/test_blackboard.rb +2 -0
  106. data/test/test_cache.rb +2 -0
  107. data/test/test_cli.rb +7 -0
  108. data/test/test_common.rb +18 -0
  109. data/test/test_common_sitemap.rb +7 -5
  110. data/test/test_configuration.rb +2 -0
  111. data/test/test_contentprocessor.rb +2 -0
  112. data/test/test_contentprocessor_blocks.rb +22 -1
  113. data/test/test_contentprocessor_builder.rb +2 -0
  114. data/test/test_contentprocessor_context.rb +2 -0
  115. data/test/test_contentprocessor_erb.rb +2 -0
  116. data/test/test_contentprocessor_erubis.rb +2 -0
  117. data/test/test_contentprocessor_fragments.rb +2 -0
  118. data/test/test_contentprocessor_haml.rb +2 -0
  119. data/test/test_contentprocessor_maruku.rb +2 -0
  120. data/test/test_contentprocessor_rdiscount.rb +2 -0
  121. data/test/test_contentprocessor_rdoc.rb +2 -0
  122. data/test/test_contentprocessor_redcloth.rb +2 -0
  123. data/test/test_contentprocessor_sass.rb +2 -0
  124. data/test/test_contentprocessor_tags.rb +2 -0
  125. data/test/test_languages.rb +2 -0
  126. data/test/test_loggable.rb +2 -0
  127. data/test/test_logger.rb +2 -0
  128. data/test/test_node.rb +2 -0
  129. data/test/test_output_filesystem.rb +2 -0
  130. data/test/test_page.rb +2 -0
  131. data/test/test_path.rb +2 -0
  132. data/test/test_source_filesystem.rb +17 -0
  133. data/test/test_source_resource.rb +2 -0
  134. data/test/test_source_stacked.rb +2 -0
  135. data/test/test_sourcehandler_base.rb +2 -0
  136. data/test/test_sourcehandler_copy.rb +2 -0
  137. data/test/test_sourcehandler_directory.rb +2 -0
  138. data/test/test_sourcehandler_feed.rb +2 -0
  139. data/test/test_sourcehandler_fragment.rb +2 -0
  140. data/test/test_sourcehandler_memory.rb +2 -0
  141. data/test/test_sourcehandler_metainfo.rb +2 -0
  142. data/test/test_sourcehandler_page.rb +2 -0
  143. data/test/test_sourcehandler_sitemap.rb +2 -0
  144. data/test/test_sourcehandler_template.rb +2 -0
  145. data/test/test_sourcehandler_virtual.rb +2 -0
  146. data/test/test_tag_base.rb +4 -0
  147. data/test/test_tag_breadcrumbtrail.rb +2 -0
  148. data/test/test_tag_coderay.rb +2 -0
  149. data/test/test_tag_date.rb +2 -0
  150. data/test/test_tag_executecommand.rb +2 -0
  151. data/test/test_tag_includefile.rb +2 -0
  152. data/test/test_tag_langbar.rb +13 -6
  153. data/test/test_tag_link.rb +2 -0
  154. data/test/test_tag_menu.rb +2 -0
  155. data/test/test_tag_metainfo.rb +2 -0
  156. data/test/test_tag_relocatable.rb +2 -0
  157. data/test/test_tag_sitemap.rb +4 -1
  158. data/test/test_tag_tikz.rb +4 -1
  159. data/test/test_tree.rb +2 -0
  160. data/test/test_webgentask.rb +2 -0
  161. data/test/test_website.rb +6 -4
  162. data/test/test_websiteaccess.rb +2 -0
  163. data/test/test_websitemanager.rb +2 -0
  164. metadata +8 -6
  165. data/misc/images/error.gif +0 -0
  166. data/misc/images/exclamation.gif +0 -0
  167. data/misc/images/information.gif +0 -0
@@ -1,3 +1,5 @@
1
+ # -*- encoding: utf-8 -*-
2
+
1
3
  require 'webgen/loggable'
2
4
  require 'benchmark'
3
5
 
@@ -50,12 +52,18 @@ module Webgen
50
52
  end
51
53
  puts "...done in " + ('%2.4f' % time.real) + ' seconds'
52
54
 
55
+ if !tree.root
56
+ puts 'No source files found - maybe not a webgen website?'
57
+ return nil
58
+ end
59
+
53
60
  puts "Writing changed nodes..."
54
61
  time = Benchmark.measure do
55
62
  write_tree(tree)
56
63
  end
57
64
  puts "...done in " + ('%2.4f' % time.real) + ' seconds'
58
65
  end while tree.node_access[:alcn].any? {|name,node| node.flagged(:created) || node.flagged(:reinit)}
66
+ :success
59
67
  end
60
68
 
61
69
  #######
@@ -1,3 +1,5 @@
1
+ # -*- encoding: utf-8 -*-
2
+
1
3
  require 'facets/symbol/to_proc'
2
4
  require 'webgen/websiteaccess'
3
5
  require 'webgen/loggable'
@@ -1,3 +1,5 @@
1
+ # -*- encoding: utf-8 -*-
2
+
1
3
  module Webgen::SourceHandler
2
4
 
3
5
  # Simple source handler for copying files from the source tree, either verbatim or by applying a
@@ -1,3 +1,5 @@
1
+ # -*- encoding: utf-8 -*-
2
+
1
3
  module Webgen::SourceHandler
2
4
 
3
5
  # Handles directory source paths.
@@ -1,3 +1,5 @@
1
+ # -*- encoding: utf-8 -*-
2
+
1
3
  module Webgen::SourceHandler
2
4
 
3
5
  # Source handler for creating atom and/or rss feeds.
@@ -53,7 +55,7 @@ module Webgen::SourceHandler
53
55
  # Helper method for returning the entries for the feed node +node+.
54
56
  def feed_entries(node)
55
57
  nr_items = (node['number_of_entries'].to_i == 0 ? 10 : node['number_of_entries'].to_i)
56
- patterns = [node['entries']].flatten.map {|pat| Pathname.new(pat =~ /^\// ? pat : File.join(node.parent.absolute_lcn, pat)).cleanpath.to_s}
58
+ patterns = [node['entries']].flatten.map {|pat| Webgen::Common.absolute_path(pat, node.parent.absolute_lcn)}
57
59
 
58
60
  node.tree.node_access[:alcn].values.
59
61
  select {|node| patterns.any? {|pat| node =~ pat} && node.node_info[:page]}.
@@ -1,3 +1,5 @@
1
+ # -*- encoding: utf-8 -*-
2
+
1
3
  module Webgen::SourceHandler
2
4
 
3
5
  # Handles page fragment nodes and provides utility methods for parsing HTML headers and generating
@@ -1,3 +1,5 @@
1
+ # -*- encoding: utf-8 -*-
2
+
1
3
  module Webgen::SourceHandler
2
4
 
3
5
  # This source handler should be used for handling nodes that are created during the write
@@ -1,3 +1,5 @@
1
+ # -*- encoding: utf-8 -*-
2
+
1
3
  require 'pathname'
2
4
  require 'yaml'
3
5
 
@@ -27,7 +29,7 @@ module Webgen::SourceHandler
27
29
  [[:mi_paths, 'paths'], [:mi_alcn, 'alcn']].each do |mi_key, block_name|
28
30
  node.node_info[mi_key] = {}
29
31
  YAML::load(page.blocks[block_name].content).each do |key, value|
30
- key = Pathname.new(key =~ /^\// ? key : File.join(parent.absolute_lcn, key)).cleanpath.to_s
32
+ key = Webgen::Common.absolute_path(key, parent.absolute_lcn)
31
33
  node.node_info[mi_key][key] = value
32
34
  end if page.blocks.has_key?(block_name)
33
35
  end
@@ -1,3 +1,5 @@
1
+ # -*- encoding: utf-8 -*-
2
+
1
3
  module Webgen::SourceHandler
2
4
 
3
5
  # Source handler for handling content files in Webgen Page Format.
@@ -1,3 +1,5 @@
1
+ # -*- encoding: utf-8 -*-
2
+
1
3
  require 'uri'
2
4
  require 'time'
3
5
 
@@ -1,3 +1,5 @@
1
+ # -*- encoding: utf-8 -*-
2
+
1
3
  module Webgen::SourceHandler
2
4
 
3
5
  # Source handler for handling template files in Webgen Page Format.
@@ -1,3 +1,5 @@
1
+ # -*- encoding: utf-8 -*-
2
+
1
3
  require 'uri'
2
4
  require 'yaml'
3
5
 
@@ -17,7 +19,7 @@ module Webgen::SourceHandler
17
19
  page = page_from_path(path)
18
20
  nodes = []
19
21
  YAML::load(page.blocks['content'].content).each do |key, meta_info|
20
- key = (key =~ /^\// ? key : File.join(parent.absolute_lcn, key))
22
+ key = Webgen::Common.absolute_path(key, parent.absolute_lcn) + (key =~ /\/$/ ? '/' : '')
21
23
  temp_parent = create_directories(parent.tree.root, File.dirname(key), path)
22
24
 
23
25
  meta_info ||= {}
data/lib/webgen/tag.rb CHANGED
@@ -1,3 +1,5 @@
1
+ # -*- encoding: utf-8 -*-
2
+
1
3
  module Webgen
2
4
 
3
5
  # Namespace for all classes that are useable by Webgen::ContentProcessor::Tag.
@@ -1,3 +1,5 @@
1
+ # -*- encoding: utf-8 -*-
2
+
1
3
  require 'yaml'
2
4
  require 'webgen/loggable'
3
5
  require 'webgen/websiteaccess'
@@ -1,3 +1,5 @@
1
+ # -*- encoding: utf-8 -*-
2
+
1
3
  module Webgen::Tag
2
4
 
3
5
  # Generates a breadcrumb trail for the page. This is especially useful when pages are in deep
@@ -1,3 +1,5 @@
1
+ # -*- encoding: utf-8 -*-
2
+
1
3
  module Webgen::Tag
2
4
 
3
5
  # Provides syntax highlighting via the +coderay+ library.
@@ -1,3 +1,5 @@
1
+ # -*- encoding: utf-8 -*-
2
+
1
3
  module Webgen::Tag
2
4
 
3
5
  # Prints out the date using a format string which will be passed to Time#strftime. Therefore you
@@ -1,3 +1,5 @@
1
+ # -*- encoding: utf-8 -*-
2
+
1
3
  require 'cgi'
2
4
  require 'tempfile'
3
5
  require 'rbconfig'
@@ -1,3 +1,5 @@
1
+ # -*- encoding: utf-8 -*-
2
+
1
3
  require 'cgi'
2
4
 
3
5
  module Webgen::Tag
@@ -1,3 +1,5 @@
1
+ # -*- encoding: utf-8 -*-
2
+
1
3
  module Webgen::Tag
2
4
 
3
5
  # Generates a list with all the languages of the page.
@@ -19,7 +21,8 @@ module Webgen::Tag
19
21
  sort {|a, b| a.lang <=> b.lang}.
20
22
  collect {|n| context.dest_node.link_to(n, :link_text => (param('tag.langbar.lang_names')[n.lang] || n.lang), :lang => n.lang)}.
21
23
  join(param('tag.langbar.separator'))
22
- (param('tag.langbar.show_single_lang') || lang_nodes.length > 1 ? result : "")
24
+
25
+ [(param('tag.langbar.show_single_lang') || lang_nodes.length > 1 ? result : ""), param('tag.langbar.process_output')]
23
26
  end
24
27
 
25
28
  #######
@@ -1,3 +1,5 @@
1
+ # -*- encoding: utf-8 -*-
2
+
1
3
  module Webgen::Tag
2
4
 
3
5
  # Create a link to a given (A)LCN.
@@ -1,3 +1,5 @@
1
+ # -*- encoding: utf-8 -*-
2
+
1
3
  module Webgen::Tag
2
4
 
3
5
  # Generates a menu that can be configured extensively.
@@ -1,3 +1,5 @@
1
+ # -*- encoding: utf-8 -*-
2
+
1
3
  module Webgen::Tag
2
4
 
3
5
  # Provides easy access to the meta information of a node.
@@ -1,3 +1,5 @@
1
+ # -*- encoding: utf-8 -*-
2
+
1
3
  require 'uri'
2
4
 
3
5
  module Webgen::Tag
@@ -1,3 +1,5 @@
1
+ # -*- encoding: utf-8 -*-
2
+
1
3
  module Webgen::Tag
2
4
 
3
5
  # Generates a sitemap. The sitemap contains the hierarchy of all pages on the web site.
@@ -1,3 +1,5 @@
1
+ # -*- encoding: utf-8 -*-
2
+
1
3
  require 'erb'
2
4
  require 'tempfile'
3
5
  require 'fileutils'
@@ -30,7 +32,7 @@ EOF
30
32
  # Create a graphic from the commands in the body of the tag.
31
33
  def call(tag, body, context)
32
34
  path = param('tag.tikz.path')
33
- path = Pathname.new(path =~ /^\// ? path : File.join(context.ref_node.parent.absolute_lcn, path)).cleanpath.to_s
35
+ path = Webgen::Common.absolute_path(path, context.ref_node.parent.absolute_lcn)
34
36
 
35
37
  mem_handler = website.cache.instance('Webgen::SourceHandler::Memory')
36
38
  src_path = context.ref_node.node_info[:src]
data/lib/webgen/tree.rb CHANGED
@@ -1,3 +1,5 @@
1
+ # -*- encoding: utf-8 -*-
2
+
1
3
  require 'webgen/websiteaccess'
2
4
  require 'webgen/node'
3
5
 
@@ -65,6 +67,9 @@ module Webgen
65
67
  end
66
68
 
67
69
  # Delete the node identified by +node_or_alcn+ and all of its children from the tree.
70
+ #
71
+ # The message <tt>:before_node_deleted</tt> is sent with the to-be-deleted node before this node
72
+ # is actually deleted from the tree.
68
73
  def delete_node(node_or_alcn)
69
74
  n = node_or_alcn.kind_of?(Node) ? node_or_alcn : @node_access[:alcn][node_or_alcn]
70
75
  return if n.nil? || n == @dummy_root
@@ -1,6 +1,8 @@
1
+ # -*- encoding: utf-8 -*-
2
+
1
3
  module Webgen
2
4
 
3
5
  # The version of webgen.
4
- VERSION = '0.5.6'
6
+ VERSION = '0.5.7'
5
7
 
6
8
  end
@@ -1,3 +1,5 @@
1
+ # -*- encoding: utf-8 -*-
2
+
1
3
  # -*- ruby -*-
2
4
  #
3
5
  #--
@@ -1,3 +1,5 @@
1
+ # -*- encoding: utf-8 -*-
2
+
1
3
  # Standard lib requires
2
4
  require 'logger'
3
5
  require 'set'
@@ -28,6 +30,102 @@ require 'webgen/page'
28
30
 
29
31
 
30
32
  # The Webgen namespace houses all classes/modules used by webgen.
33
+ #
34
+ # = webgen
35
+ #
36
+ # webgen is a command line application for generating a web site from templates and content
37
+ # files. Despite this fact, the implementation also provides adequate support for using webgen as a
38
+ # library and *full* *support* for extending it.
39
+ #
40
+ # = Extending webgen
41
+ #
42
+ # webgen can be extended very easily. Any file called <tt>init.rb</tt> put into the <tt>ext/</tt>
43
+ # directory of the website or into one of its sub-directories is automatically loaded on
44
+ # Website#init.
45
+ #
46
+ # You can extend webgen in several ways. However, no magic or special knowledge is needed since
47
+ # webgen relies on the power of Ruby itself. So, for example, an extension is just a normal Ruby
48
+ # class. Most extension types provide a Base module for mixing into an extension which provides
49
+ # default implementations for needed methods.
50
+ #
51
+ # Following are links to detailed descriptions on how to develop specific types of extensions:
52
+ #
53
+ # [Webgen::Source] Information on how to implement a class that provides source paths for
54
+ # webgen. For example, one could implement a source class that uses a database as
55
+ # backend.
56
+ #
57
+ # [Webgen::Output] Information on how to implement a class that writes content to an output
58
+ # location. The default output class just writes to the file system. One could, for
59
+ # example, implement an output class that writes the generated files to multiple
60
+ # locations or to a remote server.
61
+ #
62
+ # [Webgen::ContentProcessor] Information on how to develop an extension that processes the
63
+ # content. For example, markup-to-HTML converters are implemented as
64
+ # content processors in webgen.
65
+ #
66
+ # [Webgen::SourceHandler::Base] Information on how to implement a class that handles objects of type
67
+ # source Path and creates Node instances. For example,
68
+ # Webgen::SourceHandler::Page handles the conversion of <tt>.page</tt>
69
+ # files to <tt>.html</tt> files.
70
+ #
71
+ # [Webgen::Tag::Base] Information on how to implement a webgen tag. webgen tags are used to provide
72
+ # an easy way for users to include dynamic content such as automatically
73
+ # generated menus.
74
+ #
75
+ # = Blackboard services
76
+ #
77
+ # The Blackboard class provides an easy communication facility between objects. It implements the
78
+ # Observer pattern on the one side and allows the definition of services on the other side. One
79
+ # advantage of a service over the direct use of an object instance method is that the caller does
80
+ # not need to how to find the object that provides the service. It justs uses the Website#blackboard
81
+ # instance. An other advantage is that one can easily exchange the place where the service was
82
+ # defined without breaking extensions that rely on it.
83
+ #
84
+ # Following is a list of all services available in the stock webgen distribution by the name and the
85
+ # method that implements it (which is useful for looking up the parameters of service).
86
+ #
87
+ # <tt>:create_fragment_nodes</tt>:: SourceHandler::Fragment#create_fragment_nodes
88
+ # <tt>:templates_for_node</tt>:: SourceHandler::Template#templates_for_node
89
+ # <tt>:parse_html_headers</tt>:: SourceHandler::Fragment#parse_html_headers
90
+ # <tt>:output_instance</tt>:: Output.instance
91
+ # <tt>:content_processor_names</tt>:: ContentProcessor.list
92
+ # <tt>:content_processor</tt>:: ContentProcessor.for_name
93
+ # <tt>:create_sitemap</tt>:: Common::Sitemap#create_sitemap
94
+ # <tt>:create_directories</tt>:: SourceHandler::Directory#create_directories
95
+ # <tt>:create_nodes</tt>:: SourceHandler::Main#create_nodes
96
+ # <tt>:source_paths</tt>:: SourceHandler::Main#source_paths
97
+ #
98
+ # Following is the list of all messages that can be listened to:
99
+ #
100
+ # <tt>:node_flagged</tt>::
101
+ # See Node#flag
102
+ #
103
+ # <tt>:node_unflagged</tt>::
104
+ # See Node#unflag
105
+ #
106
+ # <tt>:node_changed?</tt>::
107
+ # See Node#changed?
108
+ # <tt>:node_meta_info_changed?</tt>::
109
+ # See Node#meta_info_changed?
110
+ #
111
+ # <tt>:before_node_created</tt>::
112
+ # Sent by the <tt>:create_nodes</tt> service before a node is created (handled by a source handler)
113
+ # with the +parent+ and the +path+ as arguments.
114
+ #
115
+ # <tt>:after_node_created</tt>::
116
+ # Sent by the <tt>:create_nodes</tt> service after a node has been created with the created node
117
+ # as argument.
118
+ #
119
+ # <tt>:before_node_deleted</tt>::
120
+ # See Tree#delete_node
121
+ #
122
+ # = Other places to look at
123
+ #
124
+ # Here is a list of modules/classes that are primarily used throughout webgen or provide useful
125
+ # methods for developing extensions:
126
+ #
127
+ # Common, Tree, Node, Path, Cache, Page
128
+
31
129
  module Webgen
32
130
 
33
131
  # Returns the data directory for webgen.
@@ -108,15 +206,17 @@ module Webgen
108
206
  self
109
207
  end
110
208
 
111
- # Render the website (after calling #init if the website is not already initialized).
209
+ # Render the website (after calling #init if the website is not already initialized) and return
210
+ # a status code not equal to +nil+ if rendering was successful.
112
211
  def render
212
+ result = nil
113
213
  execute_in_env do
114
214
  init unless @config
115
215
 
116
216
  puts "Starting webgen..."
117
217
  shm = SourceHandler::Main.new
118
- shm.render(@tree)
119
- save_tree_and_cache
218
+ result = shm.render(@tree)
219
+ save_tree_and_cache if result
120
220
  puts "Finished"
121
221
 
122
222
  if @logger && @logger.log_output.length > 0
@@ -124,6 +224,7 @@ module Webgen
124
224
  puts @logger.log_output
125
225
  end
126
226
  end
227
+ result
127
228
  end
128
229
 
129
230
  # Clean the website directory from all generated output files (including the cache file). If
@@ -1,3 +1,5 @@
1
+ # -*- encoding: utf-8 -*-
2
+
1
3
  module Webgen
2
4
 
3
5
  # Mixed into modules/classes that need access to the current website object.
@@ -1,3 +1,5 @@
1
+ # -*- encoding: utf-8 -*-
2
+
1
3
  require 'ostruct'
2
4
  require 'fileutils'
3
5
  require 'webgen/website'
data/man/man1/webgen.1 CHANGED
@@ -55,6 +55,12 @@ Shows the version of the program and exit.
55
55
  .TP
56
56
  \fBwebgui\fR
57
57
  Starts the webgen webgui, a browser based graphical user interface for manging webgen websites.
58
+ .SH ENVIRONMENT VARIABLES
59
+ webgen's behaviour is affected by the following environment variables:
60
+ .TP
61
+ \fBWEBGEN_WEBSITE\fR
62
+ If no website is specified via the \-d option and this variable is set, webgen assumes that its
63
+ content is the webgen website directory that should be used.
58
64
  .SH SEE ALSO
59
65
  The webgen website, http://webgen.rubyforge.org/ for more information.
60
66
  .SH AUTHOR