diff options
author | elijah <elijah@riseup.net> | 2013-05-19 22:28:01 -0700 |
---|---|---|
committer | elijah <elijah@riseup.net> | 2013-05-19 22:28:01 -0700 |
commit | f9d6b218be3bdbb2d3c544849b2ab92348d0e394 (patch) | |
tree | 71cd7ab6e5e9ffb4571b555324ada743c3d29387 /bin | |
parent | 5d2e69ad4f2b6214df52c617f5e6cb23d9f40944 (diff) |
many related changes -- allow command line configs, validate addresses, overhaul bootstrap.
Diffstat (limited to 'bin')
-rwxr-xr-x | bin/nickserver | 27 |
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 |