Inheritance: ICleanParameters
コード例 #1
0
        /// <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);
        }
コード例 #2
0
ファイル: CleanParametersTest.cs プロジェクト: vigoo/bari
        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();
        }
コード例 #3
0
ファイル: CleanCommand.cs プロジェクト: zvrana/bari
        /// <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);
        }
コード例 #4
0
ファイル: RebuildCommand.cs プロジェクト: zvrana/bari
        /// <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;
        }
コード例 #5
0
ファイル: CleanCommand.cs プロジェクト: vigoo/bari
        /// <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;
        }
コード例 #6
0
ファイル: CleanParametersTest.cs プロジェクト: zvrana/bari
 public void AcceptsAlternativeKeepReferencesParameter()
 {
     var parameters = new CleanParameters(new[] { "--keep-refs" });
     parameters.KeepReferences.Should().BeTrue();
 }
コード例 #7
0
ファイル: CleanParametersTest.cs プロジェクト: zvrana/bari
 public void ByDefaultDoesNotKeepReferences()
 {
     var parameters = new CleanParameters(new string[0]);
     parameters.KeepReferences.Should().BeFalse();
 }
コード例 #8
0
ファイル: CleanParametersTest.cs プロジェクト: vigoo/bari
 public void ByDefaultNoSoftClean()
 {
     var parameters = new CleanParameters(new string[0]);
     parameters.SoftClean.Should().BeFalse();
 }
コード例 #9
0
ファイル: CleanParametersTest.cs プロジェクト: vigoo/bari
 public void AcceptsSoftCleanParameter()
 {
     var parameters = new CleanParameters(new[] {"--soft-clean"});
     parameters.SoftClean.Should().BeTrue();
 }
コード例 #10
0
ファイル: CleanCommand.cs プロジェクト: zvrana/bari
        /// <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;
        }