当前位置: 首页>>代码示例>>C#>>正文


C# DeploymentResult.AddAbort方法代码示例

本文整理汇总了C#中DeploymentResult.AddAbort方法的典型用法代码示例。如果您正苦于以下问题:C# DeploymentResult.AddAbort方法的具体用法?C# DeploymentResult.AddAbort怎么用?C# DeploymentResult.AddAbort使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在DeploymentResult的用法示例。


在下文中一共展示了DeploymentResult.AddAbort方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Execute

        public DeploymentResult Execute()
        {
            var deploymentResult = new DeploymentResult();

            try
            {
                Ex(detail =>
                {
                    if (!deploymentResult.ShouldAbort)
                    {
                        var verifyResult = detail.Verify();
                        deploymentResult.MergedWith(verifyResult);

                        if (verifyResult.ContainsError())
                        {
                            DisplayResults(verifyResult);
                        }
                        else
                        {
                            Logging.Coarse(LogLevel.Info, "[Run  ] {0}", detail.Name);
                            var executeResult = detail.Execute();
                            DisplayResults(executeResult);
                            deploymentResult.MergedWith(executeResult);
                        }

                        if (deploymentResult.ContainsError() && AbortOnError)
                        {
                            var message = "[Abort] Aborting due to previous error (since --abortOnError switch was specified).";
                            deploymentResult.AddAbort(message);
                            Logging.Coarse(LogLevel.Error, message);
                            throw new DeploymentAbortedException();
                        }
                    }
                    else
                    {
                        Logging.Coarse(LogLevel.Error, "[Skip ] {0}", detail.Name);
                    }
                });
            }
            catch (DeploymentAbortedException) { }

            return deploymentResult;
        }
开发者ID:Allon-Guralnek,项目名称:dropkick,代码行数:43,代码来源:DeploymentPlan.cs

示例2: VerifyCanRun

        public override DeploymentResult VerifyCanRun()
        {
            var result = new DeploymentResult();
             result.AddNote(_reason);

             if(_filesShouldExist.Count > 0) {
            var tmpDR = new DeploymentResult();
            foreach(var filePath in _filesShouldExist) {
               string actualPath = _path.GetFullPath(filePath);
               if(!File.Exists(actualPath)) { tmpDR.AddError("  File '{0}' should exist!.".FormatWith(actualPath)); }
            }
            result.MergedWith(tmpDR);
            //errors show up anyway, give some feedback if everything OK.
            if(!tmpDR.ContainsError()) { result.AddNote("  All {0} files found!".FormatWith(_filesShouldExist.Count)); }
             } else {
            result.AddNote("  No Files that should exist.");
             }

             if(_directoriesShouldExist.Count > 0) {
            var tmpDR = new DeploymentResult();
            foreach(var dirPath in _directoriesShouldExist) {
               string actualPath = _path.GetFullPath(dirPath);
               if(!Directory.Exists(actualPath)) { tmpDR.AddError("  Directory '{0}' should exist".FormatWith(actualPath)); }
            }
            result.MergedWith(tmpDR);
            //errors show up anyway, give some feedback if everything OK.
            if(!tmpDR.ContainsError()) { result.AddNote("  All {0} directories found!".FormatWith(_directoriesShouldExist.Count)); }
             } else {
            result.AddNote("  No Directories that should exist.");
             }

             if(_filesShould_NOT_Exist.Count > 0) {
            var tmpDR = new DeploymentResult();
            foreach(var filePath in _filesShould_NOT_Exist) {
               string actualPath = _path.GetFullPath(filePath);
               if(File.Exists(actualPath)) { tmpDR.AddError("  File '{0}' should NOT exist!.".FormatWith(actualPath)); }
            }
            result.MergedWith(tmpDR);
            if(!tmpDR.ContainsError()) { result.AddNote("  None of the {0} files exist!".FormatWith(_filesShould_NOT_Exist.Count)); }
             } else {
            result.AddNote("  No Files that should NOT exist.");
             }

             if(_directoriesShould_NOT_Exist.Count > 0) {
            var tmpDR = new DeploymentResult();
            foreach(var dirPath in _directoriesShould_NOT_Exist) {
               string actualPath = _path.GetFullPath(dirPath);
               if(Directory.Exists(actualPath)) { tmpDR.AddError("  Directory '{0}' should NOT exist".FormatWith(actualPath)); }
            }
            result.MergedWith(tmpDR);
            if(!tmpDR.ContainsError()) { result.AddNote("  None of the {0} directories exist!".FormatWith(_directoriesShould_NOT_Exist.Count)); }
             } else {
            result.AddNote("  No Directories that should NOT exist.");
             }

             if(_shouldAbortOnError && result.ContainsError()) { result.AddAbort(_reason); }
             return result;
        }
开发者ID:Allon-Guralnek,项目名称:dropkick,代码行数:58,代码来源:ExistsTasks.cs


注:本文中的DeploymentResult.AddAbort方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。