核心引擎负责处理所有的数据和状态逻辑,此核心可以完全独立于Rails框架而自成体系。

主引擎:

ruby 代码
  1. #2007-5-30 wiwolf@126.com   
  2. # Homepage  http://eve.woygo.com   
  3. # Support http://rails.woygo.com   
  4. #Copyright (c) 2007 Ye Tian   
  5. # Licensed under the Apache License, Version 2.0 (the "License");   
  6. # you may not use this file except in compliance with the License.   
  7. # You may obtain a copy of the License at   
  8.   
  9. #       http://www.apache.org/licenses/LICENSE-2.0   
  10.   
  11. # Unless required by applicable law or agreed to in writing, software   
  12. # distributed under the License is distributed on an "AS IS" BASIS,   
  13. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.   
  14. # See the License for the specific language governing permissions and   
  15. # limitations under the License.   
  16.   
  17. #This is base for engine.   
  18.   
  19. require File.join(File.dirname(__FILE__),'logger')   
  20. require File.join(File.dirname(__FILE__),'online')   
  21. require File.join(File.dirname(__FILE__),'eve')   
  22. class Eden   
  23.   #Include log module   
  24.   include EdenLogger   
  25.      
  26.   #Include onlie module   
  27.   include OnlineModule   
  28.      
  29.   #Include eve module   
  30.   include Eve   
  31.      
  32.   #initialize   
  33.   private_class_method :new  
  34.   @@eden = nil  
  35.   def Eden.create   
  36.     @@eden = new unless @@eden  
  37.     @@eden  
  38.   end  
  39.      
  40.   def initialize   
  41.        
  42.     engine_config = YAML.load_file('lib/eden/config/config.yml')   
  43.        
  44.     #initialize logger   
  45.     init_logger_module engine_config['logger_file'],engine_config['logger_file_dir'],engine_config['logger_level']   
  46.        
  47.     #initialize eve   
  48.     init_eve_module   
  49.     #start maintenance thread   
  50.     init_online_module   
  51.        
  52.     @logger.info 'Eden was initialized.'   
  53.   end  
  54. end  
  • 849b19d8-b8e9-4039-8f09-cfb6017e5d7e-thumb
  • 描述:
  • 大小: 96.8 KB
评论
发表评论

您还没有登录,请登录后发表评论

wiwolf
搜索本博客
最近加入圈子
存档
最新评论