class Webgen::RakeTask
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/rake_task' Webgen::RakeTask.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
-
generate the webgen website
- clobber_webgen
-
remove all 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 website directory is webgen
under the main project directory use the following code fragment in project Rakefile:
require 'webgen/rake_task' namespace :dev do Webgen::RakeTask.new do |site| site.directory = File.join(Dir.pwd, "webgen") site.clobber_outdir = true site.config_block = lambda |website| website.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.
Attributes
During the clobber, should webgen's output directory be clobbered? The default is false.
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 'webgen.config' file lying around.
The directory of the webgen website.
This would be the directory of your 'webgen.config' file. Or the parent directory of the 'src' directory.
The default value is Dir.pwd
.
Public Class Methods
Create webgen tasks. You can override the task name with the parameter name
.