summaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorelijah <elijah@riseup.net>2013-05-19 22:28:01 -0700
committerelijah <elijah@riseup.net>2013-05-19 22:28:01 -0700
commitf9d6b218be3bdbb2d3c544849b2ab92348d0e394 (patch)
tree71cd7ab6e5e9ffb4571b555324ada743c3d29387 /bin
parent5d2e69ad4f2b6214df52c617f5e6cb23d9f40944 (diff)
many related changes -- allow command line configs, validate addresses, overhaul bootstrap.
Diffstat (limited to 'bin')
-rwxr-xr-xbin/nickserver27
1 files changed, 10 insertions, 17 deletions
diff --git a/bin/nickserver b/bin/nickserver
index 8843dde..062684f 100755
--- a/bin/nickserver
+++ b/bin/nickserver
@@ -4,27 +4,20 @@
# Nickserver key discovery daemon
#
-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, requiring gems in Gemfile if it exists.
- base_directory = File.expand_path('../..', File.symlink?(__FILE__) ? File.readlink(__FILE__) : __FILE__)
- if File.exists?("#{base_directory}/Gemfile.lock")
- ENV['BUNDLE_GEMFILE'] ||= "#{base_directory}/Gemfile"
- require 'bundler'
- Bundler.require(:default)
- end
- $LOAD_PATH << "#{base_directory}/lib"
- require name
+def load_local_gem(dir_path='../..')
+ base_directory = File.expand_path(dir_path, File.symlink?(__FILE__) ? File.readlink(__FILE__) : __FILE__)
+ if !$LOAD_PATH.include? "#{base_directory}/lib"
+ if File.exists?("#{base_directory}/Gemfile.lock")
+ ENV['BUNDLE_GEMFILE'] ||= "#{base_directory}/Gemfile"
+ require 'bundler'
+ Bundler.require(:default)
end
+ $LOAD_PATH << "#{base_directory}/lib"
end
end
-load_library('nickserver')
+load_local_gem
+require 'nickserver'
Nickserver::Daemon.run('nickserver') do
EventMachine.run do