| # -*- 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 |
| |
| Webgen::WebgenTask.new do |website| |
| website.clobber_outdir = true |
| website.config_block = lambda do |config| |
| # you can set configuration options here |
| end |
| end |
| |
| desc "Render the website automatically on changes" |
| task :auto_webgen do |
| puts 'Starting auto-render mode' |
| time = Time.now |
| 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} |
| Rake::Task['webgen'].execute({}) |
| end |
| time = Time.now |
| old_paths = paths |
| sleep 2 |
| end |
| end |
| |
| desc "Deploy the site" |
| task :upload do |
| sh %{webgen; scp -r out/* #{ENV['SSH_USER']}@people.apache.org:/www/activemq.apache.org/stomp} |
| end |