Permalink
Browse files

Added deamon controller, bundler.

  • Loading branch information...
hpeikemo committed Jun 11, 2011
1 parent edb1a49 commit 874d27132f66ef26f4836877137cfd56cdf17b04
Showing with 69 additions and 3 deletions.
  1. +7 −0 Gemfile
  2. +28 −0 Gemfile.lock
  3. +30 −0 bin/rumpetrolld
  4. +2 −1 em/daemon.rb
  5. +2 −2 public/js/main.js
View
@@ -0,0 +1,7 @@
+source "http://rubygems.org"
+
+gem 'daemons'
+gem 'em-websocket'
+gem 'em-mongo'
+gem 'mongo'
+gem 'oauth'
View
@@ -0,0 +1,28 @@
+GEM
+ remote: http://rubygems.org/
+ specs:
+ addressable (2.2.6)
+ bson (1.3.1)
+ bson_ext (1.3.1)
+ daemons (1.1.3)
+ em-mongo (0.3.6)
+ bson (>= 1.1.3)
+ bson_ext (>= 1.1.3)
+ eventmachine (>= 0.12.10)
+ em-websocket (0.3.0)
+ addressable (>= 2.1.1)
+ eventmachine (>= 0.12.9)
+ eventmachine (0.12.10)
+ mongo (1.3.1)
+ bson (>= 1.3.1)
+ oauth (0.4.4)
+
+PLATFORMS
+ ruby
+
+DEPENDENCIES
+ daemons
+ em-mongo
+ em-websocket
+ mongo
+ oauth
View
@@ -0,0 +1,30 @@
+#!/usr/bin/env ruby
+# encoding: utf-8
+
+require 'rubygems'
+require 'bundler/setup'
+Bundler.require(:default)
+
+basedir = File.dirname(File.expand_path(File.join(__FILE__,"..")))
+script = File.join(basedir,"em","daemon.rb")
+
+require 'daemons'
+
+def stop_and_exit
+ # Do something useful here....
+ exit 0
+end
+
+Signal.trap('INT') { stop_and_exit }
+Signal.trap('TERM'){ stop_and_exit }
+
+
+options = {
+ :app_name => 'rumpetrolld',
+ :multiple => false,
+ :log_output => true,
+ :dir_mode => :normal,
+ :dir => File.join(basedir,'log')
+}
+
+Daemons.run(script, options)
View
@@ -2,6 +2,7 @@
# encoding: utf-8
$: << File.dirname(__FILE__)
+rootdir = File.join(File.dirname(__FILE__),'..')
require 'rubygems'
require 'em-websocket'
@@ -16,7 +17,7 @@
require 'settings'
-settings = Settings.new('data/settings.yaml')
+settings = Settings.new(File.join(rootdir,'data','settings.yaml'))
DEV_MODE = ARGV.include? "--dev"
VERBOSE_MODE = ARGV.include? "--verbose"
View
@@ -32,7 +32,7 @@ var initApp = function() {
app.authorize(null,null);
authWindow = window.open("auth.html","","width=950,height=460,menubar=no,toolbar=no,location=no,directories=no,status=no,scrollbars=yes,resizable=yes')")
return false;
- });
+ },false);
setInterval(runLoop,30);
}
@@ -47,7 +47,7 @@ if(Modernizr.canvas && Modernizr.websockets) {
initApp();
} else {
document.getElementById('unsupported-browser').style.display = "block";
- document.getElementById('force-init-button').addEventListener('click', forceInit);
+ document.getElementById('force-init-button').addEventListener('click', forceInit, false);
}
var addStats = function() {

0 comments on commit 874d271

Please sign in to comment.