Class Webgen::WebgenTask
In: lib/webgen/webgentask.rb
Parent: ::Rake::TaskLib
Error RenderError CommandNotFoundError LoadError NodeCreationError ::Rake::TaskLib WebgenTask Helpers Configuration Node Context\n[lib/webgen/context.rb\nlib/webgen/context/nodes.rb\nlib/webgen/context/render.rb\nlib/webgen/context/tags.rb] Tree FileSystem Sitemap Copy Feed Virtual Sitemap Directory Page Fragment Template Metainfo Memory Coderay Sitemap IncludeFile BreadcrumbTrail Langbar TikZ Menu Tags Fragments Resource Website Tidy Head Kramdown Less Xmllint Blocks Comparable Language Path StandardError CmdParse::CommandParser CommandParser CmdParse::Command RunCommand WebguiCommand CreateCommand ApplyCommand WebsiteAccess Main Loggable OutputPathHelpers ExecuteCommand Link Date Relocatable Metainfo ::Kramdown::Converter::Html KramdownHtmlConverter Cache Blackboard WebsiteManager Logger Page ProxyNode Utils Scss RDoc Sass Erb RDiscount Erubis Haml Maruku Builder RedCloth AccessHash TarArchive Stacked FileSystem lib/webgen/cache.rb lib/webgen/error.rb lib/webgen/languages.rb lib/webgen/context/render.rb lib/webgen/website.rb lib/webgen/blackboard.rb lib/webgen/tree.rb lib/webgen/websitemanager.rb lib/webgen/logger.rb lib/webgen/configuration.rb lib/webgen/path.rb lib/webgen/webgentask.rb lib/webgen/page.rb lib/webgen/node.rb ClassMethods WebsiteAccess lib/webgen/cli/run_command.rb lib/webgen/cli/utils.rb lib/webgen/cli/apply_command.rb lib/webgen/cli/webgui_command.rb lib/webgen/cli.rb lib/webgen/cli/create_command.rb Color CLI LanguageManager lib/webgen/output/filesystem.rb Output lib/webgen/common/sitemap.rb Common lib/webgen/sourcehandler/memory.rb lib/webgen/sourcehandler/metainfo.rb lib/webgen/sourcehandler/copy.rb lib/webgen/sourcehandler/directory.rb lib/webgen/sourcehandler.rb lib/webgen/sourcehandler/page.rb lib/webgen/sourcehandler/template.rb lib/webgen/sourcehandler/fragment.rb lib/webgen/sourcehandler/sitemap.rb lib/webgen/sourcehandler/virtual.rb lib/webgen/sourcehandler/feed.rb OutputPathHelpers Base SourceHandler lib/webgen/tag/coderay.rb lib/webgen/tag/relocatable.rb lib/webgen/tag/menu.rb lib/webgen/tag/langbar.rb lib/webgen/tag/executecommand.rb lib/webgen/tag/breadcrumbtrail.rb lib/webgen/tag/metainfo.rb lib/webgen/tag/includefile.rb lib/webgen/tag/link.rb lib/webgen/tag/date.rb lib/webgen/tag/tikz.rb lib/webgen/tag/sitemap.rb Base Tag lib/webgen/contentprocessor/less.rb lib/webgen/contentprocessor/scss.rb lib/webgen/contentprocessor/blocks.rb lib/webgen/contentprocessor/rdoc.rb lib/webgen/contentprocessor/sass.rb lib/webgen/contentprocessor/erb.rb lib/webgen/contentprocessor/rdiscount.rb lib/webgen/contentprocessor/tags.rb lib/webgen/contentprocessor/erubis.rb lib/webgen/contentprocessor/kramdown/html.rb lib/webgen/contentprocessor/haml.rb lib/webgen/contentprocessor/maruku.rb lib/webgen/contentprocessor/xmllint.rb lib/webgen/contentprocessor/kramdown.rb lib/webgen/contentprocessor/head.rb lib/webgen/contentprocessor/builder.rb lib/webgen/contentprocessor/tidy.rb lib/webgen/contentprocessor/redcloth.rb lib/webgen/contentprocessor/fragments.rb lib/webgen/contentprocessor.rb ContentProcessor lib/webgen/source/tararchive.rb lib/webgen/source/stacked.rb lib/webgen/source/resource.rb lib/webgen/source/filesystem.rb Source Loggable Webgen dot/m_82_0.png

Task library to manage a webgen website.

It is assumed that you have already used the ‘webgen’ command to create the website directory for the site.

Basics

  require 'webgen/webgentask'

  Webgen::WebgenTask.new

Attributes

The attributes available in the new block are:

directory
the root directory of the webgen site (default Dir.pwd)
config
the config block for setting additional configuration options
clobber_outdir
remove webgens output directory on clobber (default false)

Tasks Provided

The tasks provided are :

webgen
render the webgen website
clobber_webgen
remove all the files created during generation

Integrate webgen in other project

To integrate webgen tasks in another project you can use rake namespaces. For example assuming webgen‘s site directory is webgen under the main project directory use the following code fragment in project Rakefile:

  require 'webgen/webgentask'

  namespace :dev do
    Webgen::WebgenTask.new do |site|
      site.directory = File.join(Dir.pwd, "webgen")
      site.clobber_outdir = true
      site.config_block = lambda |config|
        config['website.lang'] = 'de'
      end
    end
  end

  task :clobber => ['dev:clobber_webgen']

This will create the following tasks:

  • dev:webgen
  • dev:clobber_webgen

and add dev:clobber_webgen to the main clobber task.

Methods

new  

Attributes

clobber_outdir  [RW]  During the clobber, should webgen‘s output directory be clobbered. The default is false.
config_block  [RW]  The configuration block that is invoked when the Webgen::Website object is initialized. This can be used to set configuration parameters and to avoid having a config.yaml file lying around.
directory  [RW]  The directory of the webgen website. This would be the directory of your config.yaml file. Or the parent directory of the src/ directory for webgen.

The default for this is assumed to be Dir.pwd

Public Class methods

Create webgen tasks. You can override the task name with the parameter name.

[Source]

     # File lib/webgen/webgentask.rb, line 114
114:     def initialize(name = 'webgen')
115:       @name           = name
116:       @directory      = Dir.pwd
117:       @clobber_outdir = false
118:       @config_block   = nil
119: 
120:       yield self if block_given?
121: 
122:       define
123:     end

[Validate]