Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Issues with Generate-BinFile / Remove-BinFile #230

Closed
gep13 opened this issue Apr 8, 2015 · 0 comments
Closed

Fix Issues with Generate-BinFile / Remove-BinFile #230

gep13 opened this issue Apr 8, 2015 · 0 comments

Comments

@gep13
Copy link
Member

gep13 commented Apr 8, 2015

0.9.9.4 of Chocolatey added back in the ability to use the Generate-BinFile and the Remove-BinFile cmdlets.

However, looks like there is still an issue when using them.

This is related to #195 and #145

When doing the above linked issues, it was believed that the $nugetExePath (which is used within these scripts) would already be available from the calling module, however, it looks like this is not the case.

Steps to reproduce:

  • choco install githubreleasemanager.portable -y

Output:

 Join-Path : Cannot bind argument to parameter 'Path' because it is null.
 At C:\ProgramData\chocolatey\helpers\functions\Generate-BinFile.ps1:24 char:37
 +   $packageBatchFileName = Join-Path $nugetExePath "$name.bat"
 +                                     ~~~~~~~~~~~~~
     + CategoryInfo          : InvalidData: (:) [Join-Path], ParameterBindingVa
    lidationException
     + FullyQualifiedErrorId : ParameterArgumentValidationErrorNullNotAllowed,M
    icrosoft.PowerShell.Commands.JoinPathCommand
 Join-Path : Cannot bind argument to parameter 'Path' because it is null.
 At C:\ProgramData\chocolatey\helpers\functions\Generate-BinFile.ps1:25 char:36
 +   $packageBashFileName = Join-Path $nugetExePath "$name"
 +                                    ~~~~~~~~~~~~~
     + CategoryInfo          : InvalidData: (:) [Join-Path], ParameterBindingVa
    lidationException
     + FullyQualifiedErrorId : ParameterArgumentValidationErrorNullNotAllowed,M
    icrosoft.PowerShell.Commands.JoinPathCommand
 Join-Path : Cannot bind argument to parameter 'Path' because it is null.
 At C:\ProgramData\chocolatey\helpers\functions\Generate-BinFile.ps1:26 char:36
 +   $packageShimFileName = Join-Path $nugetExePath "$name.exe"
 +                                    ~~~~~~~~~~~~~
     + CategoryInfo          : InvalidData: (:) [Join-Path], ParameterBindingVa
    lidationException
     + FullyQualifiedErrorId : ParameterArgumentValidationErrorNullNotAllowed,M
    icrosoft.PowerShell.Commands.JoinPathCommand
 Test-Path : Cannot bind argument to parameter 'Path' because it is null.
 At C:\ProgramData\chocolatey\helpers\functions\Generate-BinFile.ps1:28 char:17
 +   if (Test-Path ($packageBatchFileName)) {Remove-Item $packageBatchFileName -
 for ...
 +                 ~~~~~~~~~~~~~~~~~~~~~~~
     + CategoryInfo          : InvalidData: (:) [Test-Path], ParameterBindingVa
    lidationException
     + FullyQualifiedErrorId : ParameterArgumentValidationErrorNullNotAllowed,M
    icrosoft.PowerShell.Commands.TestPathCommand
 Test-Path : Cannot bind argument to parameter 'Path' because it is null.
 At C:\ProgramData\chocolatey\helpers\functions\Generate-BinFile.ps1:29 char:17
 +   if (Test-Path ($packageBashFileName)) {Remove-Item $packageBashFileName -fo
 rce ...
 +                 ~~~~~~~~~~~~~~~~~~~~~~
     + CategoryInfo          : InvalidData: (:) [Test-Path], ParameterBindingVa
    lidationException
     + FullyQualifiedErrorId : ParameterArgumentValidationErrorNullNotAllowed,M
    icrosoft.PowerShell.Commands.TestPathCommand
 You cannot call a method on a null-valued expression.
 At C:\ProgramData\chocolatey\helpers\functions\Generate-BinFile.ps1:31 char:3
 +   $path = $path.ToLower().Replace($nugetPath.ToLower(), "..\").Replace("\\","
 \")
 +   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 + CategoryInfo          : InvalidOperation: (:) [], RuntimeException
 + FullyQualifiedErrorId : InvokeMethodOnNull

Test-Path : Cannot bind argument to parameter 'Path' because it is null.
At C:\ProgramData\chocolatey\helpers\functions\Generate-BinFile.ps1:70 char:17

  • if (Test-Path ($packageShimFileName)) {
  •             ~~~~~~~~~~~~~~~~~~~~~~
    
    • CategoryInfo : InvalidData: (:) [Test-Path], ParameterBindingVa
      lidationException
    • FullyQualifiedErrorId : ParameterArgumentValidationErrorNullNotAllowed,M
      icrosoft.PowerShell.Commands.TestPathCommand
      githubreleasemanager.portable install not successful.
      Error while running 'C:\ProgramData\chocolatey\lib\githubreleasemanager.portable\tools\chocolateyInstall.ps1'.
      See log for details.

Chocolatey installed 0/1 package(s). 1 package(s) failed.
See the log for details.
Failures:

  • githubreleasemanager.portable
@gep13 gep13 added the Bug label Apr 8, 2015
@ferventcoder ferventcoder added this to the 0.9.9.5 milestone Apr 16, 2015
@ferventcoder ferventcoder changed the title Problem with Generate-BinFile Fix Issues with Generate-BinFile / Remove-BinFile Apr 20, 2015
ferventcoder added a commit that referenced this issue Apr 20, 2015
- Rename Generate-BinFile to Install-BinFile to remove warnings.
- Create an alias Generate-BinFile for Install-BinFile so that existing
package scripts are not broken when using the old function name.
- Create an alias Add-BinFile for Install-BinFile to be similar to
Remove-BinFile.
- Rename Remove-BinFile to Uninstall-BinFile to match the rest of the
package script names.
- Create alias Remove-BinFile to not break existing package scripts.
- Fix path and variable issues with both functions.
ferventcoder added a commit that referenced this issue Apr 20, 2015
Instead of just Exporting the functions imported by helpers path,
export all functions and aliases defined, including those imported by
community extensions.
@ferventcoder ferventcoder self-assigned this Apr 20, 2015
ferventcoder added a commit that referenced this issue Apr 20, 2015
* stable: (22 commits)
  (GH-121) Making Uninstall-ChocolateyZipPackage more robust when
deleting files that were copied during installation of the Zip package
  (doc) update changelog/nuspec
  (GH-238) ApiKey source matching intuitive
  (maint) formatting
  (GH-240) Set CredentialProvider for NuGet
  (GH-240) ChocolateyNugetCredentialProvider
  (GH-240) Add default sources to machine sources
  (maint) Only warn subcommand list if not empty
  (GH-171) Use RedirectedHttpClient
  (GH-240) pass credentials at runtime
  (GH-240)(config) Add machine sources
  (doc) how to quote values
  (GH-230) Export all functions and aliases imported
  (GH-230) Fix Issues with Generate/Remove BinFile
  (GH-185) Remove console prompt default choices
  (GH-186) Uninstall - no prompt for one version
  (GH-182) Ask before printing ps1 scripts
  (GH-187) Show log file path in messages.
  (maint) formatting
  (GH-169) Do not resolve disabled sources
  ...

Conflicts:
	src/chocolatey/infrastructure.app/commands/ChocolateySourceCommand.cs
	src/chocolatey/infrastructure.app/runners/GenericRunner.cs
ferventcoder added a commit that referenced this issue Mar 22, 2017
Export built-in functions prior to loading extensions so that
extension-specific loading behavior can be used based on built-in
functions. This allows those overrides to be much more deterministic.

This behavior of not loading built-in functions first was changed in
039f70a with GH-230. That was first released in 0.9.9.5.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants