-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathIntegreat.wls
executable file
·37 lines (32 loc) · 1.1 KB
/
Integreat.wls
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#!/usr/bin/env wolframscript
(* ::Package:: *)
help = "Usage:\n" <>
"Integreat.wls build [--skip-docs]\n" <>
"Integreat.wls install [--skip-docs]\n" <>
"Integreat.wls load\n" <>
"Integreat.wls docs\n" <>
"Integreat.wls uninstall\n" <>
"Integreat.wls clean";
If[Length[$ScriptCommandLine] < 2, (
Print[help];
Exit[];
)];
Needs["PacletTools`"];
integreatDir = DirectoryName[First[$ScriptCommandLine]];
srcDir = FileNameJoin[{integreatDir, "src"}];
buildDir = FileNameJoin[{integreatDir, "build"}];
docsDir = FileNameJoin[{integreatDir, "docs"}];
build[] := If[
MemberQ[$ScriptCommandLine, "--skip-docs"],
CreatePacletArchive,
PacletBuild[##]["PacletArchive"] &
][srcDir, buildDir];
Switch[$ScriptCommandLine[[2]],
"build", build[],
"install", PacletInstall[build[], ForceVersionInstall -> True],
"load", Print["PacletDirectoryLoad[\"" <> ExpandFileName[srcDir] <> "\"]"],
"docs", PacletDocumentationBuild[srcDir, docsDir, "HTML"],
"uninstall", PacletUninstall["Integreat"],
"clean", Scan[DeleteDirectory[#, DeleteContents -> True] &, {buildDir, docsDir}],
_, Print["Unrecognized command\n\n" <> help];
];