puppetlabs / puppetlabs/ruby-pwsh

Migrate custom functions available in the dynamic runspace to a startup script & add unit tests

Open
#135 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

maintenance
Dominant language
Ruby
Stars
20
Forks
27
Avg merge
1d 7h
Merged PRs (30d)
4

Description

Describe the Change You Would Like

The custom functions available in the dynamic runspace used via Pwsh::Manager.execute() be moved to their own separate script file and become unit tested.

While this work is not blocked on #132, being able to specify the script as part of the InitialSessionState would further simplify the init script. In the meantime, the file could be read from disk and loaded as a string, similar to how it is currently implemented.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with lib/templates/init.ps1, especially lines 332-355, and inspect how Pwsh::Manager.execute() creates its dynamic runspace and InitialSessionState. Move the custom functions into a separate startup script, load that script for the runspace, and add unit tests covering their availability and behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
powershell, ruby
Domain
testing, tooling
Issue type
Refactor
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.