public int IncrementVersion(NextVersionOption opts)
        {
            try
            {
                //if no path provided, we default into current directory
                if (string.IsNullOrEmpty(opts.Path))
                {
                    var workingPath = _environmentService.GetCurrentDirectory();
                    opts.Path = workingPath;
                }

                if (opts.IncrementMajorVersion)
                {
                    var nextVersion = _localVersionService.IncrementMajorVersion(opts.Path, opts.File);
                    _traceService.Success($"New major version created {nextVersion} on {opts.Path}.");
                }
                else if (opts.IncrementMinorVersion || (!opts.IncrementMajorVersion && !opts.IncrementMinorVersion))
                {
                    var nextVersion = _localVersionService.IncrementMinorVersion(opts.Path, opts.File);
                    _traceService.Success($"New minor version created {nextVersion} on {opts.Path}.");
                }

                return(0);
            } catch (Exception ex)
            {
                return(OnException(ex, "Failed to execute vnext function", opts.Debug, _traceService));
            }
        }
Beispiel #2
0
        public object IncrementVersion(NextVersionOption opts)
        {
            try
            {
                //if no path provided, we default into current directory
                if (string.IsNullOrEmpty(opts.Path))
                {
                    var workingPath = _environmentService.GetCurrentDirectory();
                    opts.Path = workingPath;
                }

                if (opts.IncrementMajorVersion)
                {
                    var nextVersion = _localVersionService.IncrementMajorVersion(opts.Path, opts.File);
                    _traceService.Info($"New major version created {nextVersion} on {opts.Path}.");
                }
                else if (opts.IncrementMinorVersion || (!opts.IncrementMajorVersion && !opts.IncrementMinorVersion))
                {
                    var nextVersion = _localVersionService.IncrementMinorVersion(opts.Path, opts.File);
                    _traceService.Info($"New minor version created {nextVersion} on {opts.Path}.");
                }
            }
            catch (Exception ex)
            {
                _traceService.Error($"Failed to execute vnext function. {Environment.NewLine}{ex.ToString()}");
                throw;
            }

            return(0);
        }
        public int RunNextVersionOption(NextVersionOption opts)
        {
            try
            {
                opts.Workspace = _configurationService.GetValueOrDefault(opts.Workspace, ENVIRONMENT_VARIABLE.YUNIQL_WORKSPACE, defaultValue: _environmentService.GetCurrentDirectory());
                if (opts.IncrementMajorVersion)
                {
                    var nextVersion = _workspaceService.IncrementMajorVersion(opts.Workspace, opts.File);
                    _traceService.Success($"New major version created {nextVersion} on {opts.Workspace}.");
                }
                else if (opts.IncrementMinorVersion || (!opts.IncrementMajorVersion && !opts.IncrementMinorVersion))
                {
                    var nextVersion = _workspaceService.IncrementMinorVersion(opts.Workspace, opts.File);
                    _traceService.Success($"New minor version created {nextVersion} on {opts.Workspace}.");
                }

                return(0);
            }
            catch (Exception ex)
            {
                return(OnException(ex, "Failed to execute vnext function", opts.IsDebug));
            }
        }