public void PullCurrentBranch(FilePath modulePath, int times = 0) { string branch = ""; modulePath.Call(_git, "status --branch --short", (o, e) => { branch = GuessBranch(o + e); }); TryGitCommand(modulePath, times, "pull --ff-only --verbose origin " + branch); TryGitCommand(modulePath, times, "submodule update --init"); }
public int Build(FilePath rootPath, FilePath buildPath) { var path = _files.GetFirstMatch(buildPath, _patterns.BuildPattern); if (path == null) return 0; foreach (var copyPath in _patterns.CopyPaths) { var src = rootPath.Navigate(copyPath.Source); var dst = buildPath.Navigate(copyPath.Destination); if (_files.Exists(src)) _files.CopyDirectory(src, dst); } var command = string.Format(_patterns.BuildCmd, path.LastElement()); Log.Verbose(command); return buildPath.Call("cmd", "/c " + command); }
void TryGitCommand(FilePath modulePath, int times, string command) { if (times > 3) { Log.Status("Git server keeps hanging up. Will continue with local copy"); return; } string s_out = ""; string s_err = ""; if (modulePath.Call(_git, command, (o, e) => { s_err = e; s_out = o; }) != 0) { if ( s_err.Contains(FatalHangup) || s_out.Contains(FatalHangup) || s_err.Contains(FatalConnect) || s_out.Contains(FatalConnect) ) { TryGitCommand(modulePath, times + 1, command); } else throw new Exception("Git pull failed on " + modulePath.ToEnvironmentalPath() + "; Please resolve and try again"); } }
public void PullMaster(FilePath repoDir) { repoDir.Call(_git, "pull --ff-only --verbose origin master"); }
public void Clone(FilePath repoDir, FilePath filePath, string repo) { repoDir.Call(_git, "clone " + repo + " " + filePath.Unroot(repoDir).ToPosixPath()); }
public void CheckoutFolder(FilePath path) { path.Call(_git, "checkout . --theirs"); }
private void RebuildByFluentMigration(FilePath projPath, FilePath psScript) { var createDatabase = projPath.Append(new FilePath("DatabaseScripts")).Append(new FilePath("CreateDatabase.sql")); Log.Status("Creating database from " + createDatabase.ToEnvironmentalPath()); _builder.RunSqlScripts(projPath, createDatabase); Log.Status("Running RunMigrationsLocally.ps1"); projPath.Call("powershell " + psScript.ToEnvironmentalPath(), ""); }
public int RunSqlScripts(FilePath root, FilePath script) { Log.Status(" " + script.LastElement()); return root.Call("sqlcmd.exe", "-f 65001 -i \"" + script.ToEnvironmentalPath() + "\" -S . -E"); }