Skip to content

Commit 52b08d6

Browse files
authored
Merge pull request #1 from mc-cc-scripts/remove-Submodules
refactor: 🗑️ removed submodules
2 parents c6da604 + 6513786 commit 52b08d6

File tree

9 files changed

+64
-30
lines changed

9 files changed

+64
-30
lines changed

.github/workflows/test.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,10 @@ jobs:
3030
luarocks install luasocket
3131
luarocks install luasec
3232
33-
- name: Git Submodule Update
33+
- name: fetch dependencies
3434
run: |
35-
git pull --recurse-submodules
36-
git submodule update --init --remote --recursive
35+
chmod +x ./fetch-deps.sh
36+
./fetch-deps.sh
3737
3838
- name: test
3939
run: |

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/libs

.gitmodules

Lines changed: 0 additions & 8 deletions
This file was deleted.

README.md

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,4 @@ builder help
2121
builder floor -w <width> -l <length> -m <"left"|"right">
2222
```
2323

24-
# Dev - Documentaion
25-
26-
### Submodules used
27-
- turtleControler-lib
28-
- turtleEmulator-lib
29-
- - plus submodules
24+
# Dev - Documentaion

ccPackage.lua

Lines changed: 0 additions & 6 deletions
This file was deleted.

fetch-deps.sh

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
#!/bin/bash
2+
3+
# ---- Whats happening ---- #
4+
5+
# This fetches the dependencies listed in the "libs" variable and saves them in the targetFolder
6+
7+
8+
9+
set -e
10+
11+
libs=(
12+
"helperFunctions-lib"
13+
"ccClass-lib"
14+
"testSuite-lib"
15+
"turtleEmulator-lib"
16+
"turtleController-lib"
17+
"eventHandler-lib"
18+
)
19+
20+
# Basic setup variables
21+
repo="mc-cc-scripts"
22+
branch="master"
23+
targetFolderName=libs
24+
25+
26+
# fetch files.txt and save each file into the targetFolder
27+
fetch() {
28+
files_txt=$(curl -fsSL "https://raw.githubusercontent.com/$repo/$1/$branch/files.txt")
29+
if [ -z "$files_txt" ]; then
30+
echo "Could not load files.txt for $1"
31+
exit 1
32+
fi
33+
while IFS= read -r FILE; do
34+
url="https://raw.githubusercontent.com/$repo/$1/$branch/$FILE"
35+
36+
mkdir -p "$(dirname "$targetFolderName/$FILE")" # create the folder (and subfolders specified in the files.txt)
37+
rm -f $targetFolderName/$FILE.lua # rm existing file
38+
if ! curl -s -o "$targetFolderName/$FILE" "$url"; then
39+
echo "could not get / write the file $i: '$FILE' to the folder '$targetFolderName'"
40+
exit 1
41+
fi
42+
# echo "saved $1: '$FILE' in '$targetFolderName'"
43+
done < <(echo "$files_txt")
44+
}
45+
46+
if [[ $# -eq 0 ]]; then
47+
# No arguments given, fetch all
48+
for i in "${libs[@]}"; do
49+
fetch "$i"
50+
done
51+
else
52+
# Argument given, fetch arguemt
53+
fetch "$1"
54+
fi

tests/test_spec.lua

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,11 @@
2828
---@field equal function
2929
assert = assert
3030

31-
local spath = debug.getinfo(1,'S').source:sub(2):gsub("/+", "/"):gsub("[^/]*$",""):gsub("/tests", ""):gsub("tests","")
32-
if spath == "" then
33-
spath = "./"
34-
end
35-
require(spath.."ccPackage")
31+
package.path = package.path .. ";"
32+
.."libs/?.lua;"
33+
.."libs/inventory/?.lua;"
34+
.."libs/peripherals/?.lua;"
35+
3636
---@class Vector
3737
_G.vector = require("vector")
3838
---@class Builder_Lib

turtleController-lib

Lines changed: 0 additions & 1 deletion
This file was deleted.

turtleEmulator-lib

Lines changed: 0 additions & 1 deletion
This file was deleted.

0 commit comments

Comments
 (0)