Example #1
0
        /// <summary>
        /// Initializes and runs the bootstrap process.
        /// </summary>
        /// <param name="input">Device that provides user input.</param>
        /// <param name="output">Device with display capabilities.</param>
        /// <param name="columnCount">Number of columns the output devices can render.</param>
        /// <param name="overrideUserDecision">Override the user interaction asking for confirmation.</param>
        /// <returns></returns>
        public async Task <bool> Run(IPackageInformationPrinter packageInformationPrinter, IBootstrapStatusLogger statusLogger, IIODefinition ioDefinition, ITextFileInput textFileInput, ITextFileOutput textFileOutput, bool overrideUserDecision = false)
        {
            this.textFileInput             = textFileInput;
            this.textFileOutput            = textFileOutput;
            this.ioDefinition              = ioDefinition;
            this.statusLogger              = statusLogger;
            this.packageInformationPrinter = packageInformationPrinter;

            InitPackageStorages();
            AddDefaultVariables();

            var dryRunSuccess = DryRunPackages();

            if (dryRunSuccess == false)
            {
                return(false);
            }

            if (InitPackageOperation(overrideUserDecision))
            {
                this.packageInformationPrinter.PrintPackageSummary(this.packages.PreviouslyRun, this.packages.Unsolved);
                await RunAllPackages(this.packages);

                WriteLog();
                await RunAllPackages(this.cleanupPackages);
            }
            else
            {
                return(false);
            }

            // Print the user feedback.
            this.packageInformationPrinter.PrintResults(this.packages.PreviouslyRun, this.packages.Solved, this.packages.Unsolved);

            return(true);
        }
 public PackageInformationPrinter(IIODefinition ioDefinition)
 {
     this.ioDefinition = ioDefinition;
 }