Skip to content

Commit

Permalink
(maint) - add bundle install function
Browse files Browse the repository at this point in the history
  • Loading branch information
jordanbreen28 committed Aug 24, 2023
1 parent 8a20266 commit a14ff82
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/Puppet.Dsc/functions/New-PuppetDscModule.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,8 @@ Function New-PuppetDscModule {
# Generate REFERENCE.md file for the Puppet module from the auto-generated types for each DSC resource
Write-PSFMessage -Message 'Writing the reference documentation for the Puppet module'
Set-PSModulePath -Path $InitialPsModulePath
Add-PuppetReferenceDocumentation -PuppetModuleFolderPath $PuppetModuleRootFolderDirectory -verbose
Install-Gems -Verbose
Add-PuppetReferenceDocumentation -PuppetModuleFolderPath $PuppetModuleRootFolderDirectory -Verbose

If ($PassThru) {
# Return the folder containing the puppetized module
Expand Down
24 changes: 24 additions & 0 deletions src/Puppet.Dsc/internal/functions/Install-Gems.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
function Install-Gems {
<#
.SYNOPSIS
Install required gems
.DESCRIPTION
Installs required gems as specified in the Gemfile.
#>
# verify required gems installed
begin {
$PuppetModuleFolderPath = Resolve-Path -Path $PuppetModuleFolderPath -ErrorAction Stop
$Command = 'pdk bundle install'
}
process {
Try {
$ErrorActionPreference = 'Stop'
Invoke-PdkCommand -Path $PuppetModuleFolderPath -Command $Command -SuccessFilterScript {
$_ -match 'gems now installed'
}
} Catch {
$PSCmdlet.ThrowTerminatingError($PSItem)
}
}
end {}
}

0 comments on commit a14ff82

Please sign in to comment.