Badgerati / Fudge

Fudge is a PowerShell tool to help manage software packages via Chocolatey for specific development projects. Think NPM and Bower, but for Chocolatey
MIT License
21 stars 3 forks source link
automation choco chocofile chocolatey devops install json pack package-manager powershell provision software windows

Fudge

MIT licensed Build status

Chocolatey Chocolatey NuGet NuGet

Fudge is a PowerShell tool to help manage software packages via Chocolatey for specific development projects. Think NPM and Bower, but for Chocolatey.

If you find any bugs, or have any feature requests, please raise them in the GitHub issues tab.

Installing Fudge

Fudge can be installed via Chocolatey:

choco install fudge

or via NuGet:

Install-Package fudge

Features

Description

Fudge is a PowerShell tool to help manage software packages via Chocolatey for specific development projects. Think NPM and Bower, but for Chocolatey.

Fudge uses a Fudgefile to control what software to install, upgrade, downgrade or uninstall. You can define specific versions of software or just use the latest version. Fudge also allows you to separate out specific developer only software - which are only needed for developer/QA environments.

You can also define pre/post install/upgrade/downgrade/uninstall scripts that need to be run. For example, you could install redis and have a post install script which sets up REDIS locally.

Fudge can also run choco pack on your nuspec files; allowing you to have multiple nuspecs and then running fudge pack website for example, to pack your website.nuspec. Just running fudge pack will pack everything.

Example Fudgefile

Below is an example of what a Fudgefile looks like, with all components shown:

{
    "scripts": {
        "pre": {
            "install": "<command or file-path>",
            "upgrade": "<command or file-path>",
            "downgrade": "<command or file-path>",
            "uninstall": "<command or file-path>",
            "pack": "<command or file-path>"
        },
        "post": {
            "install": "<command or file-path>",
            "upgrade": "<command or file-path>",
            "downgrade": "<command or file-path>",
            "uninstall": "<command or file-path>",
            "pack": "<command or file-path>"
        }
    },
    "source": "<custom sources || blank for chocolatey || use -s arg>",
    "packages": [
        { "name": "curl" },
        {
            "name": "nodejs.install",
            "version": "6.5.0",
            "source": "<custom source for this package>",
            "params": "<package parameters for installer>",
            "args": "<other arguments you wish to pass>"
        }
    ],
    "devPackages": [
        { "name": "git.install" },
        {
            "name": "vim",
            "version": "7.4.1641"
        }
    ],
    "pack": {
        "website": "./nuspecs/website.nuspec",
        "service": "./nuspecs/service.nuspec"
    }
}

And that's it!

Sections Defined

Name Description
scripts The scripts section is optional. Scripts can either be direct PowerShell command like "Write-Host 'hello, world!'", or a path to a PowerShell script
packages These are the main packages that will be installed, upgraded, downgraded or uninstalled
devPackages These packages will only be touched if the -dev switch is specified on the CLI
pack This is a key-value map of paths to nuspecs files that can be packed via Chocolatey

Example Calls

A normal call to Fudge will look as follows, assuming there's a Fudgefile at the current path:

fudge install                   # install one or all packages (one if a package_id is passed)
fudge upgrade                   # upgrade one or all packages
fudge downgrade                 # downgrade one or all packages
fudge uninstall                 # uninstall one or all packages
fudge reinstall                 # reinstall one or all packages (runs uninstall then install)
fudge pack <id>                 # pack one or all nuspec files
fudge list                      # list information about packages in the Fudgefile
fudge search <id>               # search chocolatey for packages, but results are sorted
fudge new <path|local>          # create an empty Fudgefile, or a populated one from a nuspec/local
fudge renew <nuspec|local>      # restores  fudgefile packages to nuspecs/local or empty
fudge delete                    # deletes a Fudgefile, with option of uninstalling packages first
fudge prune                     # uninstalls packages not in a Fudgefile (except choco/fudge)
fudge clean                     # uninstalls all packages currently installed (except choco/fudge)
fudge which <id>                # returns the path for a command (ie, 7z: C:\...\7z.exe)
fudge rebuild                   # rebuilds the machine by running "clean" then "install"
fudge add <id>                  # adds a new package to the Fudgefile
fudge remove <id>               # removes a package from the Fudgefile
fudge install -dev              # this will install from packages and devPackages
fudge install -devOnly          # this will only install from the devPackages
fudge install 7zip
fudge install 7zip -ad          # will adhoc install 7zip without checking Fudgefile
fudge pack
fudge pack website
fudge list
fudge list checksum
fudge list -dev
fudge search checksum
fudge search git -l 20          # -l limits the results displayed, default is 10 (0 is everything)
fudge new                       # creates a new empty template Fudgefile at the current path
fudge new <nuspec_path>         # creates a new template Fudgefile, with packages/pack populated
fudge new -fp './custom'        # creates a new Fudgefile, but with a custom name
fudge new <nuspec_path> -i      # create new template from a nuspec, then installs the packages
fudge new local                 # creates a new Fudgefile using the packages currently installed
fudge delete                    # delete the default Fudgefile at the current path
fudge delete -fp './custom'     # delete a custom Fudgefile
fudge delete -u                 # delete the Fudgefile, but first uninstall the packages
fudge prune                     # prunes the machine using the default Fudgefile
fudge prune -fp './custum'      # prunes the machine using a custom Fudgefile
fudge prune -d                  # pruning now also respects the devPackages
fudge clean                     # cleans the machine of all packages installed
fudge which 7z                  # returns the path for the 7z command
fudge rebuild                   # rebuild the machine using the default Fudgefile
fudge rebuild -fp './custum'    # rebuild the machine using a custom Fudgefile
fudge rebuild -d                # rebuilding now also respects the devPackages
fudge add curl                  # adds the curl package to the Fudgefile
fudge add curl@7.57.0 -i        # adds curl v7.57.0 to the Fudgefile, and installs curl
fudge add curl -d               # adds curl to the devPackages
fudge remove curl               # removes the curl package from the Fudgefile
fudge remove curl -u            # removes curl from the Fudgefile, and uninstalls curl
fudge remove curl -d            # removes curl from the devPackages

Bugs and Feature Requests

For any bugs you may find or features you wish to request, please create an issue in GitHub.