Vim & Vundle
I finally bit the bullet and learned to use Vim competently. One of the things I was really impressed by in the Vim space is a plugin called Vundle. Vundle is a package manager for Vim plugins. At first, swimming in a sea of package managers, I was loathe to learn another one–but Vundle is extremely simple. It uses github as a package repository. “Installing” a package is basically as simple as running a git clone
to the right location. Updating the package is a git pull
. Security is managed by github. Genius.
Powershell
As a developer on Windows I find Powershell to be an extremely useful tool, especially when running in an excellent terminal emulator such as ConEmu. One of the problems that Powershell has is that there is no good way to install modules. The closest thing is PsGet.
What’s wrong with PsGet?
Nothing. PsGet is great. However, not every powershell module can be made public, and not every powershell module developer goes through the process of registering their modules at PsGet.
Introducing Psundle
I thought to myself, “Hell, if Vundle can install modules directly from github, I should be able to implement something similar in Powershell” and Psundle was born.
Psundle is a package manager for Powershell modules written in Powershell. It’s only dependency is that git
is available in the PATH
.
Disclaimer
Psundle is an alpha-quality product. It works, but API details may change. It will improve if you use it and submit your issues and/or Pull Requests through github.
Installation
You can install Psundle by running the following script in powershell:
iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/crmckenzie/psundle/master/tools/install.ps1'))
In your powershell profile, make sure you Import-Module Psundle
. Your powershell profile is located at
"$home/Documents/WindowsPowershell/Profile.ps1"
I advise that you don’t just run some dude’s script you found on the internet. Review the script first (it’s easy to understand). Please, please, please report any installation errors with the self-installer.
Installing Powershell Modules With Psundle
Install-PsundleModule "owner" "repo"
For example, if you want to install the module I wrote for managing ruby versions on Windows, you would run:
Install-PsundleModule "crmckenzie" "psundle-ruby" http://github.com/crmckenzie/psundle-ruby
What does this accomplish?
As long as you have imported the Psundle module in your profile, Psundle will automatically load any modules it manages into your powershell session.
Other Features
Show-PsundleEnvironment
Executing Show-PsundleEnvironment
gives output like this:
Module | Path | Updates | HasUpdates |
---|---|---|---|
Psundle | C:\Users\Username\Documents\WindowsPowerShell\Modu… {dbed58a | Updating readme to resolve installation … | True |
ChefDk | C:\Users\Username\Documents\WindowsPowerShell\Modu… | False | |
Ruby | C:\Users\Username\Documents\WindowsPowerShell\Modu… | False | |
VSCX | C:\Users\Username\Documents\WindowsPowerShell\Modu… | False |
Update-PsundleModule
I can update a module by running:
Update-PsundleModule "owner" "repo"
If I’m feeling brave, I can also Update-PsundleModules
to update everything in one step.
Requirements For Installed Modules
Because Psundle ultimately just uses git clone
to install powershell modules, Powershell modules in github need to be in the same structure that would be installed on disk.
Primarily, this means that the psm1
and psd1
files for the module should be in the repo root.
Committment to Develop
I’m making a blind committment to maintain this module through the end of 2016. “Maintenance” means I will answer issues and respond to pull requests for at least that length of time.
Whether I continue maintaining the module depends on whether or not people use it.