예제 #1
0
        protected override void Process([NotNull] ProcessorArgs args)
        {
            Install9Args   arguments      = (Install9Args)args;
            Task           task           = arguments.Tasker.Tasks.FirstOrDefault(t => t.Name == this.taskName);
            PowerShellTask powershellTask = task as PowerShellTask;

            if (powershellTask != null)
            {
                string result = powershellTask.GetScript();
                if (task.State == TaskState.Failed)
                {
                    throw new AggregateException(string.Format("Failed to execute {0} task. \n{1}", task.Name, result));
                }

                string path = Path.Combine(arguments.Tasker.GlobalParams.First(p => p.Name == "FilesRoot").Value,
                                           string.Format("generated_scripts/{0}", task.UnInstall ? "Uninstall" : "Install"));
                Directory.CreateDirectory(path);

                using (StreamWriter writer = new StreamWriter(Path.Combine(path, string.Format("{0}.ps1", task.Name))))
                {
                    writer.Write(powershellTask.GetScript());
                }
            }
            else
            {
                this.Skip();
            }
        }
        protected override void Process([NotNull] ProcessorArgs args)
        {
            Install9Args arguments = (Install9Args)args;

            if (arguments.Tasker.UnInstall || arguments.ScriptsOnly)
            {
                this.Skip();
                return;
            }
            arguments.UnInstallDataPath = arguments.Tasker.SaveUninstallData(ApplicationManager.UnInstallParamsFolder);
        }
        protected override void Process([NotNull] ProcessorArgs args)
        {
            Install9Args arguments = (Install9Args)args;

            if (arguments.Tasker.UnInstall || arguments.ScriptsOnly)
            {
                this.Skip();
                return;
            }

            InstallParam sqlDbPrefixParam = arguments.Tasker.GlobalParams.FirstOrDefault(p => p.Name == SqlDbPrefix);

            if (sqlDbPrefixParam != null && !string.IsNullOrEmpty(sqlDbPrefixParam.Value))
            {
                this.AddSitecoreEnvironment(this.CreateSitecoreEnvironment(arguments.Tasker, sqlDbPrefixParam.Value, arguments.UnInstallDataPath));
            }
        }
        public override IEnumerable <Processor> CreateProcessors(ProcessorArgs args)
        {
            Install9Args     arguments  = (Install9Args)args;
            List <Processor> processors = new List <Processor>();

            arguments.Tasker.EvaluateGlobalParams();
            Processor root      = null;
            bool      uninstall = this.ParentDefinition.Param.Equals("uninstall", StringComparison.InvariantCultureIgnoreCase);

            foreach (PowerShellTask task in arguments.Tasker.Tasks)
            {
                if (!task.ShouldRun || (!task.SupportsUninstall() && uninstall))
                {
                    continue;
                }

                Processor proc = null;
                if (arguments.ScriptsOnly)
                {
                    proc = new GenerateScriptProcessor(task.Name);
                }
                else
                {
                    proc = new RunPSTaskProcessor(task.Name);
                }

                proc.ProcessorDefinition.Title = task.Name;
                proc.ProcessorDefinition.Type  = proc.GetType();
                if (root == null)
                {
                    processors.Add(proc);
                }
                else
                {
                    root._NestedProcessors.Add(proc);
                }
                root = proc;
            }

            return(processors);
        }
        protected override void Process([NotNull] ProcessorArgs args)
        {
            Install9Args arguments = (Install9Args)args;

            Sitecore9Installer.Tasks.Task task = arguments.Tasker.Tasks.FirstOrDefault(t => t.Name == this.taskName);
            Assert.ArgumentNotNull(task, nameof(task));

            string result = string.Empty;

            try
            {
                result = task.Run();
            }
            catch (Exception ex)
            {
                this.HandleError(task, ex);
            }

            if (task.State != TaskState.Finished)
            {
                this.HandleError(task, result);
            }
        }
예제 #6
0
        public override long EvaluateStepsCount([NotNull] ProcessorArgs args)
        {
            Install9Args arguments = (Install9Args)args;

            return(arguments.Tasker.Tasks.Count(t => t.ShouldRun));
        }