Skip to content

Commit

Permalink
chore(readme): update dev section
Browse files Browse the repository at this point in the history
  • Loading branch information
Atticus committed Jun 22, 2024
1 parent 79756cb commit 2e10375
Show file tree
Hide file tree
Showing 3 changed files with 111 additions and 1 deletion.
1 change: 0 additions & 1 deletion .github/workflows/ant.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ jobs:
run: luarocks install ar-io-ao-0.1-1.rockspec

- name: Run Busted Tests
working-directory: ant
run: busted .

- name: Upload coverage reports to Codecov
Expand Down
96 changes: 96 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,102 @@ Removes a record from the ANT.
| Action | string | "Remove-Record" | true | Action tag for triggering handler |
| Sub-Domain | string | "^(?:[a-zA-Z0-9_-]+\|@)$" | true | Subdomain of the record to remove. |

## Developers

### Requirements

- Lua 5.3 - [Download](https://www.lua.org/download.html)
- Luarocks - [Download](https://luarocks.org/)

### Lua Setup (MacOS)

1. Clone the repository and navigate to the project directory.
1. Install `lua`
- `brew install [email protected]`
1. Add the following to your `.zshrc` or `.bashrc` file:

```bash
echo 'export LDFLAGS="-L/usr/local/opt/[email protected]/lib"' >> ~/.zshrc
echo 'export CPPFLAGS="-I/usr/local/opt/[email protected]/include"' >> ~/.zshrc
echo 'export PKG_CONFIG_PATH="/usr/local/opt/[email protected]/lib/pkgconfig"' >> ~/.zshrc
echo 'export PATH="/usr/local/opt/[email protected]/bin:$PATH"' >> ~/.zshrc
```

1. Run `source ~/.zshrc` or `source ~/.bashrc` to apply the changes.
1. Run `lua -v` to verify the installation.

### LuaRocks Setup

1. Install `luarocks`

```bash
curl -R -O http://luarocks.github.io/luarocks/releases/luarocks-3.9.1.tar.gz
tar zxpf luarocks-3.9.1.tar.gz
cd luarocks-3.9.1
./configure --with-lua=/usr/local/opt/[email protected] --with-lua-include=/usr/local/opt/[email protected]/include
make build
sudo make install
```

1. Check the installation by running `luarocks --version`.
1. Check the LuaRocks configuration by running `luarocks config | grep LUA`

If you ever need to refresh .luarocks, run the following command:

```sh
luarocks purge && luarocks install ar-io-ao-0.1-1.rockspec
```

### aos

To load the module into the `aos` REPL, run the following command:

```sh
aos --load src/main.lua
```

### Code Formatting

The code is formatted using `stylua`. To install `stylua`, run the following command:

```sh
cargo install stylua
stylua contract
```

### Testing

To run the tests, execute the following command:

```sh
busted .
```

To see the test coverage, run the following command:

```sh
luacov --reporter html && open luacov-html/index.html
```

### Dependencies

To add new dependencies, install using luarocks to the local directory

```sh
luarocks install <package>
```

And add the package to the `dependencies` table in the `ar-io-ao-0.1-1.rockspec` file.

```lua
-- rest of the file
dependencies = {
"lua >= 5.3",
"luaunit >= 3.3.0",
"<package>"
}
```

# Additional Resources

- [AR.IO Gateways]
Expand Down
15 changes: 15 additions & 0 deletions ar-io-ao-0.1-1.rockspec
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package = "ar-io-ao"
version = "0.1-1"
rockspec_format = "3.0"
source = {
url = "./src/aos.lua"
}
dependencies = {
"busted >= 2.2.0",
"luacov >= 0.15.0",
"luacheck >= 1.1.2",
"luacov-html >=1.0.0"
}
test = {
type = "busted",
}

0 comments on commit 2e10375

Please sign in to comment.