Scenario
My PowerShell folder contains a library of utility scripts. I have it shared and version controlled with GitHub between my work and home computers. At work I now have a number of projects where I want to take advantage of my script library.
Problem
When I update the a utility script, I don't want to copy it manually to all the work projects where it is used.
Possible solutions
(Simple)
Write a PowerShell function to copy my whole script library to a 'Dependencies\Scripts' directory under the working directory for each script project. As my script library grows, it may become difficult for others to find the library scripts that are relevant to the script project.
(Overcomplicated?)
Use some kind of 'requires' function in each work project script file that requires one of library scripts. When a library script is updated a tool can then decide which work projects require that library script and copy the latest version to the work project. If a script is run without the appropriate dependency it will throw an error that reminding the user how to get the latest version from the library.
Questions
- Has anyone solved this problem before?
- Are there existing dependency management tools for PowerShell that will do 2?