v1.11.0
Install
luarocks install lapis
Highlights
- Substantially improved performance for
url_for
generation - Introduce
db.clause
- Lua is now first class. Etlua improvements. Application class APIs match Lua & MoonScript. Documentation and APIs show Lua by default
- Homepage and documentation have been substantially updated
Additions
lapis.db
Add thedb.clause
constructor for safely building SQL fragments including clauses and conditionals- All db related methods can now take
db.clause
objects when appropriate for configuring filtering (eg.Model:find
, relationwhere:
clause, etc.) lapis.db
Thelapis.db.encode_clause
function can be used to convert adb.clause
object a fragment of SQL codelapis.application
AddApplication:extend()
method to create a sub-class ofApplication
when MoonScript is not availablelapis.application
All route related methods are now consistently available for both application instances and classes. This includesinclude
,match
,extend
,find_action
,before_filter
,get
,post
,put
,delete
lapis.session
Theget_session
function can now take a string object as first argument, as an alternative to the request object, to decode a session from a cookie's string valuelapis.html
AddWidget:extend()
method for creating sublcass of theWidget
class when MoonScript is not availablelapis.html
Theclassnames
function will now recurisvely evaluate any tables in the argumentlapis.html
Addis_mixins_class
function to determine if a class is a dynamically generated mixin class created byWidget:include
lapis.etlua
Theelement
function has been added to the template scope to allow rendering HTML elements programmatically (similar to the HTML builder syntax)lapis.etlua
self
has been added to the template scope to allow accessing the instance of theEtluaWidget
- The
lapis migrate
command now supports a--transaction
flag, can be set toglobal
to apply a transaction across all migrations to be run, orindividual
to apply a transaction to each migration run. lapis.flow
AddFlow:extend()
method for sublcassing theFlow
class
Changes
lapis.db
Internally, queries now usedb.clause
to generate SQL conditional statements . This means that order of certain fields may now be different when usingwhere
clauses.lapis.db
It is no longer possible to override fields configured by a relation when specifying awhere:
option. This also applies to paginators generated for relationslapis.db.model
Relations can now be specified with a direct reference to a Model class, or a function that should resolve to a Model class (existing support for relation name has not changed)lapis.application
Inheritance of routes is now more well defined, allowing for route names and paths to be overidden by subclasses or instances during the creation of the router. If you aren't using application inheritance then this will not affect you.lapis.application
Lazy action loading is now supported for actions generated byinclude
and actions built by the HTTP verbmatch
helpers (get
,post
, etc.). Previously, if provided an action name (ortrue
), it would load the action module immediately. Now all named actions are consistently loaded on first request regardless of where they are usedlapis.application
Thefind_action
method now searches up inheritance hierarchy, and can be used on both app classes and instanceslapis.application
Trying to callenable
ormatch
directly on thelapis.Application
class reference will now throw an error to help prevent accidentally mutating the global objectlapis.html
TheWidget:render()
method will now return nothing instead ofnil
lapis.router
Router URL creation (akaurl_for
) has been rewritten to be substantially faster. Previously routes were re-parsed on calls tourl_for
but will not generate from a cached intermediate form that will allow the URL to be generated with little overhead.lapis.cqueues
Add error capturing around the app boot process to provide better error message when attempting to load a faulty app, and prevent infinite loop processing bug fromlua-http
- The environment variable
LAPIS_FORCE_LOGGING
can not be set to0
to force logging off - The
application
field is no longer present on thelapis.init
module. This was never documented. Userequire("lapis.application")
instead. - Many error messages have been rewritten to be prefixed with the module or method they originate from
Internal Changes
These changes should have no effect on the end user implementing an app, but
they are documented here in case you were depending on the undocumented
structure of lapis
lapis.application
The internal structure used by the HTTP verbmatch
helpers has been changed (get
,post
, etc.)lapis.router
Parsed routes are now stored, and the arguments forfill_path
have changedlapis.application
The way routes are internally managed and iterated has been rewritten to provide unified interface based on metatable inheritance. Thelapis.application.route_group
module has been added to work with this interface.
Misc
- Substantial updates to documentation, including rewrites for clarify and documenting fields that were previously not documented.
- Changes to the homepage to prioritize Lua syntax over MoonScript to reduce confusion about what & who the framework is for
Full Changelog: v1.10.0...v1.11.0