Created
January 4, 2011 15:24
-
-
Save brettbuddin/764895 to your computer and use it in GitHub Desktop.
Simple HTTP server for static file sites
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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