Skip to content

Commit 6b0a027

Browse files
committed
refactor: 🗑️ removed submodules
Added a script which pulls the dependencies. Removed Submodules. Old Repositories which had utilized this repo need to be updated
1 parent 8232efe commit 6b0a027

File tree

16 files changed

+75
-119
lines changed

16 files changed

+75
-119
lines changed

.github/workflows/test.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,9 @@ jobs:
2626
luarocks install luasocket
2727
luarocks install luasec
2828
29+
- name: fetch dependencies
30+
run: .fetch-deps.sh
31+
2932
- name: test
3033
run: |
31-
busted vector
32-
# further tests here
34+
busted vector

.gitignore

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
11
/config
22
/.vscode
3-
/computer
3+
/computer
4+
/libs/eventCallStack.lua
5+
/libs/helperFunctions.lua
6+
/libs/ccClass.lua

.gitmodules

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

README.md

Lines changed: 21 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,21 @@
1-
# Install
2-
3-
in your testfile(s), just add these few lines to automaticly install the test-suites in the /suits folder of your current path.
4-
5-
```lua
6-
-- Check if relvant suit is found(only relevant when testing locally)
7-
-- otherwise run the installer
8-
if not pcall(function () io.open("./suits/vector/vector.lua", "r"):close() end) then
9-
print("Downloading TestSuite-lib")
10-
local http = require("socket.http")
11-
local url = "https://raw.githubusercontent.com/mc-cc-scripts/TestSuite-lib/master/installSuit.lua" -- URL of the installer
12-
local body, statusCode = http.request(url)
13-
if statusCode == 200 then
14-
local loader
15-
if _VERSION == "Lua 5.1" then
16-
loader = loadstring
17-
else
18-
loader = load
19-
end
20-
local installScript = loader(body)().install()
21-
else
22-
error("Failed to download TestSuite-lib: " .. tostring(statusCode))
23-
end
24-
end
25-
```
26-
27-
## Planned features
28-
Specify the install location for the suit
29-
update files already present / add missing files
1+
# TestSuite
2+
3+
This emulates the basic ccTweaked functions missing in basic-lua.
4+
5+
- fs
6+
- http
7+
- vector-functions
8+
9+
Additionally it emulates our **[scm](https://github.com/mc-cc-scripts/script-manager)** script and includes the **[json](https://gist.github.com/tylerneylon/59f4bcf316be525b30ab)** handler - which makes tests a lot easier.
10+
11+
# Usage
12+
13+
As this repo emulates many functionalites given by ccTweaked, you might want to test you code **outside** of Minecraft, maybe even automated. To achieve that, you need to download the scripts listed above and save them in your testingenv.
14+
15+
Ideally you want to add those scripts to your .gitignore and only add them locally / for github actions.
16+
17+
### Example
18+
19+
For how to import the scipts, an example is already used by this repo for some of its dependancies:
20+
21+
[fetch-deps.sh](fetch-deps.sh)

ccClass/ccClass.lua

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

ccPackage.lua

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

eventCallStack-lib

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

fetch-deps.sh

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
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+
"eventCallStack-lib"
14+
"ccClass-lib"
15+
)
16+
17+
# Basic setup variables
18+
repo="mc-cc-scripts"
19+
branch="master"
20+
targetFolderName=libs
21+
22+
23+
# fetch files.txt and save each file into the targetFolder
24+
fetch() {
25+
26+
files_txt=$(curl -fsSL "https://raw.githubusercontent.com/$repo/$1/$branch/files.txt")
27+
if [ -z "$files_txt" ]; then
28+
echo "Could not load files.txt for $1"
29+
exit 1
30+
fi
31+
while IFS= read -r FILE; do
32+
rm -f $targetFolderName/$1.lua # rm existing file
33+
curl -s "https://raw.githubusercontent.com/$repo/$1/$branch/$FILE" -o "$targetFolderName/$FILE"
34+
done < <(echo "$files_txt")
35+
}
36+
37+
for i in "${libs[@]}"; do
38+
fetch "$i"
39+
done

files.txt

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
1-
vector/vector.lua
2-
ccClass/ccClass.lua
3-
http/http.lua
4-
fs/fs.lua
5-
helperFunctions/helperFunctions.lua
6-
json/json.lua
1+
libs/vector.lua
2+
libs/http.lua
3+
libs/fs.lua
4+
libs/json.lua
5+
libs/scm.lua

helperFunctions

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

0 commit comments

Comments
 (0)