[Hiki-cvs 1542] [1089] now can specify config_path

Back to archive index

svnno****@sourc***** svnno****@sourc*****
2009年 11月 24日 (火) 22:47:17 JST


Revision: 1089
          http://sourceforge.jp/projects/hiki/svn/view?view=rev&revision=1089
Author:   okkez
Date:     2009-11-24 22:47:17 +0900 (Tue, 24 Nov 2009)

Log Message:
-----------
now can specify config_path

Modified Paths:
--------------
    hiki/branches/rack/hiki/app.rb
    hiki/branches/rack/hiki/attachment.rb
    hiki/branches/rack/hiki/config.rb
    hiki/branches/rack/hiki.ru

Modified: hiki/branches/rack/hiki/app.rb
===================================================================
--- hiki/branches/rack/hiki/app.rb	2009-10-20 15:03:07 UTC (rev 1088)
+++ hiki/branches/rack/hiki/app.rb	2009-11-24 13:47:17 UTC (rev 1089)
@@ -9,12 +9,15 @@
 
 module Hiki
   class App
+    def initialize(config_path = 'hikiconf.rb')
+      @config_path = config_path
+    end
     def call(env)
       request = Rack::Request.new(env)
       # TODO use Rack::Request#env or other methods instead of ENV
       # HACK replace ENV values to web application environment
       env.each{|k,v| ENV[k] = v.to_s unless /\Arack\./ =~ k }
-      conf = Hiki::Config.new
+      conf = Hiki::Config.new(@config_path)
       response = nil
       if %r|text/xml| =~ request.content_type and request.post?
         server = Hiki::XMLRPCServer.new(conf, request)

Modified: hiki/branches/rack/hiki/attachment.rb
===================================================================
--- hiki/branches/rack/hiki/attachment.rb	2009-10-20 15:03:07 UTC (rev 1088)
+++ hiki/branches/rack/hiki/attachment.rb	2009-11-24 13:47:17 UTC (rev 1089)
@@ -10,11 +10,14 @@
 module Hiki
   class Attachment
     include ::Hiki::Util
+    def initialize(config_path)
+      @config_path = config_path
+    end
     def call(env)
       request = Hiki::Request.new(env)
       # HACK replace ENV values to web application environment
       env.each{|k,v| ENV[k] = v unless /\Arack\./ =~ k }
-      conf = Hiki::Config.new
+      conf = Hiki::Config.new(@config_path)
       response = attach_file(request, conf)
       response.finish
     end

Modified: hiki/branches/rack/hiki/config.rb
===================================================================
--- hiki/branches/rack/hiki/config.rb	2009-10-20 15:03:07 UTC (rev 1088)
+++ hiki/branches/rack/hiki/config.rb	2009-11-24 13:47:17 UTC (rev 1089)
@@ -23,8 +23,8 @@
 
   class Config
     include ::Hiki::Util
-    def initialize
-      load
+    def initialize(config_path = 'hikiconf.rb')
+      load(config_path)
       load_cgi_conf
 
       load_messages
@@ -123,9 +123,9 @@
     private
 
     # loading hikiconf.rb in current directory
-    def load
+    def load(config_path = 'hikiconf.rb')
       @options = {}
-      eval( File.open( "hikiconf.rb" ){|f| f.read }.untaint, binding, "(hikiconf.rb)", 1 )
+      eval( File.open(config_path){|f| f.read }.untaint, binding, "(#{config_path})", 1 )
       formaterror if $data_path
 
       raise 'No @data_path variable.' unless @data_path

Modified: hiki/branches/rack/hiki.ru
===================================================================
--- hiki/branches/rack/hiki.ru	2009-10-20 15:03:07 UTC (rev 1088)
+++ hiki/branches/rack/hiki.ru	2009-11-24 13:47:17 UTC (rev 1089)
@@ -12,8 +12,8 @@
 use Rack::Static, :urls => ['/theme'], :root => '.'
 
 map '/' do
-  run Hiki::App.new
+  run Hiki::App.new('hikiconf.rb')
 end
 map '/attach' do
-  run Hiki::Attachment.new
+  run Hiki::Attachment.new('hikiconf.rb')
 end




Hiki-cvs メーリングリストの案内
Back to archive index