Beispiel #1
0
        private static string CreateNewVersion(this ICakeContext context, string productVersion, string buildNumber)
        {
            string[] versionparts = productVersion.Split('.');
            string   newVersion   = "";

            if (versionparts.Length >= 3)
            {
                newVersion = string.Join(".", versionparts[0], versionparts[1], versionparts[2], buildNumber);
                LoggingAliases.Information(context, "Created new version number: {0}", newVersion);
            }
            else
            {
                LoggingAliases.Error(context, "Product version doesn't match three slack, can't form new version number {0} {1}",
                                     productVersion, " format required must be inline of 1.0.0.0 or 1.0.0-aplha");
                throw new InvalidDataException("Product version doesn't match three slack, can't form new version number ");
            }
            return(newVersion);
        }
Beispiel #2
0
        private static bool IsProductVersionValid(this ICakeContext context, string productVersion)
        {
            string regexPattern = @"\d.\d.\d[.-]\w*";
            var    rx           = new Regex(regexPattern);

            if (rx.IsMatch(productVersion))
            {
                LoggingAliases.Information(context,
                                           "Following product version is **valid** and inline with 1.0.0.0 or 1.0.0-aplha format ",
                                           productVersion);
                return(true);
            }
            else
            {
                LoggingAliases.Error(context, "Product version found in csproj doesn't match required format {0} {1}",
                                     productVersion,
                                     " format required must be inline of 1.0.0.0 or 1.0.0-aplha");
                throw new InvalidDataException("Product version found in csproj doesn't match required format, format required must be inline of 1.0.0.0 or 1.0.0-aplha");
            }
        }