blob: 845ad49ca5cecd32eb181ea6539b274eac5234d9 [file] [log] [blame]
# -*- ruby -*-
# This is a sample Rakefile to which you can add tasks to manage your website. For example, users
# may use this file for specifying an upload task for their website (copying the output to a server
# via rsync, ftp, scp, ...).
# It also provides some tasks out of the box, for example, rendering the website, clobbering the
# generated files, an auto render task,...
require 'webgen/webgentask'
task :default => :webgen
task :rebuild => [:clobber, :webgen]
task :auto => :auto_webgen do |website|
website.clobber_outdir = true
website.config_block = lambda do |config|
# you can set configuration options here
desc "Render the website automatically on changes"
task :auto_webgen do
puts 'Starting auto-render mode'
time =
abort = false
old_paths = []
Signal.trap('INT') {abort = true}
while !abort
# you may need to adjust the glob so that all your sources are included
paths = Dir['src/**/*'].sort
if old_paths != paths || paths.any? {|p| File.mtime(p) > time}
time =
old_paths = paths
sleep 2
desc "Deploy the site"
task :upload do
sh %{webgen; scp -r out/* #{ENV['SSH_USER']}}