Skip to content

Commit

Permalink
Added helper scripts to set up local luarocks install
Browse files Browse the repository at this point in the history
  • Loading branch information
svermeulen committed Aug 19, 2024
1 parent 5dc5089 commit cea33bd
Show file tree
Hide file tree
Showing 5 changed files with 68 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@
/.luarocks
/luarocks.bat
/lua.bat
/luarocks_tree
6 changes: 6 additions & 0 deletions scripts/generate_lua.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
@echo off
setlocal enabledelayedexpansion
call %~dp0setup_local_luarocks.bat
cd %~dp0\..
del src\tlcheck.lua
call luarocks\bin\tl.bat gen src\tlcheck.tl -o src\tlcheck.lua
16 changes: 16 additions & 0 deletions scripts/generate_lua.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/bin/bash
set -ex
cd `dirname $BASH_SOURCE`/..
rm -rf ./gen
mkdir ./gen
mkdir ./gen/lusc
mkdir ./gen/lusc/internal
mkdir ./gen/lusc/tests
tl gen src/lusc/init.tl -o gen/lusc/init.lua
tl gen src/lusc/internal/util.tl -o gen/lusc/internal/util.lua
cp src/lusc/internal/queue.lua gen/lusc/internal/queue.lua
tl gen src/lusc/tests/async_helper.tl -o gen/lusc/tests/async_helper.lua
tl gen src/lusc/tests/lusc_spec.tl -o gen/lusc/tests/lusc_spec.lua
tl gen src/lusc/tests/setup.tl -o gen/lusc/tests/setup.lua
tl gen src/lusc/luv_async.tl -o gen/lusc/luv_async.lua
tl gen src/lusc/tests/luv_async_spec.tl -o gen/lusc/tests/luv_async_spec.lua
27 changes: 27 additions & 0 deletions scripts/setup_local_luarocks.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
@echo off
setlocal enabledelayedexpansion

rem Navigate to the root of the repo
cd %~dp0\..

rem Check if the local luarocks tree is already initialized
if not exist "luarocks" (
echo Initializing local LuaRocks tree...
luarocks init --tree=./luarocks
) else (
echo Local LuaRocks tree already exists.
)

rem Set the local LuaRocks path
set "LUAROCKS_TREE=%~dp0\..\luarocks"

rem Install project dependencies from the rockspec
echo Installing project dependencies...
call luarocks make --tree=!LUAROCKS_TREE!

rem Confirm installations
echo Installed LuaRocks packages:
call luarocks list --tree=!LUAROCKS_TREE!

endlocal

18 changes: 18 additions & 0 deletions scripts/setup_local_luarocks.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#!/bin/bash
set -e

# Navigate to the root of the repo
cd "$(dirname "$0")/.."

luarocks init --tree=./luarocks_tree

# Set the local LuaRocks path
LUAROCKS_TREE="$(pwd)/luarocks_tree"

# Install project dependencies from the rockspec
echo "Installing project dependencies..."
luarocks make --tree="$LUAROCKS_TREE"

# Confirm installations
echo "Installed LuaRocks packages:"
luarocks list --tree="$LUAROCKS_TREE"

0 comments on commit cea33bd

Please sign in to comment.