Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
94 changes: 47 additions & 47 deletions tools/VersionController/Models/VersionBumper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -98,53 +98,53 @@ public Tuple<string, bool> GetOldVersion()
version = localVersion;
isPreview = localPreview;

using (PowerShell powetshell = PowerShell.Create())
{
powetshell.AddScript("Register-PackageSource -Name PSGallery -Location https://www.powershellgallery.com/api/v2 -ProviderName PowerShellGet");
powetshell.AddScript("Find-Module -Name " + moduleName + " -AllowPrerelease -Repository PSGallery -AllVersions");
var cmdletResult = powetshell.Invoke();
if (cmdletResult.Count != 0)
{
var psVersionImformation = cmdletResult[0].ToString();
Regex reg = new Regex("Version=(.*?)(-|;)");
Match match = reg.Match(psVersionImformation);
psVersion = match.Groups[1].Value;
psPreview = Regex.IsMatch(psVersionImformation, "preview");
}
}
if (psVersion == null)
{
psVersion = "0.1.0";
}
if (new AzurePSVersion(psVersion) > new AzurePSVersion(version))
{
version = psVersion;
isPreview = psPreview;
}

using (PowerShell powetshell = PowerShell.Create())
{
powetshell.AddScript("Register-PackageSource -Name TestGallery -Location https://www.poshtestgallery.com/api/v2 -ProviderName PowerShellGet");
powetshell.AddScript("Find-Module -Name " + moduleName + " -AllowPrerelease -Repository TestGallery -AllVersions");
var cmdletResult = powetshell.Invoke();
if (cmdletResult.Count != 0)
{
var testVersionImformation = cmdletResult[0].ToString();
Regex reg = new Regex("Version=(.*?)(-|;)");
Match match = reg.Match(testVersionImformation);
testVersion = match.Groups[1].Value;
testPreview = Regex.IsMatch(testVersionImformation, "preview");
}
}
if (testVersion == null)
{
testVersion = "0.1.0";
}
if (new AzurePSVersion(testVersion) > new AzurePSVersion(version))
{
version = testVersion;
isPreview = testPreview;
}
// using (PowerShell powetshell = PowerShell.Create())
// {
// powetshell.AddScript("Register-PackageSource -Name PSGallery -Location https://www.powershellgallery.com/api/v2 -ProviderName PowerShellGet");
// powetshell.AddScript("Find-Module -Name " + moduleName + " -AllowPrerelease -Repository PSGallery -AllVersions");
// var cmdletResult = powetshell.Invoke();
// if (cmdletResult.Count != 0)
// {
// var psVersionImformation = cmdletResult[0].ToString();
// Regex reg = new Regex("Version=(.*?)(-|;)");
// Match match = reg.Match(psVersionImformation);
// psVersion = match.Groups[1].Value;
// psPreview = Regex.IsMatch(psVersionImformation, "preview");
// }
// }
// if (psVersion == null)
// {
// psVersion = "0.1.0";
// }
// if (new AzurePSVersion(psVersion) > new AzurePSVersion(version))
// {
// version = psVersion;
// isPreview = psPreview;
// }

// using (PowerShell powetshell = PowerShell.Create())
// {
// powetshell.AddScript("Register-PackageSource -Name TestGallery -Location https://www.poshtestgallery.com/api/v2 -ProviderName PowerShellGet");
// powetshell.AddScript("Find-Module -Name " + moduleName + " -AllowPrerelease -Repository TestGallery -AllVersions");
// var cmdletResult = powetshell.Invoke();
// if (cmdletResult.Count != 0)
// {
// var testVersionImformation = cmdletResult[0].ToString();
// Regex reg = new Regex("Version=(.*?)(-|;)");
// Match match = reg.Match(testVersionImformation);
// testVersion = match.Groups[1].Value;
// testPreview = Regex.IsMatch(testVersionImformation, "preview");
// }
// }
// if (testVersion == null)
// {
// testVersion = "0.1.0";
// }
// if (new AzurePSVersion(testVersion) > new AzurePSVersion(version))
// {
// version = testVersion;
// isPreview = testPreview;
// }

return Tuple.Create(version, isPreview);
}
Expand Down