Giter Club home page Giter Club logo

modulekit's Introduction

Lua module template for Tarantool 1.6+

Use this template to create and publish a Tarantool module written in pure Lua.

Note: If you write a Tarantool module in C, see the ckit branch of this repository.

Table of contents

Kit content

  • ./README.md - this file
  • ./luakit/init.lua - the Lua module itself, loaded with require('luakit')
  • ./luakit-scm-1.rockspec - a specification for the tarantool/rocks repository
  • ./test/luakit.test.lua - tests for the module
  • ./rpm/ - files to build an RPM package
  • ./debian/ - files to build a DEB package

Prerequisites

Tarantool 1.6.8+ with header files (tarantool and tarantool-dev packages)

Usage

  1. Clone this repository.

    git clone https://github.com/tarantool/modulekit.git

    The default branch is luakit, which is what you need for a module in pure Lua.

  2. Rename all files to use your favorite name.

    For example, mymodule:

    grep -R luakit .
    mv luakit/ mymodule/
    mv test/luakit.test.lua test/mymodule.test.lua
    ...
  3. Implement your code in ./mymodule/.

    You will have one or more Lua modules that export their functions for API calls.

    As an example, see the Lua module luakit/init.lua from the luakit package. Here we have one internal function (test()), and we export it as test for API calls.

    As a result, after we publish the luakit package in step 7, Tarantool users will be able to load the package and call the function test() with require('luakit').test(arg).

    Note: The basics of creating a Lua module for Tarantool are explained in the Tarantool manual.

  4. Add tests to ./test/mymodule.test.lua:

    prove -v ./test/luakit.test.lua or ./test/luakit.test.lua
  5. Update copyright and README files.

  6. Push all files except rpm/, debian/ and mymodule-scm-1.rockspec.

  7. Update and check the rockspec.

    A .rockspec file wraps a module into a package. This is what you can publish. If you are new to Lua rocks, see general information on rockspec format and creation.

    Your rockspec must comply with these requirements and allow to build and install your package locally:

    luarocks install --local mymodule-scm-1.rockspec

    See an annotated rockspec example in luakit-scm-1.rockspec.

  8. Push your rockspec and make a pull request to the tarantool/rocks repository.

    The Tarantool team will review the request and decide on including your package in Tarantool rocks list and official Tarantool images for Docker.

  9. [Optional] Check DEB packaging and push debian/ to GitHub.

    dpkg-buildpackage -D -b -us -uc
    ls -l ../*.deb
  10. [Optional] Check RPM packaging and push rpm/ to GitHub.

    tar cvzf ~/rpmbuild/SOURCES/tarantool-mymodule-1.0.0.tar.gz
    rpmbuild -b rpm/tarantool-mymodule.spec

Enjoy! Thank you for contributing to Tarantool.

Examples

See also

modulekit's People

Contributors

bigbes avatar funny-falcon avatar kostja avatar lenkis avatar rtsisyk avatar runsfor avatar totktonada avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

modulekit's Issues

ckit: add build with ASAN

Let's add some helpers/flags to build module with ASAN. I think it's quite important to create test infrastructure for C modules as SMTP, kafka, HTTP, etc.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.