Skip to content

Commit

Permalink
docs: update README
Browse files Browse the repository at this point in the history
  • Loading branch information
un-def committed May 4, 2024
1 parent 1893752 commit 2837283
Showing 1 changed file with 45 additions and 23 deletions.
68 changes: 45 additions & 23 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,46 +11,68 @@ Lua environment manager built on top of [hererocks](https://github.com/luarocks/

## Installation

1. Install `luamb` using `pip` (`hererocks` will be installed automatically):
1. Install luamb using `pip`:

```sh
pip install [--user] luamb
```

2. Create a directory for environments:
or `pipx`:

```sh
mkdir $HOME/.luambenvs
pipx install luamb
```

3. Configure your shell (add these lines to `~/.bashrc` or `~/.zshrc`):
2. Set up your shell add the following to `~/.bashrc` or `~/.zshrc`:

```sh
# path to the directory with environments
export LUAMB_DIR=$HOME/.luambenvs
# optional variables:
export LUAMB_LUA_DEFAULT='lua 5.3' # default Lua version
export LUAMB_LUAROCKS_DEFAULT=latest # default LuaRocks version
LUAMB_DISABLE_COMPLETION=true # disable shell completions
LUAMB_PYTHON_BIN=/usr/bin/python3 # explicitly set Python executable
# make some magic
source <(luamb shellsrc)
# or if luamb executable is not in PATH:
source <("$LUAMB_PYTHON_BIN" -m luamb shellsrc)
```

4. Try to execute in a new shell:
3. Install hererocks:

```sh
luamb --help
luamb update
```


## Configuration

luamb is configured via environment variables.

* `LUAMB_HOME`

A directory where luamb stores its data (hererocks, environments, etc.). The default value is `$XDG_DATA_HOME/luamb` (usually `~/.local/share/luamb`) on Linux and `~/Library/Application Support/luamb` on macOS.

* `LUAMB_ENVS_DIR`

A directory where luamb stores environments. The default value is `$LUAMB_HOME/envs`.

* `LUAMB_LUA_DEFAULT`

A default Lua interpreter/version. The format is `interpreter version_specifier`, e.g., `lua 5.3`, `luajit @v2.1`, `moonjit /path/to`, `raptorjit latest`.

* `LUAMB_LUAROCKS_DEFAULT`

A default LuaRocks version, e.g, `latest`, `3.11.0`.

* `LUAMB_DISABLE_COMPLETION`

Set to `true` to disable shell completions.

* `LUAMB_PYTHON_BIN`

If the luamb executable is not in `PATH`, set `LUAMB_PYTHON_BIN` to the Python executable with the `luamb` package installed and change the shell initialization command:

```sh
export LUAMB_PYTHON_BIN=/path/to/bin/python
source <("$LUAMB_PYTHON_BIN" -m luamb shellsrc)
```


## Examples

* Create an environment 'myproject' with the latest Lua 5.2 (5.2.4), the latest LuaRocks and associate it with /home/user/projects/myproject:
* Create an environment 'myproject' with the latest Lua 5.2, the latest LuaRocks and associate it with /home/user/projects/myproject:

```sh
luamb mk myproject -l 5.2 -r latest -a /home/user/projects/myproject
Expand All @@ -62,7 +84,7 @@ Lua environment manager built on top of [hererocks](https://github.com/luarocks/
luamb mk jittest -j 2.0.4 -a /home/user/projects/jitproj
```

* Set the latest LuaJIT 2.0 (2.0.5) and the latest LuaRocks version by default:
* Set the latest LuaJIT 2.0 and the latest LuaRocks as default versions:

```sh
export LUAMB_LUA_DEFAULT='luajit 2.0'
Expand All @@ -75,7 +97,7 @@ Lua environment manager built on top of [hererocks](https://github.com/luarocks/
luamb mk newenv
```

* Create an environment 'norocks' with the default Lua version (LuaJIT 2.0.5) and without LuaRocks (verbose mode):
* Create an environment 'norocks' with the default Lua version and without LuaRocks (verbose mode):

```sh
luamb mk norocks --no-luarocks --verbose
Expand All @@ -102,14 +124,14 @@ Lua environment manager built on top of [hererocks](https://github.com/luarocks/

## Commands

Each command has one or more aliases.

* `on` | `enable` | `activate` — activate an environment
* `off` | `disable` | `deactivate` — deactivate the current environment
* `mk` | `new` | `create` — create a new environment
* `rm` | `remove` | `del` | `delete` — remove an environment
* `info` | `show` — Show the details for a single virtualenv
* `ls` | `list` — list all of the environments
* `update` — install/update the `hererocks` script
* `shellsrc` — print the shell initialization code


## Version history
Expand Down

0 comments on commit 2837283

Please sign in to comment.