Skip to content

Commit

Permalink
Merge branch 'release/0.0.2'
Browse files Browse the repository at this point in the history
  • Loading branch information
Steffen committed Aug 17, 2023
2 parents dc7cdf5 + 11b1700 commit da5b365
Show file tree
Hide file tree
Showing 5 changed files with 109 additions and 2 deletions.
61 changes: 61 additions & 0 deletions docs/Find-OutdatedDependency.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
---
external help file: PSDependHelper-help.xml
Module Name: PSDependHelper
online version:
schema: 2.0.0
---

# Find-OutdatedDependency

## SYNOPSIS
{{ Fill in the Synopsis }}

## SYNTAX

```
Find-OutdatedDependency [-Directory] <DirectoryInfo> [<CommonParameters>]
```

## DESCRIPTION
{{ Fill in the Description }}

## EXAMPLES

### Example 1
```powershell
PS C:\> {{ Add example code here }}
```

{{ Add example description here }}

## PARAMETERS

### -Directory
{{ Fill Directory Description }}

```yaml
Type: DirectoryInfo
Parameter Sets: (All)
Aliases:

Required: True
Position: 0
Default value: None
Accept pipeline input: True (ByValue)
Accept wildcard characters: False
```
### CommonParameters
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216).
## INPUTS
### System.IO.DirectoryInfo
## OUTPUTS
### Microsoft.PowerShell.Commands.ModuleSpecification
## NOTES
## RELATED LINKS
2 changes: 1 addition & 1 deletion docs/Import-Dependency.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ Path to the PowerShell script or manifest.
```yaml
Type: FileInfo
Parameter Sets: (All)
Aliases:
Aliases: FullName

Required: True
Position: 1
Expand Down
2 changes: 1 addition & 1 deletion src/PSDependHelper.psd1
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
RootModule = 'PSDependHelper.psm1'

# Version number of this module.
ModuleVersion = '0.0.1'
ModuleVersion = '0.0.2'

# Supported PSEditions
# CompatiblePSEditions = @()
Expand Down
45 changes: 45 additions & 0 deletions src/Public/Find-OutdatedDependency.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
function Find-OutdatedDependency {

[OutputType([Microsoft.PowerShell.Commands.ModuleSpecification])]
[CmdletBinding()]
param (
# The directory, to scan for dependencies.
[Parameter( Mandatory, ValueFromPipeline )]
[ValidateScript({ $_.Exists })]
[System.IO.DirectoryInfo] $Directory
)

begin {
$Dependencies = @()
}

process {
$Dependencies += $Directory | ForEach-Object {
$Dependencies1 = $_ | Get-ChildItem -Recurse -Include *.psd1, *.ps1 |
ForEach-Object {
$Dependencies2 = $_ | Import-Dependency
$Dependencies2 | Add-Member ByFilePath $_.FullName
$Dependencies2 | Write-Output
}
$Dependencies1 | Add-Member ByModuleName $_.Name
$Dependencies1 | Write-Output
}
}

end {
$DependencyGroups = $Dependencies | Group-Dependency
$DependencyGroups | Where-Object { $_.Version } | ForEach-Object {
$group = $_
$Dependencies | Where-Object {
$_.Version
} | Where-Object {
$_.Name -eq $group.Name
} | Where-Object {
$_.Version -ne $group.Version
} | ForEach-Object {
$_ | Add-Member TargetVersion $group.Version
$_ | Write-Output
}
}
}
}
1 change: 1 addition & 0 deletions src/Public/Import-Dependency.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ function Import-Dependency {
# Path to the PowerShell script or manifest.
[Parameter( Mandatory, ValueFromPipeline, ValueFromPipelineByPropertyName )]
[ValidateScript({ $_.Exists })]
[Alias('FullName')]
[System.IO.FileInfo] $Path,

# If set, dependencies of required modules are imported recursively.
Expand Down

0 comments on commit da5b365

Please sign in to comment.