ssh_user    = "joerg@higgsboson.tk"
ssh_port    = "22"
document_root  = "/var/www/home/"
rsync_delete= true

public_dir = "build"
source_dir = "source"

desc "Generate jekyll site"
task :generate do
  system "middleman build"
end

desc "Deploy website via rsync"
task :deploy do
  exclude = ""
  if File.exists?('./rsync-exclude')
    exclude = "--exclude-from '#{File.expand_path('./rsync-exclude')}'"
  end
  puts "## Deploying website via Rsync"
  ok_failed system("rsync -avze 'ssh -p #{ssh_port}' #{exclude} #{"--delete" unless rsync_delete == false} #{public_dir}/ #{ssh_user}:#{document_root}")
end

desc "Generate website and deploy"
task :gen_deploy => [:generate, :deploy] do
end
