Skip to content

Instantly share code, notes, and snippets.

@bnadlerjr
Created March 14, 2010 16:37
Show Gist options
  • Save bnadlerjr/332063 to your computer and use it in GitHub Desktop.
Save bnadlerjr/332063 to your computer and use it in GitHub Desktop.
PORT = 22
USER = 'username'
SERVER = 'server name or ip'
DEST = 'web root on server'
desc 'Builds site using StaticMatic'
task :build do
system 'staticmatic build .'
end
desc 'Syncs /site with server using rsync'
task :sync do
cmd = 'rsync'
cmd += ' -rtu' # recursive copy; preserve timestamps; skip files that are newer on dest
cmd += ' --progress' # show progress during transfer
cmd += ' --delay-updates' # put all updated files into place at transfer's end
cmd += ' --delete' # delete extraneous files from destination dirs
cmd += ' --delete-after' # receiver deletes after transfer, not during
cmd += " -e 'ssh -p #{PORT}'" # Use non-standard port
cmd += ' site/' # source
cmd += " #{USER}@#{SERVER}:#{DEST}" # destination
system cmd
end
desc 'First builds site, then deploys it using rsync'
task :deploy => [:build, :sync]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment