Skip to content

Instantly share code, notes, and snippets.

@overbalance
Created June 2, 2011 21:17
Show Gist options
  • Save overbalance/1005360 to your computer and use it in GitHub Desktop.
Save overbalance/1005360 to your computer and use it in GitHub Desktop.
Middleman Rake Tasks
require 'rubygems'
desc "Completely empty /build"
task :clobber do
sh "rm -rf build/* build/.[Dh]*"
end
desc "Export compiled build"
task :build do
sh "mm-build"
end
desc "Deply to ftp"
task :deploy => [:clobber, :build] do
servers = %w{ftp.server.com}
servers.each do |server|
puts "Deploying app to #{server}"
system("cd build;rsync -rltvz --delete-before -e ssh . user@#{server}:/home/your/server/path")
# system("ssh root@#{server} chown -R www-data:www-data /var/www/webapp/")
# system("ssh root@server /etc/init.d/apache2 reload")
end
end
desc "Tar up the build folder with timestamp"
task :zip => [:clobber, :build] do
system("tar -czf build"+DateTime::now().strftime("%Y%m%d-%H%M%S")+".tar.gz build/")
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment