Skip to content

Latest commit

 

History

History
171 lines (127 loc) · 5.39 KB

README.md

File metadata and controls

171 lines (127 loc) · 5.39 KB

lenv

test

Lua Version Manager.


Installation

  1. download a binary release from the releases page.
  2. extract the downloaded file and place the lenv command in the desired location. (e.g. /usr/local/bin/lenv)
  3. run a lenv setup command to set up the required files and directories.
    • you can also run a lenv -g setup command to set up the required files and directories in the /usr/local/lenv directory.

Setting up the .lenvrc file.

  1. run lenv path > ~/.lenvrc command to create the lenvrc file.
    • if you set up the required files and directories in the /usr/local/lenv directory, you should run a lenv -g path > ~/.lenvrc command.
  2. add the following to your .bashrc or .bash_profile file.
    source ~/.lenvrc

Commands

please run a help command to show the help message.

$ lenv help

lenv - lua version manager

Usage:
  lenv <option> <command> [<args>...]

Options:
  -g, --global                   Use /usr/local/lenv as installation directory

Commands:
  help                           Show this message
  setup                          Set up required files and directories
  path [<target>]                Show the configured paths

  Note:
    The <target> specifier of the above commands can be specified as follows;

    lenv path bin     ; show the PATH of the current lua environment
    lenv path lualib  ; show the LUA_PATH of the current lua environment
    lenv path luaclib ; show the LUA_CPATH of the current lua environment

    if <target> is not specified, all the above paths of the current lua
    environment will be shown.

  fetch                          Fetch remote versions
  vers                           List available versions
  ls                             List installed versions
  install <version> <opt...>     Install and use a <version> of lua
  use <version>                  Use a <version> of lua
  uninstall <version>            Uninstall a <version> of lua

  Note:
    The <version> specifier of the above commands can be specified as follows;

    lenv install latest  ; that picks the latest version
    lenv install 5       ; that picks the latest minor version and patch version
    lenv install 5.4     ; that picks the latest patch version
    lenv install lj-v2.1 ; that picks the version of luajit

    lenv install latest:latest ; that picks the the latest version of lua and
                               ; luarocks in current lua environment
    lenv install :latest       ; that picks the the latest version of luarocks
                                 in current lua environment

    If the version of luarocks is specified along with the version of lua, the
    operation will target the specified version of the lua environment.
    Otherwise, the operation will target the current lua environment.

    In the case of the 'uninstall' command, the version specifier must match the
    target version exactly. Also, if the version of luarocks is specified along
    with the version of lua, the version specifier of luarocks is ignored.

NOTE: you must run a fetch command at the first. that command will crawling the version files of Lua, LuaJIT and LuaRocks immediately.

$ lenv fetch
...snip...
$ lenv vers
...snip...

Package URL's

the following URL's are used to download the version files and source files.

Usage

the following example are installing the Lua 5.1.5.

$ lenv install 5.1.5 macosx
...snip...
$ lua -v
Lua 5.1.5  Copyright (C) 1994-2012 Lua.org, PUC-Rio

the following example are installing the LuaJIT v2.1.

$ lenv install lj-v2.1
...snip...
$ lua -v
LuaJIT 2.1.1710088188 -- Copyright (C) 2005-2023 Mike Pall. https://luajit.org/

the following example are installing the LuaRocks 3.5.0 for Lua 5.1.5.

$ lenv use 5.1.5
use lua version 5.1.5 ("lua/5.1.5")
$ lenv install-rocks 3.5.0
...snip...
$ luarocks --version
/Users/mah/.lenv/current/lua_modules/bin/luarocks 3.5.0
LuaRocks main command-line interface

the following example are installing the lua and luarocks at same time.

$ lenv install 5.1.:latest
...snip...
$ lua -v
Lua 5.1.5  Copyright (C) 1994-2012 Lua.org, PUC-Rio
$ luarocks --version
/Users/mah/.lenv/current/lua_modules/bin/luarocks 3.9.2
LuaRocks main command-line interface

Installation Locations

lenv manages the following directories.

~/.lenv
├── current                 -> symlink to the `lua/<ver> or `luajit/<ver>` directory
├── lua/<ver>               -> lua installation directory
│   ├── lua_modules         -> symlink to `luarocks/<ver>/lua_modules`
│   └── luarocks/<ver>      -> luarocks installation directory for lua/<ver>
│       └── lua_modules
│           ├── bin         -> symlink to `luarocks/<ver>/bin`
│           ├── lualib/<N>  -> symlink to LUA_PATH/LUA_CPATH directories under 
│           └── luaclib/<N>    the luarocks/<ver> directory
│
├── luajit/<ver>            -> luajit installation directory
│   │
│   :: same layout as the lua/<ver> directory ::
│
└── src
    └── <cache>.tar.gz