diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 5347502..6d0ab4a 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -30,10 +30,10 @@ jobs: luarocks install luasocket luarocks install luasec - - name: Git Submodule Update + - name: fetch dependencies run: | - git pull --recurse-submodules - git submodule update --init --remote --recursive + chmod +x ./fetch-deps.sh + ./fetch-deps.sh - name: test run: | diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..73df968 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +/libs \ No newline at end of file diff --git a/.gitmodules b/.gitmodules deleted file mode 100644 index 4e65a3d..0000000 --- a/.gitmodules +++ /dev/null @@ -1,8 +0,0 @@ -[submodule "turtleController-lib"] - path = turtleController-lib - url = https://github.com/mc-cc-scripts/turtleController-lib.git - branch = master -[submodule "turtleEmulator-lib"] - path = turtleEmulator-lib - url = https://github.com/mc-cc-scripts/turtleEmulator-lib.git - branch = master diff --git a/README.md b/README.md index 4394c6d..08c1651 100644 --- a/README.md +++ b/README.md @@ -21,9 +21,4 @@ builder help builder floor -w -l -m <"left"|"right"> ``` -# Dev - Documentaion - -### Submodules used -- turtleControler-lib -- turtleEmulator-lib -- - plus submodules +# Dev - Documentaion \ No newline at end of file diff --git a/ccPackage.lua b/ccPackage.lua deleted file mode 100644 index 98d7cf4..0000000 --- a/ccPackage.lua +++ /dev/null @@ -1,6 +0,0 @@ -local spath = - debug.getinfo(1,'S').source:sub(2):gsub("/+", "/"):gsub("[^/]*$","") -package.path = spath.."?.lua;" - .. spath.."turtleController-lib/?.lua;" - .. package.path -require(spath.."turtleEmulator-lib/ccPackage") \ No newline at end of file diff --git a/fetch-deps.sh b/fetch-deps.sh new file mode 100755 index 0000000..921ddf9 --- /dev/null +++ b/fetch-deps.sh @@ -0,0 +1,54 @@ +#!/bin/bash + +# ---- Whats happening ---- # + +# This fetches the dependencies listed in the "libs" variable and saves them in the targetFolder + + + +set -e + +libs=( + "helperFunctions-lib" + "ccClass-lib" + "testSuite-lib" + "turtleEmulator-lib" + "turtleController-lib" + "eventHandler-lib" +) + +# Basic setup variables +repo="mc-cc-scripts" +branch="master" +targetFolderName=libs + + +# fetch files.txt and save each file into the targetFolder +fetch() { + files_txt=$(curl -fsSL "https://raw.githubusercontent.com/$repo/$1/$branch/files.txt") + if [ -z "$files_txt" ]; then + echo "Could not load files.txt for $1" + exit 1 + fi + while IFS= read -r FILE; do + url="https://raw.githubusercontent.com/$repo/$1/$branch/$FILE" + + mkdir -p "$(dirname "$targetFolderName/$FILE")" # create the folder (and subfolders specified in the files.txt) + rm -f $targetFolderName/$FILE.lua # rm existing file + if ! curl -s -o "$targetFolderName/$FILE" "$url"; then + echo "could not get / write the file $i: '$FILE' to the folder '$targetFolderName'" + exit 1 + fi + # echo "saved $1: '$FILE' in '$targetFolderName'" + done < <(echo "$files_txt") +} + +if [[ $# -eq 0 ]]; then + # No arguments given, fetch all + for i in "${libs[@]}"; do + fetch "$i" + done +else + # Argument given, fetch arguemt + fetch "$1" +fi \ No newline at end of file diff --git a/tests/test_spec.lua b/tests/test_spec.lua index 16edaf2..c68717e 100644 --- a/tests/test_spec.lua +++ b/tests/test_spec.lua @@ -28,11 +28,11 @@ ---@field equal function assert = assert -local spath = debug.getinfo(1,'S').source:sub(2):gsub("/+", "/"):gsub("[^/]*$",""):gsub("/tests", ""):gsub("tests","") -if spath == "" then - spath = "./" -end -require(spath.."ccPackage") +package.path = package.path .. ";" + .."libs/?.lua;" + .."libs/inventory/?.lua;" + .."libs/peripherals/?.lua;" + ---@class Vector _G.vector = require("vector") ---@class Builder_Lib diff --git a/turtleController-lib b/turtleController-lib deleted file mode 160000 index 8816bf4..0000000 --- a/turtleController-lib +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 8816bf4de67da590aa75c2a6ad7b537b63aca446 diff --git a/turtleEmulator-lib b/turtleEmulator-lib deleted file mode 160000 index 6c41199..0000000 --- a/turtleEmulator-lib +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 6c411996cd8ac7117def9ebcf67c91a9ea82d946