Browse Source

added "run" command.

Nicolas Cannasse 19 years ago
parent
commit
07dae325fa
3 changed files with 39 additions and 6 deletions
  1. 22 2
      std/tools/haxelib/Main.hx
  2. 6 4
      std/tools/haxelib/haxelib.hxml
  3. 11 0
      std/tools/haxelib/haxelib.hxp

+ 22 - 2
std/tools/haxelib/Main.hx

@@ -83,6 +83,7 @@ class Main {
 		addCommand("setup",setup,"set the haxelib repository path");
 		addCommand("config",config,"print the repository path");
 		addCommand("path",path,"give paths to libraries");
+		addCommand("run",run,"run the specified project with parameters");
 		siteUrl = "http://"+SERVER.host+":"+SERVER.port+"/"+SERVER.dir;
 		site = new SiteProxy(haxe.remoting.Connection.urlConnect(siteUrl+SERVER.url).api);
 	}
@@ -123,7 +124,7 @@ class Main {
 		neko.Sys.exit(1);
 	}
 
-	function run() {
+	function process() {
 		var debug = false;
 		argcur = 0;
 		if( args[argcur] == "-debug" ) {
@@ -567,6 +568,25 @@ class Main {
 		}
 	}
 
+	function run() {
+		var rep = getRepository();
+		var project = param("Project");
+		var pdir = rep + Datas.safe(project);
+		if( !neko.FileSystem.exists(pdir) )
+			throw "Project "+project+" is not installed";
+		pdir += "/";
+		var version = neko.io.File.getContent(pdir+".current");
+		var vdir = pdir + Datas.safe(version);
+		var rdir = vdir + "/run.n";
+		if( !neko.FileSystem.exists(rdir) )
+			throw "Project "+project+" version "+version+" does not have a run script";
+		neko.Sys.setCwd(vdir);
+		var cmd = "neko run.n";
+		for( i in argcur...args.length )
+			cmd += " "+args[i];
+		neko.Sys.exit(neko.Sys.command(cmd));
+	}
+
 	// ----------------------------------
 
 	static function print(str) {
@@ -574,7 +594,7 @@ class Main {
 	}
 
 	static function main() {
-		new Main().run();
+		new Main().process();
 	}
 
 }

+ 6 - 4
std/tools/haxelib/haxelib.hxml

@@ -1,8 +1,10 @@
--main tools.haxelib.Site
+# Site
 -neko index.n
+-main tools.haxelib.Site
 
---next
 
--main tools.haxelib.Main
+--next
+# Command
 -neko haxelib.n
--cmd nekotools boot haxelib.n
+-main tools.haxelib.Main
+-cmd nekotools boot haxelib.n

+ 11 - 0
std/tools/haxelib/haxelib.hxp

@@ -0,0 +1,11 @@
+<haxe selected="1">
+  <output name="Site" mode="neko" out="index.n" class="tools.haxelib.Site" lib="" cmd="" main="True" debug="False"></output>
+  <output name="Command" mode="neko" out="haxelib.n" class="tools.haxelib.Main" lib="" cmd="" main="True" debug="False">-cmd nekotools boot haxelib.n</output>
+  <files path="/">
+    <file path="Datas.hx" />
+    <file path="Main.hx" />
+    <file path="Site.hx" />
+    <file path="SiteApi.hx" />
+    <file path="SiteDb.hx" />
+  </files>
+</haxe>