Skip to content

Commit 5047249

Browse files
committed
Remove logging
1 parent 53b9d72 commit 5047249

File tree

3 files changed

+9
-51
lines changed

3 files changed

+9
-51
lines changed

src/code/InstallHelper.cs

Lines changed: 0 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -737,8 +737,6 @@ private Hashtable BeginPackageInstall(
737737
FindResults responses = null;
738738
errRecord = null;
739739

740-
//_cmdletPassedIn.WriteWarning($"~~~~~~~~~~~~~~~~~~ pkgNameToInstall is: '{pkgNameToInstall}'.");
741-
742740
switch (searchVersionType)
743741
{
744742
case VersionType.VersionRange:
@@ -816,9 +814,6 @@ private Hashtable BeginPackageInstall(
816814
return packagesHash;
817815
}
818816

819-
// THIS SHOULD BE THE CORRECT PKG NAME
820-
// _cmdletPassedIn.WriteWarning($"~~~~~~~~~~~~~~~~~~ pkgToInstall.Name is: '{pkgToInstall.Name}'.");
821-
822817
pkgToInstall.RepositorySourceLocation = repository.Uri.ToString();
823818
pkgToInstall.AdditionalMetadata.TryGetValue("NormalizedVersion", out string pkgVersion);
824819
if (pkgVersion == null) {
@@ -976,14 +971,6 @@ private bool TryInstallToTempPath(
976971
updatedPackagesHash = packagesHash;
977972
try
978973
{
979-
if (responseStream == null)
980-
{
981-
_cmdletPassedIn.WriteVerbose($"response stream is null");
982-
}
983-
else {
984-
_cmdletPassedIn.WriteVerbose($"response stream is NOT null");
985-
}
986-
987974
var pathToFile = Path.Combine(tempInstallPath, $"{pkgName}.{normalizedPkgVersion}.zip");
988975
_cmdletPassedIn.WriteVerbose($"pathToFile IS: {pathToFile}.");
989976

@@ -1003,41 +990,11 @@ private bool TryInstallToTempPath(
1003990
return false;
1004991
}
1005992

1006-
1007-
_cmdletPassedIn.WriteVerbose($"tempDirNameVersionIS: {tempDirNameVersion}.");
1008-
1009-
// Check if the directory exists
1010-
if (Directory.Exists(tempDirNameVersion))
1011-
{
1012-
Console.WriteLine($"Contents of {tempDirNameVersion}:");
1013-
1014-
// Display all files in the directory
1015-
string[] files = Directory.GetFiles(tempDirNameVersion, "*.*", SearchOption.AllDirectories);
1016-
foreach (string file in files)
1017-
{
1018-
Console.WriteLine($"File: {file}");
1019-
}
1020-
1021-
// Display all subdirectories in the directory
1022-
string[] directories = Directory.GetDirectories(tempDirNameVersion, "*", SearchOption.AllDirectories);
1023-
foreach (string directory in directories)
1024-
{
1025-
Console.WriteLine($"Directory: {directory}");
1026-
}
1027-
}
1028-
else
1029-
{
1030-
Console.WriteLine($"The directory {tempDirNameVersion} does not exist.");
1031-
}
1032-
1033-
1034-
1035993
File.Delete(pathToFile);
1036994

1037995
var moduleManifest = Path.Combine(tempDirNameVersion, pkgName + PSDataFileExt);
1038996
var scriptPath = Path.Combine(tempDirNameVersion, pkgName + PSScriptFileExt);
1039997

1040-
_cmdletPassedIn.WriteVerbose($"MODULE MANIFEST PATH IS: {moduleManifest}.");
1041998
bool isModule = File.Exists(moduleManifest);
1042999
bool isScript = File.Exists(scriptPath);
10431000

src/code/LocalServerApiCalls.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -730,7 +730,7 @@ private Hashtable GetMetadataFromNupkg(string packageName, string packagePath, s
730730
}
731731

732732
pkgMetadata = parsedScript.ToHashtable();
733-
pkgMetadata.Add("Id", packageName);
733+
pkgMetadata.Add("Id", properCasingPkgName);
734734
pkgMetadata.Add(_fileTypeKey, Utils.MetadataFileType.ScriptFile);
735735
pkgTags.AddRange(pkgMetadata["Tags"] as string[]);
736736

src/code/Utils.cs

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1186,27 +1186,28 @@ internal static void GetMetadataFilesFromPath(string dirPath, string packageName
11861186
{
11871187
if (rgx.IsMatch(file))
11881188
{
1189-
if (file.EndsWith("psd1"))
1189+
string fileName = Path.GetFileName(file);
1190+
if (fileName.EndsWith("psd1"))
11901191
{
1191-
if (string.Compare($"{packageName}.psd1", file, StringComparison.OrdinalIgnoreCase) == 0)
1192+
if (string.Compare($"{packageName}.psd1", fileName, StringComparison.OrdinalIgnoreCase) == 0)
11921193
{
1193-
properCasingPkgName = file.Split(new string[] { ".psd1" }, StringSplitOptions.None).First();
1194+
properCasingPkgName = Path.GetFileNameWithoutExtension(file);
11941195
}
11951196
psd1FilePath = file;
11961197
}
11971198
else if (file.EndsWith("nuspec"))
11981199
{
1199-
if (string.Compare($"{packageName}.nuspec", file, StringComparison.OrdinalIgnoreCase) == 0)
1200+
if (string.Compare($"{packageName}.nuspec", fileName, StringComparison.OrdinalIgnoreCase) == 0)
12001201
{
1201-
properCasingPkgName = file.Split(new string[] { ".nuspec" }, StringSplitOptions.None).First();
1202+
properCasingPkgName = Path.GetFileNameWithoutExtension(file);
12021203
}
12031204
nuspecFilePath = file;
12041205
}
12051206
else if (file.EndsWith("ps1"))
12061207
{
1207-
if (string.Compare($"{packageName}.ps1", file, StringComparison.OrdinalIgnoreCase) == 0)
1208+
if (string.Compare($"{packageName}.ps1", fileName, StringComparison.OrdinalIgnoreCase) == 0)
12081209
{
1209-
properCasingPkgName = file.Split(new string[] { ".ps1" }, StringSplitOptions.None).First();
1210+
properCasingPkgName = Path.GetFileNameWithoutExtension(file);
12101211
}
12111212
ps1FilePath = file;
12121213
}

0 commit comments

Comments
 (0)