Class FileHandlers::DirectoryHandler
In: lib/webgen/plugins/filehandlers/directory.rb
Parent: DefaultHandler
Webgen::Plugin DefaultHandler FileHandler CopyHandler ThumbnailWriter SipttraHandler VirtualFileHandler GalleryHandler TemplateHandler PageHandler DirectoryHandler Listener lib/webgen/plugins/filehandlers/filehandler.rb lib/webgen/plugins/filehandlers/copy.rb lib/webgen/plugins/filehandlers/directory.rb lib/webgen/plugins/filehandlers/page.rb lib/webgen/plugins/filehandlers/sipttra.rb lib/webgen/plugins/filehandlers/gallery.rb lib/webgen/plugins/filehandlers/template.rb FileHandlers dot/m_26_0.png

Handles directories.

Methods

Classes and Modules

Class FileHandlers::DirectoryHandler::DirNode

Public Instance methods

Returns a new DirNode.

[Source]

    # File lib/webgen/plugins/filehandlers/directory.rb, line 81
81:     def create_node( path, parent, meta_info )
82:       filename = File.basename( path ) + '/'
83:       if parent.nil? || (node = parent.find {|child| child =~ filename }).nil?
84:         node = DirNode.new( parent, filename, meta_info )
85:         node.node_info[:processor] = self
86:         node.node_info[:src] = path
87:       end
88:       node
89:     end

See DefaultFileHandler#link_from and PageHandler#link_from.

[Source]

     # File lib/webgen/plugins/filehandlers/directory.rb, line 105
105:     def link_from( node, ref_node, attr = {} )
106:       lang_node = (attr[:resolve_lang_node] == false ? node : node.node_for_lang( ref_node['lang'] ) )
107:       attr[:link_text] ||=  lang_node['directoryName'] || node['title']
108:       super( lang_node, ref_node, attr )
109:     end

Return the page node for the directory node using the specified language lang. If an index file is specified, then the its correct language node is returned, else node is returned.

[Source]

     # File lib/webgen/plugins/filehandlers/directory.rb, line 99
 99:     def node_for_lang( node, lang )
100:       langnode = node['indexFile'].node_for_lang( lang ) if node['indexFile']
101:       langnode || node
102:     end

Recursively creates a given directory path starting from the path of parent and returns the bottom most directory node.

[Source]

     # File lib/webgen/plugins/filehandlers/directory.rb, line 113
113:     def recursive_create_path( path, parent )
114:       path.split( File::SEPARATOR ).each do |pathname|
115:         case pathname
116:         when '.' then  #do nothing
117:         when '..' then parent = parent.parent
118:         else parent = @plugin_manager['Core/FileHandler'].create_node( pathname, parent, self )
119:         end
120:       end
121:       parent
122:     end

Creates the directory (and all its parent directories if necessary).

[Source]

    # File lib/webgen/plugins/filehandlers/directory.rb, line 92
92:     def write_node( node )
93:       FileUtils.makedirs( node.full_path ) unless File.exists?( node.full_path )
94:     end

[Validate]