Skip to content

Instantly share code, notes, and snippets.

@brettbuddin
Created January 4, 2011 15:24
Show Gist options
  • Save brettbuddin/764895 to your computer and use it in GitHub Desktop.
Save brettbuddin/764895 to your computer and use it in GitHub Desktop.
Simple HTTP server for static file sites
require 'webrick'
DEPLOY_TO = ''
desc "Starts an HTTP server in the current directory"
task :server do
config = {:Port => 3000, :DocumentRoot => '.'}
server = WEBrick::HTTPServer.new config
['INT', 'TERM'].each do |signal|
trap(signal) { server.shutdown }
end
server.start
end
namespace :deploy do
desc "Deploy via rsync"
task :rsync do
`rsync --verbose --progress --stats --compress --recursive --times --perms --links --delete #{Dir.pwd}/* #{DEPLOY_TO}`
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment