@@ -78,9 +78,11 @@ public void BumpAllVersions()
78
78
public Tuple < string , bool > GetOldVersion ( )
79
79
{
80
80
string version ;
81
- string localVersion = null , psVersion = null , testVersion = null ;
81
+ string localVersion = null ;
82
+ // string localVersion = null, psVersion = null, testVersion = null;
82
83
bool isPreview ;
83
- bool localPreview = false , psPreview = false , testPreview = false ;
84
+ bool localPreview = false ;
85
+ // bool localPreview = false, psPreview = false, testPreview = false;
84
86
var moduleName = _fileHelper . ModuleName ;
85
87
86
88
using ( PowerShell powershell = PowerShell . Create ( ) )
@@ -98,53 +100,53 @@ public Tuple<string, bool> GetOldVersion()
98
100
version = localVersion ;
99
101
isPreview = localPreview ;
100
102
101
- using ( PowerShell powetshell = PowerShell . Create ( ) )
102
- {
103
- powetshell . AddScript ( "Register-PackageSource -Name PSGallery -Location https://www.powershellgallery.com/api/v2 -ProviderName PowerShellGet" ) ;
104
- powetshell . AddScript ( "Find-Module -Name " + moduleName + " -AllowPrerelease -Repository PSGallery -AllVersions" ) ;
105
- var cmdletResult = powetshell . Invoke ( ) ;
106
- if ( cmdletResult . Count != 0 )
107
- {
108
- var psVersionImformation = cmdletResult [ 0 ] . ToString ( ) ;
109
- Regex reg = new Regex ( "Version=(.*?)(-|;)" ) ;
110
- Match match = reg . Match ( psVersionImformation ) ;
111
- psVersion = match . Groups [ 1 ] . Value ;
112
- psPreview = Regex . IsMatch ( psVersionImformation , "preview" ) ;
113
- }
114
- }
115
- if ( psVersion == null )
116
- {
117
- psVersion = "0.1.0" ;
118
- }
119
- if ( new AzurePSVersion ( psVersion ) > new AzurePSVersion ( version ) )
120
- {
121
- version = psVersion ;
122
- isPreview = psPreview ;
123
- }
124
-
125
- using ( PowerShell powetshell = PowerShell . Create ( ) )
126
- {
127
- powetshell . AddScript ( "Register-PackageSource -Name TestGallery -Location https://www.poshtestgallery.com/api/v2 -ProviderName PowerShellGet" ) ;
128
- powetshell . AddScript ( "Find-Module -Name " + moduleName + " -AllowPrerelease -Repository TestGallery -AllVersions" ) ;
129
- var cmdletResult = powetshell . Invoke ( ) ;
130
- if ( cmdletResult . Count != 0 )
131
- {
132
- var testVersionImformation = cmdletResult [ 0 ] . ToString ( ) ;
133
- Regex reg = new Regex ( "Version=(.*?)(-|;)" ) ;
134
- Match match = reg . Match ( testVersionImformation ) ;
135
- testVersion = match . Groups [ 1 ] . Value ;
136
- testPreview = Regex . IsMatch ( testVersionImformation , "preview" ) ;
137
- }
138
- }
139
- if ( testVersion == null )
140
- {
141
- testVersion = "0.1.0" ;
142
- }
143
- if ( new AzurePSVersion ( testVersion ) > new AzurePSVersion ( version ) )
144
- {
145
- version = testVersion ;
146
- isPreview = testPreview ;
147
- }
103
+ // using (PowerShell powetshell = PowerShell.Create())
104
+ // {
105
+ // powetshell.AddScript("Register-PackageSource -Name PSGallery -Location https://www.powershellgallery.com/api/v2 -ProviderName PowerShellGet");
106
+ // powetshell.AddScript("Find-Module -Name " + moduleName + " -AllowPrerelease -Repository PSGallery -AllVersions");
107
+ // var cmdletResult = powetshell.Invoke();
108
+ // if (cmdletResult.Count != 0)
109
+ // {
110
+ // var psVersionImformation = cmdletResult[0].ToString();
111
+ // Regex reg = new Regex("Version=(.*?)(-|;)");
112
+ // Match match = reg.Match(psVersionImformation);
113
+ // psVersion = match.Groups[1].Value;
114
+ // psPreview = Regex.IsMatch(psVersionImformation, "preview");
115
+ // }
116
+ // }
117
+ // if (psVersion == null)
118
+ // {
119
+ // psVersion = "0.1.0";
120
+ // }
121
+ // if (new AzurePSVersion(psVersion) > new AzurePSVersion(version))
122
+ // {
123
+ // version = psVersion;
124
+ // isPreview = psPreview;
125
+ // }
126
+
127
+ // using (PowerShell powetshell = PowerShell.Create())
128
+ // {
129
+ // powetshell.AddScript("Register-PackageSource -Name TestGallery -Location https://www.poshtestgallery.com/api/v2 -ProviderName PowerShellGet");
130
+ // powetshell.AddScript("Find-Module -Name " + moduleName + " -AllowPrerelease -Repository TestGallery -AllVersions");
131
+ // var cmdletResult = powetshell.Invoke();
132
+ // if (cmdletResult.Count != 0)
133
+ // {
134
+ // var testVersionImformation = cmdletResult[0].ToString();
135
+ // Regex reg = new Regex("Version=(.*?)(-|;)");
136
+ // Match match = reg.Match(testVersionImformation);
137
+ // testVersion = match.Groups[1].Value;
138
+ // testPreview = Regex.IsMatch(testVersionImformation, "preview");
139
+ // }
140
+ // }
141
+ // if (testVersion == null)
142
+ // {
143
+ // testVersion = "0.1.0";
144
+ // }
145
+ // if (new AzurePSVersion(testVersion) > new AzurePSVersion(version))
146
+ // {
147
+ // version = testVersion;
148
+ // isPreview = testPreview;
149
+ // }
148
150
149
151
return Tuple . Create ( version , isPreview ) ;
150
152
}
0 commit comments