Reset() public static method

public static Reset ( ) : void
return void
Example #1
0
        public override bool Execute()
        {
            try
            {
                VersionVariables variables;

                if (VersionAndBranchFinder.TryGetVersion(SolutionDirectory, out variables, NoFetch, new Authentication(), fileSystem))
                {
                    var thisType = typeof(GetVersion);
                    foreach (var variable in variables)
                    {
                        thisType.GetProperty(variable.Key).SetValue(this, variable.Value, null);
                    }
                }
                return(true);
            }
            catch (WarningException errorException)
            {
                logger.LogWarning(errorException.Message);
                return(true);
            }
            catch (Exception exception)
            {
                logger.LogError("Error occurred: " + exception);
                return(false);
            }
            finally
            {
                Logger.Reset();
            }
        }
Example #2
0
 public override bool Execute()
 {
     try
     {
         SemanticVersion versionAndBranch;
         if (VersionAndBranchFinder.TryGetVersion(SolutionDirectory, out versionAndBranch))
         {
             var thisType  = typeof(GetVersion);
             var variables = VariableProvider.GetVariablesFor(versionAndBranch);
             foreach (var variable in variables)
             {
                 thisType.GetProperty(variable.Key).SetValue(this, variable.Value, null);
             }
         }
         return(true);
     }
     catch (WarningException errorException)
     {
         logger.LogWarning(errorException.Message);
         return(true);
     }
     catch (Exception exception)
     {
         logger.LogError("Error occurred: " + exception);
         return(false);
     }
     finally
     {
         Logger.Reset();
     }
 }
Example #3
0
        public override bool Execute()
        {
            try
            {
                CachedVersion versionAndBranch;
                var           gitDirectory  = GitDirFinder.TreeWalkForGitDir(SolutionDirectory);
                var           configuration = ConfigurationProvider.Provide(gitDirectory, fileSystem);

                // TODO This should be covered by tests
                // Null is intentional. Empty string means the user has set the value to an empty string and wants to clear the tag
                if (DevelopBranchTag != null)
                {
                    configuration.DevelopBranchTag = DevelopBranchTag;
                }

                if (ReleaseBranchTag != null)
                {
                    configuration.ReleaseBranchTag = ReleaseBranchTag;
                }

                if (TagPrefix != null)
                {
                    configuration.TagPrefix = TagPrefix;
                }

                if (NextVersion != null)
                {
                    configuration.NextVersion = NextVersion;
                }

                if (VersionAndBranchFinder.TryGetVersion(SolutionDirectory, out versionAndBranch, configuration))
                {
                    var thisType  = typeof(GetVersion);
                    var variables = VariableProvider.GetVariablesFor(versionAndBranch.SemanticVersion, configuration);
                    foreach (var variable in variables)
                    {
                        thisType.GetProperty(variable.Key).SetValue(this, variable.Value, null);
                    }
                }
                return(true);
            }
            catch (WarningException errorException)
            {
                logger.LogWarning(errorException.Message);
                return(true);
            }
            catch (Exception exception)
            {
                logger.LogError("Error occurred: " + exception);
                return(false);
            }
            finally
            {
                Logger.Reset();
            }
        }
Example #4
0
        public override bool Execute()
        {
            try
            {
                Tuple <CachedVersion, GitVersionContext> versionAndBranch;
                var gitDirectory  = GitDirFinder.TreeWalkForGitDir(SolutionDirectory);
                var configuration = ConfigurationProvider.Provide(gitDirectory, fileSystem);

                if (VersionAndBranchFinder.TryGetVersion(SolutionDirectory, out versionAndBranch, configuration))
                {
                    var thisType          = typeof(GetVersion);
                    var cachedVersion     = versionAndBranch.Item1;
                    var gitVersionContext = versionAndBranch.Item2;
                    var config            = gitVersionContext.Configuration;
                    var variables         = VariableProvider.GetVariablesFor(
                        cachedVersion.SemanticVersion, config.AssemblyVersioningScheme,
                        config.VersioningMode, config.ContinuousDeploymentFallbackTag,
                        gitVersionContext.IsCurrentCommitTagged);
                    foreach (var variable in variables)
                    {
                        thisType.GetProperty(variable.Key).SetValue(this, variable.Value, null);
                    }
                }
                return(true);
            }
            catch (WarningException errorException)
            {
                logger.LogWarning(errorException.Message);
                return(true);
            }
            catch (Exception exception)
            {
                logger.LogError("Error occurred: " + exception);
                return(false);
            }
            finally
            {
                Logger.Reset();
            }
        }
Example #5
0
 public override bool Execute()
 {
     try
     {
         InnerExecute();
         return(true);
     }
     catch (WarningException errorException)
     {
         logger.LogWarning(errorException.Message);
         return(true);
     }
     catch (Exception exception)
     {
         logger.LogError("Error occurred: " + exception);
         return(false);
     }
     finally
     {
         Logger.Reset();
     }
 }