Class: RibitConfigParser

Inherits:
Object
  • Object
show all
Defined in:
lib/ribit/config.rb

Instance Method Summary collapse

Instance Method Details

#parse(fileName) ⇒ Object

Parses an XML file and returns instance of RibitPage



80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
# File 'lib/ribit/config.rb', line 80

def parse( fileName )
  file = File.new( fileName )
  begin    
     doc = REXML::Document.new file
    @ribitConfig = RibitConfig.new
    
    config = doc.elements['ribitconfig']
    if ( config != nil )
      read_prop( config, RibitConfig::HTTP_PORT )
      read_prop( config, RibitConfig::HTTP_HOST )
      read_prop( config, RibitConfig::MOUNT_POINT )
      read_prop( config, RibitConfig::DATA_PATH )
      read_prop( config, RibitConfig::DATA_RELOAD )
      read_prop( config, RibitConfig::USER_ID )
      read_prop( config, RibitConfig::GROUP_ID )
      read_prop( config, RibitConfig::PID_FILE )
      read_prop( config, RibitConfig::MAIN_PAGE )
      read_prop( config, RibitConfig::CVSROOT )
      read_prop( config, RibitConfig::PAGE_CACHE_DIR )
    end
    
  ensure
    file.close
  end
  
  # read logging properties
  RibitLoggerConfig.init_from_file( fileName )
    
  return @ribitConfig
end