aboutsummaryrefslogtreecommitdiff
path: root/docs/Code Documentation/Modules/CompileAndRun.md
diff options
context:
space:
mode:
authorJakob Stendahl <14180120+JakobST1n@users.noreply.github.com>2021-10-11 20:02:04 +0200
committerGitHub <noreply@github.com>2021-10-11 20:02:04 +0200
commitc67531161e56488166a33232f87566309ba8676e (patch)
tree846e59a020e80bea48557d5a06af5728e44961ff /docs/Code Documentation/Modules/CompileAndRun.md
parente6880cd8ccf82d993f222cb14b4860581654acb8 (diff)
parentc1b6eec770b885a9829e1f62bad5cc99389ca429 (diff)
downloadLuxcena-Neo-c67531161e56488166a33232f87566309ba8676e.tar.gz
Luxcena-Neo-c67531161e56488166a33232f87566309ba8676e.zip
Merge pull request #24 from JakobST1n/rebuild
v1.0.0
Diffstat (limited to 'docs/Code Documentation/Modules/CompileAndRun.md')
-rw-r--r--docs/Code Documentation/Modules/CompileAndRun.md58
1 files changed, 58 insertions, 0 deletions
diff --git a/docs/Code Documentation/Modules/CompileAndRun.md b/docs/Code Documentation/Modules/CompileAndRun.md
new file mode 100644
index 0000000..535ed5f
--- /dev/null
+++ b/docs/Code Documentation/Modules/CompileAndRun.md
@@ -0,0 +1,58 @@
+## Index
+---
+## Locals
+
+### var `pythonSupportFiles`
+
+Points to the files for our python support code. They should be in a subdir of the module itself.
+
+## Exported
+
+### class `Python`
+
+This is exported as Python, just so that we could add other languages later. Used to build and run python-scripts with our support-code.
+
+### method `Python.constructor`
+
+Takes one parameter, which is the full path to the folder where the script is located.
+
+When initializing the class, this will be called. Can be done like this:
+
+```javascript
+new compileRun.Python(global.DirSwap + "/usrData/usrCode/example");
+```
+
+### method `Python.compile`
+
+This deletes old build-folder, and makes a new one. It then moves all required files into the build-folder, making us ready for running the script.
+
+### method `Python.run`
+
+Spawns a new process, starting entry.py in our build-folder. It also attaches event-listners on our class-object. All of them is in the example below:
+
+```javascript
+let sc = new compileRun.Python(global.DirSwap + "/usrData/usrCode/example");
+​
+// When data is printed from the python-script
+sc.on("stdout::data", (_stdout) => { });
+// Last write when script closes, any exiting messages
+sc.on("stdout::end", (_stdout) => { });
+// When something is printed from the python-script to the error-out. Usually when a `throw` is called
+sc.on("stderr::out", (_stderr) => { });
+// Last words when process is dying from an error :`(
+sc.on("stderr::end", (_stderr) => { });
+// When script exits, _code is the exit-code
+sc.on("close", (_code) => { });
+```
+
+## Python
+
+This is the support-files for user-made scripts.
+
+## Entry.py
+
+The entry-point when running a script. A file called script.py, containing the user-script, should be placed next to this file. Starting it should be done like this (Where app-root is where our app.js is located):
+
+```
+python entry.py <pathToAppRoot>
+```