From 73eb4a54f734ce508aa57ebc27c54043e4da6125 Mon Sep 17 00:00:00 2001 From: elijah Date: Sat, 18 May 2013 16:39:30 -0700 Subject: if Gemfile.lock is present, then issue a Bundle.require --- bin/nickserver | 31 ++++++++++++++++++------------- 1 file changed, 18 insertions(+), 13 deletions(-) (limited to 'bin/nickserver') 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 -- cgit v1.2.3