public void Pull(string workingDirectory, ILog log, IBounce bounce) { using (new DirectoryChange(workingDirectory)) { log.Info("pulling git repo in: " + workingDirectory); Git(bounce, "pull"); } }
public override void Build(IBounce bounce) { var iisServer = new ServerManager(); var existingSite = iisServer.Sites[Name.Value]; if (!SiteUpToDate(existingSite)) { bounce.Log.Info("installing IIS website at: " + Directory.Value); RemoveWebSiteIfExtant(iisServer); var site = iisServer.Sites.Add(Name.Value, Directory.Value, Port.Value); if (Bindings != null && Bindings.Value != null) { site.Bindings.Clear(); foreach (var binding in Bindings.Value) { site.Bindings.Add(binding.Information.Value, binding.Protocol.Value); } } if (ApplicationPoolNameIfSet != null) { site.ApplicationDefaults.ApplicationPoolName = ApplicationPoolNameIfSet; } iisServer.CommitChanges(); } else { bounce.Log.Info("IIS website already installed"); } }
private bool IsServiceStatus(IBounce bounce, string status) { Regex statePattern = new Regex(@"STATE\s+:\s+\d\s+" + status.ToUpper(), RegexOptions.IgnoreCase); var queryOutput = ExecuteSc(bounce, @"query ""{0}""", Name.Value).Output; return(statePattern.Match(queryOutput).Success); }
public override void Clean(IBounce bounce) { if (SolutionExists) { bounce.Log.Info("cleaning solution at: " + SolutionPath.Value); bounce.ShellCommand.ExecuteAndExpectSuccess("msbuild.exe", String.Format(@"/target:Clean ""{0}""", SolutionPath.Value)); } }
public override void Build(IBounce bounce) { IEnumerable<string> testDlls = DllPaths.Select(dll => dll.Value).Where(dll => dll.EndsWith("Tests.dll")); string joinedTestDlls = "\"" + String.Join("\" \"", testDlls.ToArray()) + "\""; bounce.Log.Info("running unit tests for: " + joinedTestDlls); bounce.ShellCommand.ExecuteAndExpectSuccess(NUnitConsolePath.Value, joinedTestDlls); }
public override void Clean(IBounce bounce) { if (SolutionExists) { bounce.Log.Info("cleaning solution at: " + SolutionPath.Value); bounce.ShellCommand.ExecuteAndExpectSuccess(MsBuildExe.Value, String.Format(@"/target:Clean ""{0}""", SolutionPath.Value)); } }
public override void Build(IBounce bounce) { if (ServiceInstalled) { bounce.Log.Info("service {0} installed, deleting", Name.Value); DeleteService(); } InstallService(); }
public override void Clean(IBounce bounce) { if (ServiceInstalled) { bounce.Log.Info("service {0} installed, deleting", Name.Value); DeleteService(); } else { bounce.Log.Info("service {0} not installed"); } }
public override void InvokeTask(IBounceCommand command, IBounce bounce) { _value = GetTasks(bounce); foreach (var task in _value) { bounce.Invoke(command, task); } }
public override void Build(IBounce bounce) { var fromPath = FromPath.Value; var toPath = _toPath.Value; bounce.Log.Debug("copying from: `{0}', to: `{1}'", fromPath, toPath); FileSystemCopier.Copy(fromPath, toPath, GetValueOf(Excludes), GetValueOf(Includes), DeleteToDirectory.Value); }
public override void Build(IBounce bounce) { if (Directory.Exists(To.Value)) throw new ArgumentException("To directory '" + To.Value + "' already exists."); if (Directory.Exists(From.Value)) Directory.Move(From.Value, To.Value); else throw new ArgumentException("From directory '" + From.Value + "' does not seem to to exist."); }
public override void Build(IBounce bounce) { var fromPath = FromPath.Value; var toPath = ToPath.Value; bounce.Log.Debug(Directory.GetCurrentDirectory()); bounce.Log.Debug("copying from: {0}, to: {1}", FromPath.Value, ToPath.Value); FileSystemCopier.Copy(fromPath, toPath, GetValueOf(Excludes), GetValueOf(Includes)); }
public override void Build(IBounce bounce) { bounce.Log.Debug("pwd"); bounce.Log.Debug(System.IO.Directory.GetCurrentDirectory()); if (DirectoryUtils.DirectoryExists(WorkingDirectory)) { GitCommand.Pull(WorkingDirectory, bounce.Log, bounce); } else { GitCommand.Clone(Repository.Value, WorkingDirectory, bounce.Log, bounce); } }
public override void InvokeTask(IBounceCommand command, IBounce bounce) { if (IsDebug) { bounce.Log.Debug("{0}: {1}", Message.Value, Value.Value); } else { bounce.Log.Info("{0}: {1}", Message.Value, Value.Value); } }
private void InstallService(IBounce bounce) { System.Console.WriteLine("installing service {0}", Name.Value); ExecuteScAndExpectSuccess(bounce, @"create ""{0}"" binPath= ""{1}""{2}", Name.Value, Path.GetFullPath(BinaryPath.Value), GetSettings()); if (Description != null && Description.Value != null) { ExecuteScAndExpectSuccess(bounce, @"description ""{0}"" ""{1}""", Name.Value, Description.Value); } }
public void Clone(string repo, string directory, IDictionary<string, string> options, ILog log, IBounce bounce) { log.Info("cloning git repo: {0}, into: {1}", repo, directory); if (options == null) { Git(bounce, @"clone {0} ""{1}""", repo, directory); } else { Git(bounce, @"clone {0} {1} ""{2}""", options.ToOptionsString(), repo, directory); } }
public override void Build(IBounce bounce) { var cwd = Directory.GetCurrentDirectory(); Directory.SetCurrentDirectory(WorkingDirectory.Value); try { bounce.ShellCommand.ExecuteAndExpectSuccess(@"bounce.exe", BounceArguments.Value); } finally { Directory.SetCurrentDirectory(cwd); } }
public override IEnumerable <T> GetTasks(IBounce bounce) { if ((Condition.Value ^ Invert)) { return(new[] { GetResult() }); } else { return(new T[0]); } }
public override void Clean(IBounce bounce) { if (IsServiceInstalled(bounce)) { bounce.Log.Info("service {0} installed, deleting", Name.Value); DeleteService(bounce); } else { bounce.Log.Info("service {0} not installed"); } }
private string GetBounceArguments(IBounce bounce, IBounceCommand command) { var args = new List <string>(); args.Add(LogOptionCommandLineTranslator.GenerateCommandLine(bounce)); args.Add(command.CommandLineCommand); args.AddRange(Targets); args.Add(CommandLineTasksParametersGenerator.GenerateCommandLineParametersForTasks(bounce.ParametersGiven, Parameters)); return(String.Join(" ", args.ToArray())); }
public override void Build(IBounce bounce) { DeleteIfExtant(); IisWebSite webSite = Iis.CreateWebSite(Name.Value, ToInternalBindings(Bindings.Value), Path.GetFullPath(Directory.Value)); SetupVirtualDirectory(webSite.VirtualDirectory); if (Started.Value) { webSite.Start(); } }
public override void Build(IBounce bounce) { foreach (var file in Directory.GetFiles(".", Path.Value)) { bounce.Log.Debug("deleting file: `{0}'", file); File.Delete(file); } foreach (var directory in Directory.GetDirectories(".", Path.Value)) { bounce.Log.Debug("deleting directory: `{0}'", directory); DirectoryUtils.DeleteDirectory(directory); } }
public override void Build(IBounce bounce) { string oldDirectory = Directory.GetCurrentDirectory(); Directory.SetCurrentDirectory(WorkingDirectory.Value); try { bounce.ShellCommand.ExecuteAndExpectSuccess(Exe.Value, ArgumentsIfExists); } finally { Directory.SetCurrentDirectory(oldDirectory); } }
protected override void BuildTask(IBounce bounce) { if (IsServiceInstalled(bounce)) { bounce.Log.Info("service {0} installed, deleting", Name.Value); DeleteService(bounce); } InstallService(bounce); if (IsServiceStartRequired.Value) { bounce.Log.Info("starting {0} service", Name.Value); StartService(bounce); } }
public override void Invoke(IBounceCommand command, IBounce bounce) { IObsoleteTask action; if (Cases.TryGetValue(Condition.Value, out action)) { bounce.Invoke(command, action); } else { throw new ConfigurationException(String.Format("no such case for `{0}'", Condition.Value)); } }
public override void Build(IBounce bounce) { bounce.Log.Info("building solution at: " + SolutionPath.Value); var arguments = Arguments( "\"" + SolutionPath.Value + "\"", ConfigIfSpecified, OutputDirIfSpecified, TargetIfSpecified ); bounce.ShellCommand.ExecuteAndExpectSuccess(MsBuildExe.Value, arguments); }
public void ParseCommandLine(ParsedCommandLineParameters parsedParameters, IBounce bounce) { parsedParameters.IfParameterDo(LogLevelParameter, loglevel => bounce.LogOptions.LogLevel = ParseLogLevel(loglevel)); parsedParameters.IfParameterDo(CommandOutputParameter, commandOutput => bounce.LogOptions.CommandOutput = ParseBoolOption(commandOutput)); parsedParameters.IfParameterDo(LogFormatParameter, logformat => bounce.LogFactory = GetLogFactoryByName(logformat)); parsedParameters.IfParameterDo(DescribeTasksParameter, descTasks => bounce.LogOptions.DescribeTasks = ParseBoolOption(descTasks)); parsedParameters.IfParameterDo(LogFileParameter, logFileName => { var textWriter = File.AppendText(logFileName); textWriter.AutoFlush = true; bounce.LogOptions.StdOut = textWriter; bounce.LogOptions.StdErr = textWriter; }); }
public override void Build(IBounce bounce) { var args = new[] { Register, Output, Target, TargetArgs, IncludedRules, ExcludedRules }.Where(arg => arg != "").ToArray(); bounce.ShellCommand.ExecuteAndExpectSuccess(PartCoverPath.Value, String.Join(" ", args)); }
public override void Build(IBounce bounce) { var iisServer = new ServerManager(); var existingSite = iisServer.Sites[Name.Value]; if (!SiteUpToDate(existingSite)) { bounce.Log.Info("installing IIS website at: " + Directory.Value); RemoveWebSiteIfExtant(iisServer); iisServer.Sites.Add(Name.Value, Directory.Value, Port.Value); iisServer.CommitChanges(); } else { bounce.Log.Info("IIS website already installed"); } }
public override void Build(IBounce bounce) { bounce.Log.Debug("pwd"); bounce.Log.Debug(System.IO.Directory.GetCurrentDirectory()); if (DirectoryUtils.DirectoryExists(WorkingDirectory)) { GitCommand.Pull(WorkingDirectory, bounce.Log, bounce); } else { var options = GetCommandOptions(); GitCommand.Clone(Repository.Value, WorkingDirectory, options, bounce.Log, bounce); } }
public override void Build(IBounce bounce) { var output = bounce.ShellCommand.ExecuteAndExpectSuccess(NuGetExePath.Value, string.Format(@"pack ""{0}""", Spec.Value)); var packageRegex = new Regex(@"Successfully created package '(.*)'."); var match = packageRegex.Match(output.Output); if (match.Success) { _packagePath = match.Groups[1].Value; } else { throw new TaskException(this, "could not parse package name"); } }
public override void Build(IBounce bounce) { if (Directory.Exists(To.Value)) { throw new ArgumentException("To directory '" + To.Value + "' already exists."); } if (Directory.Exists(From.Value)) { Directory.Move(From.Value, To.Value); } else { throw new ArgumentException("From directory '" + From.Value + "' does not seem to to exist."); } }
public string GenerateCommandLine(IBounce bounce) { var args = new List<string>(); args.Add("/" + DescribeTasksParameter + ":" + bounce.LogOptions.DescribeTasks.ToString().ToLower()); args.Add("/" + LogLevelParameter + ":" + bounce.LogOptions.LogLevel.ToString().ToLower()); args.Add("/" + CommandOutputParameter + ":" + bounce.LogOptions.CommandOutput.ToString().ToLower()); var logFormatName = LogFactoryRegistry.FindNameForLogFactory(bounce.LogFactory); if (logFormatName != null) { args.Add("/" + LogFormatParameter + ":" + logFormatName); } return String.Join(" ", args.ToArray()); }
public override void Build(IBounce bounce) { var joinedTestDlls = "\"" + String.Join("\" \"", DllPaths.Value.ToArray()) + "\""; bounce.Log.Info("running unit tests for: " + joinedTestDlls); var args = new[] { Excludes, Includes, Framework, joinedTestDlls }; bounce.ShellCommand.ExecuteAndExpectSuccess(NUnitConsolePath.Value, String.Join(" ", args)); }
public override void Build(IBounce bounce) { IEnumerable<string> testDlls = DllPaths.Select(dll => dll.Value); string joinedTestDlls = "\"" + String.Join("\" \"", testDlls.ToArray()) + "\""; bounce.Log.Info("running unit tests for: " + joinedTestDlls); var args = new[] { Excludes, Includes, joinedTestDlls, }; bounce.ShellCommand.ExecuteAndExpectSuccess(NUnitConsolePath.Value, String.Join(" ", args)); }
public string GenerateCommandLine(IBounce bounce) { var args = new List <string>(); args.Add("/" + DescribeTasksParameter + ":" + bounce.LogOptions.DescribeTasks.ToString().ToLower()); args.Add("/" + LogLevelParameter + ":" + bounce.LogOptions.LogLevel.ToString().ToLower()); args.Add("/" + CommandOutputParameter + ":" + bounce.LogOptions.CommandOutput.ToString().ToLower()); var logFormatName = LogFactoryRegistry.FindNameForLogFactory(bounce.LogFactory); if (logFormatName != null) { args.Add("/" + LogFormatParameter + ":" + logFormatName); } return(String.Join(" ", args.ToArray())); }
protected override void BuildTask(IBounce bounce) { if (IsServiceInstalled(bounce) && !IsServiceStopped(bounce)) { StopService(bounce); DateTime timeWhenAskedToStop = DateTime.Now; do { Thread.Sleep(1000); if (WaitedLongerThanTimeout(timeWhenAskedToStop)) { throw new BounceException(String.Format("service {0} could not be stopped", Name)); } } while (!IsServiceStopped(bounce)); Thread.Sleep(Wait.Value); } }
public override void Clean(IBounce bounce) { Console.WriteLine("Cleaning {0}", Description.Value); }
public override void Build(IBounce bounce) { BuiltWithBounce = bounce; }
public override void Build(IBounce bounce) { WasBuilt = true; }
public override void Invoke(IBounceCommand command, IBounce bounce) { base.Invoke(command, bounce); Invoked = true; }
public override void Build(IBounce bounce) { bounce.ShellCommand.ExecuteAndExpectSuccess(@"VeryLongRunningConsole\bin\Debug\VeryLongRunningConsole", ""); }
public override void Build(IBounce bounce) { Output.WriteLine(@"##teamcity[publishArtifacts '{0}']", ArtifactPath.Value); }
public override void Build(IBounce bounce) { bounce.ShellCommand.ExecuteAndExpectSuccess("cmd", "/c dir"); }
public override void Clean(IBounce bounce) { CleanedWithBounce = bounce; }