An OpenResty Lua MVC Web Framework
vanilla.v.libs.cache
,vanilla.v.cache.mc
,vanilla.v.cache.lru
etc.New Features
1.install vanilla 0.1.--rc6.0 is same to rc5.
2.Loaders useage.
-- LoadLibrary to load application's Library.
LoadLibrary('aa') -- ~/data/vanilla/ok/application/library/aa.lua
-- LoadController to load application's Controller.
LoadController('index') -- ~/data/vanilla/ok/application/controllers/index.lua
-- LoadModel to load application's Model.
LoadModel('service.user') -- ~/data/vanilla/ok/application/models/service/user.lua
-- LoadPlugin to load application's Plugin.
-- LoadApplication to load application's Application dir.
LoadApplication('controller.index') -- ~/data/vanilla/ok/application/controllers/index.lua
-- LoadApp to load libs from Application root.
LoadApp 'application.bootstrap' -- ~/data/vanilla/ok/application/bootstrap.lua
-- LoadV to load Vanilla FrameWork libs.
LoadV 'vanilla.v.error' -- ~/data/vanilla/framework/0_1_0_rc6/vanilla/v/error.lua
3.OO practice
-- ~/data/vanilla/ok/application/library/bb.lua
local LibBb = Class("bb")
function LibBb:idevzDo(params)
local params = params or { lib_bb = 'idevzDo LibBb'}
return params
end
function LibBb:__construct( data )
print_r('===============init bbb=========')
self.lib = 'LibBb---------------xxx' .. data.info
-- self.a = 'ppp'
end
function LibBb:idevzDobb(params)
local params = params or { lib_bb = 'idevzDo idevzDobb'}
return params
end
return LibBb
-- ~/data/vanilla/ok/application/library/aa.lua
local LibAa = Class("aa", LoadLibrary('bb'))
function LibAa:idevzDo(params)
local params = params or { lib_aa = 'idevzDo LibAa'}
return params
end
function LibAa:__construct( data )
print_r('===============init==aaa=======' .. data.info)
-- self.parent:init()
self.lib = 'LibAa----------------------------aaaa'
end
return LibAa
-- ~/data/vanilla/ok/application/controllers/index.lua
local IndexController = Class('controllers.index')
local aa = LoadLibrary('aa')
function IndexController:__construct()
self.aa = aa({info='ppppp'})
local get = self:getRequest():getParams()
self.d = '===============index===============' .. get.act
end
function IndexController:index()
-- self.parent:fff()
do return user_service:get()
.. sprint_r(aa:idevzDobb())
.. sprint_r(self.aa:idevzDobb())
-- .. sprint_r(self.parent.aaa)
.. Registry['APP_NAME']
.. self.d
end
local view = self:getView()
local p = {}
p['vanilla'] = 'Welcome To Vanilla...' .. service:get()
p['zhoujing'] = 'Power by Openresty'
view:assign(p)
return view:display()
end
return IndexController
New Features
1.install vanilla with its version, thus for easier updating.
$ git clone [email protected]:idevz/vanilla.git
$ cd vanilla
$ ./setup-framework -v $VANILLA_PROJ_ROOT -o $OPENRESTY_ROOT #see ./setup-framework -h for more details
after installation you can got two commands vanilla-
and v-console
which with a version number.
2.Vanilla apps use thire own vhost conf both in development and production environment. You shoud give a full path(-a $VANILLA_APP_ROOT) to setup a Vanilla app.
$ ./setup-vanilal-demoapp [-a $VANILLA_APP_ROOT -u $VANILLA_APP_USER -g $VANILLA_APP_GROUP -e $VANILLA_RUNNING_ENV] #see ./setup-vanilal-demoapp -h for more details
3.You can use va-{{vanilla app name}}-service script to manage each service.
$ ./$VANILLA_APP_ROOT/va-appname-service start
1.fix a bug about restful route,when get params from request 2.add a way to parse request params 3.The most important thing is V0.1.0-rc5.0 is coming, create this tag for this milepost.
fix some bugs: 1.Waf bug about "attempt to yield across C-call boundary" 2.change lua file permissions to 644 3.add BSD installnations 4.update luarocks installnations 5.update errinfo "Vanilla Inner Lpcall Err." and "Plugins Err"
Use "make" instead luarocks to install vanilla, make vanilla more easy to ues. Reduce package dependency. Implements a router and a set of pluggable routing protocol. Specifies nginx bin PATH for vanilla start or stop, Specifies lua or luajit bin PATH for vanilla command. Pcall call local static functions instead of dynamic functions. Ning conf file can use {{NGX_PATH}} as a config params.
This version includes specification request process, perfect routing, plug-ins, request distribution, view and controller, the bootstrap components.Vanilla's infrastructure has been completed
just contain the base feature
--vanilla system settings
sys/application
sys/vanilla
sys/application
sys/config
sys/nginx/handle
sys/nginx/directive
sys/nginx/config
--a vanilla app
v/application
v/bootstrap
v/controller
v/dispatcher
v/error
v/libs/utils
v/libs/http
v/registry
v/request
v/response
v/routes/simple
v/view
v/views/rtpl