Skip to content

DRY: Address New-Item calls in pre_install/post_install scripts #3166

@r15ch13

Description

@r15ch13

Should we address the repeated calls of New-Item in many pre_install/post_install scripts to keep them DRY? 😄
Most of them run Test-Path, display a message and create a directory or a file with no content.

These scripts could be cleanup up and be more readable in JSON format by using some simple functions like:

New-Directory -Path "$dir\conf.d" -Message "Creating 'conf.d' directory"
New-JsonFile -Path "$dir\bla.json" -Message "Creating 'bla.json' for ..." -Content "{ "bla": "blubb" }" -Encoding "utf-8"
New-EmptyFile -Path "$dir\empty.ini"

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions