@@ -187,7 +187,7 @@ private List<PSResourceInfo> ProcessRepositories(
187
187
if ( repository != null && repository . Length != 0 )
188
188
{
189
189
// Write error and disregard repository entries containing wildcards.
190
- repository = Utils . ProcessNameWildcards ( repository , removeWildcardEntries : false , out string [ ] errorMsgs , out _ ) ;
190
+ repository = Utils . ProcessNameWildcards ( repository , removeWildcardEntries : false , out string [ ] errorMsgs , out _ ) ;
191
191
foreach ( string error in errorMsgs )
192
192
{
193
193
_cmdletPassedIn . WriteError ( new ErrorRecord (
@@ -231,7 +231,7 @@ private List<PSResourceInfo> ProcessRepositories(
231
231
if ( repositoriesToSearch != null && repositoriesToSearch . Count == 0 )
232
232
{
233
233
_cmdletPassedIn . ThrowTerminatingError ( new ErrorRecord (
234
- new PSArgumentException ( "Cannot resolve -Repository name. Run 'Get-PSResourceRepository' to view all registered repositories." ) ,
234
+ new PSArgumentException ( "Cannot resolve -Repository name. Run 'Get-PSResourceRepository' to view all registered repositories." ) ,
235
235
"RepositoryNameIsNotResolved" ,
236
236
ErrorCategory . InvalidArgument ,
237
237
_cmdletPassedIn ) ) ;
@@ -305,7 +305,8 @@ private List<PSResourceInfo> ProcessRepositories(
305
305
bool installDepsForRepo = skipDependencyCheck ;
306
306
307
307
// If no more packages to install, then return
308
- if ( _pkgNamesToInstall . Count == 0 ) {
308
+ if ( _pkgNamesToInstall . Count == 0 )
309
+ {
309
310
return allPkgsInstalled ;
310
311
}
311
312
@@ -329,14 +330,9 @@ private List<PSResourceInfo> ProcessRepositories(
329
330
}
330
331
331
332
repositoryNamesToSearch . Add ( repoName ) ;
332
- if ( ( currentRepository . ApiVersion == PSRepositoryInfo . APIVersion . V3 ) && ( ! installDepsForRepo ) )
333
- {
334
- _cmdletPassedIn . WriteWarning ( "Installing dependencies is not currently supported for V3 server protocol repositories. The package will be installed without installing dependencies." ) ;
335
- installDepsForRepo = true ;
336
- }
337
333
338
- var installedPkgs = InstallPackages ( _pkgNamesToInstall . ToArray ( ) , currentRepository , currentServer , currentResponseUtil , scope , skipDependencyCheck , findHelper ) ;
339
- foreach ( var pkg in installedPkgs )
334
+ List < PSResourceInfo > installedPkgs = InstallPackages ( _pkgNamesToInstall . ToArray ( ) , currentRepository , currentServer , currentResponseUtil , scope , skipDependencyCheck , findHelper ) ;
335
+ foreach ( PSResourceInfo pkg in installedPkgs )
340
336
{
341
337
_pkgNamesToInstall . RemoveAll ( x => x . Equals ( pkg . Name , StringComparison . InvariantCultureIgnoreCase ) ) ;
342
338
}
@@ -535,8 +531,10 @@ private void MoveFilesIntoInstallPath(
535
531
File . Delete ( Path . Combine ( finalModuleVersionDir , pkgInfo . Name + PSScriptFileExt ) ) ;
536
532
}
537
533
}
538
- else {
539
- if ( _includeXml ) {
534
+ else
535
+ {
536
+ if ( _includeXml )
537
+ {
540
538
_cmdletPassedIn . WriteVerbose ( string . Format ( "Moving '{0}' to '{1}'" , Path . Combine ( dirNameVersion , scriptXML ) , Path . Combine ( installPath , scriptXML ) ) ) ;
541
539
Utils . MoveFiles ( Path . Combine ( dirNameVersion , scriptXML ) , Path . Combine ( installPath , scriptXML ) ) ;
542
540
}
@@ -614,11 +612,6 @@ private List<PSResourceInfo> InstallPackages(
614
612
615
613
if ( ! skipDependencyCheck )
616
614
{
617
- if ( currentServer . Repository . ApiVersion == PSRepositoryInfo . APIVersion . V3 )
618
- {
619
- _cmdletPassedIn . WriteWarning ( "Installing dependencies is not currently supported for V3 server protocol repositories. The package will be installed without installing dependencies." ) ;
620
- }
621
-
622
615
// Get the dependencies from the installed package.
623
616
if ( parentPkgObj . Dependencies . Length > 0 )
624
617
{
@@ -748,7 +741,7 @@ private Hashtable BeginPackageInstall(
748
741
return packagesHash ;
749
742
}
750
743
751
- break ;
744
+ break ;
752
745
753
746
case VersionType . SpecificVersion :
754
747
string nugetVersionString = specificVersion . ToNormalizedString ( ) ; // 3.0.17-beta
@@ -802,7 +795,9 @@ private Hashtable BeginPackageInstall(
802
795
803
796
break ;
804
797
}
805
- } else {
798
+ }
799
+ else
800
+ {
806
801
pkgToInstall = currentResult . returnedObject ;
807
802
808
803
break ;
@@ -816,11 +811,13 @@ private Hashtable BeginPackageInstall(
816
811
817
812
pkgToInstall . RepositorySourceLocation = repository . Uri . ToString ( ) ;
818
813
pkgToInstall . AdditionalMetadata . TryGetValue ( "NormalizedVersion" , out string pkgVersion ) ;
819
- if ( pkgVersion == null ) {
814
+ if ( pkgVersion == null )
815
+ {
820
816
// Not all NuGet providers (e.g. Artifactory, possibly others) send NormalizedVersion in NuGet package responses.
821
817
// If they don't, we need to manually construct the combined version+prerelease from pkgToInstall.Version and the prerelease string.
822
818
pkgVersion = pkgToInstall . Version . ToString ( ) ;
823
- if ( ! String . IsNullOrEmpty ( pkgToInstall . Prerelease ) ) {
819
+ if ( ! String . IsNullOrEmpty ( pkgToInstall . Prerelease ) )
820
+ {
824
821
pkgVersion += $ "-{ pkgToInstall . Prerelease } ";
825
822
}
826
823
}
@@ -913,11 +910,11 @@ private string CreateInstallationTempPath()
913
910
try
914
911
{
915
912
var dir = Directory . CreateDirectory ( tempInstallPath ) ; // should check it gets created properly
916
- // To delete file attributes from the existing ones get the current file attributes first and use AND (&) operator
917
- // with a mask (bitwise complement of desired attributes combination).
918
- // TODO: check the attributes and if it's read only then set it
919
- // attribute may be inherited from the parent
920
- // TODO: are there Linux accommodations we need to consider here?
913
+ // To delete file attributes from the existing ones get the current file attributes first and use AND (&) operator
914
+ // with a mask (bitwise complement of desired attributes combination).
915
+ // TODO: check the attributes and if it's read only then set it
916
+ // attribute may be inherited from the parent
917
+ // TODO: are there Linux accommodations we need to consider here?
921
918
dir . Attributes &= ~ FileAttributes . ReadOnly ;
922
919
}
923
920
catch ( Exception e )
@@ -995,7 +992,8 @@ private bool TryInstallToTempPath(
995
992
bool isModule = File . Exists ( moduleManifest ) ;
996
993
bool isScript = File . Exists ( scriptPath ) ;
997
994
998
- if ( ! isModule && ! isScript ) {
995
+ if ( ! isModule && ! isScript )
996
+ {
999
997
scriptPath = "" ;
1000
998
}
1001
999
@@ -1374,7 +1372,8 @@ private bool CallAcceptLicense(PSResourceInfo p, string moduleManifest, string t
1374
1372
new ArgumentException ( $ "Package '{ p . Name } ' could not be installed: License.txt not found. License.txt must be provided when user license acceptance is required.") ,
1375
1373
"LicenseTxtNotFound" ,
1376
1374
ErrorCategory . ObjectNotFound ,
1377
- _cmdletPassedIn ) ; ;
1375
+ _cmdletPassedIn ) ;
1376
+ ;
1378
1377
success = false ;
1379
1378
1380
1379
return success ;
0 commit comments