Repository navigation
Installing modules
There are three major features for end users in the PoshCode package manager module: the ability to find a module, to install it, and to update it.
The Find-Module command allows searching for key words, or specifying a module name and/or author name. As a shortcut, the Install-Module command will allow you to specify a module name and will call Find-Module
For finding modules, the PoshCode Package Manager supports the notion of a repository. There is support built-in for two core types of repositories built-in to the module: folder based, and file based, as well as limited support for getting modules from GitHub repositories directly, and additional repositories can be plugged in as modules.
A folder-based repository is just a folder full of packages, whether that's a local folder, a UNC networks share, or a WebDAV share like \PoshCode.org\Modules ... the idea is that an administrator puts each module package there along with the most recent copy of its package manifest, renamed to the ModuleName.psd1, and (if necessary) modifies them to make sure that the URL for updates and downloads points at the folder.
A file-base repository is a psd1 file which basically contains the contents of all the package manifests for the modules. In the case of the file-based repository, the actual modules (and their real package manifests) remain wherever they were, and typically you remove the version numbers and download URLs from the repository file.
The Find-Module cmdlet from the PoshCode Repository module searches all configured repositories, in order. The configuration can be accessed through Get-ConfigData and Set-ConfigData but it's just a PSD1 file called "UserSettings.psd1" which can also be edited by hand. The config data has two keys: InstallPaths and Repositories:
- InstallPaths is a list of the configured places where you might install modules (you can specify any name here as a switch parameter to Install-Module).
- Repositories is an array of hashtables, where each entry has a Type (FileSystem or Github, so far), a Root (the file path or github API url), an optional name (which can be used with the
-Repositoryswitch to Find-Module), and a boolean value "SearchByDefault" which controls which ones will be searched when you do not specify the-Repositoryswitch.