bin/sekka-server in sekka-0.9.6 vs bin/sekka-server in sekka-0.9.7

- old
+ new

@@ -3,12 +3,12 @@ require 'digest/md5' require 'fileutils' require 'rack' require 'uri' -require File.expand_path(File.dirname(__FILE__) + "/../lib/sekkaconfig") -require File.expand_path(File.dirname(__FILE__) + "/../lib/sekka/sekkaversion") +require 'sekkaconfig' +require 'sekka/sekkaversion' DICTDIR = File.expand_path( "~/.sekka-server" ) DICTURL = "https://raw.github.com/kiyoka/sekka/master/public_dict/" + SekkaVersion.dictVersion @@ -158,20 +158,26 @@ end # 設定項目をConfigオブジェクトに代入 SekkaServer::Config.setup( dictType, dictSource, MEMCACHED, 12929, proxyHost, proxyPort ) - # サーバースクリプトのrootディレクトリへ移動 - FileUtils.cd(File.dirname(__FILE__) + "/../") + # rackに渡すための sekka.ru のインストールパスを求める。 + vendordir = File.expand_path(File.dirname(__FILE__) + "/../lib") + if RbConfig::CONFIG[ 'vendordir' ] + if File.exists? RbConfig::CONFIG[ 'vendordir' ] + "/sekka.ru" + vendordir = RbConfig::CONFIG[ 'vendordir' ] + end + end + # print "vendordir = " + vendordir + "\n" # サーバー起動 Rack::Server.start( :environment => "development", :pid => nil, :Port => SekkaServer::Config.listenPort, :Host => "0.0.0.0", :AccessLog => [], - :config => "./lib/sekka.ru" + :config => vendordir + "/sekka.ru" ) end main()