Permalink
Browse files

Add command line option to require additional files

  • Loading branch information...
skade committed Apr 12, 2012
1 parent 774858f commit d0791f76c9c5165ae10218942b7c1a4b0f400679
Showing with 7 additions and 1 deletion.
  1. +5 −0 bin/slanger
  2. +1 −1 lib/slanger/config.rb
  3. +1 −0 lib/slanger/service.rb
View
@@ -34,6 +34,11 @@ OptionParser.new do |opts|
options[:websocket_host], options[:websocket_port] = p.split(':')
end
opts.on '-i', '--require FILE', "Require a file before starting Slanger" do |p|
options[:require] ||= []
options[:require] << p
end
opts.on "-v", "--[no-]verbose", "Run verbosely" do |v|
options[:debug] = v
end
View
@@ -14,7 +14,7 @@ def options
@options ||= {
api_host: '0.0.0.0', api_port: '4567', websocket_host: '0.0.0.0',
websocket_port: '8080', debug: false, redis_address: 'redis://0.0.0.0:6379/0',
socket_handler: Slanger::Handler
socket_handler: Slanger::Handler, require: []
}
end
View
@@ -4,6 +4,7 @@
module Slanger
module Service
def run
Slanger::Config[:require].each { |f| require f }
Thin::Logging.silent = true
Rack::Handler::Thin.run Slanger::ApiServer, Host: Slanger::Config.api_host, Port: Slanger::Config.api_port
Slanger::WebSocketServer.run

0 comments on commit d0791f7

Please sign in to comment.