Masato Taruishi
taru****@users*****
2004年 9月 16日 (木) 15:04:43 JST
=================================================================== RCS file: demo/haviewer/lib/ultrapossum.rb,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- demo/haviewer/lib/ultrapossum.rb 2004/09/11 14:52:16 1.1 +++ demo/haviewer/lib/ultrapossum.rb 2004/09/16 06:04:43 1.2 @@ -41,13 +41,22 @@ VARIABLES[m] = variables(m) end - def initialize - open("|ultrapossum-config get") do |io| + def initialize( sysconfdir = nil ) + env = "" + if ! sysconfdir.nil? + if FileTest.directory?( sysconfdir ) + env = "SYSCONFDIR=#{sysconfdir}" + else + raise "No such directory: #{sysconfdir}" + end + end + open("|sh -c '#{env} ultrapossum-config get'") do |io| io.each_line do |line| /([^=]+)=\"(.*)\"/ =~ line - self[$1] = $2 - end + self[$1] = $2 + end end + end end @@ -61,7 +70,7 @@ puts "\t#{v}" end end - conf = UltraPossum::Config.new + conf = UltraPossum::Config.new(ARGV[0]) conf.each_key do |key| puts "#{key} -> #{conf[key]}" end