| Class | Webgen::WebgenTask |
| In: |
lib/webgen/webgentask.rb
|
| Parent: | ::Rake::TaskLib |
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.
require 'webgen/webgentask' Webgen::WebgenTask.new
The attributes available in the new block are:
The tasks provided are :
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:
and add dev:clobber_webgen to the main clobber task.
| 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 |
Create webgen tasks. You can override the task name with the parameter name.
# 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