summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorelijah <elijah@riseup.net>2013-05-18 16:39:30 -0700
committerelijah <elijah@riseup.net>2013-05-18 16:39:30 -0700
commit73eb4a54f734ce508aa57ebc27c54043e4da6125 (patch)
tree5b56e64829f658a4bce359c8dfa3047326419619
parent650e5794694addb5f8843f3107af7e97c45a0d3a (diff)
if Gemfile.lock is present, then issue a Bundle.require
-rwxr-xr-xbin/nickserver31
1 files changed, 18 insertions, 13 deletions
diff --git a/bin/nickserver b/bin/nickserver
index de7e334..f392efe 100755
--- a/bin/nickserver
+++ b/bin/nickserver
@@ -4,22 +4,27 @@
# Nickserver key discovery daemon
#
-#
-# bootstrap nickserver library
-#
-begin # try without rubygems (might be already loaded or not present)
- require 'nickserver'
-rescue LoadError
- begin # try with rubygems
- require 'rubygems'
- require 'nickserver'
- rescue LoadError # try manually
- BASE_DIR = File.expand_path('../..', File.symlink?(__FILE__) ? File.readlink(__FILE__) : __FILE__)
- $LOAD_PATH << "#{BASE_DIR}/lib"
- require "nickserver"
+def load_library(name)
+ begin # try without rubygems (might be already loaded or not present)
+ require name
+ rescue LoadError
+ begin # try it as a gem
+ require 'rubygems'
+ require name
+ rescue LoadError # try manually
+ base_directory = File.expand_path('../..', File.symlink?(__FILE__) ? File.readlink(__FILE__) : __FILE__)
+ if File.exists?("#{base_directory}/Gemfile.lock")
+ require 'bundler'
+ Bundler.require(:default)
+ end
+ $LOAD_PATH << "#{base_directory}/lib"
+ require name
+ end
end
end
+load_library('nickserver')
+
Nickserver::Daemon.run('nickserver') do
EventMachine.run do
Nickserver::Server.start