Skip to content

Commit

Permalink
seperate some modules from model.lua.
Browse files Browse the repository at this point in the history
Signed-off-by: Daogang Tang <daogangtang@gmail.com>
  • Loading branch information
miketang84 committed Oct 13, 2012
1 parent 28b7397 commit 045a102
Show file tree
Hide file tree
Showing 625 changed files with 2,507 additions and 29,759 deletions.
34 changes: 0 additions & 34 deletions Makefile

This file was deleted.

25 changes: 19 additions & 6 deletions src/bin/bamboo_handler
Expand Up @@ -67,6 +67,22 @@ _G['View'] = require 'bamboo.view'
_G['Form'] = require 'bamboo.form'
_G['Model'] = require 'bamboo.model'
_G['Session'] = require 'bamboo.session'



config.config_file = config.config_file or "config.lua"
if config.monserver_dir then
-- format full directory of config_file, to find mongrel2's configuration
config.config_file = config.monserver_dir + '/' + config.config_file
end
config.route = config.route or '/'

local m2 = require 'bamboo.m2'
m2.loadConfig(config)
-- make a connection as the pipe interact with mongrel2
local conn = assert(m2.connect(config), "Failed to connect to monserver. ")
bamboo.conn = conn

local Web = require 'bamboo.web'

------------------------------------------------------------------------
Expand Down Expand Up @@ -126,11 +142,12 @@ local MappingTableConcrete, MappingTablePattern = makeUrlHandlerMapping(URLS)
bamboo.URLS = MappingTableConcrete
bamboo.PATTERN_URLS = MappingTablePattern

if not config.PRODUCTION then
print('-------------------- URL Settings --------------------')
ptable(MappingTableConcrete)
ptable(MappingTablePattern)
print('------------------------------------------------------')

end
------------------------------------------------------------------------
-- find handler function by path
-- @param path: coming path
Expand Down Expand Up @@ -379,7 +396,7 @@ local function run(conn, config)
print('Bamboo main loop aborted!')
end

local m2 = require 'bamboo.m2'


local function collectConfig(config)

Expand Down Expand Up @@ -426,10 +443,6 @@ end
-- @return: none
------------------------------------------------------------------------
local function start(config)
-- load sqlite3 configuration, update to config table
m2.loadConfig(config)
-- make a connection as the pipe interact with mongrel2
local conn = assert(m2.connect(config), "Failed to connect to monserver. ")

-- boot main loop
run(conn, config)
Expand Down
2 changes: 2 additions & 0 deletions src/bin/shell.lua
Expand Up @@ -7,6 +7,7 @@ local util = require 'bamboo.util'
-- load configuration
local config = util.readSettings(bamboo.config)
ptable(config)
config.is_shell = true

local DB_HOST = config.DB_HOST or arg[1] or '127.0.0.1'
local DB_PORT = config.DB_PORT or arg[2] or '6379'
Expand All @@ -22,3 +23,4 @@ setfenv(assert(loadfile('app/handler_entry.lua') or loadfile('../app/handler_ent

print('Entering bamboo shell.... OK')
return true

1 change: 0 additions & 1 deletion src/cmd_tmpls/admin/README

This file was deleted.

0 comments on commit 045a102

Please sign in to comment.