Skip to content

Commit 67c9fb7

Browse files
committed
removed eventhandler and helperfunctions
1 parent d320da7 commit 67c9fb7

File tree

3 files changed

+44
-15
lines changed

3 files changed

+44
-15
lines changed

.gitignore

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

README.md

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ This emulates the basic ccTweaked functions missing in basic-lua.
55
- fs
66
- http
77
- vector-functions
8+
- settings
9+
- (no validations what so ever as of yet)
810

911
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.
1012

@@ -14,8 +16,26 @@ As this repo emulates many functionalites given by ccTweaked, you might want to
1416

1517
Ideally you want to add those scripts to your .gitignore and only add them locally / for github actions.
1618

17-
### Example
19+
### How to use those functions
1820

19-
For how to import the scipts, an example is already used by this repo for some of its dependancies:
21+
```lua
22+
-- IN YOUR TEST_SPEC:
23+
24+
package.path = "pathToTestSuite-lib_Folder/?.lua;" .. package.path
25+
-- adds all libs to your path, so they are available without specifying their path each time
26+
27+
_G.fs = require("fs")
28+
_G.vector = require("vector")
29+
-- ...
30+
-- _G holds all global variables, so it may be used by your other scripts
31+
32+
local scriptToTest = require("scriptToTest")
33+
-- this script can now access the fs- & vector-functions
34+
-- without any need to modify the script you want to test
35+
```
36+
37+
### How to import these scripts
38+
39+
For how to import the scipts, an example is already used by this repo for some of ITS dependancies (which you will also need):
2040

2141
[fetch-deps.sh](fetch-deps.sh)

fetch-deps.sh

Lines changed: 20 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@
88

99
set -e
1010

11+
# dependencies
12+
# just add TestSuite-lib to the list when you need this suite
1113
libs=(
12-
"helperFunctions-lib"
13-
"eventCallStack-lib"
1414
"ccClass-lib"
1515
)
1616

@@ -22,20 +22,30 @@ targetFolderName=libs
2222

2323
# fetch files.txt and save each file into the targetFolder
2424
fetch() {
25-
2625
files_txt=$(curl -fsSL "https://raw.githubusercontent.com/$repo/$1/$branch/files.txt")
2726
if [ -z "$files_txt" ]; then
2827
echo "Could not load files.txt for $1"
2928
exit 1
3029
fi
3130
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"
31+
url="https://raw.githubusercontent.com/$repo/$1/$branch/$FILE"
32+
33+
mkdir -p "$(dirname "$targetFolderName/$FILE")" # create the folder (and subfolders specified in the files.txt)
34+
rm -f $targetFolderName/$FILE.lua # rm existing file
35+
if ! curl -s -o "$targetFolderName/$FILE" "$url"; then
36+
echo "could not get / write the file $i: '$FILE' to the folder '$targetFolderName'"
37+
exit 1
38+
fi
39+
# echo "saved $1: '$FILE' in '$targetFolderName'"
3440
done < <(echo "$files_txt")
3541
}
3642

37-
mkdir -p $targetFolderName
38-
39-
for i in "${libs[@]}"; do
40-
fetch "$i"
41-
done
43+
if [[ $# -eq 0 ]]; then
44+
# No arguments given, fetch all
45+
for i in "${libs[@]}"; do
46+
fetch "$i"
47+
done
48+
else
49+
# Argument given, fetch arguemt
50+
fetch "$1"
51+
fi

0 commit comments

Comments
 (0)