-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Atticus
committed
Jun 22, 2024
1 parent
79756cb
commit 2e10375
Showing
3 changed files
with
111 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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] | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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", | ||
} |