Ejemplo n.º 1
0
        public bool Execute(bool throwOnFailure = false)
        {
            foreach (var step in _steps)
            {
                try
                {
                    step.Execute(_input, _runner);
                }
                catch (Exception ex)
                {
                    cleanupPackages();
                    _solution.Reset();

                    RippleLog.Error("Error executing {0}".ToFormat(step.GetType().Name), ex);

                    // Mostly for testing
                    if (_forceThrow || throwOnFailure)
                    {
                        throw;
                    }

                    return(false);
                }
            }

            _solution.EachProject(project => project.RemoveDuplicateReferences());
            _solution.Save(_forceSave);

            if (_resetSolution)
            {
                _solution.Reset();
            }

            return(true);
        }
Ejemplo n.º 2
0
        public static CommandExecutionExpression With(Solution solution, bool throwOnFailure = true)
        {
            _target     = solution;
            _forceThrow = throwOnFailure;
            RippleLog.RemoveFileListener();

            return(new CommandExecutionExpression(() =>
            {
                _target = null;
                _forceThrow = false;
                RippleLog.AddFileListener();
            }));
        }
Ejemplo n.º 3
0
        public static void Fail(string message, params object[] substitutions)
        {
            // TODO -- Hate this
            var formattedMessage = message;

            try
            {
                formattedMessage = message.ToFormat(substitutions);
            }
            catch (FormatException)
            {
                // Just swallow it
            }

            RippleLog.Error(formattedMessage);
            throw new RippleFatalError(message);
        }
Ejemplo n.º 4
0
        public static RippleOperation For <T>(SolutionInput input, Solution solution)
        {
            var target = _target ?? solution;

            var description = input.DescribePlan(solution);

            if (description.IsNotEmpty())
            {
                RippleLog.Info(description);
            }

            input.Apply(target);

            var runner = new RippleStepRunner(new FileSystem());

            return(new RippleOperation(target, input, runner));
        }
Ejemplo n.º 5
0
        public static CommandExecutionExpression With(Solution solution, bool throwOnFailure = true, bool resetSolution = false)
        {
            _target        = solution;
            _forceThrow    = throwOnFailure;
            _resetSolution = resetSolution;

            RippleLog.RemoveFileListener();

            RippleFileSystem.StubCurrentDirectory(solution.Directory);

            return(new CommandExecutionExpression(() =>
            {
                _target = null;
                _forceThrow = false;
                _resetSolution = false;
                RippleLog.AddFileListener();
                RippleFileSystem.Live();
            }));
        }
Ejemplo n.º 6
0
 public static void Fail(string message, params object[] substitutions)
 {
     RippleLog.Error(message.ToFormat(substitutions));
     throw new RippleFatalError(message);
 }
Ejemplo n.º 7
0
 public static void Fail(string message)
 {
     RippleLog.Error(message);
     throw new RippleFatalError(message);
 }
Ejemplo n.º 8
0
 public static void CleanWithTracing(this IFileSystem system, string directory)
 {
     RippleLog.Info("Cleaning contents of directory " + directory);
     system.ForceClean(directory);
 }