diff --git a/hmm.json b/hmm.json index 8fcd0b46..32090162 100644 --- a/hmm.json +++ b/hmm.json @@ -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" }, diff --git a/update.bat b/update.bat index 48a2b3cf..243553c5 100644 --- a/update.bat +++ b/update.bat @@ -1,3 +1 @@ -haxelib install hmm -haxelib run hmm setup -hmm install \ No newline at end of file +@haxe -cp update -D analyzer-optimize -main Update --interp \ No newline at end of file diff --git a/update/Update.hx b/update/Update.hx new file mode 100644 index 00000000..f0c748fb --- /dev/null +++ b/update/Update.hx @@ -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 = 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; +} \ No newline at end of file