6
6
using Cmf . CLI . Constants ;
7
7
using Cmf . CLI . Core . Attributes ;
8
8
using Cmf . CLI . Core . Commands ;
9
+ using Cmf . CLI . Core . Constants ;
9
10
using Cmf . CLI . Core . Enums ;
10
11
using Cmf . CLI . Core . Objects ;
11
12
using Cmf . CLI . Utilities ;
@@ -27,7 +28,6 @@ internal class InitArguments
27
28
public string version { get ; set ; }
28
29
public IFileInfo config { get ; set ; }
29
30
public IDirectoryInfo deploymentDir { get ; set ; }
30
- public Uri repositoryUrl { get ; set ; }
31
31
public string BaseVersion { get ; set ; }
32
32
public string DevTasksVersion { get ; set ; }
33
33
public string HTMLStarterVersion { get ; set ; }
@@ -38,20 +38,10 @@ internal class InitArguments
38
38
public IFileInfo infrastructure { get ; set ; }
39
39
public Uri nugetRegistry { get ; set ; }
40
40
public Uri npmRegistry { get ; set ; }
41
- public Uri azureDevOpsCollectionUrl { get ; set ; }
42
- public string agentPool { get ; set ; }
43
- public AgentType ? agentType { get ; set ; }
44
41
public IFileInfo ISOLocation { get ; set ; }
45
42
public string nugetRegistryUsername { get ; set ; }
46
43
public string nugetRegistryPassword { get ; set ; }
47
- public string cmfPipelineRepository { get ; set ; }
48
44
public string cmfCliRepository { get ; set ; }
49
- public string pipelinesFolder { get ; set ; }
50
- public string releaseCustomerEnvironment { get ; set ; }
51
- public string releaseSite { get ; set ; }
52
- public string releaseDeploymentPackage { get ; set ; }
53
- public string releaseLicense { get ; set ; }
54
- public string releaseDeploymentTarget { get ; set ; }
55
45
public RepositoryType repositoryType { get ; set ; }
56
46
// ReSharper restore UnusedAutoPropertyAccessor.Global
57
47
// ReSharper restore InconsistentNaming
@@ -117,10 +107,6 @@ public override void Configure(Command cmd)
117
107
{ IsRequired = true } ) ;
118
108
119
109
// template-time options. These are all mandatory
120
- cmd . AddOption ( new Option < Uri > (
121
- aliases : new [ ] { "--repositoryUrl" } ,
122
- description : "Git repository URL"
123
- ) { IsRequired = true } ) ;
124
110
cmd . AddOption ( new Option < IDirectoryInfo > (
125
111
aliases : new [ ] { "--deploymentDir" } ,
126
112
parseArgument : argResult => Parse < IDirectoryInfo > ( argResult ) ,
@@ -171,18 +157,7 @@ public override void Configure(Command cmd)
171
157
aliases : new [ ] { "--npmRegistry" } ,
172
158
description : "NPM registry that contains the MES packages"
173
159
) ) ;
174
- cmd . AddOption ( new Option < Uri > (
175
- aliases : new [ ] { "--azureDevOpsCollectionUrl" } ,
176
- description : "The Azure DevOps collection address"
177
- ) ) ;
178
- cmd . AddOption ( new Option < string > (
179
- aliases : new [ ] { "--agentPool" } ,
180
- description : "Azure DevOps agent pool"
181
- ) ) ;
182
- cmd . AddOption ( new Option < AgentType > (
183
- aliases : new [ ] { "--agentType" } ,
184
- description : "Type of Azure DevOps agents: Cloud or Hosted"
185
- ) ) ;
160
+
186
161
cmd . AddOption ( new Option < IFileInfo > (
187
162
aliases : new [ ] { "--ISOLocation" } ,
188
163
parseArgument : argResult => Parse < IFileInfo > ( argResult ) ,
@@ -202,63 +177,13 @@ public override void Configure(Command cmd)
202
177
description : "NPM registry that contains the CLI" ,
203
178
getDefaultValue : ( ) => new Uri ( CliConstants . NpmJsUrl , UriKind . Absolute )
204
179
) ) ;
205
- cmd . AddOption ( new Option < Uri > (
206
- aliases : new [ ] { "--cmfPipelineRepository" } ,
207
- description : "NPM registry that contains the CLI Pipeline Plugin"
208
- ) ) ;
209
- cmd . AddOption ( new Option < string > (
210
- aliases : new [ ] { "--pipelinesFolder" } ,
211
- getDefaultValue : ( ) => "" ,
212
- description : "Folder where we should put the pipelines in. Empty means the root folder"
213
- ) ) ;
214
-
215
- // container-specific switches
216
- cmd . AddOption ( new Option < string > (
217
- aliases : new [ ] { "--releaseCustomerEnvironment" } ,
218
- description : "Customer Environment Name defined in DevOpsCenter"
219
- ) ) ;
220
- cmd . AddOption ( new Option < string > (
221
- aliases : new [ ] { "--releaseSite" } ,
222
- description : "Site defined in DevOpsCenter"
223
- ) ) ;
224
- cmd . AddOption ( new Option < string > (
225
- aliases : new [ ] { "--releaseDeploymentPackage" } ,
226
- description : "DeploymentPackage defined in DevOpsCenter"
227
- ) ) ;
228
- cmd . AddOption ( new Option < string > (
229
- aliases : new [ ] { "--releaseLicense" } ,
230
- description : "License defined in DevOpsCenter"
231
- ) ) ;
232
- cmd . AddOption ( new Option < string > (
233
- aliases : new [ ] { "--releaseDeploymentTarget" } ,
234
- description : "DeploymentTarget defined in DevOpsCenter"
235
- ) ) ;
236
-
180
+
237
181
// Add the handler
238
182
cmd . Handler = CommandHandler
239
183
. Create ( ( InitArguments args ) =>
240
184
{
241
185
this . Execute ( args ) ;
242
186
} ) ;
243
- // no overload accepts these many arguments...
244
- // .Create<
245
- // IDirectoryInfo, // workingDir
246
- // string, // rootPackageName,
247
- // IFileInfo, // config
248
- // IDirectoryInfo, // deploymentDir
249
- // string, // MESVersion
250
- // string, // DevTasksVersion
251
- // string, // HTMLStarterVersion
252
- // string, // yoGeneratorVersion
253
- // string, // nugetVersion
254
- // string, // testScenariosNugetVersion
255
- // IFileInfo, // infrastructure
256
- // Uri, // nugetRegistry
257
- // Uri, // npmRegistry
258
- // Uri, // universalRegistry
259
- // string, // agentPool
260
- // AgentType? // agentType
261
- // >(this.Execute);
262
187
}
263
188
264
189
/// <summary>
@@ -287,29 +212,9 @@ internal void Execute(InitArguments x)
287
212
if ( x . deploymentDir != null )
288
213
{
289
214
args . AddRange ( new [ ] { "--deploymentDir" , x . deploymentDir . FullName } ) ;
290
- // repositories are sub-folders of deploymentDir
291
- args . AddRange ( new [ ] { "--CIRepo" , $ "{ x . deploymentDir . FullName } \\ CIPackages"} ) ;
292
- args . AddRange ( new [ ] { "--ADArtifactsRepo" , $ "{ x . deploymentDir . FullName } \\ ADArtifacts"} ) ;
293
- args . AddRange ( new [ ] { "--RCRepo" , $ "{ x . deploymentDir . FullName } \\ ReleaseCandidates"} ) ;
294
215
args . AddRange ( new [ ] { "--DeliveredRepo" , $ "{ x . deploymentDir . FullName } \\ Delivered"} ) ;
216
+ args . AddRange ( new [ ] { "--CIRepo" , $ "{ x . deploymentDir . FullName } \\ CIPackages" } ) ;
295
217
}
296
-
297
- var repoName = x . projectName ;
298
- if ( x . repositoryUrl != null )
299
- {
300
- args . AddRange ( new [ ] { "--repositoryUrl" , x . repositoryUrl . AbsoluteUri } ) ;
301
- var match = CliConstants . RepoRegex . Match ( x . repositoryUrl . AbsoluteUri ) ;
302
- if ( ( match ? . Success ?? false ) && match . Groups . ContainsKey ( "repo" ) )
303
- {
304
- repoName = match . Groups [ "repo" ] . Value ;
305
- }
306
- }
307
-
308
- if ( repoName != null )
309
- {
310
- args . AddRange ( new [ ] { "--repositoryName" , repoName } ) ;
311
- }
312
-
313
218
if ( x . BaseVersion != null )
314
219
{
315
220
args . AddRange ( new [ ] { "--MESVersion" , x . BaseVersion } ) ;
@@ -329,16 +234,6 @@ internal void Execute(InitArguments x)
329
234
args . AddRange ( new [ ] { "--testScenariosNugetVersion" , x . testScenariosNugetVersion } ) ;
330
235
}
331
236
332
- if ( ! string . IsNullOrWhiteSpace ( x . pipelinesFolder ) )
333
- {
334
- var folder = x . pipelinesFolder . Replace ( "/" , "\\ " ) ;
335
- if ( ! folder . StartsWith ( "\\ " ) )
336
- {
337
- folder = "\\ " + folder ;
338
- }
339
- args . AddRange ( new [ ] { "--pipelinesFolder" , folder } ) ;
340
- }
341
-
342
237
#region infrastructure
343
238
344
239
if ( x . infrastructure != null )
@@ -349,12 +244,6 @@ internal void Execute(InitArguments x)
349
244
{
350
245
x . nugetRegistry ??= GenericUtilities . JsonObjectToUri ( infraJson [ "NuGetRegistry" ] ) ;
351
246
x . npmRegistry ??= GenericUtilities . JsonObjectToUri ( infraJson [ "NPMRegistry" ] ) ;
352
- x . azureDevOpsCollectionUrl ??= GenericUtilities . JsonObjectToUri ( infraJson [ "AzureDevopsCollectionURL" ] ) ;
353
- x . agentPool ??= infraJson [ "AgentPool" ] ? . Value ;
354
- if ( Enum . TryParse < AgentType > ( infraJson [ "AgentType" ] ? . Value , out AgentType agentTypeParsed ) )
355
- {
356
- x . agentType ??= agentTypeParsed ;
357
- }
358
247
if ( ! string . IsNullOrEmpty ( infraJson [ "NuGetRegistryUsername" ] ? . Value ) )
359
248
{
360
249
x . nugetRegistryUsername ??= infraJson [ "NuGetRegistryUsername" ] ? . Value ;
@@ -367,18 +256,16 @@ internal void Execute(InitArguments x)
367
256
{
368
257
x . cmfCliRepository ??= infraJson [ "CmfCliRepository" ] ? . Value ;
369
258
}
370
- if ( ! string . IsNullOrEmpty ( infraJson [ "CmfPipelineRepository" ] ? . Value ) )
371
- {
372
- x . cmfPipelineRepository ??= infraJson [ "CmfPipelineRepository" ] ? . Value ;
373
- }
374
- }
375
259
}
260
+ }
376
261
377
262
if ( x . nugetRegistry == null ||
378
263
x . npmRegistry == null ||
379
- x . azureDevOpsCollectionUrl == null ||
380
- x . ISOLocation == null ||
381
- x . agentPool == null )
264
+ //x.azureDevOpsCollectionUrl == null ||
265
+ x . ISOLocation == null
266
+ //||
267
+ //x.agentPool == null
268
+ )
382
269
{
383
270
throw new CliException ( "Missing infrastructure options. Either specify an infrastructure file with [--infrastructure] or specify each infrastructure option separately." ) ;
384
271
}
@@ -391,10 +278,6 @@ internal void Execute(InitArguments x)
391
278
{
392
279
args . AddRange ( new [ ] { "--npmRegistry" , x . npmRegistry . AbsoluteUri } ) ;
393
280
}
394
- if ( x . azureDevOpsCollectionUrl != null )
395
- {
396
- args . AddRange ( new [ ] { "--azureDevOpsCollectionUrl" , x . azureDevOpsCollectionUrl . AbsoluteUri } ) ;
397
- }
398
281
if ( x . ISOLocation != null )
399
282
{
400
283
args . AddRange ( new [ ] { "--ISOLocation" , x . ISOLocation . FullName } ) ;
@@ -410,52 +293,12 @@ internal void Execute(InitArguments x)
410
293
411
294
args . AddRange ( x . cmfCliRepository != null
412
295
? new [ ] { "--cmfCliRepository" , x . cmfCliRepository }
413
- : new [ ] { "--cmfCliRepository" , CliConstants . NpmJsUrl } ) ;
414
- args . AddRange ( x . cmfPipelineRepository != null
415
- ? new [ ] { "--cmfPipelineRepository" , x . cmfPipelineRepository }
416
- : new [ ] { "--cmfPipelineRepository" , CliConstants . NpmJsUrl } ) ;
296
+ : new [ ] { "--cmfCliRepository" , CoreConstants . NpmJsUrl } ) ;
417
297
418
- if ( ! string . IsNullOrEmpty ( x . agentPool ) )
419
- {
420
- args . AddRange ( new [ ] { "--agentPool" , x . agentPool } ) ;
421
- }
422
- args . AddRange ( new [ ] { "--agentType" , ( x . agentType ??= AgentType . Hosted ) . ToString ( ) } ) ;
423
298
424
-
425
- #endregion
426
-
427
- #region container-specific switches
428
- if ( ! string . IsNullOrEmpty ( x . releaseCustomerEnvironment ) )
429
- {
430
- args . AddRange ( new [ ] { "--releaseCustomerEnvironment" , x . releaseCustomerEnvironment } ) ;
431
- }
432
-
433
- if ( ! string . IsNullOrEmpty ( x . releaseSite ) )
434
- {
435
- args . AddRange ( new [ ] { "--releaseSite" , x . releaseSite } ) ;
436
- }
437
-
438
- if ( ! string . IsNullOrEmpty ( x . releaseDeploymentPackage ) )
439
- {
440
- // we need to escape the @ symbol to avoid that commandline lib parses it as a file
441
- // https://github.com/dotnet/command-line-api/issues/816
442
- x . releaseDeploymentPackage = x . releaseDeploymentPackage . Length > 1 && x . releaseDeploymentPackage [ 0 ] == '\\ '
443
- ? x . releaseDeploymentPackage [ 1 ..]
444
- : x . releaseDeploymentPackage ;
445
-
446
- args . AddRange ( new [ ] { "--releaseDeploymentPackage" , $ "{ x . releaseDeploymentPackage } " } ) ;
447
- }
448
-
449
- if ( ! string . IsNullOrEmpty ( x . releaseLicense ) )
450
- {
451
- args . AddRange ( new [ ] { "--releaseLicense" , x . releaseLicense } ) ;
452
- }
453
299
454
- if ( ! string . IsNullOrEmpty ( x . releaseDeploymentTarget ) )
455
- {
456
- args . AddRange ( new [ ] { "--releaseDeploymentTarget" , x . releaseDeploymentTarget } ) ;
457
- }
458
- #endregion
300
+
301
+ #endregion
459
302
460
303
#region version-specific bits
461
304
0 commit comments