RamblingCookieMonster / PSDepend

PowerShell Dependency Handler
MIT License
285 stars 76 forks source link

Allow override of the dependency name in the Github dependency type #116

Open mpiederiet opened 4 years ago

mpiederiet commented 4 years ago

When using a subfolder from a GitHub repository, it would be great to have an option to override the dependency name (or else the module will not successfully import when using invoke-psdepend -import.

Example dependency definition: 'MathieuBuisson/PowerShell-DevOps' = @{ Name = 'Export-NUnitXML' Version = 'master' DependencyType = 'GitHub' Parameters = @{ ExtractPath = 'Export-NUnitXML\Export-NUnitXML.psm1' } }

Code to fix this (PSDependScripts\Github.ps1, line 183) $DependencyName = if ($Dependency.Name) {$Dependency.Name} Else {$DependencyID.Split("/")[1]}

when using the current code, the import will fail, because it would assume the name to be "PowerShell-DevOps\PowerShell-DevOps.xml", while it is "PowerShell-DevOps\Export-NUnitXML.psm1". I know this is a corner case, but it's only a minor code change which does not affect the original working of the dependency type so I was hoping you would consider adopting it into the PSDepend module.