|
@@ -659,11 +659,13 @@ class Main {
|
|
|
function doUpdate( p : String, state ) {
|
|
function doUpdate( p : String, state ) {
|
|
|
var rep = state.rep;
|
|
var rep = state.rep;
|
|
|
if( sys.FileSystem.exists(rep + "/" + p + "/git") && sys.FileSystem.isDirectory(rep + "/" + p + "/git") ) {
|
|
if( sys.FileSystem.exists(rep + "/" + p + "/git") && sys.FileSystem.isDirectory(rep + "/" + p + "/git") ) {
|
|
|
|
|
+ checkGit();
|
|
|
var oldCwd = Sys.getCwd();
|
|
var oldCwd = Sys.getCwd();
|
|
|
Sys.setCwd(rep + "/" + p + "/git");
|
|
Sys.setCwd(rep + "/" + p + "/git");
|
|
|
Sys.command("git pull");
|
|
Sys.command("git pull");
|
|
|
// TODO: update haxelib.xml version?
|
|
// TODO: update haxelib.xml version?
|
|
|
Sys.setCwd(oldCwd);
|
|
Sys.setCwd(oldCwd);
|
|
|
|
|
+ state.updated = true;
|
|
|
} else {
|
|
} else {
|
|
|
var inf = try site.infos(p) catch( e : Dynamic ) { Sys.println(e); return; };
|
|
var inf = try site.infos(p) catch( e : Dynamic ) { Sys.println(e); return; };
|
|
|
if( !sys.FileSystem.exists(rep+Data.safe(p)+"/"+Data.safe(inf.curversion)) ) {
|
|
if( !sys.FileSystem.exists(rep+Data.safe(p)+"/"+Data.safe(inf.curversion)) ) {
|
|
@@ -827,7 +829,7 @@ class Main {
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- function git() {
|
|
|
|
|
|
|
+ function checkGit() {
|
|
|
var gitExists = function()
|
|
var gitExists = function()
|
|
|
try { command("git", []); return true; } catch (e:Dynamic) return false;
|
|
try { command("git", []); return true; } catch (e:Dynamic) return false;
|
|
|
if (!gitExists())
|
|
if (!gitExists())
|
|
@@ -847,12 +849,18 @@ class Main {
|
|
|
return;
|
|
return;
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ function git() {
|
|
|
var libName = param("Library name");
|
|
var libName = param("Library name");
|
|
|
var rep = getRepository();
|
|
var rep = getRepository();
|
|
|
var libPath = rep + Data.safe(libName) + "/git";
|
|
var libPath = rep + Data.safe(libName) + "/git";
|
|
|
|
|
|
|
|
if( sys.FileSystem.exists(libPath) ) {
|
|
if( sys.FileSystem.exists(libPath) ) {
|
|
|
- print("You already have a git version of "+libName+" installed");
|
|
|
|
|
|
|
+ var state = { rep : rep, prompt : false, updated : false };
|
|
|
|
|
+ doUpdate(libName,state);
|
|
|
|
|
+ if( !state.updated )
|
|
|
|
|
+ print("You already have a git version of "+libName+" installed");
|
|
|
return;
|
|
return;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -869,6 +877,8 @@ class Main {
|
|
|
null;
|
|
null;
|
|
|
|
|
|
|
|
print("Installing " +libName + " from " +gitPath);
|
|
print("Installing " +libName + " from " +gitPath);
|
|
|
|
|
+ checkGit();
|
|
|
|
|
+
|
|
|
if( Sys.command("git clone \"" +gitPath + "\" \"" +libPath + "\"") != 0 ) {
|
|
if( Sys.command("git clone \"" +gitPath + "\" \"" +libPath + "\"") != 0 ) {
|
|
|
print("Could not clone git repository");
|
|
print("Could not clone git repository");
|
|
|
return;
|
|
return;
|