Skip to content

v1.14.0

Compare
Choose a tag to compare
@leafo leafo released this 18 Apr 20:17
· 71 commits to master since this release
71ecc89

Install

luarocks install lapis

Additions

  • Add --rockspec command to lapis 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. See lapis 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. See lapis 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.

Fixes

  • Fix code reloading for cqueues when changes to package.path, package.cpath, package.searchers, and package.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 the lapis generate command if necessary, eg. lapis generate app

    • lapis new will now internally call lapis generate to create the necessary files
    • lapis 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 or app.moon)
      • config – For creating config.lua or config.moon
      • models – For creating autoloader modules.lua or modules.moon module
      • gitignore – For creating initial .gitignore when using lapis new --git
      • tupfile – For creating initial Tupfile and Tuprules.tup when using lapis new --tup
      • nginx.config – For creating initial nginx.conf
      • nginx.mime_types – For creating mime.types nginx configuration include
  • The default generated config for cqueues on MoonScript now longer includes fields for code_cache and num_workers, and instead now matches the Lua version of the config.

  • lapis.db db.clause supports a prefix option to optionally append something to the front of the encoded clause if it contains any fields.

  • lapis.db.model Generic preload 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 add skip_included option to do nothing on objects that already have the related field loaded

  • Model:include_in add loaded_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 to true)

  • 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 Add multi_params for joining two params_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