Skip to content

Instantly share code, notes, and snippets.

@scottwb
Created February 24, 2012 17:21
Show Gist options
  • Save scottwb/1902178 to your computer and use it in GitHub Desktop.
Save scottwb/1902178 to your computer and use it in GitHub Desktop.
Rakefile for Middleman with an rsync deploy task.
SSH_USER = 'root'
SSH_HOST = 'www.example.com'
SSH_DIR = '/var/www/html/www.example.com'
desc "Build the website from source"
task :build do
puts "## Building website"
status = system("middleman build --clean")
puts status ? "OK" : "FAILED"
end
desc "Run the preview server at http://localhost:4567"
task :preview do
system("middleman server")
end
desc "Deploy website via rsync"
task :deploy do
puts "## Deploying website via rsync to #{SSH_HOST}"
status = system("rsync -avze 'ssh' --delete build/ #{SSH_USER}@#{SSH_HOST}:#{SSH_DIR}")
puts status ? "OK" : "FAILED"
end
desc "Build and deploy website"
task :gen_deploy => [:build, :deploy] do
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment