- This PackMan was forked from OmidS's Packman.
- OmidS's Packman was forked from a great repository called DepMat, by Tom Doel.
PackMan aims to bring dependency management, similar to what npm does for Node.js, to MATLAB. It is a fork of and improves on OmidS's Packman.
- Adds the possibility to source from private repositories.
- Adds the possibility to write git native commands directly from matlab.
Let's say you have a MATLAB project and you want to be able to use external packages in your code. An external package can be any git repository for which you have read access (e.g. any public repository on GitHub).
You will need to do the following once, to enable package management with PackMan for your project:
- Make sure there is no directory called 'external' at the root directory of your project
- Copy "installDeps.m" to the root directory of your project
- Copy "getDepList.m" to the root directory of your project.
Done! Your project is now equipped with dependency management.
You will need to do the following any time you want to add/remove a dependency
- (Option 1) Update the list of dependencies in a file called package.json (for R2016b and later). PackMan will create a package.json file the first time you call "installDeps.m". Each dependency can have the fields listed in the following sample "package.json":
{
"dependencies":{
"PackMan":{
"Name":"PackMan",
"Branch":"master",
"Url":"https://github.com/DanielAtKrypton/PackMan.git",
"FolderName":"PackMan",
"Commit":"",
"GetLatest":true
}
}
}
- (Option 2) Modify "getDepList.m" to make sure it lists the dependencies that you want. It is good to also have PackMan itself in the dependency list (uncomment line 10 of getDepList.m)
Note: when removing any repositories, it is best to delete the 'external' directory completely so that PackMan starts fresh.
You will need to do the following to install or update dependencies
- Run the following command (this will install/update all dependencies)
>> installDeps;
You will need to run the following to add the dependencies to the MATLAB path before running your code
- Now before running you code, add dependencies to the path by calling:
>> pm = installDeps;
>> addpath(pm.genPath(:));
You can also gracefully remove all dependencies from the path by calling:
>> rmpath(pm.genPath(:));
testsResults = runtests('testPackMan')
- Add and successfully pass continuous integration.
- Make sure it works for Mac and Linux operating systems.
- It was tested for Windows only because git.m uses a batch file workaround (RunCommand.cmd) to allow private repositories to be used within Packman.