script for running a local server that's just enough for polatch2 development
authorAndy Allan <gravitystorm@gmail.com>
Mon, 23 Nov 2009 17:29:17 +0000 (17:29 +0000)
committerAndy Allan <gravitystorm@gmail.com>
Mon, 23 Nov 2009 17:29:17 +0000 (17:29 +0000)
resources/server.rb [new file with mode: 0644]

diff --git a/resources/server.rb b/resources/server.rb
new file mode 100644 (file)
index 0000000..1d2f477
--- /dev/null
@@ -0,0 +1,23 @@
+#!/usr/bin/ruby
+
+# A very simple script to use Potlatch2 locally
+# without having to install a rails_port. 
+# Run this script on a console, then visit
+# http://yourmachinename:3333/potlatch2.html
+#
+# Note that for *very* stupid flash-player reasons
+# neither 127.0.0.1 nor any other IP nor localhost 
+# will work. Add a hostname to your /etc/hosts if
+# needs be.
+
+require 'webrick'
+include WEBrick
+
+s=HTTPServer.new(:Port => 3333, :DocumentRoot => Dir.pwd)
+
+# Handle signals.
+%w(INT TERM).each do |signal|
+  trap(signal) { s.shutdown }
+end
+
+s.start