hmm pretty shitty so i wrote my own updater

This commit is contained in:
Yoshman29
2023-01-06 23:57:07 +01:00
parent 2391f7b16b
commit a6aa350e9c
3 changed files with 49 additions and 7 deletions
+4 -4
View File
@@ -8,14 +8,14 @@
{
"name": "flixel-yc29",
"type": "git",
"dir": null,
"dir": "flixel",
"ref": "master",
"url": "https://www.github.com/YoshiCrafter29/flixel"
},
{
"name": "flxanimate",
"type": "git",
"dir": null,
"dir": "flxanimate",
"ref": "master",
"url": "https://github.com/Dot-Stuff/flxanimate/"
},
@@ -27,7 +27,7 @@
{
"name": "hscript-improved",
"type": "git",
"dir": null,
"dir": "hscript-improved",
"ref": "master",
"url": "https://www.github.com/YoshiCrafter29/hscript-improved"
},
@@ -44,7 +44,7 @@
{
"name": "linc_discord-rpc",
"type": "git",
"dir": null,
"dir": "linc_discord-rpc",
"ref": "master",
"url": "https://github.com/Aidan63/linc_discord-rpc"
},
+1 -3
View File
@@ -1,3 +1 @@
haxelib install hmm
haxelib run hmm setup
hmm install
@haxe -cp update -D analyzer-optimize -main Update --interp
+44
View File
@@ -0,0 +1,44 @@
import haxe.Json;
import sys.io.File;
import sys.FileSystem;
class Update {
public static function main() {
// to prevent messing with currently installed libs
if (!FileSystem.exists('.haxelib'))
FileSystem.createDirectory('.haxelib');
var json:Array<Library> = Json.parse(File.getContent('./hmm.json')).dependencies;
prettyPrint("Installing libraries...");
for(lib in json) {
// install lib.
switch(lib.type) {
case "haxelib":
prettyPrint('Installing haxelib ${lib.name}...');
Sys.command('haxelib install ${lib.name}');
case "git":
prettyPrint('Installing ${lib.name} from git url ${lib.url}');
Sys.command('haxelib git ${lib.name} ${lib.url}');
}
}
}
public static function prettyPrint(text:String) {
var header = "══════";
for(i in 0...text.length)
header += "═";
Sys.println("");
Sys.println('╔$header╗');
Sys.println('║ $text ║');
Sys.println('╚$header╝');
}
}
typedef Library = {
var name:String;
var type:String;
var version:String;
var dir:String;
var ref:String;
var url:String;
}