From f9d6b218be3bdbb2d3c544849b2ab92348d0e394 Mon Sep 17 00:00:00 2001 From: elijah Date: Sun, 19 May 2013 22:28:01 -0700 Subject: many related changes -- allow command line configs, validate addresses, overhaul bootstrap. --- bin/nickserver | 27 ++++++++++----------------- 1 file changed, 10 insertions(+), 17 deletions(-) (limited to 'bin') 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 -- cgit v1.2.3