Class: Webgen::SourceHandler::Main
- Inherits:
-
Object
- Object
- Webgen::SourceHandler::Main
- Includes:
- Loggable, WebsiteAccess
- Defined in:
- lib/webgen/sourcehandler.rb
Overview
This class is used by Website to do the actual rendering of the website. It
-
collects all source paths using the source classes
-
creates nodes using the source handler classes
-
writes changed nodes out using an output class
Instance Method Summary collapse
-
#initialize ⇒ Main
constructor
:nodoc:.
-
#render(tree) ⇒ Object
Render the nodes provided in the
tree
.
Methods included from Loggable
Methods included from WebsiteAccess
Constructor Details
#initialize ⇒ Main
:nodoc:
36 37 38 39 40 |
# File 'lib/webgen/sourcehandler.rb', line 36 def initialize #:nodoc: website.blackboard.add_service(:create_nodes, method(:create_nodes)) website.blackboard.add_service(:source_paths, method(:find_all_source_paths)) website.blackboard.add_listener(:node_meta_info_changed?, method(:meta_info_changed?)) end |
Instance Method Details
#render(tree) ⇒ Object
Render the nodes provided in the tree
. Before the actual rendering is done, the sources are checked (nodes for deleted sources are deleted, nodes for new and changed sources).
44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 |
# File 'lib/webgen/sourcehandler.rb', line 44 def render(tree) begin website.logger.mark_new_cycle if website.logger puts "Updating tree..." time = Benchmark.measure do website.cache.reset_volatile_cache update_tree(tree) end puts "...done in " + ('%2.4f' % time.real) + ' seconds' if !tree.root puts 'No source files found - maybe not a webgen website?' return nil end puts "Writing changed nodes..." time = Benchmark.measure do write_tree(tree) end puts "...done in " + ('%2.4f' % time.real) + ' seconds' end while tree.node_access[:alcn].any? {|name,node| node.flagged(:created) || node.flagged(:reinit)} :success end |