/// <summary> /// Runs the command /// </summary> /// <param name="suite">The current suite model the command is applied to</param> /// <param name="parameters">Parameters given to the command (in unprocessed form)</param> public bool Run(Suite suite, string[] parameters) { var cleanParams = new CleanParameters(parameters); try { if (cleanParams.SoftClean) { targetRoot.Delete(predicates.ShouldDelete); } else { targetRoot.Delete(); } } catch (UnauthorizedAccessException ex) { CleanWarning(ex); } catch (IOException ex) { CleanWarning(ex); } foreach (var cleanExtension in extensions) { cleanExtension.Clean(cleanParams); } return(true); }
public void AcceptsBothParametersInAnyOrder() { var parameters1 = new CleanParameters(new[] { "--soft-clean", "--keep-refs" }); parameters1.SoftClean.Should().BeTrue(); parameters1.KeepReferences.Should().BeTrue(); var parameters2 = new CleanParameters(new[] { "--keep-references", "--soft-clean" }); parameters2.SoftClean.Should().BeTrue(); parameters2.KeepReferences.Should().BeTrue(); }
/// <summary> /// Runs the command /// </summary> /// <param name="suite">The current suite model the command is applied to</param> /// <param name="parameters">Parameters given to the command (in unprocessed form)</param> public bool Run(Suite suite, string[] parameters) { var cleanParams = new CleanParameters(parameters); try { targetRoot.Delete(); } catch (IOException ex) { output.Warning(String.Format("Failed to clean target root: {0}", ex.Message), new [] { "A command prompt may have its current directory set there", "Maybe the process is running" }); } foreach (var cleanExtension in extensions) { cleanExtension.Clean(cleanParams); } return(true); }
/// <summary> /// Runs the command /// </summary> /// <param name="suite">The current suite model the command is applied to</param> /// <param name="parameters">Parameters given to the command (in unprocessed form)</param> public bool Run(Suite suite, string[] parameters) { var cleanParams = new CleanParameters(new string[0]); var cleanParameters = parameters.Where(cleanParams.IsKeepReferencesParameter).ToArray(); var buildParameters = parameters.Where(p => !cleanParams.IsKeepReferencesParameter(p)).ToArray(); var cleanSucceeded = cleanCommand.Run(suite, cleanParameters); targetRoot.Remake(); cacheRoot.Remake(); var buildSucceeded = buildCommand.Run(suite, buildParameters); return cleanSucceeded && buildSucceeded; }
/// <summary> /// Runs the command /// </summary> /// <param name="suite">The current suite model the command is applied to</param> /// <param name="parameters">Parameters given to the command (in unprocessed form)</param> public bool Run(Suite suite, string[] parameters) { var cleanParams = new CleanParameters(parameters); try { if (cleanParams.SoftClean) { targetRoot.Delete(predicates.ShouldDelete); } else { targetRoot.Delete(); } } catch (UnauthorizedAccessException ex) { CleanWarning(ex); } catch (IOException ex) { CleanWarning(ex); } foreach (var cleanExtension in extensions) { cleanExtension.Clean(cleanParams); } return true; }
public void AcceptsAlternativeKeepReferencesParameter() { var parameters = new CleanParameters(new[] { "--keep-refs" }); parameters.KeepReferences.Should().BeTrue(); }
public void ByDefaultDoesNotKeepReferences() { var parameters = new CleanParameters(new string[0]); parameters.KeepReferences.Should().BeFalse(); }
public void ByDefaultNoSoftClean() { var parameters = new CleanParameters(new string[0]); parameters.SoftClean.Should().BeFalse(); }
public void AcceptsSoftCleanParameter() { var parameters = new CleanParameters(new[] {"--soft-clean"}); parameters.SoftClean.Should().BeTrue(); }
/// <summary> /// Runs the command /// </summary> /// <param name="suite">The current suite model the command is applied to</param> /// <param name="parameters">Parameters given to the command (in unprocessed form)</param> public bool Run(Suite suite, string[] parameters) { var cleanParams = new CleanParameters(parameters); try { targetRoot.Delete(); } catch (IOException ex) { output.Warning(String.Format("Failed to clean target root: {0}", ex.Message), new [] { "A command prompt may have its current directory set there", "Maybe the process is running" }); } foreach (var cleanExtension in extensions) { cleanExtension.Clean(cleanParams); } return true; }