summaryrefslogtreecommitdiff
path: root/bin/nickserver
diff options
context:
space:
mode:
Diffstat (limited to 'bin/nickserver')
-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