v1.14.0
Install
luarocks install lapis
Additions
- Add
--rockspec
command tolapis new
- Add
lapis generate migration
command to either create blank migration file or append a new migration at the end of the existing migration file. Seelapis generate migration --help
for more information- Can append to Lua and MoonScript migrations files. It may not be able to edit all types of migration files, ensure that you return a simple table.
- Support for appending either timestamp named migration or incrementing counter named migration
- Add
lapis generate rockspec
command to create a new rockspec for managing app dependencies. Seelapis generate rockspec --help
for more information- It will automatically detect the app name fro the current directory, if not specified with
--app-name
- It will automatically detect the git source URL from the current directory if a git repository has been created and has a remote
- Additional initial dependencies can be included with flags like
--postgres
,--sqlite
,--moonscript
, etc.
- It will automatically detect the app name fro the current directory, if not specified with
Fixes
- Fix code reloading for cqueues when changes to
package.path
,package.cpath
,package.searchers
, andpackage.loaders
is involved- These values will be reset to prevent infinitely growing module search path when reloading code
- Fix bug with
lapis simulate
command where header output wouldn't be normalized correctly - Fix bug where
lapis.validate.types
params_shape
was not correctly passing initial state object through the validation
Changes
-
Update custom sub-command runner to support running commands with
argparse
specification- Update built in support for lapis annotate and lapis sytemd to work with this new system. It is necessary to update both of those packages if you wish to use them with this version of Lapis
-
Rewrite all template files that
lapis new
creates as generator modules. All of these files can be independently created using thelapis generate
command if necessary, eg.lapis generate app
lapis new
will now internally calllapis generate
to create the necessary fileslapis generate {NAME} --help
can now be used for every template generator to view configuration options- List of updated generators: (these can be called with
lapis generate {NAME}
)app
– For creating initial lapis application file in (app.lua
orapp.moon
)config
– For creatingconfig.lua
orconfig.moon
models
– For creating autoloadermodules.lua
ormodules.moon
modulegitignore
– For creating initial.gitignore
when usinglapis new --git
tupfile
– For creating initial Tupfile and Tuprules.tup when usinglapis new --tup
nginx.config
– For creating initialnginx.conf
nginx.mime_types
– For creatingmime.types
nginx configuration include
-
The default generated config for cqueues on MoonScript now longer includes fields for
code_cache
andnum_workers
, and instead now matches the Lua version of the config. -
lapis.db
db.clause
supports aprefix
option to optionally append something to the front of the encoded clause if it contains any fields. -
lapis.db.model
Genericpreload
can take the a callback function with the name of a relation to execute a callback on the loaded objects. Eg. `preload(users, { profile = function(profiles) ... end }) -
Model:include_in
addskip_included
option to do nothing on objects that already have the related field loaded -
Model:include_in
addloaded_results_callback
option to provide a function callback to be called with with the list of objects that were fetched from the query -
Model:include_in
when loading objects by a composite key, duplicate composite values will be stripped to reduce the size of the query generated (Singular keys already functioned this way) -
lapis.db.model.relations
mark_loaded_relations
can now take a third argument of a value to set for the relation (defaults totrue
) -
lapis.util
singularize
function has been improved slightly with more cases (eg. vertex, child, index, status) and will work with all capital words. Note that this function will never be comprehensive, only suitable for calculating a quick default in scenarios where names aren't explicitly specified -
lapis.validate.types
Addmulti_params
for joining twoparams_shape
objects together
Internal Changes
- Rewrite generic
preload
- Add much more comprehensive test suite for generic
preload
Full Changelog: v1.13.1...v1.14.0