This project is an adaptation of apt-get using the nuget as the package format.
Creating packages are done through the nuget command
The package can contain special files that make this tool quite interesting. The nuget specification states that a nuget package can contain a tools folder. This tool accepts the following PowerShell files
- Setup.ps1
- Install.ps1
- Uninstall.ps1
- Teardown.ps1
- Configuration.json
The script signature for each of these files is as follows:
param ($installationFolder, $configuration)
These parameters are described in the next section.
This section describes how all the magic comes together.
There is a command line tool that is adequately called napt-get that you can execute. Here is the help output to guide you along.
Usage: napt-get <action> options
Global options:
OPTION TYPE ORDER DESCRIPTION
-package (-p) String* 1 The package to install or uninstall
-version (-v) SemanticVersion 2 The version of the package.
-source (-s) String The source of the packages.
-destination (-d) String The package destination.
-configuration (-c) String The location from where to read the JSON configuration file.
Actions:
install - Install a package
uninstall - Uninstall a package
To install the latest version of "PackageName" use the following command (this will install it in the current directory you are in)
napt-get install -p PackageName
To install a specific version of "PackageName" use the following command (please not that nuget follows semantic versioning for versions)
napt-get install -p PackageName -v 1.0.0.0
To uninstall the latest version of "PackageName" use the following command
napt-get install -p PackageName
When the package is about install it follows the following rules:
- If there is a package installed call the Uninstall.ps1 (passing the configuration that is in the package or the one specified by the -c flag)
- Call the Setup.ps1 (passing the configuration that is in the package or the one specified by the -c flag)
- Unzip the contents of the package (current folder or the location specified by the -d flag)
- Call Install.ps1 (passing the configuration that is in the package or the one specified by the -c flag)
When the package is about to uninstall it follows the following rules:
- Call the Uninstall.ps1 (passing the configuration that is in the package or the one specified by the -c flag)
- Delete the contents of the package from the disk.
- Call the Teardown.ps1 (passing the configuration that is in the package or the one specified by the -c flag)
The usual error checking is done if you pass in bogus information.