Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
146 commits
Select commit Hold shift + click to select a range
f8723a1
:construction: Development path.
Mar 10, 2020
a0153c5
:construction: Development path.
Mar 10, 2020
d183855
:construction: Development path.
Mar 10, 2020
8717a5a
:construction: Development path.
Mar 10, 2020
6983cef
:art: Spell check of variable.
Mar 10, 2020
7395609
:construction: Development path.
Mar 12, 2020
0b1621a
:art: Better structure code.
Mar 12, 2020
781da82
:art: Better structure code.
Mar 12, 2020
93b2acc
:bug: Fix installDeps.
Mar 12, 2020
da7f478
:bug: Fix installDeps.
Mar 12, 2020
83c33aa
:rocket: Speed up git commands when auth is not needed.
Mar 12, 2020
2b72923
:bug: Fix status bug.
Mar 12, 2020
33ea5a8
:bug: Fix status bug.
Mar 12, 2020
26269f1
:bug: Fix pull bug.
Mar 12, 2020
dfa9242
:bug: Fix git bug.
Mar 12, 2020
5044896
:bug: Fix git bug.
Mar 12, 2020
54aa2ec
:bug: Attempt to fix recursive behavior.
Mar 13, 2020
d957616
:bug: Fix RunCommand.bat
Mar 13, 2020
e6c9a54
:construction: Improve dependency management.
Mar 13, 2020
203b19e
:art: Improve code quality.
Mar 13, 2020
99dca89
:art: Improve code quality.
Mar 13, 2020
c3fae7f
Does not affect path back again.
Mar 13, 2020
2344136
:rocket: Improve performance.
Mar 13, 2020
c3a8caa
:construction: Update installDeps.m
Mar 14, 2020
54982f5
:bug: Fix git push.
Mar 17, 2020
2d0e0c0
:heavy_plus_sign: Comma separated args should also work for git.
Mar 17, 2020
08324b8
Revert.
Mar 17, 2020
fcd5007
:heavy_plus_sign: Comma separated args should also work for git.
Mar 17, 2020
d97c5f2
:construction: Development path.
Mar 18, 2020
2ad117a
:arrow_up: Update installDeps.m
Mar 18, 2020
ea436c2
:arrow_up: Update installDeps.m
Mar 18, 2020
f2b1e95
:construction: Development path.
Mar 18, 2020
630654a
:construction: Development path.
Mar 18, 2020
27af37a
:construction: Development path.
Mar 18, 2020
5e5b5af
:bug: Fix createDepPackMan.
Mar 18, 2020
f8445fe
:bug: Fix getSelfPaths.
Mar 18, 2020
c68e197
:bug: Fix getSelfPaths.
Mar 18, 2020
75d32a9
:bug: Fix getSelfPaths.
Mar 18, 2020
c7cdd6a
:bug: Fix installDeps.
Mar 18, 2020
3010bf6
:bug: Fix installDeps.
Mar 18, 2020
9f874da
:bug: Fix installDeps.
Mar 18, 2020
7c9d59c
:construction: Development path.
Mar 18, 2020
661ba02
:construction: Development path.
Mar 18, 2020
37bdaca
:construction: Development path.
Mar 18, 2020
761f11d
:construction: Development path.
Mar 18, 2020
9e36364
:construction: Development path.
Mar 18, 2020
e613e59
:construction: Development path.
Mar 18, 2020
baf0dfd
:construction: Development path.
Mar 18, 2020
b1ad27e
:bug: Fix PackMan.
Mar 18, 2020
d84f7e3
:white_check_mark: Add tests.
Mar 18, 2020
7b2adbb
:bug: Fix PackMan.
Mar 18, 2020
eb4994d
:bug: Fix PackMan.
Mar 18, 2020
db24c10
:white_check_mark: Add tests.
Mar 18, 2020
f92882f
:white_check_mark: Add tests.
Mar 18, 2020
cd2febe
:bug: Fix PackMan.
Mar 18, 2020
b71bd8d
:construction: Development path.
Mar 18, 2020
0787c53
:bug: Fix PackMan.
Mar 18, 2020
3f530fc
:bug: Fix PackMan.
Mar 18, 2020
56aa551
:white_check_mark: Add all tests.
Mar 18, 2020
03d1515
:shirt: Remove warning.
Mar 18, 2020
c841029
:construction: Development path.
Mar 24, 2020
523c6a8
:construction: Development path.
Mar 24, 2020
0de39b2
:construction: Development path.
Mar 24, 2020
657dc4a
:construction: Development path.
Mar 24, 2020
e98f27c
:construction: Development path.
Mar 24, 2020
c3dcbf1
:construction: Development path.
Mar 24, 2020
c44a618
Merge branch 'dev02'
Mar 24, 2020
5064f3d
:construction: Development path.
Mar 24, 2020
aa25522
:construction: Development path.
Mar 24, 2020
218b028
:construction: Development path.
Mar 24, 2020
f5efd7a
:construction: Development path.
Mar 24, 2020
5b88988
:heavy_plus_sign: Add travis yml file.
Mar 27, 2020
eca6018
:construction: Build travis yml file.
Mar 27, 2020
c479835
Merge branch 'development'
Mar 27, 2020
e97006d
:construction: Build travis yml file.
Mar 27, 2020
ddf5c58
:construction: Build travis yml file.
Mar 27, 2020
448e812
:construction: Build travis yml file.
Mar 27, 2020
fe65388
:construction: Build travis yml file.
Mar 27, 2020
fe5539a
:construction: Build travis yml file.
Mar 27, 2020
ca09b0a
:construction: Build travis yml file.
Mar 27, 2020
a1a9b51
:construction: Build travis yml file.
Mar 27, 2020
7cb5c61
:construction: Build travis yml file.
Mar 27, 2020
1c2eb2d
:construction: Build travis yml file.
Mar 27, 2020
42a04b3
:construction: Build travis yml file.
Mar 27, 2020
b5e93c1
:construction: Build travis yml file.
Mar 27, 2020
ad55c33
:construction: Build travis yml file.
Mar 27, 2020
2fe367f
:construction: Build travis yml file.
Mar 27, 2020
ba0b7bd
:construction: Build travis yml file.
Mar 27, 2020
bc7b53f
:construction: Build travis yml file.
Mar 27, 2020
9905e5e
:construction: Build travis yml file.
Mar 27, 2020
0fb7229
:construction: Build travis yml file.
Mar 27, 2020
6aa04e3
:construction: Build travis yml file.
Mar 27, 2020
5cea11c
:construction: Build travis yml file.
Mar 27, 2020
d6c631e
:construction: Build travis yml file.
Mar 27, 2020
7d0f51e
:construction: Build travis yml file.
Mar 27, 2020
ecb95a0
:construction: Build travis yml file.
Mar 27, 2020
8e73c95
:construction: Build travis yml file.
Mar 27, 2020
7f7aecf
:construction: Build travis yml file.
Mar 27, 2020
4137e55
:construction: Build travis yml file.
Mar 27, 2020
b0d7de0
:construction: Build travis yml file.
Mar 27, 2020
56d280b
:construction: Build travis yml file.
Mar 27, 2020
1abde35
:construction: Build travis yml file.
Mar 27, 2020
eb1df15
:construction: Build travis yml file.
Mar 27, 2020
7dee71f
:construction: Build travis yml file.
Mar 27, 2020
2661763
:construction: Build travis yml file.
Mar 27, 2020
1b4d97e
:construction: Build travis yml file.
Mar 27, 2020
2c54c4a
:construction: Build travis yml file.
Mar 27, 2020
8556afc
:construction: Build travis yml file.
Mar 27, 2020
542eb69
:construction: Build travis yml file.
Mar 27, 2020
5a47e9f
:construction: Build travis yml file.
Mar 27, 2020
1c963b4
:construction: Build travis yml file.
Mar 27, 2020
020fd22
:construction: Build travis yml file.
Mar 27, 2020
a546252
:construction: Build travis yml file.
Mar 27, 2020
182b8d6
:construction: Build travis yml file.
Mar 27, 2020
fbcd99a
:construction: Build travis yml file.
Mar 27, 2020
2396d54
:construction: Build travis yml file.
Mar 27, 2020
fa0a120
:construction: Build travis yml file.
Mar 27, 2020
197bf96
:construction: Build travis yml file.
Mar 27, 2020
3bda0cf
:construction: Build travis yml file.
Mar 27, 2020
fd69e94
:construction: Build travis yml file.
Mar 27, 2020
e15ea6c
:construction: Build travis yml file.
Mar 27, 2020
23347bb
:heavy_plus_sign: Add travis yml file.
Mar 27, 2020
972200c
:heavy_plus_sign: Add travis yml file.
Mar 27, 2020
5d70dfd
:heavy_plus_sign: Add travis yml file.
Mar 27, 2020
ca88fb4
:heavy_plus_sign: Add travis yml file.
Mar 27, 2020
591a29b
:heavy_plus_sign: Add travis yml file.
Mar 27, 2020
9e2af7f
:heavy_plus_sign: Add travis yml file.
Mar 27, 2020
13aa819
Update .travis.yml
DanielAtKrypton Mar 27, 2020
f131f88
Update .travis.yml
DanielAtKrypton Mar 27, 2020
5307083
Update .travis.yml
DanielAtKrypton Mar 27, 2020
1f1a6fc
Update .travis.yml
DanielAtKrypton Mar 27, 2020
75ef3e1
Update .travis.yml
DanielAtKrypton Mar 27, 2020
e870f2d
Update .travis.yml
DanielAtKrypton Mar 27, 2020
6a0f727
Update .travis.yml
DanielAtKrypton Mar 27, 2020
6a538df
Update .travis.yml
DanielAtKrypton Mar 27, 2020
d5bb911
Update .travis.yml
DanielAtKrypton Mar 27, 2020
4dae77c
Update .travis.yml
DanielAtKrypton Mar 27, 2020
0905fe8
Update .travis.yml
DanielAtKrypton Mar 27, 2020
46d7789
:heavy_plus_sign: Add travis yml file.
Mar 27, 2020
a535d51
Update .travis.yml
DanielAtKrypton Mar 27, 2020
b1f9a00
Update .travis.yml
DanielAtKrypton Mar 27, 2020
d722c24
:memo: Improve README.md.
Apr 3, 2020
bab12b4
Merge branch 'master' of github.com:DanielAtKrypton/PackMan
Apr 3, 2020
2d28d62
:construction: Improve getDepList.m
Apr 3, 2020
bf044d2
:shirt: Markdown lint README.md
Apr 3, 2020
950cdb6
:bug: Fix git bug.
DanielAtKrypton Sep 6, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,5 @@ slprj/

# Session info
octave-workspace

package.json
170 changes: 170 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,170 @@
os: linux
dist: xenial
language: general

###############################################################################
cache:
# Downloading octave takes a while, so let's cache apt
apt: true
directories:
# Cache octave packages
- $HOME/octave
# Cache other packages
- $HOME/external_cache

###############################################################################
env:
jobs:
- COVERAGE="false"
- COVERAGE="true"
jobs:
allow_failures: '[{ env: COVERAGE=true }]'
fast_finish: true

###############################################################################
# Command to install dependencies
before_install:
- echo '<?xml version="1.0" encoding="UTF-8" standalone="no"?><project basedir="." default="build" name="PackMan"><target name="test"/></project>' > build.xml
# Remember the directory where our repository to test is located
- REPOPATH="$(pwd)" && pwd
# ---------------------------------------------------------------------------
# Check whether we need to upgrade the gcc and g++ versions. We do need to if
# the version is less the 4.8 and we need to install the image package from
# Octave Forge (possibly for other packages as well).
# For now, lets just always say we do need to do this.
- UPGRADE_GCC="true"
# ---------------------------------------------------------------------------
# Add repository for octave
- travis_retry sudo add-apt-repository -y ppa:octave/stable
# Add repository for installing g++-4.8 on Ubuntu 12.04
- if [ "$UPGRADE_GCC" = "true" ]; then
sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test;
fi
# Update apt-get to include the contents from the new locations
- travis_retry sudo apt-get update -qq
# Install octave with apt-get
- travis_retry sudo apt-get install -y octave liboctave-dev
# Add a C++11 compiler so we can install image package
- if [ "$UPGRADE_GCC" = "true" ]; then
travis_retry sudo apt-get install -y gcc-4.8 g++-4.8;
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.8 50;
sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-4.8 50;
fi;
# Check which versions of g++ and gcc we are using
- which g++;
g++ --version;
which gcc;
gcc --version;
# ---------------------------------------------------------------------------
# Go up one level and retrieve MOxUnit from its repository
- cd ..;
ls -alh;
# Remove directory if it is already there from previous build
- rm -rf MOxUnit;
- git clone https://github.com/MOxUnit/MOxUnit.git
# Install MOxUnit, which adds itself to the startup path
- make -C MOxUnit install
# Install MOcov, which adds itself to the startup path
- if [ "$COVERAGE" = "true" ]; then
rm -rf MOcov;
git clone https://github.com/MOcov/MOcov.git;
make -C MOcov install;
fi;
# Go back to the repository directory
- cd ${REPOPATH}

###############################################################################
install:
# Ensure external packages folder exists and is empty
- EXTPATH="source/external";
echo ${EXTPATH};
rm -rf ${EXTPATH};
mkdir -p ${EXTPATH};
# Install required packages for Octave
- if [ -f requirements-octave.txt ]; then
mopi/mopi.sh requirements-octave.txt ${EXTPATH} "$HOME/external_cache";
fi;
# Install other required packages
- if [ -f requirements.txt ]; then
mopi/mopi.sh requirements.txt ${EXTPATH} "$HOME/external_cache";
fi;
# Install developmental requirements
- if [ -f requirements-dev.txt ]; then
mopi/mopi.sh requirements-dev.txt ${EXTPATH} "$HOME/external_cache";
fi;
# Before running the tests, we will have to add our package and our
# external dependencies to the octave path
- PACKAGE_FOLDER="source";
ADDPATH_COMMAND="addpath(genpath(fullfile(pwd, '$PACKAGE_FOLDER')));";
ADDPATH_COMMAND+=" addpath(genpath(fullfile(pwd, '${EXTPATH}')));";
echo "ADDPATH_COMMAND| $ADDPATH_COMMAND";

###############################################################################
before_script:
- testFolder="source/tests"
- TEST_ARGS="'-recursive', '-verbose', '-junit_xml_file', 'testresults.xml'";
if [ "$COVERAGE" = "true" ]; then
TEST_ARGS+=", '-with_coverage', '-cover', '$PACKAGE_FOLDER'";
TEST_ARGS+=", '-cover_exclude', ${testFolder}";
TEST_ARGS+=", '-cover_xml_file', 'coverage.xml'";
TEST_ARGS+=", '-cover_json_file', 'coveralls.json'";
fi;
TEST_COMMAND="exit(~moxunit_runtests('${testFolder}', $TEST_ARGS));";
echo "TEST_COMMAND| $TEST_COMMAND";
# Double-check we are still in the right directory
- pwd
# Check what octave packages we have installed
# - octave -q --eval "ver"
# - octave -q --eval "2+3"
# ---------------------------------------------------------------------------
# Remove any cached results files from previous build, if present
- rm -f testresults.xml;
rm -f coverage.xml;
rm -f .coverage;
rm -f coveralls.json;
# ---------------------------------------------------------------------------
# Set up folders for test results on Shippable
- if [ "$SHIPPABLE" = "true" ]; then
rm -fr shippable;
mkdir -p shippable/testresults;
mkdir -p shippable/codecoverage;
fi;
###############################################################################
script:
- octave -v --eval "moxunit_runtests('${testFolder}')"
# - octave -v --eval "$ADDPATH_COMMAND $TEST_COMMAND";

###############################################################################
after_script:
# Check where we ended up and what's going on where we are
- pwd
- ls -alh
# ---------------------------------------------------------------------------
# Move results and coverage files into appropriate places
- if [ "$SHIPPABLE" = "true" ] && [ -f testresults.xml ]; then
mv testresults.xml shippable/testresults/;
fi;
if [ "$SHIPPABLE" = "true" ] && [ -f coverage.xml ]; then
cp coverage.xml shippable/codecoverage/;
fi;

###############################################################################
after_success:
# Only run coveralls on Travis. When running on a public Travis-CI, the
# repo token is automatically inferred, but to run coveralls on Shippable
# the repo token needs to be specified in a .coveralls.yml or as an
# environment variable COVERALLS_REPO_TOKEN. This should be kept hidden
# from public viewing, either by encrypting the token or running on a
# private build.
# We ignore coverage push failures because the servers are not 100%
# reliable and we don't want the CI to report a failure just because the
# coverage report wasn't published.
# For Codecov, we use this https://github.com/codecov/codecov-bash
- if [ "$COVERAGE" = "true" ] && [ "$TRAVIS" = "true" ] && [ "$SHIPPABLE" != "true" ]; then
curl --verbose -F json_file=`pwd`/coveralls.json https://coveralls.io/api/v1/jobs || echo "Coveralls push failed";
bash <(curl -s https://codecov.io/bash) || echo "Codecov push failed";
fi;

###############################################################################
# Enable archiving of artifacts on Shippable (does nothing on Travis)
archive: true
91 changes: 71 additions & 20 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,27 +1,57 @@
# PackMan
PackMan aims to bring dependency management, similar to what [npm](https://www.npmjs.com) does for [Node.js](https://nodejs.org), to [MATLAB](https://www.mathworks.com/products/matlab.html). It is a fork of and improves on [DepMat](https://github.com/tomdoel/depmat).

# Usage guide
## Table of Contents

1. [Acknowledgements](#acknowledgements)
2. [Description](#description)
3. [Usage Guide](#usage-guide)
4. [Examples](#examples)
5. [Test](#test)
6. [ToDo](#todo)
7. [Limitations](#limitations)
8. [References](#references)

## Acknowledgements

- This PackMan was forked from [OmidS's Packman](https://github.com/OmidS/PackMan).
- OmidS's Packman was forked from a great repository called [DepMat](https://github.com/tomdoel/depmat), by [Tom Doel](http://www.tomdoel.com).

## Description

PackMan aims to bring dependency management, similar to what [npm](https://www.npmjs.com) does for [Node.js](https://nodejs.org), to [MATLAB](https://www.mathworks.com/products/matlab.html). It is a fork of and improves on [OmidS's Packman](https://github.com/OmidS/PackMan).

### Additional Features

- Adds the possibility to source from private repositories.
- Adds the possibility to write git native commands directly from matlab.

## Usage guide

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).

## One time setup
### One time setup

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](https://github.com/OmidS/PackMan/blob/master/source/installDeps.m)" to the root directory of your project
- (Optional) Copy "[getDepList.m](https://github.com/OmidS/PackMan/blob/master/source/getDepList.m)" to the root directory of your project.
- Copy "[installDeps.m](https://raw.githubusercontent.com/DanielAtKrypton/PackMan/master/source/installDeps.m)" to the root directory of your project
- Copy "[getDepList.m](https://raw.githubusercontent.com/DanielAtKrypton/PackMan/master/source/getDepList.m)" to the root directory of your project.

Done! Your project is now equipped with dependency management.

## Add/remove dependencies
### Add/remove dependencies

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":
```

```json
{
"dependencies":{
"PackMan":{
"Name":"PackMan",
"Branch":"master",
"Url":"https://github.com/OmidS/PackMan.git",
"Url":"https://github.com/DanielAtKrypton/PackMan.git",
"FolderName":"PackMan",
"Commit":"",
"GetLatest":true
Expand All @@ -34,31 +64,52 @@ You will need to do the following any time you want to add/remove a dependency

Note: when removing any repositories, it is best to delete the 'external' directory completely so that PackMan starts fresh.

## Install/update dependencies
### Install/update dependencies

You will need to do the following to install or update dependencies

- Run the following command (this will install/update all dependencies)
```

```matlab
>> installDeps;
```

### Add dependencies to the path

You will need to run the following to add the dependencies to the MATLAB path before running your code

## Add dependencies to the path
You will need to run the following to add the dependencies to the MATALAB path before running your code
- Now before running you code, add dependencies to the path by calling:
```

```matlab
>> pm = installDeps;
>> addpath(pm.genPath());
>> addpath(pm.genPath(:));
```

You can also gracefully remove all dependencies from the path by calling:

```matlab
>> rmpath(pm.genPath(:));
```
>> rmpath(pm.genPath());

## Examples

- [PackManRecursiveSample](https://github.com/DanielAtKrypton/PackManRecursiveSample.git)

## Test

```matlab
testsResults = runtests('testPackMan')
```

## Complete example:
See the following sample repository for a complete usage example for PackMan:
https://github.com/OmidS/matlabPackManSample
## ToDo

- Add and successfully pass continuous integration.
- Make sure it works for Mac and Linux operating systems.

## Limitations

- 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.

## References

# Credits
PackMan was forked from a great repository called [DepMat](https://github.com/tomdoel/depmat), by [Tom Doel](http://www.tomdoel.com).
- [matlab-continuous-integration](https://github.com/scottclowe/matlab-continuous-integration)
5 changes: 0 additions & 5 deletions package.json

This file was deleted.

11 changes: 7 additions & 4 deletions source/DepMat.m
Original file line number Diff line number Diff line change
Expand Up @@ -84,16 +84,19 @@ function setDispHandler(obj, funcHandle)
[return_value, output] = system(command);
success = return_value == 0;
if ~success
if strfind(output, 'Protocol https not supported or disabled in libcurl')
if contains(output, 'Protocol https not supported or disabled in libcurl')
obj.dispHandler('! You need to modify the the DYLD_LIBRARY_PATH environment variable to point to a newer version of libcurl. The version installed with Matlab does not support using https with git.');
end
end
end

function installed = isGitInstalled
command = 'git --help';

installed = DepMat.execute(command);
installed = true;
try
git('--help');
catch
installed = false;
end
end

function fixCurlPath
Expand Down
4 changes: 2 additions & 2 deletions source/DepMatAddPaths.m
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ function DepMatAddPaths(baseFolderList, repoNameList, forceUpdate)

full_path = mfilename('fullpath');
[path_root, ~, ~] = fileparts(full_path);
myPaths = genpath(path_root);
myPaths = genNonGitPath(path_root);
allPathsToAdd = [allPathsToAdd, myPaths];

for repoIndex = 1 : numel(baseFolderList)
Expand All @@ -32,7 +32,7 @@ function DepMatAddPaths(baseFolderList, repoNameList, forceUpdate)
DepMat_PathsHaveBeenSet{end + 1} = repoName;
end
if doAddPaths
repoPaths = genpath(baseFolderList{repoIndex});
repoPaths = genNonGitPath(baseFolderList{repoIndex});
allPathsToAdd = [allPathsToAdd, repoPaths];
end

Expand Down
Loading