summaryrefslogtreecommitdiff
path: root/bin/nickserver
blob: 0890def71c0512d2507a02ac03bbfbfd9a3e7662 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#!/usr/bin/env ruby

#
# Nickserver key discovery daemon
#

def load_local_gem(dir_path = '../..')
  actual_file = File.symlink?(__FILE__) ? File.readlink(__FILE__) : __FILE__
  base_directory = File.expand_path(dir_path, actual_file)
  unless $LOAD_PATH.include? "#{base_directory}/lib"
    if File.exist?("#{base_directory}/Gemfile.lock")
      ENV['BUNDLE_GEMFILE'] ||= "#{base_directory}/Gemfile"
      require 'bundler'
      Bundler.require(:default)
    end
    $LOAD_PATH << "#{base_directory}/lib"
  end
end

load_local_gem
require 'nickserver/daemon'
require 'nickserver/server'

Nickserver::Daemon.run('nickserver') do
  Nickserver::Server.start
  sleep
end