Skip to content

Commit

Permalink
Remove logging
Browse files Browse the repository at this point in the history
  • Loading branch information
alerickson committed Oct 28, 2024
1 parent 53b9d72 commit 5047249
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 51 deletions.
43 changes: 0 additions & 43 deletions src/code/InstallHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -737,8 +737,6 @@ private Hashtable BeginPackageInstall(
FindResults responses = null;
errRecord = null;

//_cmdletPassedIn.WriteWarning($"~~~~~~~~~~~~~~~~~~ pkgNameToInstall is: '{pkgNameToInstall}'.");

switch (searchVersionType)
{
case VersionType.VersionRange:
Expand Down Expand Up @@ -816,9 +814,6 @@ private Hashtable BeginPackageInstall(
return packagesHash;
}

// THIS SHOULD BE THE CORRECT PKG NAME
// _cmdletPassedIn.WriteWarning($"~~~~~~~~~~~~~~~~~~ pkgToInstall.Name is: '{pkgToInstall.Name}'.");

pkgToInstall.RepositorySourceLocation = repository.Uri.ToString();
pkgToInstall.AdditionalMetadata.TryGetValue("NormalizedVersion", out string pkgVersion);
if (pkgVersion == null) {
Expand Down Expand Up @@ -976,14 +971,6 @@ private bool TryInstallToTempPath(
updatedPackagesHash = packagesHash;
try
{
if (responseStream == null)
{
_cmdletPassedIn.WriteVerbose($"response stream is null");
}
else {
_cmdletPassedIn.WriteVerbose($"response stream is NOT null");
}

var pathToFile = Path.Combine(tempInstallPath, $"{pkgName}.{normalizedPkgVersion}.zip");
_cmdletPassedIn.WriteVerbose($"pathToFile IS: {pathToFile}.");

Expand All @@ -1003,41 +990,11 @@ private bool TryInstallToTempPath(
return false;
}


_cmdletPassedIn.WriteVerbose($"tempDirNameVersionIS: {tempDirNameVersion}.");

// Check if the directory exists
if (Directory.Exists(tempDirNameVersion))
{
Console.WriteLine($"Contents of {tempDirNameVersion}:");

// Display all files in the directory
string[] files = Directory.GetFiles(tempDirNameVersion, "*.*", SearchOption.AllDirectories);
foreach (string file in files)
{
Console.WriteLine($"File: {file}");
}

// Display all subdirectories in the directory
string[] directories = Directory.GetDirectories(tempDirNameVersion, "*", SearchOption.AllDirectories);
foreach (string directory in directories)
{
Console.WriteLine($"Directory: {directory}");
}
}
else
{
Console.WriteLine($"The directory {tempDirNameVersion} does not exist.");
}



File.Delete(pathToFile);

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

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

Expand Down
2 changes: 1 addition & 1 deletion src/code/LocalServerApiCalls.cs
Original file line number Diff line number Diff line change
Expand Up @@ -730,7 +730,7 @@ private Hashtable GetMetadataFromNupkg(string packageName, string packagePath, s
}

pkgMetadata = parsedScript.ToHashtable();
pkgMetadata.Add("Id", packageName);
pkgMetadata.Add("Id", properCasingPkgName);
pkgMetadata.Add(_fileTypeKey, Utils.MetadataFileType.ScriptFile);
pkgTags.AddRange(pkgMetadata["Tags"] as string[]);

Expand Down
15 changes: 8 additions & 7 deletions src/code/Utils.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1186,27 +1186,28 @@ internal static void GetMetadataFilesFromPath(string dirPath, string packageName
{
if (rgx.IsMatch(file))
{
if (file.EndsWith("psd1"))
string fileName = Path.GetFileName(file);
if (fileName.EndsWith("psd1"))
{
if (string.Compare($"{packageName}.psd1", file, StringComparison.OrdinalIgnoreCase) == 0)
if (string.Compare($"{packageName}.psd1", fileName, StringComparison.OrdinalIgnoreCase) == 0)
{
properCasingPkgName = file.Split(new string[] { ".psd1" }, StringSplitOptions.None).First();
properCasingPkgName = Path.GetFileNameWithoutExtension(file);
}
psd1FilePath = file;
}
else if (file.EndsWith("nuspec"))
{
if (string.Compare($"{packageName}.nuspec", file, StringComparison.OrdinalIgnoreCase) == 0)
if (string.Compare($"{packageName}.nuspec", fileName, StringComparison.OrdinalIgnoreCase) == 0)
{
properCasingPkgName = file.Split(new string[] { ".nuspec" }, StringSplitOptions.None).First();
properCasingPkgName = Path.GetFileNameWithoutExtension(file);
}
nuspecFilePath = file;
}
else if (file.EndsWith("ps1"))
{
if (string.Compare($"{packageName}.ps1", file, StringComparison.OrdinalIgnoreCase) == 0)
if (string.Compare($"{packageName}.ps1", fileName, StringComparison.OrdinalIgnoreCase) == 0)
{
properCasingPkgName = file.Split(new string[] { ".ps1" }, StringSplitOptions.None).First();
properCasingPkgName = Path.GetFileNameWithoutExtension(file);
}
ps1FilePath = file;
}
Expand Down

0 comments on commit 5047249

Please sign in to comment.