Permalink
Browse files

Add basic web development server.

  • Loading branch information...
1 parent 9b16db2 commit 898149d6cb9204dbbea4fc6ee292bba9adfbd554 @SaberUK committed Dec 18, 2012
Showing with 17 additions and 0 deletions.
  1. +17 −0 bin/serve
View
@@ -0,0 +1,17 @@
+#!/usr/bin/env ruby
+# ==============================================================================
+# SaberUK's Dot Files <https://github.com/saberuk/dotfiles/>
+# ==============================================================================
+# Copyright (C) 2012 Peter "SaberUK" Powell <petpow@saberuk.com>
+# ==============================================================================
+require 'webrick'
+if ARGV.size < 1
+ puts "Syntax: #{File.basename($PROGRAM_NAME)} <dir>"
+ exit 1
+else
+ server = WEBrick::HTTPServer.new(Address: '0.0.0.0', Port: 9999, DocumentRoot: ARGV[0])
+ trap 'INT' do
+ server.shutdown
+ end
+ server.start
+end

0 comments on commit 898149d

Please sign in to comment.