From f8723a1ad817b38990f426e53f176c1e9ab884d9 Mon Sep 17 00:00:00 2001 From: Daniel Kaminski de Souza Date: Tue, 10 Mar 2020 01:19:06 -0400 Subject: [PATCH 001/143] :construction: Development path. --- source/RunCommand.bat | 9 +++++++++ source/git.m | 11 +++++++++++ 2 files changed, 20 insertions(+) create mode 100644 source/RunCommand.bat create mode 100644 source/git.m diff --git a/source/RunCommand.bat b/source/RunCommand.bat new file mode 100644 index 0000000..06b212c --- /dev/null +++ b/source/RunCommand.bat @@ -0,0 +1,9 @@ +@echo off +REM iex "$args" +REM Remove-Item -Path 'executingSignal' +REM exit + +SET subject=%* +%subject% +del "executingSignal" +exit \ No newline at end of file diff --git a/source/git.m b/source/git.m new file mode 100644 index 0000000..223fcd8 --- /dev/null +++ b/source/git.m @@ -0,0 +1,11 @@ +function [status, result] = git(parameterStr) +%GIT Summary of this function goes here +% Detailed explanation goes here +fid = fopen( 'executingSignal', 'wt' ); +fclose(fid); + +[status, result] = dos(['RunCommand.bat git ' parameterStr ' &']); +% [status, result] = system(['pwsh -Command .\RunCommand.ps1 git ' parameterStr ' &']); +while(isfile('executingSignal')) + pause(0.2); +end \ No newline at end of file From a0153c5207217bedd7beab28e85001a167abf80d Mon Sep 17 00:00:00 2001 From: Daniel Kaminski de Souza Date: Tue, 10 Mar 2020 01:22:34 -0400 Subject: [PATCH 002/143] :construction: Development path. --- README.md | 2 +- source/getDepList.m | 2 +- source/installDeps.m | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index ca4a6f1..94b2517 100644 --- a/README.md +++ b/README.md @@ -21,7 +21,7 @@ You will need to do the following any time you want to add/remove a dependency "PackMan":{ "Name":"PackMan", "Branch":"master", - "Url":"https://github.com/OmidS/PackMan.git", + "Url":"https://github.com/DanielAtKrypton/PackMan.git", "FolderName":"PackMan", "Commit":"", "GetLatest":true diff --git a/source/getDepList.m b/source/getDepList.m index fcb6151..11bfb18 100644 --- a/source/getDepList.m +++ b/source/getDepList.m @@ -7,7 +7,7 @@ depList = []; % Arguments for DepMatRepo: DepMatRepo(Name, Branch, Url, FolderName, Commit, GetLatest) % Example: -% depList = DepMatRepo('PackMan', 'master', 'https://github.com/OmidS/PackMan.git', 'PackMan', '', true); +% depList = DepMatRepo('PackMan', 'master', 'https://github.com/DanielAtKrypton/PackMan.git', 'PackMan', '', true); % depList(end+1, 1) = DepMatRepo('depmat', 'master', 'https://github.com/OmidS/depmat.git', 'subid', '', true); end \ No newline at end of file diff --git a/source/installDeps.m b/source/installDeps.m index 23a3ce1..d785f75 100644 --- a/source/installDeps.m +++ b/source/installDeps.m @@ -71,7 +71,7 @@ function installPackMan( depDirPath ) packManDir = fullfile(depDirPath, 'PackMan'); try - repoUrl = 'https://github.com/OmidS/PackMan.git'; + repoUrl = 'https://github.com/DanielAtKrypton/PackMan.git'; command = ['git clone ', repoUrl, ' "',packManDir,'"']; [status, cmdout] = system(command); if (~status), fprintf('%s', cmdout); end From d1838557060c676f93ef65235fb8c813ad3f371b Mon Sep 17 00:00:00 2001 From: Daniel Kaminski de Souza Date: Tue, 10 Mar 2020 01:51:47 -0400 Subject: [PATCH 003/143] :construction: Development path. --- source/DepMatRepositoryUpdater.m | 12 +++++++----- source/git.m | 2 +- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/source/DepMatRepositoryUpdater.m b/source/DepMatRepositoryUpdater.m index 9a1440b..6d949d2 100644 --- a/source/DepMatRepositoryUpdater.m +++ b/source/DepMatRepositoryUpdater.m @@ -290,12 +290,14 @@ function setDispHandler(obj, funcHandle) end end - if ~DepMat.execute('git fetch') - obj.setFetchFailure; + % TODO Error handling. + % if ~DepMat.execute('git fetch') + % obj.setFetchFailure; - success = false; - return; - end + % success = false; + % return; + % end + [status, result] = git('fetch'); if ~isempty(obj.RepoDef.Commit)&&~obj.RepoDef.GetLatest checkoutCmd = ['git checkout ' obj.RepoDef.Commit]; diff --git a/source/git.m b/source/git.m index 223fcd8..55ddc84 100644 --- a/source/git.m +++ b/source/git.m @@ -4,7 +4,7 @@ fid = fopen( 'executingSignal', 'wt' ); fclose(fid); -[status, result] = dos(['RunCommand.bat git ' parameterStr ' &']); +[status, result] = dos([which('RunCommand.bat') ' git ' parameterStr ' &']); % [status, result] = system(['pwsh -Command .\RunCommand.ps1 git ' parameterStr ' &']); while(isfile('executingSignal')) pause(0.2); From 8717a5a8b9bd6e2145467cbfa14ac68e96b6ef11 Mon Sep 17 00:00:00 2001 From: Daniel Kaminski de Souza Date: Tue, 10 Mar 2020 02:05:28 -0400 Subject: [PATCH 004/143] :construction: Development path. --- source/DepMatRepositoryUpdater.m | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/source/DepMatRepositoryUpdater.m b/source/DepMatRepositoryUpdater.m index 6d949d2..8a51a4b 100644 --- a/source/DepMatRepositoryUpdater.m +++ b/source/DepMatRepositoryUpdater.m @@ -195,8 +195,9 @@ function setDispHandler(obj, funcHandle) return; end - [success, local_id] = DepMat.execute('git remote update'); - if ~success + % TODO check this out + [faiure, ~] = git('remote update'); + if faiure status = DepMatStatus.GitFailure; return; end From 6983cefe2e004500c1a2132283e17c5f192ef79e Mon Sep 17 00:00:00 2001 From: Daniel Kaminski de Souza Date: Tue, 10 Mar 2020 02:09:09 -0400 Subject: [PATCH 005/143] :art: Spell check of variable. --- source/DepMatRepositoryUpdater.m | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/source/DepMatRepositoryUpdater.m b/source/DepMatRepositoryUpdater.m index 8a51a4b..6cc43ce 100644 --- a/source/DepMatRepositoryUpdater.m +++ b/source/DepMatRepositoryUpdater.m @@ -196,8 +196,8 @@ function setDispHandler(obj, funcHandle) end % TODO check this out - [faiure, ~] = git('remote update'); - if faiure + [failure, ~] = git('remote update'); + if failure status = DepMatStatus.GitFailure; return; end From 7395609accb5b388082a0d699e5628e018090382 Mon Sep 17 00:00:00 2001 From: Daniel Kaminski de Souza Date: Thu, 12 Mar 2020 02:26:21 -0400 Subject: [PATCH 006/143] :construction: Development path. --- source/DepMat.m | 5 +- source/DepMatRepositoryUpdater.m | 106 ++++++++++++++++--------------- source/RunCommand.bat | 14 ++-- source/git.m | 24 +++++-- 4 files changed, 84 insertions(+), 65 deletions(-) diff --git a/source/DepMat.m b/source/DepMat.m index c22c48a..53b44cc 100644 --- a/source/DepMat.m +++ b/source/DepMat.m @@ -91,9 +91,8 @@ function setDispHandler(obj, funcHandle) end function installed = isGitInstalled - command = 'git --help'; - - installed = DepMat.execute(command); + failure = git('--help'); + installed = ~failure; end function fixCurlPath diff --git a/source/DepMatRepositoryUpdater.m b/source/DepMatRepositoryUpdater.m index 6cc43ce..6b35d68 100644 --- a/source/DepMatRepositoryUpdater.m +++ b/source/DepMatRepositoryUpdater.m @@ -45,7 +45,7 @@ [status, varargout{1}] = obj.internalGetStatus; if isempty(varargout{1}), [~, varargout{1}] = obj.internalGetHeadHash(); end cd(lastDir); - catch ex + catch cd(lastDir); status = DepMatStatus.GitFailure; end @@ -64,7 +64,7 @@ cd(obj.SourceDir); success = obj.internalCloneRepo; cd(lastDir); - catch ex + catch cd(lastDir); success = false; end @@ -78,7 +78,7 @@ try cd(obj.SourceDir); [success, output] = obj.internalUpdateRepo; - catch ME + catch success = false; output = ''; end @@ -93,7 +93,7 @@ try status = obj.getStatus; - catch ex + catch success = false; obj.dispHandler(['! ' obj.RepoDef.Name ' unable to check for updates']); return; @@ -160,7 +160,7 @@ obj.dispHandler(['! ' obj.RepoDef.Name ' could not check out specified commit (',obj.RepoDef.Commit,')']); end cd(lastDir); - catch ex + catch cd(lastDir); success = false; end @@ -202,12 +202,12 @@ function setDispHandler(obj, funcHandle) return; end - [success, local_id_head] = DepMat.execute(['git rev-parse @{0}']); % current head commit - if ~success + [failure, local_id_head] = git('rev-parse @{0}'); % current head commit + if failure status = DepMatStatus.GitFailure; return; end - local_id_head = strrep(local_id_head,sprintf('\n'),''); + local_id_head = strrep(local_id_head,newline,''); if ~obj.RepoDef.GetLatest if strcmp(local_id_head, obj.RepoDef.Commit) @@ -216,25 +216,25 @@ function setDispHandler(obj, funcHandle) status = DepMatStatus.UpToDateButWrongHead; end else % Get the latest commit - [success, local_id] = DepMat.execute(['git rev-parse ',obj.RepoDef.Branch,'@{0}']); % Latest local commit - if ~success + [failure, local_id] = git(['rev-parse ',obj.RepoDef.Branch,'@{0}']); % Latest local commit + if failure status = DepMatStatus.GitFailure; return; end - [success, remote_id] = DepMat.execute(['git rev-parse ',obj.RepoDef.Branch,'@{u}']); % Latest remote commit - if ~success + [failure, remote_id] = git(['rev-parse ',obj.RepoDef.Branch,'@{u}']); % Latest remote commit + if failure status = DepMatStatus.GitFailure; return; end - [success, base] = DepMat.execute(['git merge-base ',obj.RepoDef.Branch,'@{0} ',obj.RepoDef.Branch,'@{u}']); - if ~success + [failure, base] = git(['merge-base ',obj.RepoDef.Branch,'@{0} ',obj.RepoDef.Branch,'@{u}']); + if failure status = DepMatStatus.GitFailure; return; end - local_id = strrep(local_id,sprintf('\n'),''); - remote_id = strrep(remote_id,sprintf('\n'),''); - base = strrep(base,sprintf('\n'),''); + local_id = strrep(local_id,newline,''); + remote_id = strrep(remote_id,newline,''); + base = strrep(base,newline,''); if strcmp(local_id, remote_id) if (~obj.RepoDef.GetLatest && strcmp(obj.RepoDef.Commit, local_id_head) ) || ... @@ -254,24 +254,16 @@ function setDispHandler(obj, funcHandle) end end - function [status, commitHash] = internalGetHeadHash(obj) - status = true; - [success, commitHash] = DepMat.execute('git rev-parse HEAD'); - if ~success - status = DepMatStatus.GitFailure; - return; - end - commitHash = strrep(commitHash,sprintf('\n'),''); - end - function [success, output] = internalUpdateRepo(obj) - [success, output] = DepMat.execute(['git checkout ',obj.RepoDef.Branch]); % Checkout the branch - if ~success - status = DepMatStatus.GitFailure; + [failure, output] = git(['checkout ',obj.RepoDef.Branch]); % Checkout the branch + if failure + % TODO Shouldn't be output rather than status? + % status = DepMatStatus.GitFailure; + DepMatStatus.GitFailure; return; end - [pullResult, output] = DepMat.execute('git pull'); + [pullResult, output] = git('pull'); success = ~isempty(pullResult) && ~isequal(pullResult, 0); end @@ -280,33 +272,32 @@ function setDispHandler(obj, funcHandle) % Avoid initialisation if it has already been done, to avoid errors fetchFailure = obj.checkForFetchFailure; if ~fetchFailure - if ~DepMat.execute('git init') + if git('init') success = false; return; end - if ~DepMat.execute(['git remote add -t ' obj.RepoDef.Branch ' origin ' obj.RepoDef.Url]) + if git(['remote add -t ' obj.RepoDef.Branch ' origin ' obj.RepoDef.Url]) success = false; return; end end - % TODO Error handling. - % if ~DepMat.execute('git fetch') - % obj.setFetchFailure; + [failure, ~] = git('fetch'); + if (failure) + obj.setFetchFailure; - % success = false; - % return; - % end - [status, result] = git('fetch'); - + success = false; + return; + end + if ~isempty(obj.RepoDef.Commit)&&~obj.RepoDef.GetLatest - checkoutCmd = ['git checkout ' obj.RepoDef.Commit]; + checkoutCmd = ['checkout ' obj.RepoDef.Commit]; else - checkoutCmd = ['git checkout ' obj.RepoDef.Branch]; + checkoutCmd = ['checkout ' obj.RepoDef.Branch]; end - if ~DepMat.execute(checkoutCmd) + if git(checkoutCmd) success = false; return; end @@ -319,10 +310,10 @@ function setDispHandler(obj, funcHandle) end function [success, changed, headCommitId] = internalCheckoutCommit(obj) - [success, local_id_head] = DepMat.execute(['git rev-parse @{0}']); % current head commit - local_id_head = strrep(local_id_head,sprintf('\n'),''); - [success, local_id_latest] = DepMat.execute(['git rev-parse ',obj.RepoDef.Branch,'@{0}']); % Latest local commit - local_id_latest = strrep(local_id_latest,sprintf('\n'),''); + [~, local_id_head] = git('rev-parse @{0}'); % current head commit + local_id_head = strrep(local_id_head,newline,''); + [~, local_id_latest] = git(['rev-parse ',obj.RepoDef.Branch,'@{0}']); % Latest local commit + local_id_latest = strrep(local_id_latest,newline,''); headCommitId = local_id_head; changed = false; @@ -333,7 +324,7 @@ function setDispHandler(obj, funcHandle) toCheckoutHash = obj.RepoDef.Commit; end if ~isempty(toCheckoutHash) - if ~DepMat.execute(['git checkout ' toCheckoutHash]) + if git(['checkout ' toCheckoutHash]) success = false; % changed = true; return; @@ -344,9 +335,6 @@ function setDispHandler(obj, funcHandle) success = true; end - function getHeadCommitId() - end - function setFetchFailure(obj) fetchFailureFilename = fullfile(obj.SourceDir, obj.FetchFailureFileName); fileHandle = fopen(fetchFailureFilename, 'w'); @@ -364,5 +352,19 @@ function clearFetchFailure(obj) end end + methods(Static) + function getHeadCommitId + end + + function [status, commitHash] = internalGetHeadHash + status = true; + [failure, commitHash] = git('rev-parse HEAD'); + if failure + status = DepMatStatus.GitFailure; + return; + end + commitHash = strrep(commitHash,newline,''); + end + end end diff --git a/source/RunCommand.bat b/source/RunCommand.bat index 06b212c..d8b1ab3 100644 --- a/source/RunCommand.bat +++ b/source/RunCommand.bat @@ -1,9 +1,11 @@ @echo off -REM iex "$args" -REM Remove-Item -Path 'executingSignal' -REM exit -SET subject=%* -%subject% -del "executingSignal" +for /f "tokens=1,* delims= " %%a in ("%*") do set ALL_BUT_FIRST=%%b +SET cmdToRun=%ALL_BUT_FIRST% + +echo Executing git command on %~1 repository: %cmdToRun% + +for /f %%i in ('%cmdToRun%') do set result=%%i +@echo %result% > %~1CommandOutput + exit \ No newline at end of file diff --git a/source/git.m b/source/git.m index 55ddc84..d41af8d 100644 --- a/source/git.m +++ b/source/git.m @@ -1,11 +1,27 @@ function [status, result] = git(parameterStr) %GIT Summary of this function goes here % Detailed explanation goes here -fid = fopen( 'executingSignal', 'wt' ); +name = getRepoName(); +filename = [name 'CommandOutput']; +fid = fopen(filename , 'wt' ); fclose(fid); -[status, result] = dos([which('RunCommand.bat') ' git ' parameterStr ' &']); +[status, ~] = dos([which('RunCommand.bat') ' ' name ' git ' parameterStr ' &']); % [status, result] = system(['pwsh -Command .\RunCommand.ps1 git ' parameterStr ' &']); -while(isfile('executingSignal')) +while(true) + fid = fopen(filename, 'rt' ); + contents = fscanf(fid, '%s\n'); + fclose(fid); + if ~isempty(contents) + delete(filename) + break; + end pause(0.2); -end \ No newline at end of file +end +result = contents; +% fclose(fid); + +function name = getRepoName() +[~, result] = system('git rev-parse --show-toplevel'); +result = result(1:end-1); % remove newline. +[~,name,~] = fileparts(result); \ No newline at end of file From 0b1621ae9edba838a53de1e33cafff277ad5324d Mon Sep 17 00:00:00 2001 From: Daniel Kaminski de Souza Date: Thu, 12 Mar 2020 03:39:21 -0400 Subject: [PATCH 007/143] :art: Better structure code. --- source/installDeps.m | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/installDeps.m b/source/installDeps.m index d785f75..22ea0fd 100644 --- a/source/installDeps.m +++ b/source/installDeps.m @@ -72,7 +72,7 @@ function installPackMan( depDirPath ) packManDir = fullfile(depDirPath, 'PackMan'); try repoUrl = 'https://github.com/DanielAtKrypton/PackMan.git'; - command = ['git clone ', repoUrl, ' "',packManDir,'"']; + command = git(['clone ', repoUrl, ' "',packManDir,'"']; [status, cmdout] = system(command); if (~status), fprintf('%s', cmdout); end catch ME From 781da829b583fa2a094c579b2b60c4a8449340cb Mon Sep 17 00:00:00 2001 From: Daniel Kaminski de Souza Date: Thu, 12 Mar 2020 03:51:02 -0400 Subject: [PATCH 008/143] :art: Better structure code. --- source/DepMat.m | 2 +- source/installDeps.m | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/source/DepMat.m b/source/DepMat.m index 53b44cc..fef7f06 100644 --- a/source/DepMat.m +++ b/source/DepMat.m @@ -84,7 +84,7 @@ 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 diff --git a/source/installDeps.m b/source/installDeps.m index 22ea0fd..78bf685 100644 --- a/source/installDeps.m +++ b/source/installDeps.m @@ -72,10 +72,10 @@ function installPackMan( depDirPath ) packManDir = fullfile(depDirPath, 'PackMan'); try repoUrl = 'https://github.com/DanielAtKrypton/PackMan.git'; - command = git(['clone ', repoUrl, ' "',packManDir,'"']; + command = git(['clone ', repoUrl, ' "',packManDir,'"']); [status, cmdout] = system(command); if (~status), fprintf('%s', cmdout); end -catch ME +catch end From 93b2acc45a25e1b813f655866b1b9f680f65668e Mon Sep 17 00:00:00 2001 From: Daniel Kaminski de Souza Date: Thu, 12 Mar 2020 03:55:42 -0400 Subject: [PATCH 009/143] :bug: Fix installDeps. --- source/installDeps.m | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/source/installDeps.m b/source/installDeps.m index 78bf685..2048a6e 100644 --- a/source/installDeps.m +++ b/source/installDeps.m @@ -72,9 +72,8 @@ function installPackMan( depDirPath ) packManDir = fullfile(depDirPath, 'PackMan'); try repoUrl = 'https://github.com/DanielAtKrypton/PackMan.git'; - command = git(['clone ', repoUrl, ' "',packManDir,'"']); - [status, cmdout] = system(command); - if (~status), fprintf('%s', cmdout); end + [failure, cmdout] = git(['clone ', repoUrl, ' "',packManDir,'"']); + if (failure), fprintf('%s', cmdout); end catch end From da7f478a1aea94c995d0dddc052b3dd45517145f Mon Sep 17 00:00:00 2001 From: Daniel Kaminski de Souza Date: Thu, 12 Mar 2020 04:00:35 -0400 Subject: [PATCH 010/143] :bug: Fix installDeps. --- source/installDeps.m | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/source/installDeps.m b/source/installDeps.m index 2048a6e..d785f75 100644 --- a/source/installDeps.m +++ b/source/installDeps.m @@ -72,9 +72,10 @@ function installPackMan( depDirPath ) packManDir = fullfile(depDirPath, 'PackMan'); try repoUrl = 'https://github.com/DanielAtKrypton/PackMan.git'; - [failure, cmdout] = git(['clone ', repoUrl, ' "',packManDir,'"']); - if (failure), fprintf('%s', cmdout); end -catch + command = ['git clone ', repoUrl, ' "',packManDir,'"']; + [status, cmdout] = system(command); + if (~status), fprintf('%s', cmdout); end +catch ME end From 83c33aa8d0c4dc57059c0ef91a142c67764fffa9 Mon Sep 17 00:00:00 2001 From: Daniel Kaminski de Souza Date: Thu, 12 Mar 2020 04:47:05 -0400 Subject: [PATCH 011/143] :rocket: Speed up git commands when auth is not needed. --- source/git.m | 41 +++++++++++++++++++++++++---------------- 1 file changed, 25 insertions(+), 16 deletions(-) diff --git a/source/git.m b/source/git.m index d41af8d..7c9514c 100644 --- a/source/git.m +++ b/source/git.m @@ -1,25 +1,34 @@ function [status, result] = git(parameterStr) %GIT Summary of this function goes here % Detailed explanation goes here -name = getRepoName(); -filename = [name 'CommandOutput']; -fid = fopen(filename , 'wt' ); -fclose(fid); - -[status, ~] = dos([which('RunCommand.bat') ' ' name ' git ' parameterStr ' &']); -% [status, result] = system(['pwsh -Command .\RunCommand.ps1 git ' parameterStr ' &']); -while(true) - fid = fopen(filename, 'rt' ); - contents = fscanf(fid, '%s\n'); +parametersList = split(parameterStr); +firstParameter = parametersList(1); +gitPlusParameters = ['git ' parameterStr]; +switch firstParameter +case 'checkout' +case 'rev-parse' +case '--help' +case 'merge-base' + [status, result] = system(gitPlusParameters); +otherwise + name = getRepoName(); + filename = [name 'CommandOutput']; + fid = fopen(filename , 'wt' ); fclose(fid); - if ~isempty(contents) - delete(filename) - break; + + [status, ~] = dos([which('RunCommand.bat') ' ' name ' ' gitPlusParameters ' &']); + while(true) + fid = fopen(filename, 'rt' ); + contents = fscanf(fid, '%s\n'); + fclose(fid); + if ~isempty(contents) + delete(filename) + break; + end + pause(0.2); end - pause(0.2); + result = contents; end -result = contents; -% fclose(fid); function name = getRepoName() [~, result] = system('git rev-parse --show-toplevel'); From 2b72923c6078915ca2fa81aa93e5d080af2dfa67 Mon Sep 17 00:00:00 2001 From: Daniel Kaminski de Souza Date: Thu, 12 Mar 2020 04:49:43 -0400 Subject: [PATCH 012/143] :bug: Fix status bug. --- source/git.m | 1 + 1 file changed, 1 insertion(+) diff --git a/source/git.m b/source/git.m index 7c9514c..893d23c 100644 --- a/source/git.m +++ b/source/git.m @@ -10,6 +10,7 @@ case '--help' case 'merge-base' [status, result] = system(gitPlusParameters); + status = ~status; otherwise name = getRepoName(); filename = [name 'CommandOutput']; From 33ea5a85e89e601a3aeefdbf5d98b897ab82a6f1 Mon Sep 17 00:00:00 2001 From: Daniel Kaminski de Souza Date: Thu, 12 Mar 2020 04:54:38 -0400 Subject: [PATCH 013/143] :bug: Fix status bug. --- source/git.m | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/git.m b/source/git.m index 893d23c..fc0c267 100644 --- a/source/git.m +++ b/source/git.m @@ -2,7 +2,7 @@ %GIT Summary of this function goes here % Detailed explanation goes here parametersList = split(parameterStr); -firstParameter = parametersList(1); +firstParameter = parametersList{1}; gitPlusParameters = ['git ' parameterStr]; switch firstParameter case 'checkout' From 26269f1edab2345d7de2c7cc6fdbdbe45dc59154 Mon Sep 17 00:00:00 2001 From: Daniel Kaminski de Souza Date: Thu, 12 Mar 2020 05:00:55 -0400 Subject: [PATCH 014/143] :bug: Fix pull bug. --- source/DepMatRepositoryUpdater.m | 1 + 1 file changed, 1 insertion(+) diff --git a/source/DepMatRepositoryUpdater.m b/source/DepMatRepositoryUpdater.m index 6b35d68..d8acda2 100644 --- a/source/DepMatRepositoryUpdater.m +++ b/source/DepMatRepositoryUpdater.m @@ -264,6 +264,7 @@ function setDispHandler(obj, funcHandle) end [pullResult, output] = git('pull'); + pullResult = ~pullResult; success = ~isempty(pullResult) && ~isequal(pullResult, 0); end From dfa9242bc529a639efb841d28734cbcd8b0bdccf Mon Sep 17 00:00:00 2001 From: Daniel Kaminski de Souza Date: Thu, 12 Mar 2020 05:11:39 -0400 Subject: [PATCH 015/143] :bug: Fix git bug. --- source/git.m | 40 ++++++++++++++++++++-------------------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/source/git.m b/source/git.m index fc0c267..924f3ac 100644 --- a/source/git.m +++ b/source/git.m @@ -5,31 +5,31 @@ firstParameter = parametersList{1}; gitPlusParameters = ['git ' parameterStr]; switch firstParameter -case 'checkout' -case 'rev-parse' -case '--help' -case 'merge-base' +case 'remote' +case 'pull' +case 'fetch' +otherwise [status, result] = system(gitPlusParameters); status = ~status; -otherwise - name = getRepoName(); - filename = [name 'CommandOutput']; - fid = fopen(filename , 'wt' ); - fclose(fid); + return; +end +name = getRepoName(); +filename = [name 'CommandOutput']; +fid = fopen(filename , 'wt' ); +fclose(fid); - [status, ~] = dos([which('RunCommand.bat') ' ' name ' ' gitPlusParameters ' &']); - while(true) - fid = fopen(filename, 'rt' ); - contents = fscanf(fid, '%s\n'); - fclose(fid); - if ~isempty(contents) - delete(filename) - break; - end - pause(0.2); +[status, ~] = dos([which('RunCommand.bat') ' ' name ' ' gitPlusParameters ' &']); +while(true) + fid = fopen(filename, 'rt' ); + contents = fscanf(fid, '%s\n'); + fclose(fid); + if ~isempty(contents) + delete(filename) + break; end - result = contents; + pause(0.2); end +result = contents; function name = getRepoName() [~, result] = system('git rev-parse --show-toplevel'); From 50448961431a587bcf47b46c72d2e36ec3359809 Mon Sep 17 00:00:00 2001 From: Daniel Kaminski de Souza Date: Thu, 12 Mar 2020 05:17:34 -0400 Subject: [PATCH 016/143] :bug: Fix git bug. --- source/git.m | 1 - 1 file changed, 1 deletion(-) diff --git a/source/git.m b/source/git.m index 924f3ac..9b199aa 100644 --- a/source/git.m +++ b/source/git.m @@ -10,7 +10,6 @@ case 'fetch' otherwise [status, result] = system(gitPlusParameters); - status = ~status; return; end name = getRepoName(); From 54aa2ec03bde7c1e07e902b1d371d5781a0ec8ab Mon Sep 17 00:00:00 2001 From: Daniel Kaminski de Souza Date: Fri, 13 Mar 2020 00:17:31 -0400 Subject: [PATCH 017/143] :bug: Attempt to fix recursive behavior. --- source/PackMan.m | 20 ++++++++++++++++++++ source/git.m | 2 +- source/installDeps.m | 2 +- 3 files changed, 22 insertions(+), 2 deletions(-) diff --git a/source/PackMan.m b/source/PackMan.m index 6fdd11b..e474369 100644 --- a/source/PackMan.m +++ b/source/PackMan.m @@ -288,6 +288,26 @@ function recurse( obj, alreadyInstalled, depth ) function pm = createDepPackMan( obj, dep ) depDir = fullfile(obj.depDirPath, dep.FolderName); pm = PackMan([], '', '', depDir); + + if (~strcmp(dep.Name,'PackMan')) + oldPath = path; + try + addpath(pm.genPath); + catch error + disp(error); + end + s = which('installDeps.m', '-ALL'); + pathIndexesContainintDepDir = contains(s, depDir); + if any(pathIndexesContainintDepDir) + installDepsPath = s{pathIndexesContainintDepDir}; + dpDirPth = fileparts(strrep(installDepsPath,depDir,'')); + getDepListFunction = fullfile(depDir, dpDirPth, 'getDepList.m'); + run(getDepListFunction); + pm = PackMan(ans, fullfile(fileparts(installDepsPath),'external') , '', depDir); + else + path(oldPath); + end + end end function saveToFile(obj) diff --git a/source/git.m b/source/git.m index 9b199aa..f9d0016 100644 --- a/source/git.m +++ b/source/git.m @@ -17,7 +17,7 @@ fid = fopen(filename , 'wt' ); fclose(fid); -[status, ~] = dos([which('RunCommand.bat') ' ' name ' ' gitPlusParameters ' &']); +[status, ~] = dos(['RunCommand.bat ' name ' ' gitPlusParameters ' &']); while(true) fid = fopen(filename, 'rt' ); contents = fscanf(fid, '%s\n'); diff --git a/source/installDeps.m b/source/installDeps.m index d785f75..06ff7a9 100644 --- a/source/installDeps.m +++ b/source/installDeps.m @@ -75,7 +75,7 @@ function installPackMan( depDirPath ) command = ['git clone ', repoUrl, ' "',packManDir,'"']; [status, cmdout] = system(command); if (~status), fprintf('%s', cmdout); end -catch ME +catch end From d95761637c39651874bb4b89d1af1c3fd4fb88af Mon Sep 17 00:00:00 2001 From: Daniel Kaminski de Souza Date: Fri, 13 Mar 2020 00:29:07 -0400 Subject: [PATCH 018/143] :bug: Fix RunCommand.bat --- source/git.m | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/git.m b/source/git.m index f9d0016..9b199aa 100644 --- a/source/git.m +++ b/source/git.m @@ -17,7 +17,7 @@ fid = fopen(filename , 'wt' ); fclose(fid); -[status, ~] = dos(['RunCommand.bat ' name ' ' gitPlusParameters ' &']); +[status, ~] = dos([which('RunCommand.bat') ' ' name ' ' gitPlusParameters ' &']); while(true) fid = fopen(filename, 'rt' ); contents = fscanf(fid, '%s\n'); From e6c9a548d898ff2ff9d689dcbf97586d99910291 Mon Sep 17 00:00:00 2001 From: Daniel Kaminski de Souza Date: Fri, 13 Mar 2020 01:50:35 -0400 Subject: [PATCH 019/143] :construction: Improve dependency management. --- source/PackMan.m | 29 +++++++++++++++-------------- 1 file changed, 15 insertions(+), 14 deletions(-) diff --git a/source/PackMan.m b/source/PackMan.m index e474369..2c08cc4 100644 --- a/source/PackMan.m +++ b/source/PackMan.m @@ -291,21 +291,22 @@ function recurse( obj, alreadyInstalled, depth ) if (~strcmp(dep.Name,'PackMan')) oldPath = path; - try + generatedPath = pm.genPath; + generatedPathWithoutLastSemicolon = generatedPath(1:end-1); + genPaths = split(generatedPathWithoutLastSemicolon, ';'); + if (all(cellfun(@exist, genPaths)== 7)) addpath(pm.genPath); - catch error - disp(error); - end - s = which('installDeps.m', '-ALL'); - pathIndexesContainintDepDir = contains(s, depDir); - if any(pathIndexesContainintDepDir) - installDepsPath = s{pathIndexesContainintDepDir}; - dpDirPth = fileparts(strrep(installDepsPath,depDir,'')); - getDepListFunction = fullfile(depDir, dpDirPth, 'getDepList.m'); - run(getDepListFunction); - pm = PackMan(ans, fullfile(fileparts(installDepsPath),'external') , '', depDir); - else - path(oldPath); + s = which('installDeps.m', '-ALL'); + pathIndexesContainintDepDir = contains(s, depDir); + if any(pathIndexesContainintDepDir) + installDepsPath = s{pathIndexesContainintDepDir}; + dpDirPth = fileparts(strrep(installDepsPath,depDir,'')); + getDepListFunction = fullfile(depDir, dpDirPth, 'getDepList.m'); + run(getDepListFunction); + pm = PackMan(ans, fullfile(fileparts(installDepsPath),'external') , '', depDir); + else + path(oldPath); + end end end end From 203b19e06039bb345c890046330aa12e3a7b8337 Mon Sep 17 00:00:00 2001 From: Daniel Kaminski de Souza Date: Fri, 13 Mar 2020 01:56:42 -0400 Subject: [PATCH 020/143] :art: Improve code quality. --- source/PackMan.m | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/source/PackMan.m b/source/PackMan.m index 2c08cc4..46ab05d 100644 --- a/source/PackMan.m +++ b/source/PackMan.m @@ -290,12 +290,13 @@ function recurse( obj, alreadyInstalled, depth ) pm = PackMan([], '', '', depDir); if (~strcmp(dep.Name,'PackMan')) - oldPath = path; generatedPath = pm.genPath; generatedPathWithoutLastSemicolon = generatedPath(1:end-1); genPaths = split(generatedPathWithoutLastSemicolon, ';'); if (all(cellfun(@exist, genPaths)== 7)) + oldPath = path; addpath(pm.genPath); + path(oldPath); s = which('installDeps.m', '-ALL'); pathIndexesContainintDepDir = contains(s, depDir); if any(pathIndexesContainintDepDir) @@ -304,8 +305,6 @@ function recurse( obj, alreadyInstalled, depth ) getDepListFunction = fullfile(depDir, dpDirPth, 'getDepList.m'); run(getDepListFunction); pm = PackMan(ans, fullfile(fileparts(installDepsPath),'external') , '', depDir); - else - path(oldPath); end end end From 99dca896fbf92bb560a0368d4cb3aa360efb20f6 Mon Sep 17 00:00:00 2001 From: Daniel Kaminski de Souza Date: Fri, 13 Mar 2020 02:12:09 -0400 Subject: [PATCH 021/143] :art: Improve code quality. --- source/PackMan.m | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/source/PackMan.m b/source/PackMan.m index 46ab05d..53bf581 100644 --- a/source/PackMan.m +++ b/source/PackMan.m @@ -290,13 +290,12 @@ function recurse( obj, alreadyInstalled, depth ) pm = PackMan([], '', '', depDir); if (~strcmp(dep.Name,'PackMan')) + oldPath = path; generatedPath = pm.genPath; generatedPathWithoutLastSemicolon = generatedPath(1:end-1); genPaths = split(generatedPathWithoutLastSemicolon, ';'); if (all(cellfun(@exist, genPaths)== 7)) - oldPath = path; - addpath(pm.genPath); - path(oldPath); + addpath(generatedPath); s = which('installDeps.m', '-ALL'); pathIndexesContainintDepDir = contains(s, depDir); if any(pathIndexesContainintDepDir) @@ -305,6 +304,8 @@ function recurse( obj, alreadyInstalled, depth ) getDepListFunction = fullfile(depDir, dpDirPth, 'getDepList.m'); run(getDepListFunction); pm = PackMan(ans, fullfile(fileparts(installDepsPath),'external') , '', depDir); + else + path(oldPath); end end end From c3fae7fe111f256b3b01772311c3d4a0d53ff71b Mon Sep 17 00:00:00 2001 From: Daniel Kaminski de Souza Date: Fri, 13 Mar 2020 02:17:10 -0400 Subject: [PATCH 022/143] Does not affect path back again. --- source/PackMan.m | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/source/PackMan.m b/source/PackMan.m index 53bf581..618136f 100644 --- a/source/PackMan.m +++ b/source/PackMan.m @@ -290,11 +290,11 @@ function recurse( obj, alreadyInstalled, depth ) pm = PackMan([], '', '', depDir); if (~strcmp(dep.Name,'PackMan')) - oldPath = path; generatedPath = pm.genPath; generatedPathWithoutLastSemicolon = generatedPath(1:end-1); genPaths = split(generatedPathWithoutLastSemicolon, ';'); if (all(cellfun(@exist, genPaths)== 7)) + oldPath = path; addpath(generatedPath); s = which('installDeps.m', '-ALL'); pathIndexesContainintDepDir = contains(s, depDir); @@ -304,9 +304,8 @@ function recurse( obj, alreadyInstalled, depth ) getDepListFunction = fullfile(depDir, dpDirPth, 'getDepList.m'); run(getDepListFunction); pm = PackMan(ans, fullfile(fileparts(installDepsPath),'external') , '', depDir); - else - path(oldPath); end + path(oldPath); end end end @@ -557,5 +556,4 @@ function setDispHandler(obj, funcHandle) if ind < length(str), strO = sprintf('%s%s', strO, str((ind+1):end)); end end end -end - +end \ No newline at end of file From 23441368eee5db7783eb900ac7e3a764a1e86b6f Mon Sep 17 00:00:00 2001 From: Daniel Kaminski de Souza Date: Fri, 13 Mar 2020 02:59:10 -0400 Subject: [PATCH 023/143] :rocket: Improve performance. --- source/PackMan.m | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/source/PackMan.m b/source/PackMan.m index 618136f..2712bde 100644 --- a/source/PackMan.m +++ b/source/PackMan.m @@ -116,10 +116,12 @@ function install(obj, alreadyInstalled, depth) if nargin < 2, alreadyInstalled = []; end if nargin < 3, depth = 0; end - for i = 1:length(obj.depList) - if i == 1 - obj.dispHandler(sprintf('Installing dependencies for %s...', obj.parentDir)); - end + depListLength = length(obj.depList); + if depListLength > 0 + obj.dispHandler(sprintf('Installing dependencies for %s...', obj.parentDir)); + end + + for i = 1:depListLength thisDep = obj.depList(i); if ~isempty(alreadyInstalled) && ( ... ismember(thisDep, alreadyInstalled) || ... From c3a8caaaf5b40842aa207af4addfb2f59a635fce Mon Sep 17 00:00:00 2001 From: Daniel Kaminski de Souza Date: Fri, 13 Mar 2020 21:29:18 -0400 Subject: [PATCH 024/143] :construction: Update installDeps.m --- source/installDeps.m | 140 ++++++++++++++++++++++++------------------- 1 file changed, 77 insertions(+), 63 deletions(-) diff --git a/source/installDeps.m b/source/installDeps.m index 06ff7a9..6816556 100644 --- a/source/installDeps.m +++ b/source/installDeps.m @@ -19,68 +19,82 @@ % % Then simply call this any time you want to install/update: % installDeps -function varargout = installDeps( depList, depSubDir, varargin ) +function varargout = installDeps() -% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -% Directory of dependencies -if nargin < 2 || isempty(depSubDir) - depSubDir = fullfile('.', 'external'); - depSubDir = getDepDirPath( depSubDir ); -end -installPackMan( depSubDir ); - -% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -% Get the list of dependencies -if nargin < 1 || isempty(depList) - depList = getDepList(); -end - -pm = PackMan(depList, depSubDir, varargin{:}); % Install other dependencies - -if nargout < 1 - pm.install(); -else - varargout{1} = pm; -end - -end - -function depDirPath = getDepDirPath( depSubDir ) -% Generates path to dependency directory based on the path of the current -% file -% Inputs: -% (1) depSubDir: relative path of the dependency directory -% Outputs: -% (1) full path of the dependency subdir - -thisFilePath = mfilename('fullpath'); -[thisFileDir, ~, ~] = fileparts(thisFilePath); -depDirPath = fullfile(thisFileDir, depSubDir); - -end - -function installPackMan( depDirPath ) -% Makes sure DepMat is available and in the path, so that PackMan can -% install other dependencies -% Inputs: -% (1) depDirPath: path to dependency directory -% Outputs: -% (none) -% Usage example: -% installPackMan( depDirPath ); - -packManDir = fullfile(depDirPath, 'PackMan'); -try - repoUrl = 'https://github.com/DanielAtKrypton/PackMan.git'; - command = ['git clone ', repoUrl, ' "',packManDir,'"']; - [status, cmdout] = system(command); - if (~status), fprintf('%s', cmdout); end -catch + % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + % Directory of dependencies + currentDirectory = pwd; + generatedPath = genpath(currentDirectory); + generatedPathWithoutLastSemicolon = generatedPath(1:end-1); + genPaths = split(generatedPathWithoutLastSemicolon, ';'); + nonGitPaths = genPaths(~startsWith(genPaths, fullfile(currentDirectory, '.git'))); + oldPath = path; + if (all(cellfun(@exist, nonGitPaths)== 7)) + addpath(generatedPath); + s = which('installDeps.m', '-ALL'); + if length(s) >= 1 + installDepsPath = s{1}; + depSubDir = fullfile(fileparts(installDepsPath),'external'); + installPackMan( depSubDir ); + dpDirPth = fileparts(installDepsPath); + getDepListFunction = fullfile(dpDirPth, 'getDepList.m'); + run(getDepListFunction); + depList = ans; + end + else + depSubDir = fullfile('.', 'external'); + depSubDir = getDepDirPath( depSubDir ); + installPackMan( depSubDir ); + end -end - -packManSourceDir = fullfile(packManDir,'source'); - -addpath(genpath(packManSourceDir)); - -end \ No newline at end of file + % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + % Get the list of dependencies + if isempty(depList) + depList = getDepList(); + end + + pm = PackMan(depList, depSubDir); % Install other dependencies + + if nargout < 1 + pm.install(); + else + varargout{1} = pm; + end + + path(oldPath); + + function depDirPath = getDepDirPath( depSubDir ) + % Generates path to dependency directory based on the path of the current + % file + % Inputs: + % (1) depSubDir: relative path of the dependency directory + % Outputs: + % (1) full path of the dependency subdir + + thisFilePath = mfilename('fullpath'); + [thisFileDir, ~, ~] = fileparts(thisFilePath); + depDirPath = fullfile(thisFileDir, depSubDir); + + function installPackMan( depDirPath ) + % Makes sure DepMat is available and in the path, so that PackMan can + % install other dependencies + % Inputs: + % (1) depDirPath: path to dependency directory + % Outputs: + % (none) + % Usage example: + % installPackMan( depDirPath ); + + packManDir = fullfile(depDirPath, 'PackMan'); + try + repoUrl = 'https://github.com/DanielAtKrypton/PackMan.git'; + command = ['git clone ', repoUrl, ' "',packManDir,'"']; + [status, cmdout] = system(command); + if (~status), fprintf('%s', cmdout); end + catch + + end + + packManSourceDir = fullfile(packManDir,'source'); + + addpath(genpath(packManSourceDir)); \ No newline at end of file From 54982f5599d0bb8b13dc8cc66ab3cf0b45447907 Mon Sep 17 00:00:00 2001 From: Daniel Kaminski de Souza Date: Tue, 17 Mar 2020 17:40:27 -0400 Subject: [PATCH 025/143] :bug: Fix git push. --- source/git.m | 1 + 1 file changed, 1 insertion(+) diff --git a/source/git.m b/source/git.m index 9b199aa..9d77c7e 100644 --- a/source/git.m +++ b/source/git.m @@ -8,6 +8,7 @@ case 'remote' case 'pull' case 'fetch' +case 'push' otherwise [status, result] = system(gitPlusParameters); return; From 2d0e0c0072795da9009d15ccbaac3ae6a51177a1 Mon Sep 17 00:00:00 2001 From: Daniel Kaminski de Souza Date: Tue, 17 Mar 2020 18:24:42 -0400 Subject: [PATCH 026/143] :heavy_plus_sign: Comma separated args should also work for git. --- source/git.m | 78 +++++++++++++++++++++++++++++----------------------- 1 file changed, 43 insertions(+), 35 deletions(-) diff --git a/source/git.m b/source/git.m index 9d77c7e..527891a 100644 --- a/source/git.m +++ b/source/git.m @@ -1,37 +1,45 @@ -function [status, result] = git(parameterStr) -%GIT Summary of this function goes here -% Detailed explanation goes here -parametersList = split(parameterStr); -firstParameter = parametersList{1}; -gitPlusParameters = ['git ' parameterStr]; -switch firstParameter -case 'remote' -case 'pull' -case 'fetch' -case 'push' -otherwise - [status, result] = system(gitPlusParameters); - return; -end -name = getRepoName(); -filename = [name 'CommandOutput']; -fid = fopen(filename , 'wt' ); -fclose(fid); - -[status, ~] = dos([which('RunCommand.bat') ' ' name ' ' gitPlusParameters ' &']); -while(true) - fid = fopen(filename, 'rt' ); - contents = fscanf(fid, '%s\n'); +function [status, result] = git(varargin) + %GIT Summary of this function goes here + % Detailed explanation goes here + if (nargin == 0) + ME = MException('Packman:gitError', ... + 'Not enough input args'); + throw(ME); + end + splitCells = cellfun(@split, varargin, 'UniformOutput', false); + parametersList = vertcat(splitCells{:}); + firstParameter = parametersList{1}; + gitPlusParametersList = [{'git'}, parametersList{:}]; + spaceSeparatedGitPlusParametersList = join(gitPlusParametersList, ' '); + commandString = spaceSeparatedGitPlusParametersList{1}; + switch firstParameter + case 'remote' + case 'pull' + case 'fetch' + case 'push' + otherwise + [status, result] = system(commandString); + return; + end + name = getRepoName(); + filename = [name 'CommandOutput']; + fid = fopen(filename , 'wt' ); fclose(fid); - if ~isempty(contents) - delete(filename) - break; + + [status, ~] = dos([which('RunCommand.bat') ' ' name ' ' gitPlusParameters ' &']); + while(true) + fid = fopen(filename, 'rt' ); + contents = fscanf(fid, '%s\n'); + fclose(fid); + if ~isempty(contents) + delete(filename) + break; + end + pause(0.2); end - pause(0.2); -end -result = contents; - -function name = getRepoName() -[~, result] = system('git rev-parse --show-toplevel'); -result = result(1:end-1); % remove newline. -[~,name,~] = fileparts(result); \ No newline at end of file + result = contents; + + function name = getRepoName() + [~, result] = system('git rev-parse --show-toplevel'); + result = result(1:end-1); % remove newline. + [~,name,~] = fileparts(result); \ No newline at end of file From 08324b8654c3778e3029745347dd7ecfe1de6a45 Mon Sep 17 00:00:00 2001 From: Daniel Kaminski de Souza Date: Tue, 17 Mar 2020 18:38:19 -0400 Subject: [PATCH 027/143] Revert. --- source/git.m | 78 +++++++++++++++++++++++----------------------------- 1 file changed, 35 insertions(+), 43 deletions(-) diff --git a/source/git.m b/source/git.m index 527891a..9d77c7e 100644 --- a/source/git.m +++ b/source/git.m @@ -1,45 +1,37 @@ -function [status, result] = git(varargin) - %GIT Summary of this function goes here - % Detailed explanation goes here - if (nargin == 0) - ME = MException('Packman:gitError', ... - 'Not enough input args'); - throw(ME); - end - splitCells = cellfun(@split, varargin, 'UniformOutput', false); - parametersList = vertcat(splitCells{:}); - firstParameter = parametersList{1}; - gitPlusParametersList = [{'git'}, parametersList{:}]; - spaceSeparatedGitPlusParametersList = join(gitPlusParametersList, ' '); - commandString = spaceSeparatedGitPlusParametersList{1}; - switch firstParameter - case 'remote' - case 'pull' - case 'fetch' - case 'push' - otherwise - [status, result] = system(commandString); - return; - end - name = getRepoName(); - filename = [name 'CommandOutput']; - fid = fopen(filename , 'wt' ); +function [status, result] = git(parameterStr) +%GIT Summary of this function goes here +% Detailed explanation goes here +parametersList = split(parameterStr); +firstParameter = parametersList{1}; +gitPlusParameters = ['git ' parameterStr]; +switch firstParameter +case 'remote' +case 'pull' +case 'fetch' +case 'push' +otherwise + [status, result] = system(gitPlusParameters); + return; +end +name = getRepoName(); +filename = [name 'CommandOutput']; +fid = fopen(filename , 'wt' ); +fclose(fid); + +[status, ~] = dos([which('RunCommand.bat') ' ' name ' ' gitPlusParameters ' &']); +while(true) + fid = fopen(filename, 'rt' ); + contents = fscanf(fid, '%s\n'); fclose(fid); - - [status, ~] = dos([which('RunCommand.bat') ' ' name ' ' gitPlusParameters ' &']); - while(true) - fid = fopen(filename, 'rt' ); - contents = fscanf(fid, '%s\n'); - fclose(fid); - if ~isempty(contents) - delete(filename) - break; - end - pause(0.2); + if ~isempty(contents) + delete(filename) + break; end - result = contents; - - function name = getRepoName() - [~, result] = system('git rev-parse --show-toplevel'); - result = result(1:end-1); % remove newline. - [~,name,~] = fileparts(result); \ No newline at end of file + pause(0.2); +end +result = contents; + +function name = getRepoName() +[~, result] = system('git rev-parse --show-toplevel'); +result = result(1:end-1); % remove newline. +[~,name,~] = fileparts(result); \ No newline at end of file From fcd5007a69390d2d3da714ff6fd763bb808c882e Mon Sep 17 00:00:00 2001 From: Daniel Kaminski de Souza Date: Tue, 17 Mar 2020 19:45:18 -0400 Subject: [PATCH 028/143] :heavy_plus_sign: Comma separated args should also work for git. --- source/git.m | 78 +++++++++++++++++++++++++++++----------------------- 1 file changed, 43 insertions(+), 35 deletions(-) diff --git a/source/git.m b/source/git.m index 9d77c7e..6baaa61 100644 --- a/source/git.m +++ b/source/git.m @@ -1,37 +1,45 @@ -function [status, result] = git(parameterStr) -%GIT Summary of this function goes here -% Detailed explanation goes here -parametersList = split(parameterStr); -firstParameter = parametersList{1}; -gitPlusParameters = ['git ' parameterStr]; -switch firstParameter -case 'remote' -case 'pull' -case 'fetch' -case 'push' -otherwise - [status, result] = system(gitPlusParameters); - return; -end -name = getRepoName(); -filename = [name 'CommandOutput']; -fid = fopen(filename , 'wt' ); -fclose(fid); - -[status, ~] = dos([which('RunCommand.bat') ' ' name ' ' gitPlusParameters ' &']); -while(true) - fid = fopen(filename, 'rt' ); - contents = fscanf(fid, '%s\n'); +function [status, result] = git(varargin) + %GIT Summary of this function goes here + % Detailed explanation goes here + if (nargin == 0) + ME = MException('Packman:gitError', ... + 'Not enough input args'); + throw(ME); + end + splitCells = cellfun(@split, varargin, 'UniformOutput', false); + parametersList = vertcat(splitCells{:}); + firstParameter = parametersList{1}; + gitPlusParametersList = [{'git'}, parametersList{:}]; + spaceSeparatedGitPlusParametersList = join(gitPlusParametersList, ' '); + commandString = spaceSeparatedGitPlusParametersList{1}; + switch firstParameter + case 'remote' + case 'pull' + case 'fetch' + case 'push' + otherwise + [status, result] = system(commandString); + return; + end + name = getRepoName(); + filename = [name 'CommandOutput']; + fid = fopen(filename , 'wt' ); fclose(fid); - if ~isempty(contents) - delete(filename) - break; + + [status, ~] = dos([which('RunCommand.bat') ' ' name ' ' commandString ' &']); + while(true) + fid = fopen(filename, 'rt' ); + contents = fscanf(fid, '%s\n'); + fclose(fid); + if ~isempty(contents) + delete(filename) + break; + end + pause(0.2); end - pause(0.2); -end -result = contents; - -function name = getRepoName() -[~, result] = system('git rev-parse --show-toplevel'); -result = result(1:end-1); % remove newline. -[~,name,~] = fileparts(result); \ No newline at end of file + result = contents; + + function name = getRepoName() + [~, result] = system('git rev-parse --show-toplevel'); + result = result(1:end-1); % remove newline. + [~,name,~] = fileparts(result); \ No newline at end of file From d97c5f297417cdd43f75bf7724fbb4cf2684fced Mon Sep 17 00:00:00 2001 From: Daniel Kaminski de Souza Date: Tue, 17 Mar 2020 21:56:45 -0400 Subject: [PATCH 029/143] :construction: Development path. --- source/DepMatAddPaths.m | 2 +- source/PackMan.m | 10 +++++----- source/genNonGitPath.m | 11 +++++++++++ source/installDeps.m | 8 +++----- 4 files changed, 20 insertions(+), 11 deletions(-) create mode 100644 source/genNonGitPath.m diff --git a/source/DepMatAddPaths.m b/source/DepMatAddPaths.m index f6be447..42c1953 100644 --- a/source/DepMatAddPaths.m +++ b/source/DepMatAddPaths.m @@ -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) diff --git a/source/PackMan.m b/source/PackMan.m index 2712bde..72afa68 100644 --- a/source/PackMan.m +++ b/source/PackMan.m @@ -206,7 +206,7 @@ function recurse( obj, alreadyInstalled, depth ) if nargin < 2, alreadyAdded = []; end if nargin < 3, selfPaths = true; end - paths = []; + paths = {}; if selfPaths % Add subpaths of this package paths = [paths, obj.getSelfPaths()]; @@ -243,7 +243,7 @@ function recurse( obj, alreadyInstalled, depth ) if nargin < 2, alreadyAdded = []; end nowAdded = []; - paths = ''; + paths = {}; for di = 1:length( obj.depList ) thisDep = obj.depList(di); % obj.dispHandler(sprintf('Considering dep %s (%s)', thisDep.Name, thisDep.Commit)); @@ -274,7 +274,7 @@ function recurse( obj, alreadyInstalled, depth ) end function paths = getSelfPaths(obj) - paths = []; + paths = {}; % Add subpaths of this package files = dir(obj.parentDir); files(~[files.isdir]) = []; @@ -282,9 +282,9 @@ function recurse( obj, alreadyInstalled, depth ) for fi = 1:length(files) subDirPath = fullfile(files(fi).folder, files(fi).name); if strcmp(subDirPath, obj.depDirPath), continue; end - paths = [paths, genpath(subDirPath)]; + paths = [paths, genNonGitPath(subDirPath)]; end - paths = [paths, obj.parentDir, ';']; + paths = [paths, obj.parentDir]; end function pm = createDepPackMan( obj, dep ) diff --git a/source/genNonGitPath.m b/source/genNonGitPath.m new file mode 100644 index 0000000..16708a6 --- /dev/null +++ b/source/genNonGitPath.m @@ -0,0 +1,11 @@ +function pathList = genNonGitPath(folderName) + %genPath - Description + % + % Syntax: output = genPath(input) + % + % Long description + + paths = genpath(folderName); + pathList = split(paths, ';'); + pathList = rmmissing(pathList); + pathList = pathList(~contains(pathList, '\.git')); \ No newline at end of file diff --git a/source/installDeps.m b/source/installDeps.m index 6816556..c847100 100644 --- a/source/installDeps.m +++ b/source/installDeps.m @@ -24,10 +24,7 @@ % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % Directory of dependencies currentDirectory = pwd; - generatedPath = genpath(currentDirectory); - generatedPathWithoutLastSemicolon = generatedPath(1:end-1); - genPaths = split(generatedPathWithoutLastSemicolon, ';'); - nonGitPaths = genPaths(~startsWith(genPaths, fullfile(currentDirectory, '.git'))); + nonGitPaths = genNonGitPath(currentDirectory); oldPath = path; if (all(cellfun(@exist, nonGitPaths)== 7)) addpath(generatedPath); @@ -97,4 +94,5 @@ function installPackMan( depDirPath ) packManSourceDir = fullfile(packManDir,'source'); - addpath(genpath(packManSourceDir)); \ No newline at end of file + nonGitPaths = genNonGitPath(packManSourceDir); + addpath(nonGitPaths{:}); \ No newline at end of file From 2ad117a78be16d0d7b0c5512b25d0addd24d1955 Mon Sep 17 00:00:00 2001 From: Daniel Kaminski de Souza Date: Tue, 17 Mar 2020 22:04:41 -0400 Subject: [PATCH 030/143] :arrow_up: Update installDeps.m --- source/installDeps.m | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/source/installDeps.m b/source/installDeps.m index c847100..f0c4c16 100644 --- a/source/installDeps.m +++ b/source/installDeps.m @@ -23,11 +23,15 @@ % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % Directory of dependencies - currentDirectory = pwd; - nonGitPaths = genNonGitPath(currentDirectory); + folderName = pwd; + paths = genpath(folderName); + pathList = split(paths, ';'); + pathList = rmmissing(pathList); + nonGitPaths = pathList(~contains(pathList, '\.git')); + oldPath = path; if (all(cellfun(@exist, nonGitPaths)== 7)) - addpath(generatedPath); + addpath(nonGitPaths{:}); s = which('installDeps.m', '-ALL'); if length(s) >= 1 installDepsPath = s{1}; @@ -94,5 +98,4 @@ function installPackMan( depDirPath ) packManSourceDir = fullfile(packManDir,'source'); - nonGitPaths = genNonGitPath(packManSourceDir); - addpath(nonGitPaths{:}); \ No newline at end of file + addpath(genpath(packManSourceDir)); \ No newline at end of file From ea436c2021ed09033c88b12500044f9bcb05234c Mon Sep 17 00:00:00 2001 From: Daniel Kaminski de Souza Date: Tue, 17 Mar 2020 22:07:48 -0400 Subject: [PATCH 031/143] :arrow_up: Update installDeps.m --- source/installDeps.m | 3 --- 1 file changed, 3 deletions(-) diff --git a/source/installDeps.m b/source/installDeps.m index f0c4c16..063dac1 100644 --- a/source/installDeps.m +++ b/source/installDeps.m @@ -29,7 +29,6 @@ pathList = rmmissing(pathList); nonGitPaths = pathList(~contains(pathList, '\.git')); - oldPath = path; if (all(cellfun(@exist, nonGitPaths)== 7)) addpath(nonGitPaths{:}); s = which('installDeps.m', '-ALL'); @@ -62,8 +61,6 @@ varargout{1} = pm; end - path(oldPath); - function depDirPath = getDepDirPath( depSubDir ) % Generates path to dependency directory based on the path of the current % file From f2b1e95b55dcdc2408cb065414e6bb51eb743308 Mon Sep 17 00:00:00 2001 From: Daniel Kaminski de Souza Date: Tue, 17 Mar 2020 22:16:04 -0400 Subject: [PATCH 032/143] :construction: Development path. --- source/PackMan.m | 6 +++--- source/installDeps.m | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/source/PackMan.m b/source/PackMan.m index 72afa68..86955dc 100644 --- a/source/PackMan.m +++ b/source/PackMan.m @@ -203,7 +203,7 @@ function recurse( obj, alreadyInstalled, depth ) % pm.install(); % paths = pm.genPath(); % addpath(paths); - if nargin < 2, alreadyAdded = []; end + if nargin < 2, alreadyAdded = {}; end if nargin < 3, selfPaths = true; end paths = {}; @@ -240,9 +240,9 @@ function recurse( obj, alreadyInstalled, depth ) % Usage sample: % pm.getDepSelfPaths(); - if nargin < 2, alreadyAdded = []; end + if nargin < 2, alreadyAdded = {}; end - nowAdded = []; + nowAdded = {}; paths = {}; for di = 1:length( obj.depList ) thisDep = obj.depList(di); diff --git a/source/installDeps.m b/source/installDeps.m index 063dac1..114106c 100644 --- a/source/installDeps.m +++ b/source/installDeps.m @@ -12,7 +12,7 @@ % used to manually install deps by calling: % pm.install(); % It can also be used for adding dep paths to path by calling -% addpath(pm.genPath()) +% addpath(pm.genPath{:}) % % Usage example: % % Modify getDepList.m to return the list of all dependencies. From 630654a763bbcb6deeaf0ca0beed1d2d633bc092 Mon Sep 17 00:00:00 2001 From: Daniel Kaminski de Souza Date: Tue, 17 Mar 2020 22:29:45 -0400 Subject: [PATCH 033/143] :construction: Development path. --- source/installDeps.m | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/installDeps.m b/source/installDeps.m index 114106c..a5436e8 100644 --- a/source/installDeps.m +++ b/source/installDeps.m @@ -86,7 +86,7 @@ function installPackMan( depDirPath ) packManDir = fullfile(depDirPath, 'PackMan'); try repoUrl = 'https://github.com/DanielAtKrypton/PackMan.git'; - command = ['git clone ', repoUrl, ' "',packManDir,'"']; + command = ['git clone --single-branch --branch dev01', repoUrl, ' "',packManDir,'"']; [status, cmdout] = system(command); if (~status), fprintf('%s', cmdout); end catch From 27af37a0ea1c412aab9273fb9d24ceb9363ebc2d Mon Sep 17 00:00:00 2001 From: Daniel Kaminski de Souza Date: Tue, 17 Mar 2020 22:31:22 -0400 Subject: [PATCH 034/143] :construction: Development path. --- source/installDeps.m | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/installDeps.m b/source/installDeps.m index a5436e8..3777779 100644 --- a/source/installDeps.m +++ b/source/installDeps.m @@ -86,7 +86,7 @@ function installPackMan( depDirPath ) packManDir = fullfile(depDirPath, 'PackMan'); try repoUrl = 'https://github.com/DanielAtKrypton/PackMan.git'; - command = ['git clone --single-branch --branch dev01', repoUrl, ' "',packManDir,'"']; + command = ['git clone --single-branch --branch dev01 ', repoUrl, ' "',packManDir,'"']; [status, cmdout] = system(command); if (~status), fprintf('%s', cmdout); end catch From 5e5b5af68463160436ef0d91b7e74a385ef3f0cf Mon Sep 17 00:00:00 2001 From: Daniel Kaminski de Souza Date: Tue, 17 Mar 2020 22:34:38 -0400 Subject: [PATCH 035/143] :bug: Fix createDepPackMan. --- source/PackMan.m | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/PackMan.m b/source/PackMan.m index 86955dc..1c12a5b 100644 --- a/source/PackMan.m +++ b/source/PackMan.m @@ -297,7 +297,7 @@ function recurse( obj, alreadyInstalled, depth ) genPaths = split(generatedPathWithoutLastSemicolon, ';'); if (all(cellfun(@exist, genPaths)== 7)) oldPath = path; - addpath(generatedPath); + addpath(generatedPath{:}); s = which('installDeps.m', '-ALL'); pathIndexesContainintDepDir = contains(s, depDir); if any(pathIndexesContainintDepDir) From f8445fe7270b02eab1309bb01a1e2cfb5459f055 Mon Sep 17 00:00:00 2001 From: Daniel Kaminski de Souza Date: Tue, 17 Mar 2020 22:37:46 -0400 Subject: [PATCH 036/143] :bug: Fix getSelfPaths. --- source/PackMan.m | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/PackMan.m b/source/PackMan.m index 1c12a5b..e0b4289 100644 --- a/source/PackMan.m +++ b/source/PackMan.m @@ -284,7 +284,7 @@ function recurse( obj, alreadyInstalled, depth ) if strcmp(subDirPath, obj.depDirPath), continue; end paths = [paths, genNonGitPath(subDirPath)]; end - paths = [paths, obj.parentDir]; + paths = [{obj.parentDir}; paths]; end function pm = createDepPackMan( obj, dep ) From c68e1975eee6d09bc2e624ec43b7132c0b21b29b Mon Sep 17 00:00:00 2001 From: Daniel Kaminski de Souza Date: Tue, 17 Mar 2020 22:42:36 -0400 Subject: [PATCH 037/143] :bug: Fix getSelfPaths. --- source/PackMan.m | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/source/PackMan.m b/source/PackMan.m index e0b4289..75f64c3 100644 --- a/source/PackMan.m +++ b/source/PackMan.m @@ -209,7 +209,7 @@ function recurse( obj, alreadyInstalled, depth ) paths = {}; if selfPaths % Add subpaths of this package - paths = [paths, obj.getSelfPaths()]; + paths = [paths; obj.getSelfPaths()]; end % Add parent paths of deps [depSelfPaths, alreadyAdded, nowAdded ] = obj.getDepSelfPaths( alreadyAdded ); @@ -219,7 +219,7 @@ function recurse( obj, alreadyInstalled, depth ) thisDep = nowAdded(di); pm = obj.createDepPackMan( thisDep ); [depPaths, alreadyAdded] = pm.genPath( alreadyAdded, false ); - paths = [paths, depPaths]; + paths = [paths; depPaths]; end if nargout > 1, varargout{1} = alreadyAdded; end @@ -263,7 +263,7 @@ function recurse( obj, alreadyInstalled, depth ) alreadyAdded = cat(1, alreadyAdded, thisDep); nowAdded = cat(1, nowAdded, thisDep); depPaths = pm.getSelfPaths(); - paths = [paths, depPaths]; + paths = [paths; depPaths]; else warning('PackMan:genpath:versionConflict', 'Two different versions of %s were listed as dependencies! Aborted adding of the following version to the path: (%s, located in "%s")!\n', thisDep.Url, thisDep.getVersionStr(), pm.parentDir); end @@ -282,7 +282,7 @@ function recurse( obj, alreadyInstalled, depth ) for fi = 1:length(files) subDirPath = fullfile(files(fi).folder, files(fi).name); if strcmp(subDirPath, obj.depDirPath), continue; end - paths = [paths, genNonGitPath(subDirPath)]; + paths = [paths; genNonGitPath(subDirPath)]; end paths = [{obj.parentDir}; paths]; end From 75d32a9a336742d4efcc2ffac405a45b42d82be8 Mon Sep 17 00:00:00 2001 From: Daniel Kaminski de Souza Date: Tue, 17 Mar 2020 22:44:44 -0400 Subject: [PATCH 038/143] :bug: Fix getSelfPaths. --- source/PackMan.m | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/PackMan.m b/source/PackMan.m index 75f64c3..f0ad31b 100644 --- a/source/PackMan.m +++ b/source/PackMan.m @@ -213,7 +213,7 @@ function recurse( obj, alreadyInstalled, depth ) end % Add parent paths of deps [depSelfPaths, alreadyAdded, nowAdded ] = obj.getDepSelfPaths( alreadyAdded ); - paths = [paths, depSelfPaths]; + paths = [paths; depSelfPaths]; % Recurse to deps of the added deps for di = 1:length(nowAdded) thisDep = nowAdded(di); From c7cdd6afd22a5854282b82c5662a99040e71934b Mon Sep 17 00:00:00 2001 From: Daniel Kaminski de Souza Date: Tue, 17 Mar 2020 22:57:25 -0400 Subject: [PATCH 039/143] :bug: Fix installDeps. --- source/installDeps.m | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/source/installDeps.m b/source/installDeps.m index 3777779..6656b88 100644 --- a/source/installDeps.m +++ b/source/installDeps.m @@ -73,7 +73,7 @@ [thisFileDir, ~, ~] = fileparts(thisFilePath); depDirPath = fullfile(thisFileDir, depSubDir); - function installPackMan( depDirPath ) + function installPackMan( depDirPath, depList ) % Makes sure DepMat is available and in the path, so that PackMan can % install other dependencies % Inputs: @@ -83,10 +83,11 @@ function installPackMan( depDirPath ) % Usage example: % installPackMan( depDirPath ); - packManDir = fullfile(depDirPath, 'PackMan'); + packageManagerName = 'PackMan'; + packManDir = fullfile(depDirPath, packageManagerName); + packageManagerDep = depList(strcmp({depList.Name}, packageManagerName)); try - repoUrl = 'https://github.com/DanielAtKrypton/PackMan.git'; - command = ['git clone --single-branch --branch dev01 ', repoUrl, ' "',packManDir,'"']; + command = ['git clone --single-branch --branch ', packageManagerDep.Branch,' ', packageManagerDep.Url, ' "',packManDir,'"']; [status, cmdout] = system(command); if (~status), fprintf('%s', cmdout); end catch From 3010bf6ad39d0c385406c6163d9ce148a31d29cb Mon Sep 17 00:00:00 2001 From: Daniel Kaminski de Souza Date: Tue, 17 Mar 2020 22:58:59 -0400 Subject: [PATCH 040/143] :bug: Fix installDeps. --- source/installDeps.m | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/source/installDeps.m b/source/installDeps.m index 6656b88..e18738f 100644 --- a/source/installDeps.m +++ b/source/installDeps.m @@ -34,12 +34,13 @@ s = which('installDeps.m', '-ALL'); if length(s) >= 1 installDepsPath = s{1}; - depSubDir = fullfile(fileparts(installDepsPath),'external'); - installPackMan( depSubDir ); dpDirPth = fileparts(installDepsPath); getDepListFunction = fullfile(dpDirPth, 'getDepList.m'); run(getDepListFunction); depList = ans; + + depSubDir = fullfile(fileparts(installDepsPath),'external'); + installPackMan( depSubDir, depList ); end else depSubDir = fullfile('.', 'external'); From 9f874daf04c401f410286dd1ba98febe9b69b0ad Mon Sep 17 00:00:00 2001 From: Daniel Kaminski de Souza Date: Tue, 17 Mar 2020 23:39:29 -0400 Subject: [PATCH 041/143] :bug: Fix installDeps. --- source/getDepList.m | 13 +++++++------ source/installDeps.m | 1 + 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/source/getDepList.m b/source/getDepList.m index 11bfb18..28229b6 100644 --- a/source/getDepList.m +++ b/source/getDepList.m @@ -4,10 +4,11 @@ function depList = getDepList -depList = []; +depList = {} % Arguments for DepMatRepo: DepMatRepo(Name, Branch, Url, FolderName, Commit, GetLatest) -% Example: -% depList = DepMatRepo('PackMan', 'master', 'https://github.com/DanielAtKrypton/PackMan.git', 'PackMan', '', true); -% depList(end+1, 1) = DepMatRepo('depmat', 'master', 'https://github.com/OmidS/depmat.git', 'subid', '', true); - -end \ No newline at end of file +% Example: +% depList = {... +% {'PackMan', 'dev01', 'https://github.com/DanielAtKrypton/PackMan.git', 'PackMan', '', true}; +% {'DataHash', 'master', 'https://github.com/DanielAtKrypton/DataHash.git', 'DataHash', '', true}; +% }; +% depList = cell2struct(depList, {'Name', 'Branch', 'Url', 'FolderName', 'Commit', 'GetLatest'}, 2); \ No newline at end of file diff --git a/source/installDeps.m b/source/installDeps.m index e18738f..4379413 100644 --- a/source/installDeps.m +++ b/source/installDeps.m @@ -88,6 +88,7 @@ function installPackMan( depDirPath, depList ) packManDir = fullfile(depDirPath, packageManagerName); packageManagerDep = depList(strcmp({depList.Name}, packageManagerName)); try +% Name, Branch, Url, FolderName, Commit, GetLatest command = ['git clone --single-branch --branch ', packageManagerDep.Branch,' ', packageManagerDep.Url, ' "',packManDir,'"']; [status, cmdout] = system(command); if (~status), fprintf('%s', cmdout); end From 7c9d59c6b5726fc649698caf009a70938845a62b Mon Sep 17 00:00:00 2001 From: Daniel Kaminski de Souza Date: Wed, 18 Mar 2020 00:30:54 -0400 Subject: [PATCH 042/143] :construction: Development path. --- source/PackMan.m | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/source/PackMan.m b/source/PackMan.m index f0ad31b..b26230b 100644 --- a/source/PackMan.m +++ b/source/PackMan.m @@ -30,7 +30,21 @@ if nargin < 4 || isempty(parDir), parDir = pwd; end obj.parentDir = parDir; - if nargin < 1 || isempty(depList), depList = DepMat.empty; end + if nargin < 1 || isempty(depList) + depList = DepMat.empty; + else + depListLenght = length(depList); + f_names = fieldnames(depList); + f_namesLength = length(f_names); + + constructorParams = cell(depListLenght, f_namesLength); + depObjList = repmat(DepMatRepo(),1,depListLenght); + for i = 1:depListLenght + constructorParams(:, i) = cellfun(@(x)(depList(i).(x)),f_names,'UniformOutput',false); + depObjList(i) = DepMatRepo(constructorParams{:,i}); + end + depList = depObjList; + end if nargin < 2 || isempty(depDirPath), depDirPath = fullfile(obj.parentDir, '/external'); end if nargin < 3 || isempty(packageFilePath) if exist('jsonencode', 'builtin') @@ -305,6 +319,7 @@ function recurse( obj, alreadyInstalled, depth ) dpDirPth = fileparts(strrep(installDepsPath,depDir,'')); getDepListFunction = fullfile(depDir, dpDirPth, 'getDepList.m'); run(getDepListFunction); + structureArray = ans; pm = PackMan(ans, fullfile(fileparts(installDepsPath),'external') , '', depDir); end path(oldPath); From 661ba022eb50ef7515e3ad102d29c1a67f0fe79f Mon Sep 17 00:00:00 2001 From: Daniel Kaminski de Souza Date: Wed, 18 Mar 2020 00:41:07 -0400 Subject: [PATCH 043/143] :construction: Development path. --- source/genNonGitPath.m | 20 +++--- source/installDeps.m | 157 ++++++++++++++++++++++------------------- 2 files changed, 93 insertions(+), 84 deletions(-) diff --git a/source/genNonGitPath.m b/source/genNonGitPath.m index 16708a6..8105979 100644 --- a/source/genNonGitPath.m +++ b/source/genNonGitPath.m @@ -1,11 +1,11 @@ function pathList = genNonGitPath(folderName) - %genPath - Description - % - % Syntax: output = genPath(input) - % - % Long description - - paths = genpath(folderName); - pathList = split(paths, ';'); - pathList = rmmissing(pathList); - pathList = pathList(~contains(pathList, '\.git')); \ No newline at end of file +%genPath - Description +% +% Syntax: output = genPath(input) +% +% Long description + +paths = genpath(folderName); +pathList = split(paths, ';'); +pathList = rmmissing(pathList); +pathList = pathList(~contains(pathList, '\.git')); \ No newline at end of file diff --git a/source/installDeps.m b/source/installDeps.m index 4379413..02b669c 100644 --- a/source/installDeps.m +++ b/source/installDeps.m @@ -21,81 +21,90 @@ function varargout = installDeps() - % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - % Directory of dependencies - folderName = pwd; - paths = genpath(folderName); - pathList = split(paths, ';'); - pathList = rmmissing(pathList); - nonGitPaths = pathList(~contains(pathList, '\.git')); - - if (all(cellfun(@exist, nonGitPaths)== 7)) - addpath(nonGitPaths{:}); - s = which('installDeps.m', '-ALL'); - if length(s) >= 1 - installDepsPath = s{1}; - dpDirPth = fileparts(installDepsPath); - getDepListFunction = fullfile(dpDirPth, 'getDepList.m'); - run(getDepListFunction); - depList = ans; - - depSubDir = fullfile(fileparts(installDepsPath),'external'); - installPackMan( depSubDir, depList ); - end - else - depSubDir = fullfile('.', 'external'); - depSubDir = getDepDirPath( depSubDir ); - installPackMan( depSubDir ); - end - - % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - % Get the list of dependencies - if isempty(depList) - depList = getDepList(); - end - - pm = PackMan(depList, depSubDir); % Install other dependencies - - if nargout < 1 - pm.install(); - else - varargout{1} = pm; - end - - function depDirPath = getDepDirPath( depSubDir ) - % Generates path to dependency directory based on the path of the current - % file - % Inputs: - % (1) depSubDir: relative path of the dependency directory - % Outputs: - % (1) full path of the dependency subdir - - thisFilePath = mfilename('fullpath'); - [thisFileDir, ~, ~] = fileparts(thisFilePath); - depDirPath = fullfile(thisFileDir, depSubDir); - - function installPackMan( depDirPath, depList ) - % Makes sure DepMat is available and in the path, so that PackMan can - % install other dependencies - % Inputs: - % (1) depDirPath: path to dependency directory - % Outputs: - % (none) - % Usage example: - % installPackMan( depDirPath ); - - packageManagerName = 'PackMan'; - packManDir = fullfile(depDirPath, packageManagerName); - packageManagerDep = depList(strcmp({depList.Name}, packageManagerName)); - try -% Name, Branch, Url, FolderName, Commit, GetLatest - command = ['git clone --single-branch --branch ', packageManagerDep.Branch,' ', packageManagerDep.Url, ' "',packManDir,'"']; - [status, cmdout] = system(command); - if (~status), fprintf('%s', cmdout); end - catch +% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% Directory of dependencies +folderName = pwd; +nonGitPaths = genNonGitPath(folderName); + +if (all(cellfun(@exist, nonGitPaths)== 7)) + addpath(nonGitPaths{:}); + s = which('installDeps.m', '-ALL'); + if length(s) >= 1 + installDepsPath = s{1}; + dpDirPth = fileparts(installDepsPath); + getDepListFunction = fullfile(dpDirPth, 'getDepList.m'); + run(getDepListFunction); + depList = ans; + depSubDir = fullfile(fileparts(installDepsPath),'external'); + installPackMan( depSubDir, depList ); end +else + depSubDir = fullfile('.', 'external'); + depSubDir = getDepDirPath( depSubDir ); + installPackMan( depSubDir ); +end + +% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% Get the list of dependencies +if isempty(depList) + depList = getDepList(); +end + +pm = PackMan(depList, depSubDir); % Install other dependencies + +if nargout < 1 + pm.install(); +else + varargout{1} = pm; +end + +function depDirPath = getDepDirPath( depSubDir ) +% Generates path to dependency directory based on the path of the current +% file +% Inputs: +% (1) depSubDir: relative path of the dependency directory +% Outputs: +% (1) full path of the dependency subdir + +thisFilePath = mfilename('fullpath'); +[thisFileDir, ~, ~] = fileparts(thisFilePath); +depDirPath = fullfile(thisFileDir, depSubDir); + +function installPackMan( depDirPath, depList ) +% Makes sure DepMat is available and in the path, so that PackMan can +% install other dependencies +% Inputs: +% (1) depDirPath: path to dependency directory +% Outputs: +% (none) +% Usage example: +% installPackMan( depDirPath ); + +packageManagerName = 'PackMan'; +packManDir = fullfile(depDirPath, packageManagerName); +packageManagerDep = depList(strcmp({depList.Name}, packageManagerName)); +try +% Name, Branch, Url, FolderName, Commit, GetLatest + command = ['git clone --single-branch --branch ', packageManagerDep.Branch,' ', packageManagerDep.Url, ' "',packManDir,'"']; + [status, cmdout] = system(command); + if (~status), fprintf('%s', cmdout); end +catch - packManSourceDir = fullfile(packManDir,'source'); +end + +packManSourceDir = fullfile(packManDir,'source'); +packManPath = genNonGitPath(packManSourceDir); +addpath(packManPath{:}); + +function pathList = genNonGitPath(folderName) +%genPath - Description +% +% Syntax: output = genPath(input) +% +% Long description - addpath(genpath(packManSourceDir)); \ No newline at end of file +paths = genpath(folderName); +pathList = split(paths, ';'); +pathList = rmmissing(pathList); +pathList = pathList(~contains(pathList, '\.git')); \ No newline at end of file From 37bdaca891b95b0d2e49b532d803ba9d6256d8cd Mon Sep 17 00:00:00 2001 From: Daniel Kaminski de Souza Date: Wed, 18 Mar 2020 01:06:39 -0400 Subject: [PATCH 044/143] :construction: Development path. --- source/DepMatAddPaths.m | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/DepMatAddPaths.m b/source/DepMatAddPaths.m index 42c1953..1eba46a 100644 --- a/source/DepMatAddPaths.m +++ b/source/DepMatAddPaths.m @@ -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 From 761f11da80de5b726d74c3f46a9cff3be83193e6 Mon Sep 17 00:00:00 2001 From: Daniel Kaminski de Souza Date: Wed, 18 Mar 2020 02:22:24 -0400 Subject: [PATCH 045/143] :construction: Development path. --- .gitignore | 2 + package.json | 5 - source/PackMan.m | 2 +- source/getDepList.m | 7 +- source/installDeps.m | 26 +-- source/tests/testPackMan.m | 319 ++++++++++++++++++++----------------- 6 files changed, 192 insertions(+), 169 deletions(-) delete mode 100644 package.json diff --git a/.gitignore b/.gitignore index 2c3de20..f55bc30 100644 --- a/.gitignore +++ b/.gitignore @@ -32,3 +32,5 @@ slprj/ # Session info octave-workspace + +package.json \ No newline at end of file diff --git a/package.json b/package.json deleted file mode 100644 index 8a21d80..0000000 --- a/package.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "dependencies":{ - - } -} \ No newline at end of file diff --git a/source/PackMan.m b/source/PackMan.m index b26230b..ea0aca8 100644 --- a/source/PackMan.m +++ b/source/PackMan.m @@ -37,7 +37,7 @@ f_names = fieldnames(depList); f_namesLength = length(f_names); - constructorParams = cell(depListLenght, f_namesLength); + constructorParams = cell(f_namesLength, depListLenght); depObjList = repmat(DepMatRepo(),1,depListLenght); for i = 1:depListLenght constructorParams(:, i) = cellfun(@(x)(depList(i).(x)),f_names,'UniformOutput',false); diff --git a/source/getDepList.m b/source/getDepList.m index 28229b6..3535f26 100644 --- a/source/getDepList.m +++ b/source/getDepList.m @@ -4,11 +4,12 @@ function depList = getDepList -depList = {} +depList = {'PackMan', 'dev01', 'https://github.com/DanielAtKrypton/PackMan.git', 'PackMan', '', true}; +depList = cell2struct(depList, {'Name', 'Branch', 'Url', 'FolderName', 'Commit', 'GetLatest'}, 2); % Arguments for DepMatRepo: DepMatRepo(Name, Branch, Url, FolderName, Commit, GetLatest) % Example: -% depList = {... +% depList = [... % {'PackMan', 'dev01', 'https://github.com/DanielAtKrypton/PackMan.git', 'PackMan', '', true}; % {'DataHash', 'master', 'https://github.com/DanielAtKrypton/DataHash.git', 'DataHash', '', true}; -% }; +% ]; % depList = cell2struct(depList, {'Name', 'Branch', 'Url', 'FolderName', 'Commit', 'GetLatest'}, 2); \ No newline at end of file diff --git a/source/installDeps.m b/source/installDeps.m index 02b669c..e1bc617 100644 --- a/source/installDeps.m +++ b/source/installDeps.m @@ -19,10 +19,9 @@ % % Then simply call this any time you want to install/update: % installDeps -function varargout = installDeps() - +function varargout = installDeps(varargin) % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -% Directory of dependencies +% Get the list of dependencies folderName = pwd; nonGitPaths = genNonGitPath(folderName); @@ -35,20 +34,23 @@ getDepListFunction = fullfile(dpDirPth, 'getDepList.m'); run(getDepListFunction); depList = ans; - + depSubDir = fullfile(fileparts(installDepsPath),'external'); + + if nargin ~= 0 + depList = varargin{1}; + end + installPackMan( depSubDir, depList ); end -else - depSubDir = fullfile('.', 'external'); - depSubDir = getDepDirPath( depSubDir ); - installPackMan( depSubDir ); +else + error('Unexistent path found!'); end -% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -% Get the list of dependencies -if isempty(depList) - depList = getDepList(); +if nargin ~= 0 + depList = varargin{1}; +else + end pm = PackMan(depList, depSubDir); % Install other dependencies diff --git a/source/tests/testPackMan.m b/source/tests/testPackMan.m index 87167db..ccfd686 100644 --- a/source/tests/testPackMan.m +++ b/source/tests/testPackMan.m @@ -8,38 +8,48 @@ end %% Test Functions -function testThatPackManConstructorWorks(testCase) - % Test specific code - pm = PackMan(); - pm.install(); - verifyEqual(testCase,class(pm),'PackMan'); -end - -function testThatPackManRelativePathsWork(testCase) - % Test specific code - wDir = pwd; - pm = PackMan(); - pm.install(); - - expectedDepDirPath = fullfile(wDir, './external'); - verifyEqual(testCase,pm.depDirPath, expectedDepDirPath); - - expectedPackagePath = fullfile(wDir, './package.mat'); - verifyEqual(testCase,pm.packageFilePath, expectedPackagePath); -end - -function testThatPackManGeneratesPackageFile(testCase) - % Test specific code - pm = PackMan(); - pm.install(); - - verifyTrue(testCase, exist(pm.packageFilePath, 'file')~=false ); -end - +% function testThatPackManConstructorWorks(testCase) +% % Test specific code +% pm = PackMan(); +% pm.install(); +% verifyEqual(testCase,class(pm),'PackMan'); +% end + +% function testThatPackManRelativePathsWork(testCase) +% % Test specific code +% wDir = pwd; +% pm = PackMan(); +% pm.install(); +% +% expectedDepDirPath = fullfile(wDir, './external'); +% verifyEqual(testCase,pm.depDirPath, expectedDepDirPath); +% +% expectedPackagePath = fullfile(wDir, './package.json'); +% verifyEqual(testCase,pm.packageFilePath, expectedPackagePath); +% end +% +% function testThatPackManGeneratesPackageFile(testCase) +% % Test specific code +% pm = PackMan(getDepList); +% if exist(pm.packageFilePath, 'file') +% delete(pm.packageFilePath) +% end +% verifyTrue(testCase, ~exist(pm.packageFilePath, 'file')) +% +% pm.install(); +% +% verifyTrue(testCase, exist(pm.packageFilePath, 'file')~=false ); +% end +% function testThatPackManFetchesRepos(testCase) % Test specific code - depList = DepMatRepo('DepMat', 'master', 'https://github.com/OmidS/depmat.git', 'depmat', '', true); - pm = PackMan( depList ); + depList = [ + {'PackMan', 'dev01', 'https://github.com/DanielAtKrypton/PackMan.git', 'PackMan', '', true}; + {'DepMat', 'master', 'https://github.com/OmidS/depmat.git', 'depmat', '', true}; + ]; + depList = cell2struct(depList, {'Name', 'Branch', 'Url', 'FolderName', 'Commit', 'GetLatest'}, 2); + + pm = installDeps(depList); pm.install(); depDir = fullfile(pm.depDirPath, depList.FolderName); @@ -53,121 +63,134 @@ function testThatPackManFetchesRepos(testCase) verifyEqual(testCase, depList(i).Url, depListOnFile(rId).Url); end end - -function testThatPackManCanFetchesSpecificCommits(testCase) - % Test specific code - depList = DepMatRepo('DepMat1', 'master', 'https://github.com/OmidS/depmat.git', 'depmat1', 'f3810b050186a2e1e5e3fbdb64dd7cd8f3bc8528', false); - depList(end+1, 1) = DepMatRepo('DepMat2', 'master', 'https://github.com/OmidS/depmat.git', 'depmat2', '95fe15dc04406846857e1601f5954a1b4997313b', false); - - pm = PackMan( depList ); - pm.install(); - - depDir1 = fullfile(pm.depDirPath, depList(1).FolderName); - depDir2 = fullfile(pm.depDirPath, depList(2).FolderName); - addedFile = 'TestRepoList.m'; % This is a file we expect to exist in commit 2 but not in commit 1 - - verifyTrue(testCase, exist( fullfile(depDir1, addedFile) , 'file')==false ); - verifyTrue(testCase, exist( fullfile(depDir2, addedFile) , 'file')~=false ); - - % Check commit ids in package file - depListOnFile = PackMan.loadFromPackageFile( pm.packageFilePath ); - for i = 1:length(depList) - rId = find( strcmp( {depListOnFile.Name}, depList(i).Name) ); - verifyEqual(testCase, depListOnFile(rId).Commit, depList(i).Commit ); - end -end - -function testThatPackManAutoInstallsOnlyWhenItHasNoOutput(testCase) - % Test specific code - depList = DepMatRepo('DepMat1', 'master', 'https://github.com/OmidS/depmat.git', 'depmat1', '', false); - - packageDir = fullfile('./external', depList(1).FolderName); - verifyTrue(testCase, exist( packageDir , 'dir')==false ); - - pm = PackMan( depList ); - verifyTrue(testCase, exist( packageDir , 'dir')==false ); - - pm.install(); - verifyTrue(testCase, exist( packageDir , 'dir')~=false ); - - depList(end+1, 1) = DepMatRepo('DepMat2', 'master', 'https://github.com/OmidS/depmat.git', 'depmat2', '', false); - packageDir = fullfile('./external', depList(2).FolderName); - verifyTrue(testCase, exist( packageDir , 'dir')==false ); - PackMan( depList ); - verifyTrue(testCase, exist( packageDir , 'dir')~=false ); -end - -function testThatPackManRejectsInvalidDepLists(testCase) - % Test specific code - depList = DepMatRepo('DepMat', 'master', 'https://github.com/OmidS/depmat.git', 'depmat1', 'f3810b050186a2e1e5e3fbdb64dd7cd8f3bc8528', false); - depList(end+1, 1) = DepMatRepo('DepMat', 'master', 'https://github.com/OmidS/depmat.git', 'depmat2', '95fe15dc04406846857e1601f5954a1b4997313b', false); - verifyError(testCase, @()( PackMan(depList) ), 'PackMan:DepListError' ); -end - -function testThatPackManReturnsDepPaths(testCase) - % Test specific code - depList = DepMatRepo('DepMat', 'master', 'https://github.com/OmidS/depmat.git', 'depmat', '', true); - pm = PackMan( depList ); - pm.install(); - paths = pm.genPath(); - expectedPaths = [fullfile(pm.parentDir, './external/depmat/tests'),';', ... - fullfile(pm.parentDir, './external/depmat'),';', ... - pm.parentDir,';']; - verifyEqual(testCase, paths, expectedPaths); -end - -function testThatPackManRecursiveWorks(testCase) - % Test specific code - depList = DepMatRepo('matlabPackManRecursiveSample', 'master', 'https://github.com/OmidS/matlabPackManRecursiveSample.git', 'matlabPackManRecursiveSample', '', true); - pm = PackMan( depList ); - pm.install(); - paths = pm.genPath(); - expectedPaths = [fullfile(pm.parentDir, './external/matlabPackManRecursiveSample/external/depmat/tests'),';', ... - fullfile(pm.parentDir, './external/matlabPackManRecursiveSample/external/depmat'),';', ... - fullfile(pm.parentDir, './external/matlabPackManRecursiveSample/external/matlabPackManSample/external/depmat/tests'),';', ... - fullfile(pm.parentDir, './external/matlabPackManRecursiveSample/external/matlabPackManSample/external/depmat'),';', ... - fullfile(pm.parentDir, './external/matlabPackManRecursiveSample/external/matlabPackManSample'),';', ... - fullfile(pm.parentDir, './external/matlabPackManRecursiveSample'),';', ... - pm.parentDir,';']; - verifyEqual(testCase, paths, expectedPaths); -end - -%% Helper functions -function [depDir, packageFile] = getPaths() - -p = fileparts( mfilename('fullpath') ); -depDir = fullfile(p, 'external'); -packageFile = fullfile(p, 'package.mat'); - -end - -%% Optional file fixtures -function setupOnce(testCase) % do not change function name -% set a new path, for example -addpath('../'); - -end - -function teardownOnce(testCase) % do not change function name -% change back to original path, for example - -end - -%% Optional fresh fixtures -function setup(testCase) % do not change function name -% open a figure, for example - -[depDir, packageFile] = getPaths(); -if exist(depDir, 'dir'), delete(depDir); end -if exist(packageFile, 'file'), delete(packageFile); end - -end - -function teardown(testCase) % do not change function name -% close figure, for example - -[depDir, packageFile] = getPaths(); -if exist(depDir, 'dir'), rmdir(depDir, 's'); end -if exist(packageFile, 'file'), delete(packageFile); end - -end \ No newline at end of file +% +% function testThatPackManCanFetchesSpecificCommits(testCase) +% % Test specific code +% depList = [ +% {'DepMat1', 'master', 'https://github.com/OmidS/depmat.git', 'depmat1', 'f3810b050186a2e1e5e3fbdb64dd7cd8f3bc8528', false}; +% {'DepMat2', 'master', 'https://github.com/OmidS/depmat.git', 'depmat2', '95fe15dc04406846857e1601f5954a1b4997313b', false}; +% ]; +% depList = cell2struct(depList, {'Name', 'Branch', 'Url', 'FolderName', 'Commit', 'GetLatest'}, 2); +% +% pm = PackMan( depList ); +% pm.install(); +% +% depDir1 = fullfile(pm.depDirPath, depList(1).FolderName); +% depDir2 = fullfile(pm.depDirPath, depList(2).FolderName); +% addedFile = 'TestRepoList.m'; % This is a file we expect to exist in commit 2 but not in commit 1 +% +% verifyTrue(testCase, exist( fullfile(depDir1, addedFile) , 'file')==false ); +% verifyTrue(testCase, exist( fullfile(depDir2, addedFile) , 'file')~=false ); +% +% % Check commit ids in package file +% depListOnFile = PackMan.loadFromPackageFile( pm.packageFilePath ); +% for i = 1:length(depList) +% rId = find( strcmp( {depListOnFile.Name}, depList(i).Name) ); +% verifyEqual(testCase, depListOnFile(rId).Commit, depList(i).Commit ); +% end +% end +% +% function testThatPackManAutoInstallsOnlyWhenItHasNoOutput(testCase) +% % Test specific code +% depList = {'DepMat1', 'master', 'https://github.com/OmidS/depmat.git', 'depmat1', '', false}; +% depList = cell2struct(depList, {'Name', 'Branch', 'Url', 'FolderName', 'Commit', 'GetLatest'}, 2); +% +% packageDir = fullfile('./external', depList(1).FolderName); +% verifyTrue(testCase, exist( packageDir , 'dir')==false ); +% +% pm = PackMan( depList ); +% verifyTrue(testCase, exist( packageDir , 'dir')==false ); +% +% pm.install(); +% verifyTrue(testCase, exist( packageDir , 'dir')~=false ); +% +% depList = [ +% {'DepMat1', 'master', 'https://github.com/OmidS/depmat.git', 'depmat1', '', false}; +% {'DepMat2', 'master', 'https://github.com/OmidS/depmat.git', 'depmat2', '', false}; +% ]; +% depList = cell2struct(depList, {'Name', 'Branch', 'Url', 'FolderName', 'Commit', 'GetLatest'}, 2); +% packageDir = fullfile('./external', depList(2).FolderName); +% verifyTrue(testCase, exist( packageDir , 'dir')==false ); +% PackMan( depList ); +% verifyTrue(testCase, exist( packageDir , 'dir')~=false ); +% end +% +% function testThatPackManRejectsInvalidDepLists(testCase) +% % Test specific code +% depList = [ +% {'DepMat', 'master', 'https://github.com/OmidS/depmat.git', 'depmat1', 'f3810b050186a2e1e5e3fbdb64dd7cd8f3bc8528', false}; +% {'DepMat', 'master', 'https://github.com/OmidS/depmat.git', 'depmat2', '95fe15dc04406846857e1601f5954a1b4997313b', false}; +% ]; +% depList = cell2struct(depList, {'Name', 'Branch', 'Url', 'FolderName', 'Commit', 'GetLatest'}, 2); +% verifyError(testCase, @()( PackMan(depList) ), 'PackMan:DepListError' ); +% end +% +% function testThatPackManReturnsDepPaths(testCase) +% % Test specific code +% depList = {'DepMat', 'master', 'https://github.com/OmidS/depmat.git', 'depmat', '', true}; +% depList = cell2struct(depList, {'Name', 'Branch', 'Url', 'FolderName', 'Commit', 'GetLatest'}, 2); +% pm = PackMan( depList ); +% pm.install(); +% paths = pm.genPath(); +% expectedPaths = [fullfile(pm.parentDir, './external/depmat/tests'),';', ... +% fullfile(pm.parentDir, './external/depmat'),';', ... +% pm.parentDir,';']; +% verifyEqual(testCase, paths, expectedPaths); +% end +% +% function testThatPackManRecursiveWorks(testCase) +% % Test specific code +% depList = {'matlabPackManRecursiveSample', 'master', 'https://github.com/OmidS/matlabPackManRecursiveSample.git', 'matlabPackManRecursiveSample', '', true}; +% depList = cell2struct(depList, {'Name', 'Branch', 'Url', 'FolderName', 'Commit', 'GetLatest'}, 2); +% pm = PackMan( depList ); +% pm.install(); +% paths = pm.genPath(); +% expectedPaths = [fullfile(pm.parentDir, './external/matlabPackManRecursiveSample/external/depmat/tests'),';', ... +% fullfile(pm.parentDir, './external/matlabPackManRecursiveSample/external/depmat'),';', ... +% fullfile(pm.parentDir, './external/matlabPackManRecursiveSample/external/matlabPackManSample/external/depmat/tests'),';', ... +% fullfile(pm.parentDir, './external/matlabPackManRecursiveSample/external/matlabPackManSample/external/depmat'),';', ... +% fullfile(pm.parentDir, './external/matlabPackManRecursiveSample/external/matlabPackManSample'),';', ... +% fullfile(pm.parentDir, './external/matlabPackManRecursiveSample'),';', ... +% pm.parentDir,';']; +% verifyEqual(testCase, paths, expectedPaths); +% end +% +% %% Helper functions +% function [depDir, packageFile] = getPaths() +% +% p = fileparts( mfilename('fullpath') ); +% depDir = fullfile(p, 'external'); +% packageFile = fullfile(p, 'package.mat'); +% +% end +% +% %% Optional file fixtures +% function setupOnce(testCase) % do not change function name +% % set a new path, for example +% addpath('../'); +% +% end +% +% function teardownOnce(testCase) % do not change function name +% % change back to original path, for example +% +% end +% +% %% Optional fresh fixtures +% function setup(testCase) % do not change function name +% % open a figure, for example +% +% [depDir, packageFile] = getPaths(); +% if exist(depDir, 'dir'), delete(depDir); end +% if exist(packageFile, 'file'), delete(packageFile); end +% +% end +% +% function teardown(testCase) % do not change function name +% % close figure, for example +% +% [depDir, packageFile] = getPaths(); +% if exist(depDir, 'dir'), rmdir(depDir, 's'); end +% if exist(packageFile, 'file'), delete(packageFile); end +% +% end \ No newline at end of file From 9e36364fd577a36f8f6f1fc4a3af81c1ab6d237f Mon Sep 17 00:00:00 2001 From: Daniel Kaminski de Souza Date: Wed, 18 Mar 2020 03:59:20 -0400 Subject: [PATCH 046/143] :construction: Development path. --- source/getDepList.m | 2 +- source/tests/prepareTestEnvironment.m | 40 +++++++++++++++++++++++++++ source/tests/testPackMan.m | 11 ++++---- 3 files changed, 47 insertions(+), 6 deletions(-) create mode 100644 source/tests/prepareTestEnvironment.m diff --git a/source/getDepList.m b/source/getDepList.m index 3535f26..a77f9de 100644 --- a/source/getDepList.m +++ b/source/getDepList.m @@ -4,7 +4,7 @@ function depList = getDepList -depList = {'PackMan', 'dev01', 'https://github.com/DanielAtKrypton/PackMan.git', 'PackMan', '', true}; +depList = {'PackMan', 'release', 'https://github.com/DanielAtKrypton/PackMan.git', 'PackMan', '', true}; depList = cell2struct(depList, {'Name', 'Branch', 'Url', 'FolderName', 'Commit', 'GetLatest'}, 2); % Arguments for DepMatRepo: DepMatRepo(Name, Branch, Url, FolderName, Commit, GetLatest) % Example: diff --git a/source/tests/prepareTestEnvironment.m b/source/tests/prepareTestEnvironment.m new file mode 100644 index 0000000..804ab22 --- /dev/null +++ b/source/tests/prepareTestEnvironment.m @@ -0,0 +1,40 @@ +function pm = prepareTestEnvironment(depList) +%PREPARETESTENVIRONMENT Summary of this function goes here +% Detailed explanation goes here +currentWorkingDir = pwd; +externalFolderPath = fullfile(currentWorkingDir,'source','external'); +currentPath = path; +currentPathList = split(currentPath, ';'); +currentPathList = rmmissing(currentPathList); +sourceFolderPath =fullfile(currentWorkingDir,'source'); +toAddBefore = currentPathList(strcmp(currentPathList, sourceFolderPath)); +if (isempty(toAddBefore)) + addpath(sourceFolderPath); +end +if exist(externalFolderPath, 'dir') + nonGitExternalFolderPaths = genNonGitPath(externalFolderPath); + externalFolderPathToRemove = nonGitExternalFolderPaths(isEachMemberASubsetOfAny(currentPathList, nonGitExternalFolderPaths)); + if (~isempty(externalFolderPathToRemove)) + rmpath(externalFolderPathToRemove{:}); + end + rmdir(externalFolderPath, 's'); +end +packageFile = fullfile(currentWorkingDir,'package.json'); +if exist(packageFile, 'file') + delete(packageFile); +end +nonGitPath = genNonGitPath(currentWorkingDir); +toRemoveLater = nonGitPath(isEachMemberASubsetOfAny(currentPathList, nonGitPath)); +toRemoveLater = toRemoveLater(~strcmp(toRemoveLater, fullfile(currentWorkingDir,'source','tests'))); +pm = installDeps(depList); +pm.install(); +rmpath(toRemoveLater{:}); + +function result = isSubset(superSet, subSet) +result = isempty(setdiff(subSet, superSet)); + +function result = isSubSetOfAny(superSetSet, subSet) +result = any(cellfun(@(x)isSubset(x, subSet), superSetSet)); + +function result = isEachMemberASubsetOfAny(superSetSet, subSetSet) +result = cellfun(@(x)isSubSetOfAny(superSetSet, x), subSetSet); \ No newline at end of file diff --git a/source/tests/testPackMan.m b/source/tests/testPackMan.m index ccfd686..d1c7169 100644 --- a/source/tests/testPackMan.m +++ b/source/tests/testPackMan.m @@ -44,16 +44,17 @@ function testThatPackManFetchesRepos(testCase) % Test specific code depList = [ - {'PackMan', 'dev01', 'https://github.com/DanielAtKrypton/PackMan.git', 'PackMan', '', true}; + {'PackMan', 'release', 'https://github.com/DanielAtKrypton/PackMan.git', 'PackMan', '', true}; {'DepMat', 'master', 'https://github.com/OmidS/depmat.git', 'depmat', '', true}; ]; depList = cell2struct(depList, {'Name', 'Branch', 'Url', 'FolderName', 'Commit', 'GetLatest'}, 2); - pm = installDeps(depList); - pm.install(); + pm = prepareTestEnvironment(depList); - depDir = fullfile(pm.depDirPath, depList.FolderName); - verifyTrue(testCase, exist(depDir, 'dir')~=false ); + for i=1:length(depList) + depDir = fullfile(pm.depDirPath, depList(i).FolderName); + verifyTrue(testCase, exist(depDir, 'dir')~=false ); + end depListOnFile = PackMan.loadFromPackageFile( pm.packageFilePath ); From e613e590a70f7a48854ac406b882c19827f689ff Mon Sep 17 00:00:00 2001 From: Daniel Kaminski de Souza Date: Wed, 18 Mar 2020 05:36:36 -0400 Subject: [PATCH 047/143] :construction: Development path. --- source/tests/prepareTestEnvironment.m | 15 +++++++++++---- source/tests/testPackMan.m | 3 +-- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/source/tests/prepareTestEnvironment.m b/source/tests/prepareTestEnvironment.m index 804ab22..1c434e0 100644 --- a/source/tests/prepareTestEnvironment.m +++ b/source/tests/prepareTestEnvironment.m @@ -10,12 +10,13 @@ toAddBefore = currentPathList(strcmp(currentPathList, sourceFolderPath)); if (isempty(toAddBefore)) addpath(sourceFolderPath); + currentPathList = [currentPathList; {sourceFolderPath}]; end if exist(externalFolderPath, 'dir') nonGitExternalFolderPaths = genNonGitPath(externalFolderPath); - externalFolderPathToRemove = nonGitExternalFolderPaths(isEachMemberASubsetOfAny(currentPathList, nonGitExternalFolderPaths)); - if (~isempty(externalFolderPathToRemove)) - rmpath(externalFolderPathToRemove{:}); + externalFolderPathsToRemove = nonGitExternalFolderPaths(isTheres(currentPathList, nonGitExternalFolderPaths)); + if (~isempty(externalFolderPathsToRemove)) + rmpath(externalFolderPathsToRemove{:}); end rmdir(externalFolderPath, 's'); end @@ -37,4 +38,10 @@ result = any(cellfun(@(x)isSubset(x, subSet), superSetSet)); function result = isEachMemberASubsetOfAny(superSetSet, subSetSet) -result = cellfun(@(x)isSubSetOfAny(superSetSet, x), subSetSet); \ No newline at end of file +result = cellfun(@(x)isSubSetOfAny(superSetSet, x), subSetSet); + +function result = isThere(setOfElements, element) +result = ~isempty(setOfElements(strcmp(setOfElements, element))); + +function result = isTheres(superSet, subSet) +result = cellfun(@(x)isThere(superSet, x), subSet); \ No newline at end of file diff --git a/source/tests/testPackMan.m b/source/tests/testPackMan.m index d1c7169..5c6fef7 100644 --- a/source/tests/testPackMan.m +++ b/source/tests/testPackMan.m @@ -73,8 +73,7 @@ function testThatPackManFetchesRepos(testCase) % ]; % depList = cell2struct(depList, {'Name', 'Branch', 'Url', 'FolderName', 'Commit', 'GetLatest'}, 2); % -% pm = PackMan( depList ); -% pm.install(); +% pm = prepareTestEnvironment(depList); % % depDir1 = fullfile(pm.depDirPath, depList(1).FolderName); % depDir2 = fullfile(pm.depDirPath, depList(2).FolderName); From baf0dfd0007bac4f3b00e8d44e101e5a7b7d30c1 Mon Sep 17 00:00:00 2001 From: Daniel Kaminski de Souza Date: Wed, 18 Mar 2020 05:54:54 -0400 Subject: [PATCH 048/143] :construction: Development path. --- source/tests/prepareTestEnvironment.m | 11 +--- source/tests/testPackMan.m | 78 ++++++++++++++------------- 2 files changed, 41 insertions(+), 48 deletions(-) diff --git a/source/tests/prepareTestEnvironment.m b/source/tests/prepareTestEnvironment.m index 1c434e0..4f020cc 100644 --- a/source/tests/prepareTestEnvironment.m +++ b/source/tests/prepareTestEnvironment.m @@ -25,21 +25,12 @@ delete(packageFile); end nonGitPath = genNonGitPath(currentWorkingDir); -toRemoveLater = nonGitPath(isEachMemberASubsetOfAny(currentPathList, nonGitPath)); +toRemoveLater = nonGitPath(isTheres(currentPathList, nonGitPath)); toRemoveLater = toRemoveLater(~strcmp(toRemoveLater, fullfile(currentWorkingDir,'source','tests'))); pm = installDeps(depList); pm.install(); rmpath(toRemoveLater{:}); -function result = isSubset(superSet, subSet) -result = isempty(setdiff(subSet, superSet)); - -function result = isSubSetOfAny(superSetSet, subSet) -result = any(cellfun(@(x)isSubset(x, subSet), superSetSet)); - -function result = isEachMemberASubsetOfAny(superSetSet, subSetSet) -result = cellfun(@(x)isSubSetOfAny(superSetSet, x), subSetSet); - function result = isThere(setOfElements, element) result = ~isempty(setOfElements(strcmp(setOfElements, element))); diff --git a/source/tests/testPackMan.m b/source/tests/testPackMan.m index 5c6fef7..2388906 100644 --- a/source/tests/testPackMan.m +++ b/source/tests/testPackMan.m @@ -41,55 +41,57 @@ % verifyTrue(testCase, exist(pm.packageFilePath, 'file')~=false ); % end % -function testThatPackManFetchesRepos(testCase) - % Test specific code - depList = [ - {'PackMan', 'release', 'https://github.com/DanielAtKrypton/PackMan.git', 'PackMan', '', true}; - {'DepMat', 'master', 'https://github.com/OmidS/depmat.git', 'depmat', '', true}; - ]; - depList = cell2struct(depList, {'Name', 'Branch', 'Url', 'FolderName', 'Commit', 'GetLatest'}, 2); - - pm = prepareTestEnvironment(depList); - - for i=1:length(depList) - depDir = fullfile(pm.depDirPath, depList(i).FolderName); - verifyTrue(testCase, exist(depDir, 'dir')~=false ); - end - - depListOnFile = PackMan.loadFromPackageFile( pm.packageFilePath ); - - verifyEqual(testCase,length(depList), length(depListOnFile)); - for i = 1:length(depList) - rId = find( strcmp( {depListOnFile.Name}, depList(i).Name) ); - verifyEqual(testCase, depList(i).Url, depListOnFile(rId).Url); - end -end -% -% function testThatPackManCanFetchesSpecificCommits(testCase) +% function testThatPackManFetchesRepos(testCase) % % Test specific code -% depList = [ -% {'DepMat1', 'master', 'https://github.com/OmidS/depmat.git', 'depmat1', 'f3810b050186a2e1e5e3fbdb64dd7cd8f3bc8528', false}; -% {'DepMat2', 'master', 'https://github.com/OmidS/depmat.git', 'depmat2', '95fe15dc04406846857e1601f5954a1b4997313b', false}; +% depList = [ +% {'PackMan', 'release', 'https://github.com/DanielAtKrypton/PackMan.git', 'PackMan', '', true}; +% {'DepMat', 'master', 'https://github.com/OmidS/depmat.git', 'depmat', '', true}; % ]; -% depList = cell2struct(depList, {'Name', 'Branch', 'Url', 'FolderName', 'Commit', 'GetLatest'}, 2); -% +% depList = cell2struct(depList, {'Name', 'Branch', 'Url', 'FolderName', 'Commit', 'GetLatest'}, 2); +% % pm = prepareTestEnvironment(depList); % -% depDir1 = fullfile(pm.depDirPath, depList(1).FolderName); -% depDir2 = fullfile(pm.depDirPath, depList(2).FolderName); -% addedFile = 'TestRepoList.m'; % This is a file we expect to exist in commit 2 but not in commit 1 -% -% verifyTrue(testCase, exist( fullfile(depDir1, addedFile) , 'file')==false ); -% verifyTrue(testCase, exist( fullfile(depDir2, addedFile) , 'file')~=false ); +% for i=1:length(depList) +% depDir = fullfile(pm.depDirPath, depList(i).FolderName); +% verifyTrue(testCase, exist(depDir, 'dir')~=false ); +% end % -% % Check commit ids in package file % depListOnFile = PackMan.loadFromPackageFile( pm.packageFilePath ); +% +% verifyEqual(testCase,length(depList), length(depListOnFile)); % for i = 1:length(depList) % rId = find( strcmp( {depListOnFile.Name}, depList(i).Name) ); -% verifyEqual(testCase, depListOnFile(rId).Commit, depList(i).Commit ); +% verifyEqual(testCase, depList(i).Url, depListOnFile(rId).Url); % end % end % +function testThatPackManCanFetchesSpecificCommits(testCase) + % Test specific code + depList = [ + {'PackMan', 'release', 'https://github.com/DanielAtKrypton/PackMan.git', 'PackMan', '', true}; + {'DepMat1', 'master', 'https://github.com/OmidS/depmat.git', 'depmat1', 'f3810b050186a2e1e5e3fbdb64dd7cd8f3bc8528', false}; + {'DepMat2', 'master', 'https://github.com/OmidS/depmat.git', 'depmat2', '95fe15dc04406846857e1601f5954a1b4997313b', false}; + ]; + depList = cell2struct(depList, {'Name', 'Branch', 'Url', 'FolderName', 'Commit', 'GetLatest'}, 2); + + pm = prepareTestEnvironment(depList); + + depDir1 = fullfile(pm.depDirPath, depList(1).FolderName); + depDir2 = fullfile(pm.depDirPath, depList(2).FolderName); + depDir3 = fullfile(pm.depDirPath, depList(3).FolderName); + addedFile = 'TestRepoList.m'; % This is a file we expect to exist in commit 2 but not in commit 1 + + verifyTrue(testCase, exist( fullfile(depDir2, addedFile) , 'file')==false ); + verifyTrue(testCase, exist( fullfile(depDir3, addedFile) , 'file')~=false ); + + % Check commit ids in package file + depListOnFile = PackMan.loadFromPackageFile( pm.packageFilePath ); + for i = 2:length(depList) + rId = find( strcmp( {depListOnFile.Name}, depList(i).Name) ); + verifyEqual(testCase, depListOnFile(rId).Commit, depList(i).Commit ); + end +end +% % function testThatPackManAutoInstallsOnlyWhenItHasNoOutput(testCase) % % Test specific code % depList = {'DepMat1', 'master', 'https://github.com/OmidS/depmat.git', 'depmat1', '', false}; From b1ad27e761a7581443cf5b9f5bba2be225a57147 Mon Sep 17 00:00:00 2001 From: Daniel Kaminski de Souza Date: Wed, 18 Mar 2020 06:15:37 -0400 Subject: [PATCH 049/143] :bug: Fix PackMan. --- source/PackMan.m | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/PackMan.m b/source/PackMan.m index ea0aca8..f51281e 100644 --- a/source/PackMan.m +++ b/source/PackMan.m @@ -147,7 +147,7 @@ function install(obj, alreadyInstalled, depth) for j = 1:length(alreadyInstalled) if (isequal(thisDep.Url, alreadyInstalled(j).Url) || ... isequal(strrep(thisDep.Url, '.git', ''), strrep(alreadyInstalled(j).Url, '.git', ''))) && ... - ~isequal(thisDep.Commit, alreadyInstalled(j).Commit) + isequal(thisDep.Commit, alreadyInstalled(j).Commit) conflict = true; end end From d84f7e39b1d190925bba6aea08c449fa82404bde Mon Sep 17 00:00:00 2001 From: Daniel Kaminski de Souza Date: Wed, 18 Mar 2020 06:42:23 -0400 Subject: [PATCH 050/143] :white_check_mark: Add tests. --- source/tests/prepareTestEnvironment.m | 5 +- .../tests/prepareTestEnvironmentAndInstall.m | 8 +++ source/tests/testPackMan.m | 59 ++++++++++--------- 3 files changed, 41 insertions(+), 31 deletions(-) create mode 100644 source/tests/prepareTestEnvironmentAndInstall.m diff --git a/source/tests/prepareTestEnvironment.m b/source/tests/prepareTestEnvironment.m index 4f020cc..bffe641 100644 --- a/source/tests/prepareTestEnvironment.m +++ b/source/tests/prepareTestEnvironment.m @@ -1,4 +1,4 @@ -function pm = prepareTestEnvironment(depList) +function toRemoveLater = prepareTestEnvironment() %PREPARETESTENVIRONMENT Summary of this function goes here % Detailed explanation goes here currentWorkingDir = pwd; @@ -27,9 +27,6 @@ nonGitPath = genNonGitPath(currentWorkingDir); toRemoveLater = nonGitPath(isTheres(currentPathList, nonGitPath)); toRemoveLater = toRemoveLater(~strcmp(toRemoveLater, fullfile(currentWorkingDir,'source','tests'))); -pm = installDeps(depList); -pm.install(); -rmpath(toRemoveLater{:}); function result = isThere(setOfElements, element) result = ~isempty(setOfElements(strcmp(setOfElements, element))); diff --git a/source/tests/prepareTestEnvironmentAndInstall.m b/source/tests/prepareTestEnvironmentAndInstall.m new file mode 100644 index 0000000..464b2a0 --- /dev/null +++ b/source/tests/prepareTestEnvironmentAndInstall.m @@ -0,0 +1,8 @@ +function pm = prepareTestEnvironmentAndInstall(depList) +%PREPARETESTENVIRONMENTANDINSTALL Summary of this function goes here +% Detailed explanation goes here +toRemoveLater = prepareTestEnvironment(); +pm = installDeps(depList); +pm.install(); +rmpath(toRemoveLater{:}); + diff --git a/source/tests/testPackMan.m b/source/tests/testPackMan.m index 2388906..c067c2c 100644 --- a/source/tests/testPackMan.m +++ b/source/tests/testPackMan.m @@ -41,30 +41,30 @@ % verifyTrue(testCase, exist(pm.packageFilePath, 'file')~=false ); % end % -% function testThatPackManFetchesRepos(testCase) -% % Test specific code -% depList = [ -% {'PackMan', 'release', 'https://github.com/DanielAtKrypton/PackMan.git', 'PackMan', '', true}; -% {'DepMat', 'master', 'https://github.com/OmidS/depmat.git', 'depmat', '', true}; -% ]; -% depList = cell2struct(depList, {'Name', 'Branch', 'Url', 'FolderName', 'Commit', 'GetLatest'}, 2); -% -% pm = prepareTestEnvironment(depList); -% -% for i=1:length(depList) -% depDir = fullfile(pm.depDirPath, depList(i).FolderName); -% verifyTrue(testCase, exist(depDir, 'dir')~=false ); -% end -% -% depListOnFile = PackMan.loadFromPackageFile( pm.packageFilePath ); -% -% verifyEqual(testCase,length(depList), length(depListOnFile)); -% for i = 1:length(depList) -% rId = find( strcmp( {depListOnFile.Name}, depList(i).Name) ); -% verifyEqual(testCase, depList(i).Url, depListOnFile(rId).Url); -% end -% end -% +function testThatPackManFetchesRepos(testCase) + % Test specific code + depList = [ + {'PackMan', 'release', 'https://github.com/DanielAtKrypton/PackMan.git', 'PackMan', '', true}; + {'DepMat', 'master', 'https://github.com/OmidS/depmat.git', 'depmat', '', true}; + ]; + depList = cell2struct(depList, {'Name', 'Branch', 'Url', 'FolderName', 'Commit', 'GetLatest'}, 2); + + pm = prepareTestEnvironmentAndInstall(depList); + + for i=1:length(depList) + depDir = fullfile(pm.depDirPath, depList(i).FolderName); + verifyTrue(testCase, exist(depDir, 'dir')~=false ); + end + + depListOnFile = PackMan.loadFromPackageFile( pm.packageFilePath ); + + verifyEqual(testCase,length(depList), length(depListOnFile)); + for i = 1:length(depList) + rId = find( strcmp( {depListOnFile.Name}, depList(i).Name) ); + verifyEqual(testCase, depList(i).Url, depListOnFile(rId).Url); + end +end + function testThatPackManCanFetchesSpecificCommits(testCase) % Test specific code depList = [ @@ -74,7 +74,7 @@ function testThatPackManCanFetchesSpecificCommits(testCase) ]; depList = cell2struct(depList, {'Name', 'Branch', 'Url', 'FolderName', 'Commit', 'GetLatest'}, 2); - pm = prepareTestEnvironment(depList); + pm = prepareTestEnvironmentAndInstall(depList); depDir1 = fullfile(pm.depDirPath, depList(1).FolderName); depDir2 = fullfile(pm.depDirPath, depList(2).FolderName); @@ -91,10 +91,14 @@ function testThatPackManCanFetchesSpecificCommits(testCase) verifyEqual(testCase, depListOnFile(rId).Commit, depList(i).Commit ); end end -% + % function testThatPackManAutoInstallsOnlyWhenItHasNoOutput(testCase) % % Test specific code -% depList = {'DepMat1', 'master', 'https://github.com/OmidS/depmat.git', 'depmat1', '', false}; +% depList = [ +% {'PackMan', 'release', 'https://github.com/DanielAtKrypton/PackMan.git', 'PackMan', '', true}; +% {'DepMat1', 'master', 'https://github.com/OmidS/depmat.git', 'depmat1', '', false}; +% ]; +% % depList = cell2struct(depList, {'Name', 'Branch', 'Url', 'FolderName', 'Commit', 'GetLatest'}, 2); % % packageDir = fullfile('./external', depList(1).FolderName); @@ -107,6 +111,7 @@ function testThatPackManCanFetchesSpecificCommits(testCase) % verifyTrue(testCase, exist( packageDir , 'dir')~=false ); % % depList = [ +% {'PackMan', 'release', 'https://github.com/DanielAtKrypton/PackMan.git', 'PackMan', '', true}; % {'DepMat1', 'master', 'https://github.com/OmidS/depmat.git', 'depmat1', '', false}; % {'DepMat2', 'master', 'https://github.com/OmidS/depmat.git', 'depmat2', '', false}; % ]; From 7b2adbb032a317bb5d308591b9aebc591a7b9670 Mon Sep 17 00:00:00 2001 From: Daniel Kaminski de Souza Date: Wed, 18 Mar 2020 07:21:47 -0400 Subject: [PATCH 051/143] :bug: Fix PackMan. --- source/PackMan.m | 3 +- source/tests/testPackMan.m | 177 ++++++++++++++++++++----------------- 2 files changed, 96 insertions(+), 84 deletions(-) diff --git a/source/PackMan.m b/source/PackMan.m index f51281e..40bc952 100644 --- a/source/PackMan.m +++ b/source/PackMan.m @@ -147,7 +147,8 @@ function install(obj, alreadyInstalled, depth) for j = 1:length(alreadyInstalled) if (isequal(thisDep.Url, alreadyInstalled(j).Url) || ... isequal(strrep(thisDep.Url, '.git', ''), strrep(alreadyInstalled(j).Url, '.git', ''))) && ... - isequal(thisDep.Commit, alreadyInstalled(j).Commit) + isequal(thisDep.Commit, alreadyInstalled(j).Commit) && ... + isequal(thisDep.FolderName, alreadyInstalled(j).FolderName) && ... conflict = true; end end diff --git a/source/tests/testPackMan.m b/source/tests/testPackMan.m index c067c2c..2001466 100644 --- a/source/tests/testPackMan.m +++ b/source/tests/testPackMan.m @@ -10,30 +10,38 @@ %% Test Functions % function testThatPackManConstructorWorks(testCase) % % Test specific code -% pm = PackMan(); -% pm.install(); +% depList = {'PackMan', 'release', 'https://github.com/DanielAtKrypton/PackMan.git', 'PackMan', '', true}; +% depList = cell2struct(depList, {'Name', 'Branch', 'Url', 'FolderName', 'Commit', 'GetLatest'}, 2); +% +% pm = prepareTestEnvironmentAndInstall(depList); % verifyEqual(testCase,class(pm),'PackMan'); % end - +% % function testThatPackManRelativePathsWork(testCase) % % Test specific code -% wDir = pwd; -% pm = PackMan(); -% pm.install(); -% -% expectedDepDirPath = fullfile(wDir, './external'); +% depList = {'PackMan', 'release', 'https://github.com/DanielAtKrypton/PackMan.git', 'PackMan', '', true}; +% depList = cell2struct(depList, {'Name', 'Branch', 'Url', 'FolderName', 'Commit', 'GetLatest'}, 2); +% +% pm = prepareTestEnvironmentAndInstall(depList); +% currentWorkingDir = pwd; +% expectedDepDirPath = fullfile(currentWorkingDir, 'source', 'external'); % verifyEqual(testCase,pm.depDirPath, expectedDepDirPath); % -% expectedPackagePath = fullfile(wDir, './package.json'); +% expectedPackagePath = fullfile(currentWorkingDir, './package.json'); % verifyEqual(testCase,pm.packageFilePath, expectedPackagePath); % end -% +% % function testThatPackManGeneratesPackageFile(testCase) % % Test specific code -% pm = PackMan(getDepList); -% if exist(pm.packageFilePath, 'file') -% delete(pm.packageFilePath) -% end +% depList = [ +% {'PackMan', 'release', 'https://github.com/DanielAtKrypton/PackMan.git', 'PackMan', '', true}; +% {'DepMat', 'master', 'https://github.com/OmidS/depmat.git', 'depmat', '', true}; +% ]; +% depList = cell2struct(depList, {'Name', 'Branch', 'Url', 'FolderName', 'Commit', 'GetLatest'}, 2); +% +% prepareTestEnvironment(); +% pm = installDeps(depList); +% % verifyTrue(testCase, ~exist(pm.packageFilePath, 'file')) % % pm.install(); @@ -41,86 +49,89 @@ % verifyTrue(testCase, exist(pm.packageFilePath, 'file')~=false ); % end % -function testThatPackManFetchesRepos(testCase) +% function testThatPackManFetchesRepos(testCase) +% % Test specific code +% depList = [ +% {'PackMan', 'release', 'https://github.com/DanielAtKrypton/PackMan.git', 'PackMan', '', true}; +% {'DepMat', 'master', 'https://github.com/OmidS/depmat.git', 'depmat', '', true}; +% ]; +% depList = cell2struct(depList, {'Name', 'Branch', 'Url', 'FolderName', 'Commit', 'GetLatest'}, 2); +% +% pm = prepareTestEnvironmentAndInstall(depList); +% +% for i=1:length(depList) +% depDir = fullfile(pm.depDirPath, depList(i).FolderName); +% verifyTrue(testCase, exist(depDir, 'dir')~=false ); +% end +% +% depListOnFile = PackMan.loadFromPackageFile( pm.packageFilePath ); +% +% verifyEqual(testCase,length(depList), length(depListOnFile)); +% for i = 1:length(depList) +% rId = find( strcmp( {depListOnFile.Name}, depList(i).Name) ); +% verifyEqual(testCase, depList(i).Url, depListOnFile(rId).Url); +% end +% end +% +% function testThatPackManCanFetchesSpecificCommits(testCase) +% % Test specific code +% depList = [ +% {'PackMan', 'release', 'https://github.com/DanielAtKrypton/PackMan.git', 'PackMan', '', true}; +% {'DepMat1', 'master', 'https://github.com/OmidS/depmat.git', 'depmat1', 'f3810b050186a2e1e5e3fbdb64dd7cd8f3bc8528', false}; +% {'DepMat2', 'master', 'https://github.com/OmidS/depmat.git', 'depmat2', '95fe15dc04406846857e1601f5954a1b4997313b', false}; +% ]; +% depList = cell2struct(depList, {'Name', 'Branch', 'Url', 'FolderName', 'Commit', 'GetLatest'}, 2); +% +% pm = prepareTestEnvironmentAndInstall(depList); +% +% depDir2 = fullfile(pm.depDirPath, depList(2).FolderName); +% depDir3 = fullfile(pm.depDirPath, depList(3).FolderName); +% addedFile = 'TestRepoList.m'; % This is a file we expect to exist in commit 2 but not in commit 1 +% +% verifyTrue(testCase, exist( fullfile(depDir2, addedFile) , 'file')==false ); +% verifyTrue(testCase, exist( fullfile(depDir3, addedFile) , 'file')~=false ); +% +% % Check commit ids in package file +% depListOnFile = PackMan.loadFromPackageFile( pm.packageFilePath ); +% for i = 2:length(depList) +% rId = find( strcmp( {depListOnFile.Name}, depList(i).Name) ); +% verifyEqual(testCase, depListOnFile(rId).Commit, depList(i).Commit ); +% end +% end + +function testThatPackManAutoInstallsOnlyWhenItHasNoOutput(testCase) % Test specific code - depList = [ - {'PackMan', 'release', 'https://github.com/DanielAtKrypton/PackMan.git', 'PackMan', '', true}; - {'DepMat', 'master', 'https://github.com/OmidS/depmat.git', 'depmat', '', true}; + depList = [ + {'PackMan', 'release', 'https://github.com/DanielAtKrypton/PackMan.git', 'PackMan', '', true}; + {'DepMat1', 'master', 'https://github.com/OmidS/depmat.git', 'depmat1', '', false}; ]; - depList = cell2struct(depList, {'Name', 'Branch', 'Url', 'FolderName', 'Commit', 'GetLatest'}, 2); - - pm = prepareTestEnvironmentAndInstall(depList); + + depList = cell2struct(depList, {'Name', 'Branch', 'Url', 'FolderName', 'Commit', 'GetLatest'}, 2); - for i=1:length(depList) - depDir = fullfile(pm.depDirPath, depList(i).FolderName); - verifyTrue(testCase, exist(depDir, 'dir')~=false ); - end + prepareTestEnvironment(); + externalFolder = fullfile(pwd, 'source', 'external'); + packageDir = fullfile(externalFolder, depList(2).FolderName); + verifyTrue(testCase, exist( packageDir , 'dir')==false ); - depListOnFile = PackMan.loadFromPackageFile( pm.packageFilePath ); + pm = installDeps(depList); + verifyTrue(testCase, exist( packageDir , 'dir')==false ); + + pm.install(); + verifyTrue(testCase, exist( packageDir , 'dir')~=false ); - verifyEqual(testCase,length(depList), length(depListOnFile)); - for i = 1:length(depList) - rId = find( strcmp( {depListOnFile.Name}, depList(i).Name) ); - verifyEqual(testCase, depList(i).Url, depListOnFile(rId).Url); - end -end - -function testThatPackManCanFetchesSpecificCommits(testCase) - % Test specific code depList = [ {'PackMan', 'release', 'https://github.com/DanielAtKrypton/PackMan.git', 'PackMan', '', true}; - {'DepMat1', 'master', 'https://github.com/OmidS/depmat.git', 'depmat1', 'f3810b050186a2e1e5e3fbdb64dd7cd8f3bc8528', false}; - {'DepMat2', 'master', 'https://github.com/OmidS/depmat.git', 'depmat2', '95fe15dc04406846857e1601f5954a1b4997313b', false}; + {'DepMat1', 'master', 'https://github.com/OmidS/depmat.git', 'depmat1', '', false}; + {'DepMat2', 'master', 'https://github.com/OmidS/depmat.git', 'depmat2', '', false}; ]; depList = cell2struct(depList, {'Name', 'Branch', 'Url', 'FolderName', 'Commit', 'GetLatest'}, 2); - pm = prepareTestEnvironmentAndInstall(depList); - - depDir1 = fullfile(pm.depDirPath, depList(1).FolderName); - depDir2 = fullfile(pm.depDirPath, depList(2).FolderName); - depDir3 = fullfile(pm.depDirPath, depList(3).FolderName); - addedFile = 'TestRepoList.m'; % This is a file we expect to exist in commit 2 but not in commit 1 - - verifyTrue(testCase, exist( fullfile(depDir2, addedFile) , 'file')==false ); - verifyTrue(testCase, exist( fullfile(depDir3, addedFile) , 'file')~=false ); - - % Check commit ids in package file - depListOnFile = PackMan.loadFromPackageFile( pm.packageFilePath ); - for i = 2:length(depList) - rId = find( strcmp( {depListOnFile.Name}, depList(i).Name) ); - verifyEqual(testCase, depListOnFile(rId).Commit, depList(i).Commit ); - end + prepareTestEnvironment(); + packageDir = fullfile(externalFolder, depList(3).FolderName); + verifyTrue(testCase, exist( packageDir , 'dir')==false ); + installDeps(depList); + verifyTrue(testCase, exist( packageDir , 'dir')~=false ); end - -% function testThatPackManAutoInstallsOnlyWhenItHasNoOutput(testCase) -% % Test specific code -% depList = [ -% {'PackMan', 'release', 'https://github.com/DanielAtKrypton/PackMan.git', 'PackMan', '', true}; -% {'DepMat1', 'master', 'https://github.com/OmidS/depmat.git', 'depmat1', '', false}; -% ]; -% -% depList = cell2struct(depList, {'Name', 'Branch', 'Url', 'FolderName', 'Commit', 'GetLatest'}, 2); -% -% packageDir = fullfile('./external', depList(1).FolderName); -% verifyTrue(testCase, exist( packageDir , 'dir')==false ); -% -% pm = PackMan( depList ); -% verifyTrue(testCase, exist( packageDir , 'dir')==false ); -% -% pm.install(); -% verifyTrue(testCase, exist( packageDir , 'dir')~=false ); -% -% depList = [ -% {'PackMan', 'release', 'https://github.com/DanielAtKrypton/PackMan.git', 'PackMan', '', true}; -% {'DepMat1', 'master', 'https://github.com/OmidS/depmat.git', 'depmat1', '', false}; -% {'DepMat2', 'master', 'https://github.com/OmidS/depmat.git', 'depmat2', '', false}; -% ]; -% depList = cell2struct(depList, {'Name', 'Branch', 'Url', 'FolderName', 'Commit', 'GetLatest'}, 2); -% packageDir = fullfile('./external', depList(2).FolderName); -% verifyTrue(testCase, exist( packageDir , 'dir')==false ); -% PackMan( depList ); -% verifyTrue(testCase, exist( packageDir , 'dir')~=false ); -% end % % function testThatPackManRejectsInvalidDepLists(testCase) % % Test specific code From eb4994d8abb4f833a51e11b90ff33368bfa561b1 Mon Sep 17 00:00:00 2001 From: Daniel Kaminski de Souza Date: Wed, 18 Mar 2020 07:22:28 -0400 Subject: [PATCH 052/143] :bug: Fix PackMan. --- source/PackMan.m | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/PackMan.m b/source/PackMan.m index 40bc952..ee33e52 100644 --- a/source/PackMan.m +++ b/source/PackMan.m @@ -148,7 +148,7 @@ function install(obj, alreadyInstalled, depth) if (isequal(thisDep.Url, alreadyInstalled(j).Url) || ... isequal(strrep(thisDep.Url, '.git', ''), strrep(alreadyInstalled(j).Url, '.git', ''))) && ... isequal(thisDep.Commit, alreadyInstalled(j).Commit) && ... - isequal(thisDep.FolderName, alreadyInstalled(j).FolderName) && ... + isequal(thisDep.FolderName, alreadyInstalled(j).FolderName) conflict = true; end end From db24c10be25a0a0791f86e703e78ceb96e1ff275 Mon Sep 17 00:00:00 2001 From: Daniel Kaminski de Souza Date: Wed, 18 Mar 2020 07:27:12 -0400 Subject: [PATCH 053/143] :white_check_mark: Add tests. --- source/tests/testPackMan.m | 182 ++++++++++++++++++------------------- 1 file changed, 91 insertions(+), 91 deletions(-) diff --git a/source/tests/testPackMan.m b/source/tests/testPackMan.m index 2001466..17ec175 100644 --- a/source/tests/testPackMan.m +++ b/source/tests/testPackMan.m @@ -8,96 +8,96 @@ end %% Test Functions -% function testThatPackManConstructorWorks(testCase) -% % Test specific code -% depList = {'PackMan', 'release', 'https://github.com/DanielAtKrypton/PackMan.git', 'PackMan', '', true}; -% depList = cell2struct(depList, {'Name', 'Branch', 'Url', 'FolderName', 'Commit', 'GetLatest'}, 2); -% -% pm = prepareTestEnvironmentAndInstall(depList); -% verifyEqual(testCase,class(pm),'PackMan'); -% end -% -% function testThatPackManRelativePathsWork(testCase) -% % Test specific code -% depList = {'PackMan', 'release', 'https://github.com/DanielAtKrypton/PackMan.git', 'PackMan', '', true}; -% depList = cell2struct(depList, {'Name', 'Branch', 'Url', 'FolderName', 'Commit', 'GetLatest'}, 2); -% -% pm = prepareTestEnvironmentAndInstall(depList); -% currentWorkingDir = pwd; -% expectedDepDirPath = fullfile(currentWorkingDir, 'source', 'external'); -% verifyEqual(testCase,pm.depDirPath, expectedDepDirPath); -% -% expectedPackagePath = fullfile(currentWorkingDir, './package.json'); -% verifyEqual(testCase,pm.packageFilePath, expectedPackagePath); -% end -% -% function testThatPackManGeneratesPackageFile(testCase) -% % Test specific code -% depList = [ -% {'PackMan', 'release', 'https://github.com/DanielAtKrypton/PackMan.git', 'PackMan', '', true}; -% {'DepMat', 'master', 'https://github.com/OmidS/depmat.git', 'depmat', '', true}; -% ]; -% depList = cell2struct(depList, {'Name', 'Branch', 'Url', 'FolderName', 'Commit', 'GetLatest'}, 2); -% -% prepareTestEnvironment(); -% pm = installDeps(depList); -% -% verifyTrue(testCase, ~exist(pm.packageFilePath, 'file')) -% -% pm.install(); -% -% verifyTrue(testCase, exist(pm.packageFilePath, 'file')~=false ); -% end -% -% function testThatPackManFetchesRepos(testCase) -% % Test specific code -% depList = [ -% {'PackMan', 'release', 'https://github.com/DanielAtKrypton/PackMan.git', 'PackMan', '', true}; -% {'DepMat', 'master', 'https://github.com/OmidS/depmat.git', 'depmat', '', true}; -% ]; -% depList = cell2struct(depList, {'Name', 'Branch', 'Url', 'FolderName', 'Commit', 'GetLatest'}, 2); -% -% pm = prepareTestEnvironmentAndInstall(depList); -% -% for i=1:length(depList) -% depDir = fullfile(pm.depDirPath, depList(i).FolderName); -% verifyTrue(testCase, exist(depDir, 'dir')~=false ); -% end -% -% depListOnFile = PackMan.loadFromPackageFile( pm.packageFilePath ); -% -% verifyEqual(testCase,length(depList), length(depListOnFile)); -% for i = 1:length(depList) -% rId = find( strcmp( {depListOnFile.Name}, depList(i).Name) ); -% verifyEqual(testCase, depList(i).Url, depListOnFile(rId).Url); -% end -% end -% -% function testThatPackManCanFetchesSpecificCommits(testCase) -% % Test specific code -% depList = [ -% {'PackMan', 'release', 'https://github.com/DanielAtKrypton/PackMan.git', 'PackMan', '', true}; -% {'DepMat1', 'master', 'https://github.com/OmidS/depmat.git', 'depmat1', 'f3810b050186a2e1e5e3fbdb64dd7cd8f3bc8528', false}; -% {'DepMat2', 'master', 'https://github.com/OmidS/depmat.git', 'depmat2', '95fe15dc04406846857e1601f5954a1b4997313b', false}; -% ]; -% depList = cell2struct(depList, {'Name', 'Branch', 'Url', 'FolderName', 'Commit', 'GetLatest'}, 2); -% -% pm = prepareTestEnvironmentAndInstall(depList); -% -% depDir2 = fullfile(pm.depDirPath, depList(2).FolderName); -% depDir3 = fullfile(pm.depDirPath, depList(3).FolderName); -% addedFile = 'TestRepoList.m'; % This is a file we expect to exist in commit 2 but not in commit 1 -% -% verifyTrue(testCase, exist( fullfile(depDir2, addedFile) , 'file')==false ); -% verifyTrue(testCase, exist( fullfile(depDir3, addedFile) , 'file')~=false ); -% -% % Check commit ids in package file -% depListOnFile = PackMan.loadFromPackageFile( pm.packageFilePath ); -% for i = 2:length(depList) -% rId = find( strcmp( {depListOnFile.Name}, depList(i).Name) ); -% verifyEqual(testCase, depListOnFile(rId).Commit, depList(i).Commit ); -% end -% end +function testThatPackManConstructorWorks(testCase) + % Test specific code + depList = {'PackMan', 'release', 'https://github.com/DanielAtKrypton/PackMan.git', 'PackMan', '', true}; + depList = cell2struct(depList, {'Name', 'Branch', 'Url', 'FolderName', 'Commit', 'GetLatest'}, 2); + + pm = prepareTestEnvironmentAndInstall(depList); + verifyEqual(testCase,class(pm),'PackMan'); +end + +function testThatPackManRelativePathsWork(testCase) + % Test specific code + depList = {'PackMan', 'release', 'https://github.com/DanielAtKrypton/PackMan.git', 'PackMan', '', true}; + depList = cell2struct(depList, {'Name', 'Branch', 'Url', 'FolderName', 'Commit', 'GetLatest'}, 2); + + pm = prepareTestEnvironmentAndInstall(depList); + currentWorkingDir = pwd; + expectedDepDirPath = fullfile(currentWorkingDir, 'source', 'external'); + verifyEqual(testCase,pm.depDirPath, expectedDepDirPath); + + expectedPackagePath = fullfile(currentWorkingDir, './package.json'); + verifyEqual(testCase,pm.packageFilePath, expectedPackagePath); +end + +function testThatPackManGeneratesPackageFile(testCase) + % Test specific code + depList = [ + {'PackMan', 'release', 'https://github.com/DanielAtKrypton/PackMan.git', 'PackMan', '', true}; + {'DepMat', 'master', 'https://github.com/OmidS/depmat.git', 'depmat', '', true}; + ]; + depList = cell2struct(depList, {'Name', 'Branch', 'Url', 'FolderName', 'Commit', 'GetLatest'}, 2); + + prepareTestEnvironment(); + pm = installDeps(depList); + + verifyTrue(testCase, ~exist(pm.packageFilePath, 'file')) + + pm.install(); + + verifyTrue(testCase, exist(pm.packageFilePath, 'file')~=false ); +end + +function testThatPackManFetchesRepos(testCase) + % Test specific code + depList = [ + {'PackMan', 'release', 'https://github.com/DanielAtKrypton/PackMan.git', 'PackMan', '', true}; + {'DepMat', 'master', 'https://github.com/OmidS/depmat.git', 'depmat', '', true}; + ]; + depList = cell2struct(depList, {'Name', 'Branch', 'Url', 'FolderName', 'Commit', 'GetLatest'}, 2); + + pm = prepareTestEnvironmentAndInstall(depList); + + for i=1:length(depList) + depDir = fullfile(pm.depDirPath, depList(i).FolderName); + verifyTrue(testCase, exist(depDir, 'dir')~=false ); + end + + depListOnFile = PackMan.loadFromPackageFile( pm.packageFilePath ); + + verifyEqual(testCase,length(depList), length(depListOnFile)); + for i = 1:length(depList) + rId = find( strcmp( {depListOnFile.Name}, depList(i).Name) ); + verifyEqual(testCase, depList(i).Url, depListOnFile(rId).Url); + end +end + +function testThatPackManCanFetchesSpecificCommits(testCase) + % Test specific code + depList = [ + {'PackMan', 'release', 'https://github.com/DanielAtKrypton/PackMan.git', 'PackMan', '', true}; + {'DepMat1', 'master', 'https://github.com/OmidS/depmat.git', 'depmat1', 'f3810b050186a2e1e5e3fbdb64dd7cd8f3bc8528', false}; + {'DepMat2', 'master', 'https://github.com/OmidS/depmat.git', 'depmat2', '95fe15dc04406846857e1601f5954a1b4997313b', false}; + ]; + depList = cell2struct(depList, {'Name', 'Branch', 'Url', 'FolderName', 'Commit', 'GetLatest'}, 2); + + pm = prepareTestEnvironmentAndInstall(depList); + + depDir2 = fullfile(pm.depDirPath, depList(2).FolderName); + depDir3 = fullfile(pm.depDirPath, depList(3).FolderName); + addedFile = 'TestRepoList.m'; % This is a file we expect to exist in commit 2 but not in commit 1 + + verifyTrue(testCase, exist( fullfile(depDir2, addedFile) , 'file')==false ); + verifyTrue(testCase, exist( fullfile(depDir3, addedFile) , 'file')~=false ); + + % Check commit ids in package file + depListOnFile = PackMan.loadFromPackageFile( pm.packageFilePath ); + for i = 2:length(depList) + rId = find( strcmp( {depListOnFile.Name}, depList(i).Name) ); + verifyEqual(testCase, depListOnFile(rId).Commit, depList(i).Commit ); + end +end function testThatPackManAutoInstallsOnlyWhenItHasNoOutput(testCase) % Test specific code @@ -132,7 +132,7 @@ function testThatPackManAutoInstallsOnlyWhenItHasNoOutput(testCase) installDeps(depList); verifyTrue(testCase, exist( packageDir , 'dir')~=false ); end -% + % function testThatPackManRejectsInvalidDepLists(testCase) % % Test specific code % depList = [ From f92882f756b51e971775bc362a6690ad02f8623f Mon Sep 17 00:00:00 2001 From: Daniel Kaminski de Souza Date: Wed, 18 Mar 2020 07:30:45 -0400 Subject: [PATCH 054/143] :white_check_mark: Add tests. --- source/tests/testPackMan.m | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/source/tests/testPackMan.m b/source/tests/testPackMan.m index 17ec175..90b4b9b 100644 --- a/source/tests/testPackMan.m +++ b/source/tests/testPackMan.m @@ -133,16 +133,18 @@ function testThatPackManAutoInstallsOnlyWhenItHasNoOutput(testCase) verifyTrue(testCase, exist( packageDir , 'dir')~=false ); end -% function testThatPackManRejectsInvalidDepLists(testCase) -% % Test specific code -% depList = [ -% {'DepMat', 'master', 'https://github.com/OmidS/depmat.git', 'depmat1', 'f3810b050186a2e1e5e3fbdb64dd7cd8f3bc8528', false}; -% {'DepMat', 'master', 'https://github.com/OmidS/depmat.git', 'depmat2', '95fe15dc04406846857e1601f5954a1b4997313b', false}; -% ]; -% depList = cell2struct(depList, {'Name', 'Branch', 'Url', 'FolderName', 'Commit', 'GetLatest'}, 2); -% verifyError(testCase, @()( PackMan(depList) ), 'PackMan:DepListError' ); -% end -% +function testThatPackManRejectsInvalidDepLists(testCase) + % Test specific code + depList = [ + {'PackMan', 'release', 'https://github.com/DanielAtKrypton/PackMan.git', 'PackMan', '', true}; + {'DepMat', 'master', 'https://github.com/OmidS/depmat.git', 'depmat1', 'f3810b050186a2e1e5e3fbdb64dd7cd8f3bc8528', false}; + {'DepMat', 'master', 'https://github.com/OmidS/depmat.git', 'depmat2', '95fe15dc04406846857e1601f5954a1b4997313b', false}; + ]; + depList = cell2struct(depList, {'Name', 'Branch', 'Url', 'FolderName', 'Commit', 'GetLatest'}, 2); + prepareTestEnvironment(); + verifyError(testCase, @()( installDeps(depList) ), 'PackMan:DepListError' ); +end + % function testThatPackManReturnsDepPaths(testCase) % % Test specific code % depList = {'DepMat', 'master', 'https://github.com/OmidS/depmat.git', 'depmat', '', true}; From cd2febeed7c7ccd234f939faf4b4177ac79464e9 Mon Sep 17 00:00:00 2001 From: Daniel Kaminski de Souza Date: Wed, 18 Mar 2020 07:47:30 -0400 Subject: [PATCH 055/143] :bug: Fix PackMan. --- source/PackMan.m | 1 + 1 file changed, 1 insertion(+) diff --git a/source/PackMan.m b/source/PackMan.m index ee33e52..c7b0ea8 100644 --- a/source/PackMan.m +++ b/source/PackMan.m @@ -237,6 +237,7 @@ function recurse( obj, alreadyInstalled, depth ) paths = [paths; depPaths]; end + paths = unique(paths); if nargout > 1, varargout{1} = alreadyAdded; end end From b71bd8dbf38d7ce548225eabd1e05e40240b5869 Mon Sep 17 00:00:00 2001 From: Daniel Kaminski de Souza Date: Wed, 18 Mar 2020 07:49:09 -0400 Subject: [PATCH 056/143] :construction: Development path. --- source/tests/testPackMan.m | 289 +++++++++++++++++++------------------ 1 file changed, 149 insertions(+), 140 deletions(-) diff --git a/source/tests/testPackMan.m b/source/tests/testPackMan.m index 90b4b9b..f338473 100644 --- a/source/tests/testPackMan.m +++ b/source/tests/testPackMan.m @@ -8,155 +8,164 @@ end %% Test Functions -function testThatPackManConstructorWorks(testCase) - % Test specific code - depList = {'PackMan', 'release', 'https://github.com/DanielAtKrypton/PackMan.git', 'PackMan', '', true}; - depList = cell2struct(depList, {'Name', 'Branch', 'Url', 'FolderName', 'Commit', 'GetLatest'}, 2); - - pm = prepareTestEnvironmentAndInstall(depList); - verifyEqual(testCase,class(pm),'PackMan'); -end - -function testThatPackManRelativePathsWork(testCase) - % Test specific code - depList = {'PackMan', 'release', 'https://github.com/DanielAtKrypton/PackMan.git', 'PackMan', '', true}; - depList = cell2struct(depList, {'Name', 'Branch', 'Url', 'FolderName', 'Commit', 'GetLatest'}, 2); - - pm = prepareTestEnvironmentAndInstall(depList); - currentWorkingDir = pwd; - expectedDepDirPath = fullfile(currentWorkingDir, 'source', 'external'); - verifyEqual(testCase,pm.depDirPath, expectedDepDirPath); - - expectedPackagePath = fullfile(currentWorkingDir, './package.json'); - verifyEqual(testCase,pm.packageFilePath, expectedPackagePath); -end - -function testThatPackManGeneratesPackageFile(testCase) - % Test specific code - depList = [ - {'PackMan', 'release', 'https://github.com/DanielAtKrypton/PackMan.git', 'PackMan', '', true}; - {'DepMat', 'master', 'https://github.com/OmidS/depmat.git', 'depmat', '', true}; - ]; - depList = cell2struct(depList, {'Name', 'Branch', 'Url', 'FolderName', 'Commit', 'GetLatest'}, 2); - - prepareTestEnvironment(); - pm = installDeps(depList); - - verifyTrue(testCase, ~exist(pm.packageFilePath, 'file')) - - pm.install(); - - verifyTrue(testCase, exist(pm.packageFilePath, 'file')~=false ); -end +% function testThatPackManConstructorWorks(testCase) +% % Test specific code +% depList = {'PackMan', 'release', 'https://github.com/DanielAtKrypton/PackMan.git', 'PackMan', '', true}; +% depList = cell2struct(depList, {'Name', 'Branch', 'Url', 'FolderName', 'Commit', 'GetLatest'}, 2); +% +% pm = prepareTestEnvironmentAndInstall(depList); +% verifyEqual(testCase,class(pm),'PackMan'); +% end +% +% function testThatPackManRelativePathsWork(testCase) +% % Test specific code +% depList = {'PackMan', 'release', 'https://github.com/DanielAtKrypton/PackMan.git', 'PackMan', '', true}; +% depList = cell2struct(depList, {'Name', 'Branch', 'Url', 'FolderName', 'Commit', 'GetLatest'}, 2); +% +% pm = prepareTestEnvironmentAndInstall(depList); +% currentWorkingDir = pwd; +% expectedDepDirPath = fullfile(currentWorkingDir, 'source', 'external'); +% verifyEqual(testCase,pm.depDirPath, expectedDepDirPath); +% +% expectedPackagePath = fullfile(currentWorkingDir, './package.json'); +% verifyEqual(testCase,pm.packageFilePath, expectedPackagePath); +% end +% +% function testThatPackManGeneratesPackageFile(testCase) +% % Test specific code +% depList = [ +% {'PackMan', 'release', 'https://github.com/DanielAtKrypton/PackMan.git', 'PackMan', '', true}; +% {'DepMat', 'master', 'https://github.com/OmidS/depmat.git', 'depmat', '', true}; +% ]; +% depList = cell2struct(depList, {'Name', 'Branch', 'Url', 'FolderName', 'Commit', 'GetLatest'}, 2); +% +% prepareTestEnvironment(); +% pm = installDeps(depList); +% +% verifyTrue(testCase, ~exist(pm.packageFilePath, 'file')) +% +% pm.install(); +% +% verifyTrue(testCase, exist(pm.packageFilePath, 'file')~=false ); +% end +% +% function testThatPackManFetchesRepos(testCase) +% % Test specific code +% depList = [ +% {'PackMan', 'release', 'https://github.com/DanielAtKrypton/PackMan.git', 'PackMan', '', true}; +% {'DepMat', 'master', 'https://github.com/OmidS/depmat.git', 'depmat', '', true}; +% ]; +% depList = cell2struct(depList, {'Name', 'Branch', 'Url', 'FolderName', 'Commit', 'GetLatest'}, 2); +% +% pm = prepareTestEnvironmentAndInstall(depList); +% +% for i=1:length(depList) +% depDir = fullfile(pm.depDirPath, depList(i).FolderName); +% verifyTrue(testCase, exist(depDir, 'dir')~=false ); +% end +% +% depListOnFile = PackMan.loadFromPackageFile( pm.packageFilePath ); +% +% verifyEqual(testCase,length(depList), length(depListOnFile)); +% for i = 1:length(depList) +% rId = find( strcmp( {depListOnFile.Name}, depList(i).Name) ); +% verifyEqual(testCase, depList(i).Url, depListOnFile(rId).Url); +% end +% end +% +% function testThatPackManCanFetchesSpecificCommits(testCase) +% % Test specific code +% depList = [ +% {'PackMan', 'release', 'https://github.com/DanielAtKrypton/PackMan.git', 'PackMan', '', true}; +% {'DepMat1', 'master', 'https://github.com/OmidS/depmat.git', 'depmat1', 'f3810b050186a2e1e5e3fbdb64dd7cd8f3bc8528', false}; +% {'DepMat2', 'master', 'https://github.com/OmidS/depmat.git', 'depmat2', '95fe15dc04406846857e1601f5954a1b4997313b', false}; +% ]; +% depList = cell2struct(depList, {'Name', 'Branch', 'Url', 'FolderName', 'Commit', 'GetLatest'}, 2); +% +% pm = prepareTestEnvironmentAndInstall(depList); +% +% depDir2 = fullfile(pm.depDirPath, depList(2).FolderName); +% depDir3 = fullfile(pm.depDirPath, depList(3).FolderName); +% addedFile = 'TestRepoList.m'; % This is a file we expect to exist in commit 2 but not in commit 1 +% +% verifyTrue(testCase, exist( fullfile(depDir2, addedFile) , 'file')==false ); +% verifyTrue(testCase, exist( fullfile(depDir3, addedFile) , 'file')~=false ); +% +% % Check commit ids in package file +% depListOnFile = PackMan.loadFromPackageFile( pm.packageFilePath ); +% for i = 2:length(depList) +% rId = find( strcmp( {depListOnFile.Name}, depList(i).Name) ); +% verifyEqual(testCase, depListOnFile(rId).Commit, depList(i).Commit ); +% end +% end +% +% function testThatPackManAutoInstallsOnlyWhenItHasNoOutput(testCase) +% % Test specific code +% depList = [ +% {'PackMan', 'release', 'https://github.com/DanielAtKrypton/PackMan.git', 'PackMan', '', true}; +% {'DepMat1', 'master', 'https://github.com/OmidS/depmat.git', 'depmat1', '', false}; +% ]; +% +% depList = cell2struct(depList, {'Name', 'Branch', 'Url', 'FolderName', 'Commit', 'GetLatest'}, 2); +% +% prepareTestEnvironment(); +% externalFolder = fullfile(pwd, 'source', 'external'); +% packageDir = fullfile(externalFolder, depList(2).FolderName); +% verifyTrue(testCase, exist( packageDir , 'dir')==false ); +% +% pm = installDeps(depList); +% verifyTrue(testCase, exist( packageDir , 'dir')==false ); +% +% pm.install(); +% verifyTrue(testCase, exist( packageDir , 'dir')~=false ); +% +% depList = [ +% {'PackMan', 'release', 'https://github.com/DanielAtKrypton/PackMan.git', 'PackMan', '', true}; +% {'DepMat1', 'master', 'https://github.com/OmidS/depmat.git', 'depmat1', '', false}; +% {'DepMat2', 'master', 'https://github.com/OmidS/depmat.git', 'depmat2', '', false}; +% ]; +% depList = cell2struct(depList, {'Name', 'Branch', 'Url', 'FolderName', 'Commit', 'GetLatest'}, 2); +% +% prepareTestEnvironment(); +% packageDir = fullfile(externalFolder, depList(3).FolderName); +% verifyTrue(testCase, exist( packageDir , 'dir')==false ); +% installDeps(depList); +% verifyTrue(testCase, exist( packageDir , 'dir')~=false ); +% end +% +% function testThatPackManRejectsInvalidDepLists(testCase) +% % Test specific code +% depList = [ +% {'PackMan', 'release', 'https://github.com/DanielAtKrypton/PackMan.git', 'PackMan', '', true}; +% {'DepMat', 'master', 'https://github.com/OmidS/depmat.git', 'depmat1', 'f3810b050186a2e1e5e3fbdb64dd7cd8f3bc8528', false}; +% {'DepMat', 'master', 'https://github.com/OmidS/depmat.git', 'depmat2', '95fe15dc04406846857e1601f5954a1b4997313b', false}; +% ]; +% depList = cell2struct(depList, {'Name', 'Branch', 'Url', 'FolderName', 'Commit', 'GetLatest'}, 2); +% prepareTestEnvironment(); +% verifyError(testCase, @()( installDeps(depList) ), 'PackMan:DepListError' ); +% end -function testThatPackManFetchesRepos(testCase) +function testThatPackManReturnsDepPaths(testCase) % Test specific code depList = [ - {'PackMan', 'release', 'https://github.com/DanielAtKrypton/PackMan.git', 'PackMan', '', true}; + {'PackMan', 'release', 'https://github.com/DanielAtKrypton/PackMan.git', 'PackMan', '', true}; {'DepMat', 'master', 'https://github.com/OmidS/depmat.git', 'depmat', '', true}; ]; - depList = cell2struct(depList, {'Name', 'Branch', 'Url', 'FolderName', 'Commit', 'GetLatest'}, 2); - - pm = prepareTestEnvironmentAndInstall(depList); - - for i=1:length(depList) - depDir = fullfile(pm.depDirPath, depList(i).FolderName); - verifyTrue(testCase, exist(depDir, 'dir')~=false ); - end - - depListOnFile = PackMan.loadFromPackageFile( pm.packageFilePath ); - - verifyEqual(testCase,length(depList), length(depListOnFile)); - for i = 1:length(depList) - rId = find( strcmp( {depListOnFile.Name}, depList(i).Name) ); - verifyEqual(testCase, depList(i).Url, depListOnFile(rId).Url); - end -end - -function testThatPackManCanFetchesSpecificCommits(testCase) - % Test specific code - depList = [ - {'PackMan', 'release', 'https://github.com/DanielAtKrypton/PackMan.git', 'PackMan', '', true}; - {'DepMat1', 'master', 'https://github.com/OmidS/depmat.git', 'depmat1', 'f3810b050186a2e1e5e3fbdb64dd7cd8f3bc8528', false}; - {'DepMat2', 'master', 'https://github.com/OmidS/depmat.git', 'depmat2', '95fe15dc04406846857e1601f5954a1b4997313b', false}; - ]; depList = cell2struct(depList, {'Name', 'Branch', 'Url', 'FolderName', 'Commit', 'GetLatest'}, 2); - pm = prepareTestEnvironmentAndInstall(depList); - - depDir2 = fullfile(pm.depDirPath, depList(2).FolderName); - depDir3 = fullfile(pm.depDirPath, depList(3).FolderName); - addedFile = 'TestRepoList.m'; % This is a file we expect to exist in commit 2 but not in commit 1 - - verifyTrue(testCase, exist( fullfile(depDir2, addedFile) , 'file')==false ); - verifyTrue(testCase, exist( fullfile(depDir3, addedFile) , 'file')~=false ); - - % Check commit ids in package file - depListOnFile = PackMan.loadFromPackageFile( pm.packageFilePath ); - for i = 2:length(depList) - rId = find( strcmp( {depListOnFile.Name}, depList(i).Name) ); - verifyEqual(testCase, depListOnFile(rId).Commit, depList(i).Commit ); - end -end - -function testThatPackManAutoInstallsOnlyWhenItHasNoOutput(testCase) - % Test specific code - depList = [ - {'PackMan', 'release', 'https://github.com/DanielAtKrypton/PackMan.git', 'PackMan', '', true}; - {'DepMat1', 'master', 'https://github.com/OmidS/depmat.git', 'depmat1', '', false}; - ]; - - depList = cell2struct(depList, {'Name', 'Branch', 'Url', 'FolderName', 'Commit', 'GetLatest'}, 2); - - prepareTestEnvironment(); - externalFolder = fullfile(pwd, 'source', 'external'); - packageDir = fullfile(externalFolder, depList(2).FolderName); - verifyTrue(testCase, exist( packageDir , 'dir')==false ); - - pm = installDeps(depList); - verifyTrue(testCase, exist( packageDir , 'dir')==false ); - - pm.install(); - verifyTrue(testCase, exist( packageDir , 'dir')~=false ); - - depList = [ - {'PackMan', 'release', 'https://github.com/DanielAtKrypton/PackMan.git', 'PackMan', '', true}; - {'DepMat1', 'master', 'https://github.com/OmidS/depmat.git', 'depmat1', '', false}; - {'DepMat2', 'master', 'https://github.com/OmidS/depmat.git', 'depmat2', '', false}; + paths = pm.genPath(); + expectedPaths = [ + {pm.parentDir } + {fullfile(pm.parentDir, 'source') } + {fullfile(pm.parentDir, 'source', 'external') } + {fullfile(pm.parentDir, 'source', 'external', 'PackMan') } + {fullfile(pm.parentDir, 'source', 'external', 'PackMan', 'source') } + {fullfile(pm.parentDir, 'source', 'external', 'depmat') } + {fullfile(pm.parentDir, 'source', 'external', 'depmat', 'tests') } + {fullfile(pm.parentDir, 'source', 'tests') } ]; - depList = cell2struct(depList, {'Name', 'Branch', 'Url', 'FolderName', 'Commit', 'GetLatest'}, 2); - - prepareTestEnvironment(); - packageDir = fullfile(externalFolder, depList(3).FolderName); - verifyTrue(testCase, exist( packageDir , 'dir')==false ); - installDeps(depList); - verifyTrue(testCase, exist( packageDir , 'dir')~=false ); + verifyEqual(testCase, paths, expectedPaths); end - -function testThatPackManRejectsInvalidDepLists(testCase) - % Test specific code - depList = [ - {'PackMan', 'release', 'https://github.com/DanielAtKrypton/PackMan.git', 'PackMan', '', true}; - {'DepMat', 'master', 'https://github.com/OmidS/depmat.git', 'depmat1', 'f3810b050186a2e1e5e3fbdb64dd7cd8f3bc8528', false}; - {'DepMat', 'master', 'https://github.com/OmidS/depmat.git', 'depmat2', '95fe15dc04406846857e1601f5954a1b4997313b', false}; - ]; - depList = cell2struct(depList, {'Name', 'Branch', 'Url', 'FolderName', 'Commit', 'GetLatest'}, 2); - prepareTestEnvironment(); - verifyError(testCase, @()( installDeps(depList) ), 'PackMan:DepListError' ); -end - -% function testThatPackManReturnsDepPaths(testCase) -% % Test specific code -% depList = {'DepMat', 'master', 'https://github.com/OmidS/depmat.git', 'depmat', '', true}; -% depList = cell2struct(depList, {'Name', 'Branch', 'Url', 'FolderName', 'Commit', 'GetLatest'}, 2); -% pm = PackMan( depList ); -% pm.install(); -% paths = pm.genPath(); -% expectedPaths = [fullfile(pm.parentDir, './external/depmat/tests'),';', ... -% fullfile(pm.parentDir, './external/depmat'),';', ... -% pm.parentDir,';']; -% verifyEqual(testCase, paths, expectedPaths); -% end % % function testThatPackManRecursiveWorks(testCase) % % Test specific code From 0787c53e2a23777131bdbad6c24ea95d04d1d512 Mon Sep 17 00:00:00 2001 From: Daniel Kaminski de Souza Date: Wed, 18 Mar 2020 08:39:24 -0400 Subject: [PATCH 057/143] :bug: Fix PackMan. --- source/PackMan.m | 4 +-- source/tests/testPackMan.m | 65 ++++++++++++++++++++++++-------------- 2 files changed, 42 insertions(+), 27 deletions(-) diff --git a/source/PackMan.m b/source/PackMan.m index c7b0ea8..8dc370d 100644 --- a/source/PackMan.m +++ b/source/PackMan.m @@ -309,9 +309,7 @@ function recurse( obj, alreadyInstalled, depth ) if (~strcmp(dep.Name,'PackMan')) generatedPath = pm.genPath; - generatedPathWithoutLastSemicolon = generatedPath(1:end-1); - genPaths = split(generatedPathWithoutLastSemicolon, ';'); - if (all(cellfun(@exist, genPaths)== 7)) + if (all(cellfun(@exist, generatedPath)== 7)) oldPath = path; addpath(generatedPath{:}); s = which('installDeps.m', '-ALL'); diff --git a/source/tests/testPackMan.m b/source/tests/testPackMan.m index f338473..ca1c1eb 100644 --- a/source/tests/testPackMan.m +++ b/source/tests/testPackMan.m @@ -145,12 +145,35 @@ % verifyError(testCase, @()( installDeps(depList) ), 'PackMan:DepListError' ); % end -function testThatPackManReturnsDepPaths(testCase) +% function testThatPackManReturnsDepPaths(testCase) +% % Test specific code +% depList = [ +% {'PackMan', 'release', 'https://github.com/DanielAtKrypton/PackMan.git', 'PackMan', '', true}; +% {'DepMat', 'master', 'https://github.com/OmidS/depmat.git', 'depmat', '', true}; +% ]; +% depList = cell2struct(depList, {'Name', 'Branch', 'Url', 'FolderName', 'Commit', 'GetLatest'}, 2); +% pm = prepareTestEnvironmentAndInstall(depList); +% paths = pm.genPath(); +% expectedPaths = [ +% {pm.parentDir } +% {fullfile(pm.parentDir, 'source') } +% {fullfile(pm.parentDir, 'source', 'external') } +% {fullfile(pm.parentDir, 'source', 'external', 'PackMan') } +% {fullfile(pm.parentDir, 'source', 'external', 'PackMan', 'source') } +% {fullfile(pm.parentDir, 'source', 'external', 'depmat') } +% {fullfile(pm.parentDir, 'source', 'external', 'depmat', 'tests') } +% {fullfile(pm.parentDir, 'source', 'tests') } +% ]; +% verifyEqual(testCase, paths, expectedPaths); +% end +% +function testThatPackManRecursiveWorks(testCase) % Test specific code depList = [ - {'PackMan', 'release', 'https://github.com/DanielAtKrypton/PackMan.git', 'PackMan', '', true}; - {'DepMat', 'master', 'https://github.com/OmidS/depmat.git', 'depmat', '', true}; + {'PackMan', 'release', 'https://github.com/DanielAtKrypton/PackMan.git', 'PackMan', '', true}; + {'matlabPackManRecursiveSample', 'master', 'https://github.com/OmidS/matlabPackManRecursiveSample.git', 'matlabPackManRecursiveSample', '', true}; ]; + depList = cell2struct(depList, {'Name', 'Branch', 'Url', 'FolderName', 'Commit', 'GetLatest'}, 2); pm = prepareTestEnvironmentAndInstall(depList); paths = pm.genPath(); @@ -160,30 +183,24 @@ function testThatPackManReturnsDepPaths(testCase) {fullfile(pm.parentDir, 'source', 'external') } {fullfile(pm.parentDir, 'source', 'external', 'PackMan') } {fullfile(pm.parentDir, 'source', 'external', 'PackMan', 'source') } - {fullfile(pm.parentDir, 'source', 'external', 'depmat') } - {fullfile(pm.parentDir, 'source', 'external', 'depmat', 'tests') } - {fullfile(pm.parentDir, 'source', 'tests') } - ]; + {fullfile(pm.parentDir, 'source', 'external', 'matlabPackManRecursiveSample') } + {fullfile(pm.parentDir, 'source', 'external', 'matlabPackManRecursiveSample', 'external') } + {fullfile(pm.parentDir, 'source', 'external', 'matlabPackManRecursiveSample', 'external', 'PackMan') } + {fullfile(pm.parentDir, 'source', 'external', 'matlabPackManRecursiveSample', 'external', 'PackManRecursiveSample') } + {fullfile(pm.parentDir, 'source', 'external', 'matlabPackManRecursiveSample', 'external', 'PackMan', 'source') } + {fullfile(pm.parentDir, 'source', 'external', 'matlabPackManRecursiveSample', 'external', 'PackMan', 'source', 'tests') } + {fullfile(pm.parentDir, 'source', 'tests') } + ]; + expectedPaths = [fullfile(pm.parentDir, './external/matlabPackManRecursiveSample/external/depmat/tests'),';', ... + fullfile(pm.parentDir, './external/matlabPackManRecursiveSample/external/depmat'),';', ... + fullfile(pm.parentDir, './external/matlabPackManRecursiveSample/external/matlabPackManSample/external/depmat/tests'),';', ... + fullfile(pm.parentDir, './external/matlabPackManRecursiveSample/external/matlabPackManSample/external/depmat'),';', ... + fullfile(pm.parentDir, './external/matlabPackManRecursiveSample/external/matlabPackManSample'),';', ... + fullfile(pm.parentDir, './external/matlabPackManRecursiveSample'),';', ... + pm.parentDir,';']; verifyEqual(testCase, paths, expectedPaths); end % -% function testThatPackManRecursiveWorks(testCase) -% % Test specific code -% depList = {'matlabPackManRecursiveSample', 'master', 'https://github.com/OmidS/matlabPackManRecursiveSample.git', 'matlabPackManRecursiveSample', '', true}; -% depList = cell2struct(depList, {'Name', 'Branch', 'Url', 'FolderName', 'Commit', 'GetLatest'}, 2); -% pm = PackMan( depList ); -% pm.install(); -% paths = pm.genPath(); -% expectedPaths = [fullfile(pm.parentDir, './external/matlabPackManRecursiveSample/external/depmat/tests'),';', ... -% fullfile(pm.parentDir, './external/matlabPackManRecursiveSample/external/depmat'),';', ... -% fullfile(pm.parentDir, './external/matlabPackManRecursiveSample/external/matlabPackManSample/external/depmat/tests'),';', ... -% fullfile(pm.parentDir, './external/matlabPackManRecursiveSample/external/matlabPackManSample/external/depmat'),';', ... -% fullfile(pm.parentDir, './external/matlabPackManRecursiveSample/external/matlabPackManSample'),';', ... -% fullfile(pm.parentDir, './external/matlabPackManRecursiveSample'),';', ... -% pm.parentDir,';']; -% verifyEqual(testCase, paths, expectedPaths); -% end -% % %% Helper functions % function [depDir, packageFile] = getPaths() % From 3f530fc9cdb78358da05c6d283caec55dd9cfc73 Mon Sep 17 00:00:00 2001 From: Daniel Kaminski de Souza Date: Wed, 18 Mar 2020 08:45:43 -0400 Subject: [PATCH 058/143] :bug: Fix PackMan. --- source/PackMan.m | 1 - 1 file changed, 1 deletion(-) diff --git a/source/PackMan.m b/source/PackMan.m index 8dc370d..fe03747 100644 --- a/source/PackMan.m +++ b/source/PackMan.m @@ -319,7 +319,6 @@ function recurse( obj, alreadyInstalled, depth ) dpDirPth = fileparts(strrep(installDepsPath,depDir,'')); getDepListFunction = fullfile(depDir, dpDirPth, 'getDepList.m'); run(getDepListFunction); - structureArray = ans; pm = PackMan(ans, fullfile(fileparts(installDepsPath),'external') , '', depDir); end path(oldPath); From 56aa55106312c1d46990552212aca8502288ce5c Mon Sep 17 00:00:00 2001 From: Daniel Kaminski de Souza Date: Wed, 18 Mar 2020 09:05:50 -0400 Subject: [PATCH 059/143] :white_check_mark: Add all tests. --- source/tests/testPackMan.m | 380 ++++++++++++++++--------------------- 1 file changed, 164 insertions(+), 216 deletions(-) diff --git a/source/tests/testPackMan.m b/source/tests/testPackMan.m index ca1c1eb..adc133f 100644 --- a/source/tests/testPackMan.m +++ b/source/tests/testPackMan.m @@ -8,172 +8,149 @@ end %% Test Functions -% function testThatPackManConstructorWorks(testCase) -% % Test specific code -% depList = {'PackMan', 'release', 'https://github.com/DanielAtKrypton/PackMan.git', 'PackMan', '', true}; -% depList = cell2struct(depList, {'Name', 'Branch', 'Url', 'FolderName', 'Commit', 'GetLatest'}, 2); -% -% pm = prepareTestEnvironmentAndInstall(depList); -% verifyEqual(testCase,class(pm),'PackMan'); -% end -% -% function testThatPackManRelativePathsWork(testCase) -% % Test specific code -% depList = {'PackMan', 'release', 'https://github.com/DanielAtKrypton/PackMan.git', 'PackMan', '', true}; -% depList = cell2struct(depList, {'Name', 'Branch', 'Url', 'FolderName', 'Commit', 'GetLatest'}, 2); -% -% pm = prepareTestEnvironmentAndInstall(depList); -% currentWorkingDir = pwd; -% expectedDepDirPath = fullfile(currentWorkingDir, 'source', 'external'); -% verifyEqual(testCase,pm.depDirPath, expectedDepDirPath); -% -% expectedPackagePath = fullfile(currentWorkingDir, './package.json'); -% verifyEqual(testCase,pm.packageFilePath, expectedPackagePath); -% end -% -% function testThatPackManGeneratesPackageFile(testCase) -% % Test specific code -% depList = [ -% {'PackMan', 'release', 'https://github.com/DanielAtKrypton/PackMan.git', 'PackMan', '', true}; -% {'DepMat', 'master', 'https://github.com/OmidS/depmat.git', 'depmat', '', true}; -% ]; -% depList = cell2struct(depList, {'Name', 'Branch', 'Url', 'FolderName', 'Commit', 'GetLatest'}, 2); -% -% prepareTestEnvironment(); -% pm = installDeps(depList); -% -% verifyTrue(testCase, ~exist(pm.packageFilePath, 'file')) -% -% pm.install(); -% -% verifyTrue(testCase, exist(pm.packageFilePath, 'file')~=false ); -% end -% -% function testThatPackManFetchesRepos(testCase) -% % Test specific code -% depList = [ -% {'PackMan', 'release', 'https://github.com/DanielAtKrypton/PackMan.git', 'PackMan', '', true}; -% {'DepMat', 'master', 'https://github.com/OmidS/depmat.git', 'depmat', '', true}; -% ]; -% depList = cell2struct(depList, {'Name', 'Branch', 'Url', 'FolderName', 'Commit', 'GetLatest'}, 2); -% -% pm = prepareTestEnvironmentAndInstall(depList); -% -% for i=1:length(depList) -% depDir = fullfile(pm.depDirPath, depList(i).FolderName); -% verifyTrue(testCase, exist(depDir, 'dir')~=false ); -% end -% -% depListOnFile = PackMan.loadFromPackageFile( pm.packageFilePath ); -% -% verifyEqual(testCase,length(depList), length(depListOnFile)); -% for i = 1:length(depList) -% rId = find( strcmp( {depListOnFile.Name}, depList(i).Name) ); -% verifyEqual(testCase, depList(i).Url, depListOnFile(rId).Url); -% end -% end -% -% function testThatPackManCanFetchesSpecificCommits(testCase) -% % Test specific code -% depList = [ -% {'PackMan', 'release', 'https://github.com/DanielAtKrypton/PackMan.git', 'PackMan', '', true}; -% {'DepMat1', 'master', 'https://github.com/OmidS/depmat.git', 'depmat1', 'f3810b050186a2e1e5e3fbdb64dd7cd8f3bc8528', false}; -% {'DepMat2', 'master', 'https://github.com/OmidS/depmat.git', 'depmat2', '95fe15dc04406846857e1601f5954a1b4997313b', false}; -% ]; -% depList = cell2struct(depList, {'Name', 'Branch', 'Url', 'FolderName', 'Commit', 'GetLatest'}, 2); -% -% pm = prepareTestEnvironmentAndInstall(depList); -% -% depDir2 = fullfile(pm.depDirPath, depList(2).FolderName); -% depDir3 = fullfile(pm.depDirPath, depList(3).FolderName); -% addedFile = 'TestRepoList.m'; % This is a file we expect to exist in commit 2 but not in commit 1 -% -% verifyTrue(testCase, exist( fullfile(depDir2, addedFile) , 'file')==false ); -% verifyTrue(testCase, exist( fullfile(depDir3, addedFile) , 'file')~=false ); -% -% % Check commit ids in package file -% depListOnFile = PackMan.loadFromPackageFile( pm.packageFilePath ); -% for i = 2:length(depList) -% rId = find( strcmp( {depListOnFile.Name}, depList(i).Name) ); -% verifyEqual(testCase, depListOnFile(rId).Commit, depList(i).Commit ); -% end -% end -% -% function testThatPackManAutoInstallsOnlyWhenItHasNoOutput(testCase) -% % Test specific code -% depList = [ -% {'PackMan', 'release', 'https://github.com/DanielAtKrypton/PackMan.git', 'PackMan', '', true}; -% {'DepMat1', 'master', 'https://github.com/OmidS/depmat.git', 'depmat1', '', false}; -% ]; -% -% depList = cell2struct(depList, {'Name', 'Branch', 'Url', 'FolderName', 'Commit', 'GetLatest'}, 2); -% -% prepareTestEnvironment(); -% externalFolder = fullfile(pwd, 'source', 'external'); -% packageDir = fullfile(externalFolder, depList(2).FolderName); -% verifyTrue(testCase, exist( packageDir , 'dir')==false ); -% -% pm = installDeps(depList); -% verifyTrue(testCase, exist( packageDir , 'dir')==false ); -% -% pm.install(); -% verifyTrue(testCase, exist( packageDir , 'dir')~=false ); -% -% depList = [ -% {'PackMan', 'release', 'https://github.com/DanielAtKrypton/PackMan.git', 'PackMan', '', true}; -% {'DepMat1', 'master', 'https://github.com/OmidS/depmat.git', 'depmat1', '', false}; -% {'DepMat2', 'master', 'https://github.com/OmidS/depmat.git', 'depmat2', '', false}; -% ]; -% depList = cell2struct(depList, {'Name', 'Branch', 'Url', 'FolderName', 'Commit', 'GetLatest'}, 2); -% -% prepareTestEnvironment(); -% packageDir = fullfile(externalFolder, depList(3).FolderName); -% verifyTrue(testCase, exist( packageDir , 'dir')==false ); -% installDeps(depList); -% verifyTrue(testCase, exist( packageDir , 'dir')~=false ); -% end -% -% function testThatPackManRejectsInvalidDepLists(testCase) -% % Test specific code -% depList = [ -% {'PackMan', 'release', 'https://github.com/DanielAtKrypton/PackMan.git', 'PackMan', '', true}; -% {'DepMat', 'master', 'https://github.com/OmidS/depmat.git', 'depmat1', 'f3810b050186a2e1e5e3fbdb64dd7cd8f3bc8528', false}; -% {'DepMat', 'master', 'https://github.com/OmidS/depmat.git', 'depmat2', '95fe15dc04406846857e1601f5954a1b4997313b', false}; -% ]; -% depList = cell2struct(depList, {'Name', 'Branch', 'Url', 'FolderName', 'Commit', 'GetLatest'}, 2); -% prepareTestEnvironment(); -% verifyError(testCase, @()( installDeps(depList) ), 'PackMan:DepListError' ); -% end +function testThatPackManConstructorWorks(testCase) + % Test specific code + depList = {'PackMan', 'release', 'https://github.com/DanielAtKrypton/PackMan.git', 'PackMan', '', true}; + depList = cell2struct(depList, {'Name', 'Branch', 'Url', 'FolderName', 'Commit', 'GetLatest'}, 2); -% function testThatPackManReturnsDepPaths(testCase) -% % Test specific code -% depList = [ -% {'PackMan', 'release', 'https://github.com/DanielAtKrypton/PackMan.git', 'PackMan', '', true}; -% {'DepMat', 'master', 'https://github.com/OmidS/depmat.git', 'depmat', '', true}; -% ]; -% depList = cell2struct(depList, {'Name', 'Branch', 'Url', 'FolderName', 'Commit', 'GetLatest'}, 2); -% pm = prepareTestEnvironmentAndInstall(depList); -% paths = pm.genPath(); -% expectedPaths = [ -% {pm.parentDir } -% {fullfile(pm.parentDir, 'source') } -% {fullfile(pm.parentDir, 'source', 'external') } -% {fullfile(pm.parentDir, 'source', 'external', 'PackMan') } -% {fullfile(pm.parentDir, 'source', 'external', 'PackMan', 'source') } -% {fullfile(pm.parentDir, 'source', 'external', 'depmat') } -% {fullfile(pm.parentDir, 'source', 'external', 'depmat', 'tests') } -% {fullfile(pm.parentDir, 'source', 'tests') } -% ]; -% verifyEqual(testCase, paths, expectedPaths); -% end -% -function testThatPackManRecursiveWorks(testCase) + pm = prepareTestEnvironmentAndInstall(depList); + verifyEqual(testCase,class(pm),'PackMan'); +end + +function testThatPackManRelativePathsWork(testCase) + % Test specific code + depList = {'PackMan', 'release', 'https://github.com/DanielAtKrypton/PackMan.git', 'PackMan', '', true}; + depList = cell2struct(depList, {'Name', 'Branch', 'Url', 'FolderName', 'Commit', 'GetLatest'}, 2); + + pm = prepareTestEnvironmentAndInstall(depList); + currentWorkingDir = pwd; + expectedDepDirPath = fullfile(currentWorkingDir, 'source', 'external'); + verifyEqual(testCase,pm.depDirPath, expectedDepDirPath); + + expectedPackagePath = fullfile(currentWorkingDir, './package.json'); + verifyEqual(testCase,pm.packageFilePath, expectedPackagePath); +end + +function testThatPackManGeneratesPackageFile(testCase) % Test specific code depList = [ - {'PackMan', 'release', 'https://github.com/DanielAtKrypton/PackMan.git', 'PackMan', '', true}; - {'matlabPackManRecursiveSample', 'master', 'https://github.com/OmidS/matlabPackManRecursiveSample.git', 'matlabPackManRecursiveSample', '', true}; + {'PackMan', 'release', 'https://github.com/DanielAtKrypton/PackMan.git', 'PackMan', '', true}; + {'DepMat', 'master', 'https://github.com/OmidS/depmat.git', 'depmat', '', true}; + ]; + depList = cell2struct(depList, {'Name', 'Branch', 'Url', 'FolderName', 'Commit', 'GetLatest'}, 2); + + prepareTestEnvironment(); + pm = installDeps(depList); + + verifyTrue(testCase, ~exist(pm.packageFilePath, 'file')) + + pm.install(); + + verifyTrue(testCase, exist(pm.packageFilePath, 'file')~=false ); +end + +function testThatPackManFetchesRepos(testCase) + % Test specific code + depList = [ + {'PackMan', 'release', 'https://github.com/DanielAtKrypton/PackMan.git', 'PackMan', '', true}; + {'DepMat', 'master', 'https://github.com/OmidS/depmat.git', 'depmat', '', true}; + ]; + depList = cell2struct(depList, {'Name', 'Branch', 'Url', 'FolderName', 'Commit', 'GetLatest'}, 2); + + pm = prepareTestEnvironmentAndInstall(depList); + + for i=1:length(depList) + depDir = fullfile(pm.depDirPath, depList(i).FolderName); + verifyTrue(testCase, exist(depDir, 'dir')~=false ); + end + + depListOnFile = PackMan.loadFromPackageFile( pm.packageFilePath ); + + verifyEqual(testCase,length(depList), length(depListOnFile)); + for i = 1:length(depList) + rId = strcmp( {depListOnFile.Name}, depList(i).Name) ; + verifyEqual(testCase, depList(i).Url, depListOnFile(rId).Url); + end +end + +function testThatPackManCanFetchesSpecificCommits(testCase) + % Test specific code + depList = [ + {'PackMan', 'release', 'https://github.com/DanielAtKrypton/PackMan.git', 'PackMan', '', true}; + {'DepMat1', 'master', 'https://github.com/OmidS/depmat.git', 'depmat1', 'f3810b050186a2e1e5e3fbdb64dd7cd8f3bc8528', false}; + {'DepMat2', 'master', 'https://github.com/OmidS/depmat.git', 'depmat2', '95fe15dc04406846857e1601f5954a1b4997313b', false}; + ]; + depList = cell2struct(depList, {'Name', 'Branch', 'Url', 'FolderName', 'Commit', 'GetLatest'}, 2); + + pm = prepareTestEnvironmentAndInstall(depList); + + depDir2 = fullfile(pm.depDirPath, depList(2).FolderName); + depDir3 = fullfile(pm.depDirPath, depList(3).FolderName); + addedFile = 'TestRepoList.m'; % This is a file we expect to exist in commit 2 but not in commit 1 + + verifyTrue(testCase, exist( fullfile(depDir2, addedFile) , 'file')==false ); + verifyTrue(testCase, exist( fullfile(depDir3, addedFile) , 'file')~=false ); + + % Check commit ids in package file + depListOnFile = PackMan.loadFromPackageFile( pm.packageFilePath ); + for i = 2:length(depList) + rId = strcmp( {depListOnFile.Name}, depList(i).Name) ; + verifyEqual(testCase, depListOnFile(rId).Commit, depList(i).Commit ); + end +end + +function testThatPackManAutoInstallsOnlyWhenItHasNoOutput(testCase) + % Test specific code + depList = [ + {'PackMan', 'release', 'https://github.com/DanielAtKrypton/PackMan.git', 'PackMan', '', true}; + {'DepMat1', 'master', 'https://github.com/OmidS/depmat.git', 'depmat1', '', false}; ]; + depList = cell2struct(depList, {'Name', 'Branch', 'Url', 'FolderName', 'Commit', 'GetLatest'}, 2); + + prepareTestEnvironment(); + externalFolder = fullfile(pwd, 'source', 'external'); + packageDir = fullfile(externalFolder, depList(2).FolderName); + verifyTrue(testCase, exist( packageDir , 'dir')==false ); + + pm = installDeps(depList); + verifyTrue(testCase, exist( packageDir , 'dir')==false ); + + pm.install(); + verifyTrue(testCase, exist( packageDir , 'dir')~=false ); + + depList = [ + {'PackMan', 'release', 'https://github.com/DanielAtKrypton/PackMan.git', 'PackMan', '', true}; + {'DepMat1', 'master', 'https://github.com/OmidS/depmat.git', 'depmat1', '', false}; + {'DepMat2', 'master', 'https://github.com/OmidS/depmat.git', 'depmat2', '', false}; + ]; + depList = cell2struct(depList, {'Name', 'Branch', 'Url', 'FolderName', 'Commit', 'GetLatest'}, 2); + + prepareTestEnvironment(); + packageDir = fullfile(externalFolder, depList(3).FolderName); + verifyTrue(testCase, exist( packageDir , 'dir')==false ); + installDeps(depList); + verifyTrue(testCase, exist( packageDir , 'dir')~=false ); +end + +function testThatPackManRejectsInvalidDepLists(testCase) + % Test specific code + depList = [ + {'PackMan', 'release', 'https://github.com/DanielAtKrypton/PackMan.git', 'PackMan', '', true}; + {'DepMat', 'master', 'https://github.com/OmidS/depmat.git', 'depmat1', 'f3810b050186a2e1e5e3fbdb64dd7cd8f3bc8528', false}; + {'DepMat', 'master', 'https://github.com/OmidS/depmat.git', 'depmat2', '95fe15dc04406846857e1601f5954a1b4997313b', false}; + ]; + depList = cell2struct(depList, {'Name', 'Branch', 'Url', 'FolderName', 'Commit', 'GetLatest'}, 2); + prepareTestEnvironment(); + verifyError(testCase, @()( installDeps(depList) ), 'PackMan:DepListError' ); +end + +function testThatPackManReturnsDepPaths(testCase) + % Test specific code + depList = [ + {'PackMan', 'release', 'https://github.com/DanielAtKrypton/PackMan.git', 'PackMan', '', true}; + {'DepMat', 'master', 'https://github.com/OmidS/depmat.git', 'depmat', '', true}; + ]; depList = cell2struct(depList, {'Name', 'Branch', 'Url', 'FolderName', 'Commit', 'GetLatest'}, 2); pm = prepareTestEnvironmentAndInstall(depList); paths = pm.genPath(); @@ -183,60 +160,31 @@ function testThatPackManRecursiveWorks(testCase) {fullfile(pm.parentDir, 'source', 'external') } {fullfile(pm.parentDir, 'source', 'external', 'PackMan') } {fullfile(pm.parentDir, 'source', 'external', 'PackMan', 'source') } - {fullfile(pm.parentDir, 'source', 'external', 'matlabPackManRecursiveSample') } - {fullfile(pm.parentDir, 'source', 'external', 'matlabPackManRecursiveSample', 'external') } - {fullfile(pm.parentDir, 'source', 'external', 'matlabPackManRecursiveSample', 'external', 'PackMan') } - {fullfile(pm.parentDir, 'source', 'external', 'matlabPackManRecursiveSample', 'external', 'PackManRecursiveSample') } - {fullfile(pm.parentDir, 'source', 'external', 'matlabPackManRecursiveSample', 'external', 'PackMan', 'source') } - {fullfile(pm.parentDir, 'source', 'external', 'matlabPackManRecursiveSample', 'external', 'PackMan', 'source', 'tests') } - {fullfile(pm.parentDir, 'source', 'tests') } - ]; - expectedPaths = [fullfile(pm.parentDir, './external/matlabPackManRecursiveSample/external/depmat/tests'),';', ... - fullfile(pm.parentDir, './external/matlabPackManRecursiveSample/external/depmat'),';', ... - fullfile(pm.parentDir, './external/matlabPackManRecursiveSample/external/matlabPackManSample/external/depmat/tests'),';', ... - fullfile(pm.parentDir, './external/matlabPackManRecursiveSample/external/matlabPackManSample/external/depmat'),';', ... - fullfile(pm.parentDir, './external/matlabPackManRecursiveSample/external/matlabPackManSample'),';', ... - fullfile(pm.parentDir, './external/matlabPackManRecursiveSample'),';', ... - pm.parentDir,';']; + {fullfile(pm.parentDir, 'source', 'external', 'depmat') } + {fullfile(pm.parentDir, 'source', 'external', 'depmat', 'tests') } + {fullfile(pm.parentDir, 'source', 'tests') } + ]; + verifyEqual(testCase, paths, expectedPaths); +end + +function testThatPackManRecursiveWorks(testCase) + % Test specific code + depList = [ + {'PackMan', 'release', 'https://github.com/DanielAtKrypton/PackMan.git', 'PackMan', '', true}; + {'PackManRecursiveSample', 'master', 'https://github.com/DanielAtKrypton/PackManRecursiveSample.git', 'PackManRecursiveSample', '', true}; + ]; + + depList = cell2struct(depList, {'Name', 'Branch', 'Url', 'FolderName', 'Commit', 'GetLatest'}, 2); + pm = prepareTestEnvironmentAndInstall(depList); + paths = pm.genPath(); + expectedPaths = [ + {pm.parentDir } + {fullfile(pm.parentDir, 'source') } + {fullfile(pm.parentDir, 'source', 'external') } + {fullfile(pm.parentDir, 'source', 'external', 'PackMan') } + {fullfile(pm.parentDir, 'source', 'external', 'PackManRecursiveSample') } + {fullfile(pm.parentDir, 'source', 'external', 'PackMan', 'source') } + {fullfile(pm.parentDir, 'source', 'tests') } + ]; verifyEqual(testCase, paths, expectedPaths); end -% -% %% Helper functions -% function [depDir, packageFile] = getPaths() -% -% p = fileparts( mfilename('fullpath') ); -% depDir = fullfile(p, 'external'); -% packageFile = fullfile(p, 'package.mat'); -% -% end -% -% %% Optional file fixtures -% function setupOnce(testCase) % do not change function name -% % set a new path, for example -% addpath('../'); -% -% end -% -% function teardownOnce(testCase) % do not change function name -% % change back to original path, for example -% -% end -% -% %% Optional fresh fixtures -% function setup(testCase) % do not change function name -% % open a figure, for example -% -% [depDir, packageFile] = getPaths(); -% if exist(depDir, 'dir'), delete(depDir); end -% if exist(packageFile, 'file'), delete(packageFile); end -% -% end -% -% function teardown(testCase) % do not change function name -% % close figure, for example -% -% [depDir, packageFile] = getPaths(); -% if exist(depDir, 'dir'), rmdir(depDir, 's'); end -% if exist(packageFile, 'file'), delete(packageFile); end -% -% end \ No newline at end of file From 03d1515afeb0687608345924df83f3fe05995dd6 Mon Sep 17 00:00:00 2001 From: Daniel Kaminski de Souza Date: Wed, 18 Mar 2020 09:38:18 -0400 Subject: [PATCH 060/143] :shirt: Remove warning. --- source/PackMan.m | 1 + 1 file changed, 1 insertion(+) diff --git a/source/PackMan.m b/source/PackMan.m index fe03747..16fb766 100644 --- a/source/PackMan.m +++ b/source/PackMan.m @@ -238,6 +238,7 @@ function recurse( obj, alreadyInstalled, depth ) end paths = unique(paths); + paths = paths(~endsWith(paths, '\private')); % Private directories not allowed in MATLAB path. if nargout > 1, varargout{1} = alreadyAdded; end end From c841029d64ba3f0b0cec9d4e3f6e0bccdd370c0b Mon Sep 17 00:00:00 2001 From: Daniel Kaminski de Souza Date: Mon, 23 Mar 2020 22:30:35 -0400 Subject: [PATCH 061/143] :construction: Development path. --- source/DepMat.m | 8 +- source/DepMatRepositoryUpdater.m | 108 ++++++++++------------ source/{RunCommand.bat => RunCommand.cmd} | 3 +- source/git.m | 38 +++++++- 4 files changed, 90 insertions(+), 67 deletions(-) rename source/{RunCommand.bat => RunCommand.cmd} (65%) diff --git a/source/DepMat.m b/source/DepMat.m index fef7f06..46894ae 100644 --- a/source/DepMat.m +++ b/source/DepMat.m @@ -91,8 +91,12 @@ function setDispHandler(obj, funcHandle) end function installed = isGitInstalled - failure = git('--help'); - installed = ~failure; + installed = true; + try + git('--help'); + catch + installed = false; + end end function fixCurlPath diff --git a/source/DepMatRepositoryUpdater.m b/source/DepMatRepositoryUpdater.m index d8acda2..2249ae2 100644 --- a/source/DepMatRepositoryUpdater.m +++ b/source/DepMatRepositoryUpdater.m @@ -195,15 +195,16 @@ function setDispHandler(obj, funcHandle) return; end - % TODO check this out - [failure, ~] = git('remote update'); - if failure + try + git('remote update'); + catch status = DepMatStatus.GitFailure; return; end - [failure, local_id_head] = git('rev-parse @{0}'); % current head commit - if failure + try + local_id_head = git('rev-parse @{0}'); % current head commit + catch status = DepMatStatus.GitFailure; return; end @@ -216,18 +217,11 @@ function setDispHandler(obj, funcHandle) status = DepMatStatus.UpToDateButWrongHead; end else % Get the latest commit - [failure, local_id] = git(['rev-parse ',obj.RepoDef.Branch,'@{0}']); % Latest local commit - if failure - status = DepMatStatus.GitFailure; - return; - end - [failure, remote_id] = git(['rev-parse ',obj.RepoDef.Branch,'@{u}']); % Latest remote commit - if failure - status = DepMatStatus.GitFailure; - return; - end - [failure, base] = git(['merge-base ',obj.RepoDef.Branch,'@{0} ',obj.RepoDef.Branch,'@{u}']); - if failure + try + local_id = git(['rev-parse ',obj.RepoDef.Branch,'@{0}']); % Latest local commit + remote_id = git(['rev-parse ',obj.RepoDef.Branch,'@{u}']); % Latest remote commit + base = git(['merge-base ',obj.RepoDef.Branch,'@{0} ',obj.RepoDef.Branch,'@{u}']); + catch status = DepMatStatus.GitFailure; return; end @@ -255,17 +249,14 @@ function setDispHandler(obj, funcHandle) end function [success, output] = internalUpdateRepo(obj) - [failure, output] = git(['checkout ',obj.RepoDef.Branch]); % Checkout the branch - if failure - % TODO Shouldn't be output rather than status? - % status = DepMatStatus.GitFailure; - DepMatStatus.GitFailure; + try + output = git(['checkout ', obj.RepoDef.Branch]); % Checkout the branch + output = git('pull'); + catch + success = false; return; end - - [pullResult, output] = git('pull'); - pullResult = ~pullResult; - success = ~isempty(pullResult) && ~isequal(pullResult, 0); + success = true; end function success = internalCloneRepo(obj) @@ -273,21 +264,19 @@ function setDispHandler(obj, funcHandle) % Avoid initialisation if it has already been done, to avoid errors fetchFailure = obj.checkForFetchFailure; if ~fetchFailure - if git('init') - success = false; - return; - end - - if git(['remote add -t ' obj.RepoDef.Branch ' origin ' obj.RepoDef.Url]) + try + git('init'); + git(['remote add -t ' obj.RepoDef.Branch ' origin ' obj.RepoDef.Url]); + catch success = false; return; end end - [failure, ~] = git('fetch'); - if (failure) + try + git('fetch'); + catch obj.setFetchFailure; - success = false; return; end @@ -298,7 +287,9 @@ function setDispHandler(obj, funcHandle) checkoutCmd = ['checkout ' obj.RepoDef.Branch]; end - if git(checkoutCmd) + try + git(checkoutCmd) + catch success = false; return; end @@ -311,29 +302,29 @@ function setDispHandler(obj, funcHandle) end function [success, changed, headCommitId] = internalCheckoutCommit(obj) - [~, local_id_head] = git('rev-parse @{0}'); % current head commit - local_id_head = strrep(local_id_head,newline,''); - [~, local_id_latest] = git(['rev-parse ',obj.RepoDef.Branch,'@{0}']); % Latest local commit - local_id_latest = strrep(local_id_latest,newline,''); - - headCommitId = local_id_head; changed = false; - toCheckoutHash = ''; - if ( obj.RepoDef.GetLatest) && ~strcmp(local_id_head, local_id_latest) - toCheckoutHash = local_id_latest; - elseif ~( obj.RepoDef.GetLatest ) && ~strcmp(local_id_head, obj.RepoDef.Commit) - toCheckoutHash = obj.RepoDef.Commit; - end - if ~isempty(toCheckoutHash) - if git(['checkout ' toCheckoutHash]) - success = false; - % changed = true; - return; + try + local_id_head = git('rev-parse @{0}'); % current head commit + local_id_head = strrep(local_id_head,newline,''); + local_id_latest = git(['rev-parse ',obj.RepoDef.Branch,'@{0}']); % Latest local commit + local_id_latest = strrep(local_id_latest,newline,''); + headCommitId = local_id_head; + toCheckoutHash = ''; + if ( obj.RepoDef.GetLatest) && ~strcmp(local_id_head, local_id_latest) + toCheckoutHash = local_id_latest; + elseif ~( obj.RepoDef.GetLatest ) && ~strcmp(local_id_head, obj.RepoDef.Commit) + toCheckoutHash = obj.RepoDef.Commit; + end + if ~isempty(toCheckoutHash) + git(['checkout ' toCheckoutHash]) + changed = true; + headCommitId = toCheckoutHash; end - changed = true; - headCommitId = toCheckoutHash; + success = true; + catch + success = false; + return; end - success = true; end function setFetchFailure(obj) @@ -359,8 +350,9 @@ function clearFetchFailure(obj) function [status, commitHash] = internalGetHeadHash status = true; - [failure, commitHash] = git('rev-parse HEAD'); - if failure + try + commitHash = git('rev-parse HEAD'); + catch status = DepMatStatus.GitFailure; return; end diff --git a/source/RunCommand.bat b/source/RunCommand.cmd similarity index 65% rename from source/RunCommand.bat rename to source/RunCommand.cmd index d8b1ab3..092a080 100644 --- a/source/RunCommand.bat +++ b/source/RunCommand.cmd @@ -5,7 +5,6 @@ SET cmdToRun=%ALL_BUT_FIRST% echo Executing git command on %~1 repository: %cmdToRun% -for /f %%i in ('%cmdToRun%') do set result=%%i -@echo %result% > %~1CommandOutput +(%cmdToRun%) > %~1CommandOutput exit \ No newline at end of file diff --git a/source/git.m b/source/git.m index 6baaa61..1b80fcc 100644 --- a/source/git.m +++ b/source/git.m @@ -1,4 +1,4 @@ -function [status, result] = git(varargin) +function result = git(varargin) %GIT Summary of this function goes here % Detailed explanation goes here if (nargin == 0) @@ -19,6 +19,11 @@ case 'push' otherwise [status, result] = system(commandString); + if status + ME = MException('Git:couldntExecuteGitCommand', ... + 'git command %s resulted in a failure!', commandString); + throw(ME); + end return; end name = getRepoName(); @@ -26,20 +31,43 @@ fid = fopen(filename , 'wt' ); fclose(fid); - [status, ~] = dos([which('RunCommand.bat') ' ' name ' ' commandString ' &']); + [status, ~] = dos([which('RunCommand.cmd') ' ' name ' ' commandString ' &']); + if status + ME = MException('Git:couldntExecuteGitCommand', ... + 'git command %s resulted in failure!', commandString); + throw(ME); + end + v = ver; + isRoboticsToolboxAvailable = any(strcmp('Robotics System Toolbox', {v.Name})); + desiredRate = 10; + if (isRoboticsToolboxAvailable) + r = robotics.Rate(desiredRate); + reset(r); + end while(true) fid = fopen(filename, 'rt' ); - contents = fscanf(fid, '%s\n'); + contents = textscan(fid,'%s','Delimiter','\n'); + contents = contents{1}; fclose(fid); if ~isempty(contents) delete(filename) break; end - pause(0.2); + if (isRoboticsToolboxAvailable) + waitfor(r); + else + pause(1/desiredRate); + end end result = contents; function name = getRepoName() - [~, result] = system('git rev-parse --show-toplevel'); + commandString = 'git rev-parse --show-toplevel'; + [status, result] = system(commandString); + if status + ME = MException('Git:couldntExecuteGitCommand', ... + 'git command %s resulted in failure!', commandString); + throw(ME); + end result = result(1:end-1); % remove newline. [~,name,~] = fileparts(result); \ No newline at end of file From 523c6a8755a018db8e6990a4b7fb46e0a7db6b3f Mon Sep 17 00:00:00 2001 From: Daniel Kaminski de Souza Date: Tue, 24 Mar 2020 00:19:17 -0400 Subject: [PATCH 062/143] :construction: Development path. --- PackManCommandOutput | 1 + source/DepMatRepositoryUpdater.m | 7 +------ source/git.m | 9 ++++++++- 3 files changed, 10 insertions(+), 7 deletions(-) create mode 100644 PackManCommandOutput diff --git a/PackManCommandOutput b/PackManCommandOutput new file mode 100644 index 0000000..859a2de --- /dev/null +++ b/PackManCommandOutput @@ -0,0 +1 @@ +Fetching origin diff --git a/source/DepMatRepositoryUpdater.m b/source/DepMatRepositoryUpdater.m index 2249ae2..35f4c01 100644 --- a/source/DepMatRepositoryUpdater.m +++ b/source/DepMatRepositoryUpdater.m @@ -197,17 +197,12 @@ function setDispHandler(obj, funcHandle) try git('remote update'); - catch - status = DepMatStatus.GitFailure; - return; - end - - try local_id_head = git('rev-parse @{0}'); % current head commit catch status = DepMatStatus.GitFailure; return; end + local_id_head = strrep(local_id_head,newline,''); if ~obj.RepoDef.GetLatest diff --git a/source/git.m b/source/git.m index 1b80fcc..6a993b5 100644 --- a/source/git.m +++ b/source/git.m @@ -50,7 +50,14 @@ contents = contents{1}; fclose(fid); if ~isempty(contents) - delete(filename) + while(true) + try + delete(filename); + break; + catch + pause(1/desiredRate); + end + end break; end if (isRoboticsToolboxAvailable) From 0de39b254d6bb55c06996e94706a1394f6ac56d1 Mon Sep 17 00:00:00 2001 From: Daniel Kaminski de Souza Date: Tue, 24 Mar 2020 00:22:06 -0400 Subject: [PATCH 063/143] :construction: Development path. --- PackManCommandOutput | 1 - 1 file changed, 1 deletion(-) delete mode 100644 PackManCommandOutput diff --git a/PackManCommandOutput b/PackManCommandOutput deleted file mode 100644 index 859a2de..0000000 --- a/PackManCommandOutput +++ /dev/null @@ -1 +0,0 @@ -Fetching origin From 657dc4a6b6a572d49d0c94d6bdce372c27fa502a Mon Sep 17 00:00:00 2001 From: Daniel Kaminski de Souza Date: Tue, 24 Mar 2020 00:30:46 -0400 Subject: [PATCH 064/143] :construction: Development path. --- source/git.m | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/git.m b/source/git.m index 6a993b5..0eaafb7 100644 --- a/source/git.m +++ b/source/git.m @@ -50,7 +50,7 @@ contents = contents{1}; fclose(fid); if ~isempty(contents) - while(true) + while(exist(filename, 'file')) try delete(filename); break; From e98f27c355214bda1366e7601d0a6102c2e6d6a7 Mon Sep 17 00:00:00 2001 From: Daniel Kaminski de Souza Date: Tue, 24 Mar 2020 00:42:00 -0400 Subject: [PATCH 065/143] :construction: Development path. --- source/git.m | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/source/git.m b/source/git.m index 0eaafb7..1fa948f 100644 --- a/source/git.m +++ b/source/git.m @@ -39,7 +39,8 @@ end v = ver; isRoboticsToolboxAvailable = any(strcmp('Robotics System Toolbox', {v.Name})); - desiredRate = 10; + desiredRate = 5; + isRoboticsToolboxAvailable = false; if (isRoboticsToolboxAvailable) r = robotics.Rate(desiredRate); reset(r); From c3dcbf1d65878c83aba6cb374affe229a78feefa Mon Sep 17 00:00:00 2001 From: Daniel Kaminski de Souza Date: Tue, 24 Mar 2020 01:22:00 -0400 Subject: [PATCH 066/143] :construction: Development path. --- source/git.m | 31 +++++++++++++++++++++++++++++-- 1 file changed, 29 insertions(+), 2 deletions(-) diff --git a/source/git.m b/source/git.m index 6baaa61..58d5f82 100644 --- a/source/git.m +++ b/source/git.m @@ -19,6 +19,11 @@ case 'push' otherwise [status, result] = system(commandString); + if status + ME = MException('Git:couldntExecuteGitCommand', ... + 'git command %s resulted in a failure!', commandString); + throw(ME); + end return; end name = getRepoName(); @@ -27,6 +32,18 @@ fclose(fid); [status, ~] = dos([which('RunCommand.bat') ' ' name ' ' commandString ' &']); + if status + ME = MException('Git:couldntExecuteGitCommand', ... + 'git command %s resulted in failure!', commandString); + throw(ME); + end + v = ver; + isRoboticsToolboxAvailable = any(strcmp('Robotics System Toolbox', {v.Name})); + desiredRate = 5; + if (isRoboticsToolboxAvailable) + r = robotics.Rate(desiredRate); + reset(r); + end while(true) fid = fopen(filename, 'rt' ); contents = fscanf(fid, '%s\n'); @@ -35,11 +52,21 @@ delete(filename) break; end - pause(0.2); + if (isRoboticsToolboxAvailable) + waitfor(r); + else + pause(1/desiredRate); + end end result = contents; function name = getRepoName() - [~, result] = system('git rev-parse --show-toplevel'); + commandString = 'git rev-parse --show-toplevel'; + [status, result] = system(commandString); + if status + ME = MException('Git:couldntExecuteGitCommand', ... + 'git command %s resulted in failure!', commandString); + throw(ME); + end result = result(1:end-1); % remove newline. [~,name,~] = fileparts(result); \ No newline at end of file From 5064f3d61c040317ece5907270f24c7cf9e99b20 Mon Sep 17 00:00:00 2001 From: Daniel Kaminski de Souza Date: Tue, 24 Mar 2020 01:42:32 -0400 Subject: [PATCH 067/143] :construction: Development path. --- source/DepMat.m | 8 ++- source/DepMatRepositoryUpdater.m | 109 ++++++++++++++----------------- source/git.m | 5 +- 3 files changed, 57 insertions(+), 65 deletions(-) diff --git a/source/DepMat.m b/source/DepMat.m index fef7f06..46894ae 100644 --- a/source/DepMat.m +++ b/source/DepMat.m @@ -91,8 +91,12 @@ function setDispHandler(obj, funcHandle) end function installed = isGitInstalled - failure = git('--help'); - installed = ~failure; + installed = true; + try + git('--help'); + catch + installed = false; + end end function fixCurlPath diff --git a/source/DepMatRepositoryUpdater.m b/source/DepMatRepositoryUpdater.m index d8acda2..35f4c01 100644 --- a/source/DepMatRepositoryUpdater.m +++ b/source/DepMatRepositoryUpdater.m @@ -195,18 +195,14 @@ function setDispHandler(obj, funcHandle) return; end - % TODO check this out - [failure, ~] = git('remote update'); - if failure + try + git('remote update'); + local_id_head = git('rev-parse @{0}'); % current head commit + catch status = DepMatStatus.GitFailure; return; end - [failure, local_id_head] = git('rev-parse @{0}'); % current head commit - if failure - status = DepMatStatus.GitFailure; - return; - end local_id_head = strrep(local_id_head,newline,''); if ~obj.RepoDef.GetLatest @@ -216,18 +212,11 @@ function setDispHandler(obj, funcHandle) status = DepMatStatus.UpToDateButWrongHead; end else % Get the latest commit - [failure, local_id] = git(['rev-parse ',obj.RepoDef.Branch,'@{0}']); % Latest local commit - if failure - status = DepMatStatus.GitFailure; - return; - end - [failure, remote_id] = git(['rev-parse ',obj.RepoDef.Branch,'@{u}']); % Latest remote commit - if failure - status = DepMatStatus.GitFailure; - return; - end - [failure, base] = git(['merge-base ',obj.RepoDef.Branch,'@{0} ',obj.RepoDef.Branch,'@{u}']); - if failure + try + local_id = git(['rev-parse ',obj.RepoDef.Branch,'@{0}']); % Latest local commit + remote_id = git(['rev-parse ',obj.RepoDef.Branch,'@{u}']); % Latest remote commit + base = git(['merge-base ',obj.RepoDef.Branch,'@{0} ',obj.RepoDef.Branch,'@{u}']); + catch status = DepMatStatus.GitFailure; return; end @@ -255,17 +244,14 @@ function setDispHandler(obj, funcHandle) end function [success, output] = internalUpdateRepo(obj) - [failure, output] = git(['checkout ',obj.RepoDef.Branch]); % Checkout the branch - if failure - % TODO Shouldn't be output rather than status? - % status = DepMatStatus.GitFailure; - DepMatStatus.GitFailure; + try + output = git(['checkout ', obj.RepoDef.Branch]); % Checkout the branch + output = git('pull'); + catch + success = false; return; end - - [pullResult, output] = git('pull'); - pullResult = ~pullResult; - success = ~isempty(pullResult) && ~isequal(pullResult, 0); + success = true; end function success = internalCloneRepo(obj) @@ -273,21 +259,19 @@ function setDispHandler(obj, funcHandle) % Avoid initialisation if it has already been done, to avoid errors fetchFailure = obj.checkForFetchFailure; if ~fetchFailure - if git('init') - success = false; - return; - end - - if git(['remote add -t ' obj.RepoDef.Branch ' origin ' obj.RepoDef.Url]) + try + git('init'); + git(['remote add -t ' obj.RepoDef.Branch ' origin ' obj.RepoDef.Url]); + catch success = false; return; end end - [failure, ~] = git('fetch'); - if (failure) + try + git('fetch'); + catch obj.setFetchFailure; - success = false; return; end @@ -298,7 +282,9 @@ function setDispHandler(obj, funcHandle) checkoutCmd = ['checkout ' obj.RepoDef.Branch]; end - if git(checkoutCmd) + try + git(checkoutCmd) + catch success = false; return; end @@ -311,29 +297,29 @@ function setDispHandler(obj, funcHandle) end function [success, changed, headCommitId] = internalCheckoutCommit(obj) - [~, local_id_head] = git('rev-parse @{0}'); % current head commit - local_id_head = strrep(local_id_head,newline,''); - [~, local_id_latest] = git(['rev-parse ',obj.RepoDef.Branch,'@{0}']); % Latest local commit - local_id_latest = strrep(local_id_latest,newline,''); - - headCommitId = local_id_head; changed = false; - toCheckoutHash = ''; - if ( obj.RepoDef.GetLatest) && ~strcmp(local_id_head, local_id_latest) - toCheckoutHash = local_id_latest; - elseif ~( obj.RepoDef.GetLatest ) && ~strcmp(local_id_head, obj.RepoDef.Commit) - toCheckoutHash = obj.RepoDef.Commit; - end - if ~isempty(toCheckoutHash) - if git(['checkout ' toCheckoutHash]) - success = false; - % changed = true; - return; + try + local_id_head = git('rev-parse @{0}'); % current head commit + local_id_head = strrep(local_id_head,newline,''); + local_id_latest = git(['rev-parse ',obj.RepoDef.Branch,'@{0}']); % Latest local commit + local_id_latest = strrep(local_id_latest,newline,''); + headCommitId = local_id_head; + toCheckoutHash = ''; + if ( obj.RepoDef.GetLatest) && ~strcmp(local_id_head, local_id_latest) + toCheckoutHash = local_id_latest; + elseif ~( obj.RepoDef.GetLatest ) && ~strcmp(local_id_head, obj.RepoDef.Commit) + toCheckoutHash = obj.RepoDef.Commit; + end + if ~isempty(toCheckoutHash) + git(['checkout ' toCheckoutHash]) + changed = true; + headCommitId = toCheckoutHash; end - changed = true; - headCommitId = toCheckoutHash; + success = true; + catch + success = false; + return; end - success = true; end function setFetchFailure(obj) @@ -359,8 +345,9 @@ function clearFetchFailure(obj) function [status, commitHash] = internalGetHeadHash status = true; - [failure, commitHash] = git('rev-parse HEAD'); - if failure + try + commitHash = git('rev-parse HEAD'); + catch status = DepMatStatus.GitFailure; return; end diff --git a/source/git.m b/source/git.m index 58d5f82..478489f 100644 --- a/source/git.m +++ b/source/git.m @@ -1,4 +1,4 @@ -function [status, result] = git(varargin) +function result = git(varargin) %GIT Summary of this function goes here % Detailed explanation goes here if (nargin == 0) @@ -46,7 +46,8 @@ end while(true) fid = fopen(filename, 'rt' ); - contents = fscanf(fid, '%s\n'); + contents = textscan(fid,'%s','Delimiter','\n'); + contents = contents{1}; fclose(fid); if ~isempty(contents) delete(filename) From aa25522daedea1835be88eaeba8ff94f14e5305b Mon Sep 17 00:00:00 2001 From: Daniel Kaminski de Souza Date: Tue, 24 Mar 2020 01:48:58 -0400 Subject: [PATCH 068/143] :construction: Development path. --- source/DepMatRepositoryUpdater.m | 2 +- source/git.m | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/source/DepMatRepositoryUpdater.m b/source/DepMatRepositoryUpdater.m index 35f4c01..1abe731 100644 --- a/source/DepMatRepositoryUpdater.m +++ b/source/DepMatRepositoryUpdater.m @@ -283,7 +283,7 @@ function setDispHandler(obj, funcHandle) end try - git(checkoutCmd) + git(checkoutCmd); catch success = false; return; diff --git a/source/git.m b/source/git.m index 478489f..70f72c8 100644 --- a/source/git.m +++ b/source/git.m @@ -39,7 +39,7 @@ end v = ver; isRoboticsToolboxAvailable = any(strcmp('Robotics System Toolbox', {v.Name})); - desiredRate = 5; + desiredRate = 20; if (isRoboticsToolboxAvailable) r = robotics.Rate(desiredRate); reset(r); From 218b028d3e28bdfa3c689bce489ef63944f012a2 Mon Sep 17 00:00:00 2001 From: Daniel Kaminski de Souza Date: Tue, 24 Mar 2020 02:08:48 -0400 Subject: [PATCH 069/143] :construction: Development path. --- source/DepMatRepositoryUpdater.m | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/source/DepMatRepositoryUpdater.m b/source/DepMatRepositoryUpdater.m index 1abe731..ec6f5ad 100644 --- a/source/DepMatRepositoryUpdater.m +++ b/source/DepMatRepositoryUpdater.m @@ -247,11 +247,10 @@ function setDispHandler(obj, funcHandle) try output = git(['checkout ', obj.RepoDef.Branch]); % Checkout the branch output = git('pull'); + success = true; catch success = false; - return; end - success = true; end function success = internalCloneRepo(obj) From f5efd7af629462c7360cc05d9ba86233465d33bd Mon Sep 17 00:00:00 2001 From: Daniel Kaminski de Souza Date: Tue, 24 Mar 2020 02:29:58 -0400 Subject: [PATCH 070/143] :construction: Development path. --- source/git.m | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/source/git.m b/source/git.m index 70f72c8..1befe72 100644 --- a/source/git.m +++ b/source/git.m @@ -1,4 +1,4 @@ -function result = git(varargin) +function varargout = git(varargin) %GIT Summary of this function goes here % Detailed explanation goes here if (nargin == 0) @@ -23,7 +23,13 @@ ME = MException('Git:couldntExecuteGitCommand', ... 'git command %s resulted in a failure!', commandString); throw(ME); - end + end + switch(nargout) + case 0 + disp(result); + otherwise + varargout{1} = result; + end return; end name = getRepoName(); @@ -60,6 +66,12 @@ end end result = contents; + switch(nargout) + case 0 + disp(result); + otherwise + varargout{1} = result; + end function name = getRepoName() commandString = 'git rev-parse --show-toplevel'; From 5b88988ab8170082ea3c97820df2890be651b473 Mon Sep 17 00:00:00 2001 From: Daniel Kaminski de Souza Date: Thu, 26 Mar 2020 23:56:52 -0400 Subject: [PATCH 071/143] :heavy_plus_sign: Add travis yml file. --- .travis.yml | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 .travis.yml diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..9573bc2 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,3 @@ +git clone https://github.com/MOxUnit/MOxUnit.git +cd MOxUnit +make install \ No newline at end of file From eca60189f5c82d8f281382be9a83bd800569b573 Mon Sep 17 00:00:00 2001 From: Daniel Kaminski de Souza Date: Fri, 27 Mar 2020 00:11:34 -0400 Subject: [PATCH 072/143] :construction: Build travis yml file. --- .travis.yml | 170 +++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 167 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index 9573bc2..71bc8cf 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,3 +1,167 @@ -git clone https://github.com/MOxUnit/MOxUnit.git -cd MOxUnit -make install \ No newline at end of file +# We pretend to be Java because we need GNU Octave which is not +# available (as of January 2016) +language: java + +############################################################################### +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: + matrix: + - COVERAGE="false" + - COVERAGE="true" + matrix: + allow_failures: + - env: COVERAGE="true" + fast_finish: true + +################################################################################ Command to install dependencies +before_install: + # 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 + - REPOPATH = rm source/external + -rf ${REPOPATH}; + mkdir -p source/external; + # Install required packages for Octave + - if [ -f requirements-octave.txt ]; then + mopi/mopi.sh requirements-octave.txt ${REPOPATH} "$HOME/external_cache"; + fi; + # Install other required packages + - if [ -f requirements.txt ]; then + mopi/mopi.sh requirements.txt ${REPOPATH} "$HOME/external_cache"; + fi; + # Install developmental requirements + - if [ -f requirements-dev.txt ]; then + mopi/mopi.sh requirements-dev.txt ${REPOPATH} "$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="package_name"; + ADDPATH_COMMAND="addpath(genpath(fullfile(pwd, '$PACKAGE_FOLDER')));"; + ADDPATH_COMMAND+=" addpath(genpath(fullfile(pwd, 'external')));"; + 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" + # --------------------------------------------------------------------------- + # 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 -q --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 \ No newline at end of file From e97006db8f58e62429b7025843520ad32f0b5f36 Mon Sep 17 00:00:00 2001 From: Daniel Kaminski de Souza Date: Fri, 27 Mar 2020 00:29:09 -0400 Subject: [PATCH 073/143] :construction: Build travis yml file. --- .travis.yml | 292 ++++++++++++++++++++++++++-------------------------- 1 file changed, 146 insertions(+), 146 deletions(-) diff --git a/.travis.yml b/.travis.yml index 71bc8cf..3a74bd9 100644 --- a/.travis.yml +++ b/.travis.yml @@ -12,156 +12,156 @@ cache: # Cache other packages - $HOME/external_cache -############################################################################### -env: - matrix: - - COVERAGE="false" - - COVERAGE="true" - matrix: - allow_failures: - - env: COVERAGE="true" - fast_finish: true +# ############################################################################### +# env: +# matrix: +# - COVERAGE="false" +# - COVERAGE="true" +# matrix: +# allow_failures: +# - env: COVERAGE="true" +# fast_finish: true -################################################################################ Command to install dependencies -before_install: - # 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} +# ################################################################################ Command to install dependencies +# before_install: +# # 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 - - REPOPATH = rm source/external - -rf ${REPOPATH}; - mkdir -p source/external; - # Install required packages for Octave - - if [ -f requirements-octave.txt ]; then - mopi/mopi.sh requirements-octave.txt ${REPOPATH} "$HOME/external_cache"; - fi; - # Install other required packages - - if [ -f requirements.txt ]; then - mopi/mopi.sh requirements.txt ${REPOPATH} "$HOME/external_cache"; - fi; - # Install developmental requirements - - if [ -f requirements-dev.txt ]; then - mopi/mopi.sh requirements-dev.txt ${REPOPATH} "$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="package_name"; - ADDPATH_COMMAND="addpath(genpath(fullfile(pwd, '$PACKAGE_FOLDER')));"; - ADDPATH_COMMAND+=" addpath(genpath(fullfile(pwd, 'external')));"; - echo "ADDPATH_COMMAND| $ADDPATH_COMMAND"; +# ############################################################################### +# install: +# # Ensure external packages folder exists and is empty +# - REPOPATH = rm source/external +# -rf ${REPOPATH}; +# mkdir -p source/external; +# # Install required packages for Octave +# - if [ -f requirements-octave.txt ]; then +# mopi/mopi.sh requirements-octave.txt ${REPOPATH} "$HOME/external_cache"; +# fi; +# # Install other required packages +# - if [ -f requirements.txt ]; then +# mopi/mopi.sh requirements.txt ${REPOPATH} "$HOME/external_cache"; +# fi; +# # Install developmental requirements +# - if [ -f requirements-dev.txt ]; then +# mopi/mopi.sh requirements-dev.txt ${REPOPATH} "$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="package_name"; +# ADDPATH_COMMAND="addpath(genpath(fullfile(pwd, '$PACKAGE_FOLDER')));"; +# ADDPATH_COMMAND+=" addpath(genpath(fullfile(pwd, 'external')));"; +# 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" - # --------------------------------------------------------------------------- - # 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; +# ############################################################################### +# 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" +# # --------------------------------------------------------------------------- +# # 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 -q --eval "$ADDPATH_COMMAND $TEST_COMMAND"; +# ############################################################################### +# script: +# - octave -q --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_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; +# ############################################################################### +# 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 \ No newline at end of file +# ############################################################################### +# # Enable archiving of artifacts on Shippable (does nothing on Travis) +# archive: true \ No newline at end of file From ddf5c5810d326490331164039c237660cb8b6326 Mon Sep 17 00:00:00 2001 From: Daniel Kaminski de Souza Date: Fri, 27 Mar 2020 00:34:02 -0400 Subject: [PATCH 074/143] :construction: Build travis yml file. --- .travis.yml | 98 ++++++++++++++++++++++++++--------------------------- 1 file changed, 49 insertions(+), 49 deletions(-) diff --git a/.travis.yml b/.travis.yml index 3a74bd9..21123c0 100644 --- a/.travis.yml +++ b/.travis.yml @@ -22,55 +22,55 @@ cache: # - env: COVERAGE="true" # fast_finish: true -# ################################################################################ Command to install dependencies -# before_install: -# # 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} +################################################################################ Command to install dependencies +before_install: + # 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: From 448e8120a1f04a5cd1c436b0626af063f19e5640 Mon Sep 17 00:00:00 2001 From: Daniel Kaminski de Souza Date: Fri, 27 Mar 2020 00:41:11 -0400 Subject: [PATCH 075/143] :construction: Build travis yml file. --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 21123c0..5091641 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,7 +1,7 @@ # We pretend to be Java because we need GNU Octave which is not # available (as of January 2016) language: java - +install: ant deps ############################################################################### cache: # Downloading octave takes a while, so let's cache apt From fe65388083378d0ba651883dbbd69ef21f81be18 Mon Sep 17 00:00:00 2001 From: Daniel Kaminski de Souza Date: Fri, 27 Mar 2020 00:57:47 -0400 Subject: [PATCH 076/143] :construction: Build travis yml file. --- .travis.yml | 55 +++++++++++++++++++++++++++-------------------------- 1 file changed, 28 insertions(+), 27 deletions(-) diff --git a/.travis.yml b/.travis.yml index 5091641..b4eb8df 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,7 +1,7 @@ # We pretend to be Java because we need GNU Octave which is not # available (as of January 2016) language: java -install: ant deps + ############################################################################### cache: # Downloading octave takes a while, so let's cache apt @@ -22,7 +22,8 @@ cache: # - env: COVERAGE="true" # fast_finish: true -################################################################################ Command to install dependencies +############################################################################### +# Command to install dependencies before_install: # Remember the directory where our repository to test is located - REPOPATH="$(pwd)" && pwd @@ -72,32 +73,32 @@ before_install: # Go back to the repository directory - cd ${REPOPATH} -# ############################################################################### -# install: -# # Ensure external packages folder exists and is empty -# - REPOPATH = rm source/external -# -rf ${REPOPATH}; -# mkdir -p source/external; -# # Install required packages for Octave -# - if [ -f requirements-octave.txt ]; then -# mopi/mopi.sh requirements-octave.txt ${REPOPATH} "$HOME/external_cache"; -# fi; -# # Install other required packages -# - if [ -f requirements.txt ]; then -# mopi/mopi.sh requirements.txt ${REPOPATH} "$HOME/external_cache"; -# fi; -# # Install developmental requirements -# - if [ -f requirements-dev.txt ]; then -# mopi/mopi.sh requirements-dev.txt ${REPOPATH} "$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="package_name"; -# ADDPATH_COMMAND="addpath(genpath(fullfile(pwd, '$PACKAGE_FOLDER')));"; -# ADDPATH_COMMAND+=" addpath(genpath(fullfile(pwd, 'external')));"; -# echo "ADDPATH_COMMAND| $ADDPATH_COMMAND"; + ############################################################################### + install: + # Ensure external packages folder exists and is empty + - REPOPATH = source/external + rm -rf ${REPOPATH}; + mkdir -p ${REPOPATH}; + # Install required packages for Octave + - if [ -f requirements-octave.txt ]; then + mopi/mopi.sh requirements-octave.txt ${REPOPATH} "$HOME/external_cache"; + fi; + # Install other required packages + - if [ -f requirements.txt ]; then + mopi/mopi.sh requirements.txt ${REPOPATH} "$HOME/external_cache"; + fi; + # Install developmental requirements + - if [ -f requirements-dev.txt ]; then + mopi/mopi.sh requirements-dev.txt ${REPOPATH} "$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="package_name"; + ADDPATH_COMMAND="addpath(genpath(fullfile(pwd, '$PACKAGE_FOLDER')));"; + ADDPATH_COMMAND+=" addpath(genpath(fullfile(pwd, '${REPOPATH}')));"; + echo "ADDPATH_COMMAND| $ADDPATH_COMMAND"; -# ############################################################################### +############################################################################### # before_script: # - testFolder = source/tests # - TEST_ARGS="'-recursive', '-verbose', '-junit_xml_file', 'testresults.xml'"; From fe5539ab66b1c9e1808d71cc1172d4c5dd84a86e Mon Sep 17 00:00:00 2001 From: Daniel Kaminski de Souza Date: Fri, 27 Mar 2020 01:07:48 -0400 Subject: [PATCH 077/143] :construction: Build travis yml file. --- .travis.yml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/.travis.yml b/.travis.yml index b4eb8df..eea3a3f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -76,26 +76,26 @@ before_install: ############################################################################### install: # Ensure external packages folder exists and is empty - - REPOPATH = source/external - rm -rf ${REPOPATH}; - mkdir -p ${REPOPATH}; + - EXTPATH = source/external + rm -rf ${EXTPATH}; + mkdir -p ${EXTPATH}; # Install required packages for Octave - if [ -f requirements-octave.txt ]; then - mopi/mopi.sh requirements-octave.txt ${REPOPATH} "$HOME/external_cache"; + 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 ${REPOPATH} "$HOME/external_cache"; + 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 ${REPOPATH} "$HOME/external_cache"; + 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="package_name"; ADDPATH_COMMAND="addpath(genpath(fullfile(pwd, '$PACKAGE_FOLDER')));"; - ADDPATH_COMMAND+=" addpath(genpath(fullfile(pwd, '${REPOPATH}')));"; + ADDPATH_COMMAND+=" addpath(genpath(fullfile(pwd, '${EXTPATH}')));"; echo "ADDPATH_COMMAND| $ADDPATH_COMMAND"; ############################################################################### From ca09b0afbcf92db16978bbe525beb9dfe096e8d9 Mon Sep 17 00:00:00 2001 From: Daniel Kaminski de Souza Date: Fri, 27 Mar 2020 01:09:47 -0400 Subject: [PATCH 078/143] :construction: Build travis yml file. --- .travis.yml | 142 ++++++++++++++++++++++++++-------------------------- 1 file changed, 71 insertions(+), 71 deletions(-) diff --git a/.travis.yml b/.travis.yml index eea3a3f..e9f65be 100644 --- a/.travis.yml +++ b/.travis.yml @@ -25,78 +25,78 @@ cache: ############################################################################### # Command to install dependencies before_install: - # 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} + # # 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 - 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="package_name"; - ADDPATH_COMMAND="addpath(genpath(fullfile(pwd, '$PACKAGE_FOLDER')));"; - ADDPATH_COMMAND+=" addpath(genpath(fullfile(pwd, '${EXTPATH}')));"; - echo "ADDPATH_COMMAND| $ADDPATH_COMMAND"; +# ############################################################################### +# install: +# # Ensure external packages folder exists and is empty +# - EXTPATH = source/external +# 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="package_name"; +# ADDPATH_COMMAND="addpath(genpath(fullfile(pwd, '$PACKAGE_FOLDER')));"; +# ADDPATH_COMMAND+=" addpath(genpath(fullfile(pwd, '${EXTPATH}')));"; +# echo "ADDPATH_COMMAND| $ADDPATH_COMMAND"; ############################################################################### # before_script: From a1a9b5199cee986ccc4ef8aa8cd6f39850e7ee6c Mon Sep 17 00:00:00 2001 From: Daniel Kaminski de Souza Date: Fri, 27 Mar 2020 01:10:52 -0400 Subject: [PATCH 079/143] :construction: Build travis yml file. --- .travis.yml | 50 +++++++++++++++++++++++++------------------------- 1 file changed, 25 insertions(+), 25 deletions(-) diff --git a/.travis.yml b/.travis.yml index e9f65be..fed1c63 100644 --- a/.travis.yml +++ b/.travis.yml @@ -25,31 +25,31 @@ cache: ############################################################################### # Command to install dependencies before_install: - # # 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; + # 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; From 7cb5c6155c7d0fa1d8f471a4b80d7fd875ea4a9a Mon Sep 17 00:00:00 2001 From: Daniel Kaminski de Souza Date: Fri, 27 Mar 2020 01:23:58 -0400 Subject: [PATCH 080/143] :construction: Build travis yml file. --- build.xml | 49 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 build.xml diff --git a/build.xml b/build.xml new file mode 100644 index 0000000..550ab80 --- /dev/null +++ b/build.xml @@ -0,0 +1,49 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + From 1c2eb2d47c2a6bb1111947ca6f8f1392bbe2ec3e Mon Sep 17 00:00:00 2001 From: Daniel Kaminski de Souza Date: Fri, 27 Mar 2020 01:40:53 -0400 Subject: [PATCH 081/143] :construction: Build travis yml file. --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index fed1c63..ca4081c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -32,7 +32,7 @@ before_install: # 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" + - UPGRADE_GCC="false" # --------------------------------------------------------------------------- # Add repository for octave - travis_retry sudo add-apt-repository -y ppa:octave/stable From 42a04b3c2545d2109356d1c3d5b695afd9912082 Mon Sep 17 00:00:00 2001 From: Daniel Kaminski de Souza Date: Fri, 27 Mar 2020 01:45:28 -0400 Subject: [PATCH 082/143] :construction: Build travis yml file. --- build.xml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/build.xml b/build.xml index 550ab80..096e3ad 100644 --- a/build.xml +++ b/build.xml @@ -32,10 +32,11 @@ + + + From ad55c335050780d03679bb535842ec56f63797ec Mon Sep 17 00:00:00 2001 From: Daniel Kaminski de Souza Date: Fri, 27 Mar 2020 01:50:54 -0400 Subject: [PATCH 084/143] :construction: Build travis yml file. --- .travis.yml | 44 ++++++++++++++++++++++---------------------- 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/.travis.yml b/.travis.yml index ca4081c..8879b50 100644 --- a/.travis.yml +++ b/.travis.yml @@ -50,28 +50,28 @@ before_install: 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} + # 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: From 2fe367fa264d02e42bfa3017a19822c9db3b81a0 Mon Sep 17 00:00:00 2001 From: Daniel Kaminski de Souza Date: Fri, 27 Mar 2020 01:57:19 -0400 Subject: [PATCH 085/143] :construction: Build travis yml file. --- .travis.yml | 48 ++++++++++++++++++++++++------------------------ 1 file changed, 24 insertions(+), 24 deletions(-) diff --git a/.travis.yml b/.travis.yml index 8879b50..98645c7 100644 --- a/.travis.yml +++ b/.travis.yml @@ -73,30 +73,30 @@ before_install: # Go back to the repository directory - cd ${REPOPATH} -# ############################################################################### -# install: -# # Ensure external packages folder exists and is empty -# - EXTPATH = source/external -# 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="package_name"; -# ADDPATH_COMMAND="addpath(genpath(fullfile(pwd, '$PACKAGE_FOLDER')));"; -# ADDPATH_COMMAND+=" addpath(genpath(fullfile(pwd, '${EXTPATH}')));"; -# echo "ADDPATH_COMMAND| $ADDPATH_COMMAND"; + ############################################################################### + install: + # Ensure external packages folder exists and is empty + - EXTPATH = source/external + 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="package_name"; + ADDPATH_COMMAND="addpath(genpath(fullfile(pwd, '$PACKAGE_FOLDER')));"; + ADDPATH_COMMAND+=" addpath(genpath(fullfile(pwd, '${EXTPATH}')));"; + echo "ADDPATH_COMMAND| $ADDPATH_COMMAND"; ############################################################################### # before_script: From ba0b7bd780c13a1167d338cd322911121b95d7bb Mon Sep 17 00:00:00 2001 From: Daniel Kaminski de Souza Date: Fri, 27 Mar 2020 02:00:10 -0400 Subject: [PATCH 086/143] :construction: Build travis yml file. --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 98645c7..0a6ba4a 100644 --- a/.travis.yml +++ b/.travis.yml @@ -76,7 +76,7 @@ before_install: ############################################################################### install: # Ensure external packages folder exists and is empty - - EXTPATH = source/external + - EXTPATH = "source/external" rm -rf ${EXTPATH}; mkdir -p ${EXTPATH}; # Install required packages for Octave From bc7b53f3eb9cb592cb0f2009452f1f1236e4fcd7 Mon Sep 17 00:00:00 2001 From: Daniel Kaminski de Souza Date: Fri, 27 Mar 2020 02:00:53 -0400 Subject: [PATCH 087/143] :construction: Build travis yml file. --- .travis.yml | 40 ++++++++++++++++++++-------------------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/.travis.yml b/.travis.yml index 0a6ba4a..c228652 100644 --- a/.travis.yml +++ b/.travis.yml @@ -77,26 +77,26 @@ before_install: install: # Ensure external packages folder exists and is empty - EXTPATH = "source/external" - 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="package_name"; - ADDPATH_COMMAND="addpath(genpath(fullfile(pwd, '$PACKAGE_FOLDER')));"; - ADDPATH_COMMAND+=" addpath(genpath(fullfile(pwd, '${EXTPATH}')));"; - echo "ADDPATH_COMMAND| $ADDPATH_COMMAND"; + # 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="package_name"; + # ADDPATH_COMMAND="addpath(genpath(fullfile(pwd, '$PACKAGE_FOLDER')));"; + # ADDPATH_COMMAND+=" addpath(genpath(fullfile(pwd, '${EXTPATH}')));"; + # echo "ADDPATH_COMMAND| $ADDPATH_COMMAND"; ############################################################################### # before_script: From 9905e5e44f2497d86f780372b2ab9dff9b77ff6b Mon Sep 17 00:00:00 2001 From: Daniel Kaminski de Souza Date: Fri, 27 Mar 2020 02:01:42 -0400 Subject: [PATCH 088/143] :construction: Build travis yml file. --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index c228652..3f2992b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -76,7 +76,7 @@ before_install: ############################################################################### install: # Ensure external packages folder exists and is empty - - EXTPATH = "source/external" + # - EXTPATH = "source/external" # rm -rf ${EXTPATH}; # mkdir -p ${EXTPATH}; # # Install required packages for Octave From 0fb722941262427b6d205a3d2808e74dbe93286c Mon Sep 17 00:00:00 2001 From: Daniel Kaminski de Souza Date: Fri, 27 Mar 2020 02:03:15 -0400 Subject: [PATCH 089/143] :construction: Build travis yml file. --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 3f2992b..33c2618 100644 --- a/.travis.yml +++ b/.travis.yml @@ -74,7 +74,7 @@ before_install: - cd ${REPOPATH} ############################################################################### - install: +# install: # Ensure external packages folder exists and is empty # - EXTPATH = "source/external" # rm -rf ${EXTPATH}; From 6aa04e3965be407effaf973cd84f6038a2513f55 Mon Sep 17 00:00:00 2001 From: Daniel Kaminski de Souza Date: Fri, 27 Mar 2020 02:05:03 -0400 Subject: [PATCH 090/143] :construction: Build travis yml file. --- .travis.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 33c2618..08a4630 100644 --- a/.travis.yml +++ b/.travis.yml @@ -74,9 +74,10 @@ before_install: - cd ${REPOPATH} ############################################################################### -# install: + install: # Ensure external packages folder exists and is empty - # - EXTPATH = "source/external" + - EXTPATH = "source/external"; + echo ${EXTPATH}; # rm -rf ${EXTPATH}; # mkdir -p ${EXTPATH}; # # Install required packages for Octave From 5cea11ce12cc67cb8c23261bd8dee0df1e4c5b04 Mon Sep 17 00:00:00 2001 From: Daniel Kaminski de Souza Date: Fri, 27 Mar 2020 02:06:45 -0400 Subject: [PATCH 091/143] :construction: Build travis yml file. --- .travis.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 08a4630..64b5665 100644 --- a/.travis.yml +++ b/.travis.yml @@ -76,8 +76,9 @@ before_install: ############################################################################### install: # Ensure external packages folder exists and is empty - - EXTPATH = "source/external"; - echo ${EXTPATH}; + - EXTPATH="$(pwd)" && pwd + # - EXTPATH = "source/external"; + # echo ${EXTPATH}; # rm -rf ${EXTPATH}; # mkdir -p ${EXTPATH}; # # Install required packages for Octave From d6c631e9684fe5c12df49b6db8aeab17ce78f3a4 Mon Sep 17 00:00:00 2001 From: Daniel Kaminski de Souza Date: Fri, 27 Mar 2020 02:08:19 -0400 Subject: [PATCH 092/143] :construction: Build travis yml file. --- .travis.yml | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/.travis.yml b/.travis.yml index 64b5665..3292ff0 100644 --- a/.travis.yml +++ b/.travis.yml @@ -74,9 +74,8 @@ before_install: - cd ${REPOPATH} ############################################################################### - install: +# install: # Ensure external packages folder exists and is empty - - EXTPATH="$(pwd)" && pwd # - EXTPATH = "source/external"; # echo ${EXTPATH}; # rm -rf ${EXTPATH}; @@ -165,6 +164,6 @@ before_install: # bash <(curl -s https://codecov.io/bash) || echo "Codecov push failed"; # fi; -# ############################################################################### -# # Enable archiving of artifacts on Shippable (does nothing on Travis) -# archive: true \ No newline at end of file + ############################################################################### + # Enable archiving of artifacts on Shippable (does nothing on Travis) + archive: true \ No newline at end of file From 7d0f51e36a7f47a1dc98c762221cbb2fe3504cd0 Mon Sep 17 00:00:00 2001 From: Daniel Kaminski de Souza Date: Fri, 27 Mar 2020 02:09:47 -0400 Subject: [PATCH 093/143] :construction: Build travis yml file. --- .travis.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index 3292ff0..25bb541 100644 --- a/.travis.yml +++ b/.travis.yml @@ -164,6 +164,6 @@ before_install: # bash <(curl -s https://codecov.io/bash) || echo "Codecov push failed"; # fi; - ############################################################################### - # Enable archiving of artifacts on Shippable (does nothing on Travis) - archive: true \ No newline at end of file +# ############################################################################### +# # Enable archiving of artifacts on Shippable (does nothing on Travis) +# archive: true \ No newline at end of file From ecb95a0e647e93976574c35e366efa8aeded046c Mon Sep 17 00:00:00 2001 From: Daniel Kaminski de Souza Date: Fri, 27 Mar 2020 02:11:13 -0400 Subject: [PATCH 094/143] :construction: Build travis yml file. --- .travis.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 25bb541..b3738f7 100644 --- a/.travis.yml +++ b/.travis.yml @@ -73,8 +73,9 @@ before_install: # Go back to the repository directory - cd ${REPOPATH} - ############################################################################### -# install: +############################################################################### +install: + - ls # Ensure external packages folder exists and is empty # - EXTPATH = "source/external"; # echo ${EXTPATH}; From 8e73c95fa67ded3d73c46c94004f5bd37a186da3 Mon Sep 17 00:00:00 2001 From: Daniel Kaminski de Souza Date: Fri, 27 Mar 2020 02:12:33 -0400 Subject: [PATCH 095/143] :construction: Build travis yml file. --- .travis.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index b3738f7..b8d529f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -75,7 +75,8 @@ before_install: ############################################################################### install: - - ls + # - ls + - EXTPATH="source/external" # Ensure external packages folder exists and is empty # - EXTPATH = "source/external"; # echo ${EXTPATH}; From 7f7aecf036f1b14a7ebb642001d3cce36636e678 Mon Sep 17 00:00:00 2001 From: Daniel Kaminski de Souza Date: Fri, 27 Mar 2020 02:13:45 -0400 Subject: [PATCH 096/143] :construction: Build travis yml file. --- .travis.yml | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/.travis.yml b/.travis.yml index b8d529f..238f1e7 100644 --- a/.travis.yml +++ b/.travis.yml @@ -75,11 +75,9 @@ before_install: ############################################################################### install: - # - ls - - EXTPATH="source/external" # Ensure external packages folder exists and is empty - # - EXTPATH = "source/external"; - # echo ${EXTPATH}; + - EXTPATH="source/external"; + echo ${EXTPATH}; # rm -rf ${EXTPATH}; # mkdir -p ${EXTPATH}; # # Install required packages for Octave From 4137e555e00b0d6d2d9f8b7d7fd5d3d6be9fad42 Mon Sep 17 00:00:00 2001 From: Daniel Kaminski de Souza Date: Fri, 27 Mar 2020 02:14:33 -0400 Subject: [PATCH 097/143] :construction: Build travis yml file. --- .travis.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 238f1e7..282825e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -78,8 +78,8 @@ install: # Ensure external packages folder exists and is empty - EXTPATH="source/external"; echo ${EXTPATH}; - # rm -rf ${EXTPATH}; - # mkdir -p ${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"; From b0d7de07f403f9c89f85441c84ea36a73da4d6db Mon Sep 17 00:00:00 2001 From: Daniel Kaminski de Souza Date: Fri, 27 Mar 2020 02:16:42 -0400 Subject: [PATCH 098/143] :construction: Build travis yml file. --- .travis.yml | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/.travis.yml b/.travis.yml index 282825e..83153ef 100644 --- a/.travis.yml +++ b/.travis.yml @@ -80,24 +80,24 @@ install: 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="package_name"; - # ADDPATH_COMMAND="addpath(genpath(fullfile(pwd, '$PACKAGE_FOLDER')));"; - # ADDPATH_COMMAND+=" addpath(genpath(fullfile(pwd, '${EXTPATH}')));"; - # echo "ADDPATH_COMMAND| $ADDPATH_COMMAND"; + # 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="package_name"; + ADDPATH_COMMAND="addpath(genpath(fullfile(pwd, '$PACKAGE_FOLDER')));"; + ADDPATH_COMMAND+=" addpath(genpath(fullfile(pwd, '${EXTPATH}')));"; + echo "ADDPATH_COMMAND| $ADDPATH_COMMAND"; ############################################################################### # before_script: From 56d280bc60830c0262849485f976d04b785e3862 Mon Sep 17 00:00:00 2001 From: Daniel Kaminski de Souza Date: Fri, 27 Mar 2020 02:20:22 -0400 Subject: [PATCH 099/143] :construction: Build travis yml file. --- .travis.yml | 124 ++++++++++++++++++++++++++-------------------------- 1 file changed, 62 insertions(+), 62 deletions(-) diff --git a/.travis.yml b/.travis.yml index 83153ef..87102af 100644 --- a/.travis.yml +++ b/.travis.yml @@ -32,7 +32,7 @@ before_install: # 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="false" + - UPGRADE_GCC="true" # --------------------------------------------------------------------------- # Add repository for octave - travis_retry sudo add-apt-repository -y ppa:octave/stable @@ -100,70 +100,70 @@ install: 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" -# # --------------------------------------------------------------------------- -# # 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; +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" + # --------------------------------------------------------------------------- + # 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 -q --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_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; +############################################################################### +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 \ No newline at end of file +############################################################################### +# Enable archiving of artifacts on Shippable (does nothing on Travis) +archive: true \ No newline at end of file From 1abde35aa78273824ed911adb7db496cb50f4385 Mon Sep 17 00:00:00 2001 From: Daniel Kaminski de Souza Date: Fri, 27 Mar 2020 02:21:22 -0400 Subject: [PATCH 100/143] :construction: Build travis yml file. --- .travis.yml | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/.travis.yml b/.travis.yml index 87102af..d47f6b1 100644 --- a/.travis.yml +++ b/.travis.yml @@ -12,15 +12,15 @@ cache: # Cache other packages - $HOME/external_cache -# ############################################################################### -# env: -# matrix: -# - COVERAGE="false" -# - COVERAGE="true" -# matrix: -# allow_failures: -# - env: COVERAGE="true" -# fast_finish: true +############################################################################### +env: + matrix: + - COVERAGE="false" + - COVERAGE="true" + matrix: + allow_failures: + - env: COVERAGE="true" + fast_finish: true ############################################################################### # Command to install dependencies From eb1df15b4fc0317dcf41db1874e2b2ce38c686fa Mon Sep 17 00:00:00 2001 From: Daniel Kaminski de Souza Date: Fri, 27 Mar 2020 02:25:06 -0400 Subject: [PATCH 101/143] :construction: Build travis yml file. --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index d47f6b1..5ed7e3b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -101,7 +101,7 @@ install: ############################################################################### before_script: - - testFolder = source/tests + - testFolder="source/tests" - TEST_ARGS="'-recursive', '-verbose', '-junit_xml_file', 'testresults.xml'"; if [ "$COVERAGE" = "true" ]; then TEST_ARGS+=", '-with_coverage', '-cover', '$PACKAGE_FOLDER'"; From 7dee71f583d7d1549342e183a08ee167e74d078c Mon Sep 17 00:00:00 2001 From: Daniel Kaminski de Souza Date: Fri, 27 Mar 2020 02:28:01 -0400 Subject: [PATCH 102/143] :construction: Build travis yml file. --- build.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/build.xml b/build.xml index 04a754d..733c62a 100644 --- a/build.xml +++ b/build.xml @@ -4,7 +4,7 @@ To include a user specific buildfile here, simply create one in the same directory with the processing instruction as the first entry and export the buildfile again. --> - + From 266176355d8fe8bc05af86db42714266e148a3e3 Mon Sep 17 00:00:00 2001 From: Daniel Kaminski de Souza Date: Fri, 27 Mar 2020 02:39:48 -0400 Subject: [PATCH 103/143] :construction: Build travis yml file. --- .travis.yml | 1 + build.xml | 50 -------------------------------------------------- 2 files changed, 1 insertion(+), 50 deletions(-) delete mode 100644 build.xml diff --git a/.travis.yml b/.travis.yml index 5ed7e3b..7956118 100644 --- a/.travis.yml +++ b/.travis.yml @@ -25,6 +25,7 @@ env: ############################################################################### # Command to install dependencies before_install: + - echo '' > build.xml # Remember the directory where our repository to test is located - REPOPATH="$(pwd)" && pwd # --------------------------------------------------------------------------- diff --git a/build.xml b/build.xml deleted file mode 100644 index 733c62a..0000000 --- a/build.xml +++ /dev/null @@ -1,50 +0,0 @@ - - - - - From 1b4d97ed602a358c6ae13f4dca72f46deaee516a Mon Sep 17 00:00:00 2001 From: Daniel Kaminski de Souza Date: Fri, 27 Mar 2020 02:43:45 -0400 Subject: [PATCH 104/143] :construction: Build travis yml file. --- .travis.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 7956118..addba01 100644 --- a/.travis.yml +++ b/.travis.yml @@ -131,8 +131,8 @@ before_script: fi; ############################################################################### -# script: -# - octave -q --eval "$ADDPATH_COMMAND $TEST_COMMAND"; +script: + - octave -q --eval "$ADDPATH_COMMAND $TEST_COMMAND"; ############################################################################### after_script: From 2c54c4aac4fc688b18f1293e6736d0cd52b383e0 Mon Sep 17 00:00:00 2001 From: Daniel Kaminski de Souza Date: Fri, 27 Mar 2020 02:52:00 -0400 Subject: [PATCH 105/143] :construction: Build travis yml file. --- .travis.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index addba01..e75a061 100644 --- a/.travis.yml +++ b/.travis.yml @@ -132,7 +132,8 @@ before_script: ############################################################################### script: - - octave -q --eval "$ADDPATH_COMMAND $TEST_COMMAND"; + - echo "$ADDPATH_COMMAND $TEST_COMMAND"; + # - octave -q --eval "$ADDPATH_COMMAND $TEST_COMMAND"; ############################################################################### after_script: From 8556afc7f131592e8a7664e385e99dd1698139bc Mon Sep 17 00:00:00 2001 From: Daniel Kaminski de Souza Date: Fri, 27 Mar 2020 03:01:04 -0400 Subject: [PATCH 106/143] :construction: Build travis yml file. --- .travis.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index e75a061..44dcb9d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -132,8 +132,7 @@ before_script: ############################################################################### script: - - echo "$ADDPATH_COMMAND $TEST_COMMAND"; - # - octave -q --eval "$ADDPATH_COMMAND $TEST_COMMAND"; + - octave -v --eval "$ADDPATH_COMMAND $TEST_COMMAND"; ############################################################################### after_script: From 542eb69ae37645834974c757e27c39298497f230 Mon Sep 17 00:00:00 2001 From: Daniel Kaminski de Souza Date: Fri, 27 Mar 2020 03:09:03 -0400 Subject: [PATCH 107/143] :construction: Build travis yml file. --- .travis.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 44dcb9d..f879dfc 100644 --- a/.travis.yml +++ b/.travis.yml @@ -14,10 +14,10 @@ cache: ############################################################################### env: - matrix: + jobs: - COVERAGE="false" - COVERAGE="true" - matrix: + jobs: allow_failures: - env: COVERAGE="true" fast_finish: true From 5a47e9f28328c3c37095004713c5a237389af4bf Mon Sep 17 00:00:00 2001 From: Daniel Kaminski de Souza Date: Fri, 27 Mar 2020 03:14:26 -0400 Subject: [PATCH 108/143] :construction: Build travis yml file. --- .travis.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index f879dfc..eb3817c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,5 +1,7 @@ # We pretend to be Java because we need GNU Octave which is not # available (as of January 2016) +os: linux +dist: bionic language: java ############################################################################### @@ -18,8 +20,7 @@ env: - COVERAGE="false" - COVERAGE="true" jobs: - allow_failures: - - env: COVERAGE="true" + allow_failures: '[{ env: COVERAGE=true }]' fast_finish: true ############################################################################### From 1c963b43f49551169a75bdc71d1f81a658087325 Mon Sep 17 00:00:00 2001 From: Daniel Kaminski de Souza Date: Fri, 27 Mar 2020 03:18:27 -0400 Subject: [PATCH 109/143] :construction: Build travis yml file. --- .travis.yml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index eb3817c..e545ce2 100644 --- a/.travis.yml +++ b/.travis.yml @@ -15,11 +15,9 @@ cache: - $HOME/external_cache ############################################################################### -env: +env: jobs: - COVERAGE="false" - - COVERAGE="true" - jobs: allow_failures: '[{ env: COVERAGE=true }]' fast_finish: true From 020fd22ea334a27f9e91393125ba45fbb3c584c3 Mon Sep 17 00:00:00 2001 From: Daniel Kaminski de Souza Date: Fri, 27 Mar 2020 03:20:02 -0400 Subject: [PATCH 110/143] :construction: Build travis yml file. --- .travis.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index e545ce2..eb3817c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -15,9 +15,11 @@ cache: - $HOME/external_cache ############################################################################### -env: +env: jobs: - COVERAGE="false" + - COVERAGE="true" + jobs: allow_failures: '[{ env: COVERAGE=true }]' fast_finish: true From a5462521a1fa9d0f36f7c7a07f30878009fc5a43 Mon Sep 17 00:00:00 2001 From: Daniel Kaminski de Souza Date: Fri, 27 Mar 2020 03:22:43 -0400 Subject: [PATCH 111/143] :construction: Build travis yml file. --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index eb3817c..13b8403 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,7 +1,7 @@ # We pretend to be Java because we need GNU Octave which is not # available (as of January 2016) os: linux -dist: bionic +dist: xenial language: java ############################################################################### From 182b8d674bfa0299ede55bdfa604db6fc1f158c6 Mon Sep 17 00:00:00 2001 From: Daniel Kaminski de Souza Date: Fri, 27 Mar 2020 03:30:07 -0400 Subject: [PATCH 112/143] :construction: Build travis yml file. --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 13b8403..eb72adc 100644 --- a/.travis.yml +++ b/.travis.yml @@ -162,7 +162,7 @@ after_success: # 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"; + 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; From fbcd99aa05a3f5408068ef7daf28db9b3df80747 Mon Sep 17 00:00:00 2001 From: Daniel Kaminski de Souza Date: Fri, 27 Mar 2020 03:37:35 -0400 Subject: [PATCH 113/143] :construction: Build travis yml file. --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index eb72adc..e249a03 100644 --- a/.travis.yml +++ b/.travis.yml @@ -162,7 +162,7 @@ after_success: # 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"; + 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; From 2396d543598abea568b492466509e99ef90d3eae Mon Sep 17 00:00:00 2001 From: Daniel Kaminski de Souza Date: Fri, 27 Mar 2020 04:41:58 -0400 Subject: [PATCH 114/143] :construction: Build travis yml file. --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index e249a03..06f0253 100644 --- a/.travis.yml +++ b/.travis.yml @@ -111,7 +111,7 @@ before_script: TEST_ARGS+=", '-cover_xml_file', 'coverage.xml'"; TEST_ARGS+=", '-cover_json_file', 'coveralls.json'"; fi; - TEST_COMMAND="exit(~moxunit_runtests(${testFolder}, $TEST_ARGS));"; + TEST_COMMAND="exit(~moxunit_runtests('${testFolder}', $TEST_ARGS));"; echo "TEST_COMMAND| $TEST_COMMAND"; # Double-check we are still in the right directory - pwd From fa0a1202eb33ea58919666b6b01a53feaf4da916 Mon Sep 17 00:00:00 2001 From: Daniel Kaminski de Souza Date: Fri, 27 Mar 2020 05:22:44 -0400 Subject: [PATCH 115/143] :construction: Build travis yml file. --- .travis.yml | 4 ++-- source/tests/testPackMan.m | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 06f0253..383218b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -133,8 +133,8 @@ before_script: ############################################################################### script: - - octave -v --eval "$ADDPATH_COMMAND $TEST_COMMAND"; - + - octave -q --eval "$ADDPATH_COMMAND $TEST_COMMAND"; + ############################################################################### after_script: # Check where we ended up and what's going on where we are diff --git a/source/tests/testPackMan.m b/source/tests/testPackMan.m index adc133f..b96f483 100644 --- a/source/tests/testPackMan.m +++ b/source/tests/testPackMan.m @@ -5,6 +5,7 @@ %% Main function to generate tests function tests = testPackMan tests = functiontests(localfunctions); +disp tests end %% Test Functions From 197bf9684c39137daf417e97a473ef2035d1f7b8 Mon Sep 17 00:00:00 2001 From: Daniel Kaminski de Souza Date: Fri, 27 Mar 2020 05:27:06 -0400 Subject: [PATCH 116/143] :construction: Build travis yml file. --- .travis.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 383218b..805d5ac 100644 --- a/.travis.yml +++ b/.travis.yml @@ -133,8 +133,8 @@ before_script: ############################################################################### script: - - octave -q --eval "$ADDPATH_COMMAND $TEST_COMMAND"; - + - octave -v --eval "$ADDPATH_COMMAND $TEST_COMMAND"; + ############################################################################### after_script: # Check where we ended up and what's going on where we are From 3bda0cfa870a2124d57c2ae22643ef9b77c78000 Mon Sep 17 00:00:00 2001 From: Daniel Kaminski de Souza Date: Fri, 27 Mar 2020 05:40:58 -0400 Subject: [PATCH 117/143] :construction: Build travis yml file. --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 805d5ac..b34bcec 100644 --- a/.travis.yml +++ b/.travis.yml @@ -96,7 +96,7 @@ install: fi; # Before running the tests, we will have to add our package and our # external dependencies to the octave path - - PACKAGE_FOLDER="package_name"; + - PACKAGE_FOLDER="source"; ADDPATH_COMMAND="addpath(genpath(fullfile(pwd, '$PACKAGE_FOLDER')));"; ADDPATH_COMMAND+=" addpath(genpath(fullfile(pwd, '${EXTPATH}')));"; echo "ADDPATH_COMMAND| $ADDPATH_COMMAND"; From fd69e942a7611dff8f49bfcf2ae326822963776b Mon Sep 17 00:00:00 2001 From: Daniel Kaminski de Souza Date: Fri, 27 Mar 2020 05:54:03 -0400 Subject: [PATCH 118/143] :construction: Build travis yml file. --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index b34bcec..a492281 100644 --- a/.travis.yml +++ b/.travis.yml @@ -133,7 +133,7 @@ before_script: ############################################################################### script: - - octave -v --eval "$ADDPATH_COMMAND $TEST_COMMAND"; + - octave --eval "$ADDPATH_COMMAND $TEST_COMMAND"; ############################################################################### after_script: From e15ea6cbf05b0ba7d208f24e76c4068826d0e833 Mon Sep 17 00:00:00 2001 From: Daniel Kaminski de Souza Date: Fri, 27 Mar 2020 05:56:20 -0400 Subject: [PATCH 119/143] :construction: Build travis yml file. --- .travis.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index a492281..ad5ff3b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -133,7 +133,9 @@ before_script: ############################################################################### script: - - octave --eval "$ADDPATH_COMMAND $TEST_COMMAND"; + - octaveCommand="$ADDPATH_COMMAND $TEST_COMMAND"; + - echo $octaveCommand; + - octave --eval $octaveCommand; ############################################################################### after_script: From 23347bbcc50b753b54d71e6a0ad22c9613d27058 Mon Sep 17 00:00:00 2001 From: Daniel Kaminski de Souza Date: Fri, 27 Mar 2020 06:03:43 -0400 Subject: [PATCH 120/143] :heavy_plus_sign: Add travis yml file. --- .travis.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.travis.yml b/.travis.yml index ad5ff3b..e76697d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -130,12 +130,12 @@ before_script: mkdir -p shippable/testresults; mkdir -p shippable/codecoverage; fi; - + - OCTAVE_COMMAND="$ADDPATH_COMMAND $TEST_COMMAND"; + echo "OCTAVE_COMMAND| $OCTAVE_COMMAND"; ############################################################################### script: - - octaveCommand="$ADDPATH_COMMAND $TEST_COMMAND"; - - echo $octaveCommand; - - octave --eval $octaveCommand; + - octave -v --eval $OCTAVE_COMMAND; + - octave -v --eval "sqrt(-1)"; ############################################################################### after_script: From 972200c4a8469fae4df1fba6c073bddf13af3977 Mon Sep 17 00:00:00 2001 From: Daniel Kaminski de Souza Date: Fri, 27 Mar 2020 06:19:24 -0400 Subject: [PATCH 121/143] :heavy_plus_sign: Add travis yml file. --- .travis.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index e76697d..91e3777 100644 --- a/.travis.yml +++ b/.travis.yml @@ -134,8 +134,10 @@ before_script: echo "OCTAVE_COMMAND| $OCTAVE_COMMAND"; ############################################################################### script: - - octave -v --eval $OCTAVE_COMMAND; - - octave -v --eval "sqrt(-1)"; + - a=eval "octave -v --eval $OCTAVE_COMMAND"; + echo $a; + - b=eval "octave -v --eval \"sqrt(-1)\""; + echo $b; ############################################################################### after_script: From 5d70dfd1d151c7f66a57bf3fab4dd999c5d40b6c Mon Sep 17 00:00:00 2001 From: Daniel Kaminski de Souza Date: Fri, 27 Mar 2020 06:36:57 -0400 Subject: [PATCH 122/143] :heavy_plus_sign: Add travis yml file. --- .travis.yml | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/.travis.yml b/.travis.yml index 91e3777..490fca9 100644 --- a/.travis.yml +++ b/.travis.yml @@ -134,10 +134,7 @@ before_script: echo "OCTAVE_COMMAND| $OCTAVE_COMMAND"; ############################################################################### script: - - a=eval "octave -v --eval $OCTAVE_COMMAND"; - echo $a; - - b=eval "octave -v --eval \"sqrt(-1)\""; - echo $b; + - echo $OCTAVE_COMMAND"; ############################################################################### after_script: From ca88fb491b5c76ffdfb3a1838fd0bc24e218c7c5 Mon Sep 17 00:00:00 2001 From: Daniel Kaminski de Souza Date: Fri, 27 Mar 2020 06:43:25 -0400 Subject: [PATCH 123/143] :heavy_plus_sign: Add travis yml file. --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 490fca9..5963f90 100644 --- a/.travis.yml +++ b/.travis.yml @@ -134,7 +134,7 @@ before_script: echo "OCTAVE_COMMAND| $OCTAVE_COMMAND"; ############################################################################### script: - - echo $OCTAVE_COMMAND"; + - echo $OCTAVE_COMMAND; ############################################################################### after_script: From 591a29b19f4df8bb1a7b97a92ba02d38bfc3c1af Mon Sep 17 00:00:00 2001 From: Daniel Kaminski de Souza Date: Fri, 27 Mar 2020 06:49:21 -0400 Subject: [PATCH 124/143] :heavy_plus_sign: Add travis yml file. --- .travis.yml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index 5963f90..71a2db3 100644 --- a/.travis.yml +++ b/.travis.yml @@ -130,11 +130,10 @@ before_script: mkdir -p shippable/testresults; mkdir -p shippable/codecoverage; fi; - - OCTAVE_COMMAND="$ADDPATH_COMMAND $TEST_COMMAND"; - echo "OCTAVE_COMMAND| $OCTAVE_COMMAND"; ############################################################################### script: - - echo $OCTAVE_COMMAND; + - octave -v --eval "$ADDPATH_COMMAND $TEST_COMMAND"; + - octave -v --eval "addpath(genpath(fullfile(pwd, 'source'))); addpath(genpath(fullfile(pwd, 'source/external')); exit(~moxunit_runtests('source/tests', '-recursive', '-verbose', '-junit_xml_file', 'testresults.xml', '-with_coverage', '-cover', 'source', '-cover_exclude', source/tests, '-cover_xml_file', 'coverage.xml', '-cover_json_file', 'coveralls.json'))"; ############################################################################### after_script: From 9e2af7fd7e33ffd37c22b7cb6e08a6697df1c7a2 Mon Sep 17 00:00:00 2001 From: Daniel Kaminski de Souza Date: Fri, 27 Mar 2020 07:18:13 -0400 Subject: [PATCH 125/143] :heavy_plus_sign: Add travis yml file. --- .travis.yml | 364 +++++++++++++++++++++++++++++++++++++--------------- 1 file changed, 261 insertions(+), 103 deletions(-) diff --git a/.travis.yml b/.travis.yml index 71a2db3..02d71b0 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,107 +1,93 @@ -# We pretend to be Java because we need GNU Octave which is not -# available (as of January 2016) -os: linux +## SPDX-License-Identifier: BSD-3-Clause +## Copyright (C) 2019 Mike Miller +## +## .travis.yml - Travis CI configuration for octave-travis-ci-example + dist: xenial -language: java +language: generic -############################################################################### -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 +services: +- docker -############################################################################### env: - jobs: - - COVERAGE="false" - - COVERAGE="true" - jobs: - allow_failures: '[{ env: COVERAGE=true }]' - fast_finish: true - -############################################################################### -# Command to install dependencies +- OCTAVE_VERSION=4.2 +- OCTAVE_VERSION=4.4 +- OCTAVE_VERSION=5 + before_install: - - echo '' > 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} - -############################################################################### +- docker pull mtmiller/octave:${OCTAVE_VERSION} +- docker run mtmiller/octave:${OCTAVE_VERSION} octave --version + +- echo '' > 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 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 +# 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"; +# 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'"; @@ -116,7 +102,7 @@ before_script: # Double-check we are still in the right directory - pwd # Check what octave packages we have installed - - octave -q --eval "ver" + - docker run mtmiller/octave octave --eval "ver" # --------------------------------------------------------------------------- # Remove any cached results files from previous build, if present - rm -f testresults.xml; @@ -130,12 +116,11 @@ before_script: mkdir -p shippable/testresults; mkdir -p shippable/codecoverage; fi; -############################################################################### + script: - - octave -v --eval "$ADDPATH_COMMAND $TEST_COMMAND"; - - octave -v --eval "addpath(genpath(fullfile(pwd, 'source'))); addpath(genpath(fullfile(pwd, 'source/external')); exit(~moxunit_runtests('source/tests', '-recursive', '-verbose', '-junit_xml_file', 'testresults.xml', '-with_coverage', '-cover', 'source', '-cover_exclude', source/tests, '-cover_xml_file', 'coverage.xml', '-cover_json_file', 'coveralls.json'))"; +# - octave -v --eval "$ADDPATH_COMMAND $TEST_COMMAND"; +- docker run mtmiller/octave octave --eval "$ADDPATH_COMMAND $TEST_COMMAND" -############################################################################### after_script: # Check where we ended up and what's going on where we are - pwd @@ -168,4 +153,177 @@ after_success: ############################################################################### # Enable archiving of artifacts on Shippable (does nothing on Travis) -archive: true \ No newline at end of file +archive: true + + +# # We pretend to be Java because we need GNU Octave which is not +# # available (as of January 2016) +# os: linux +# dist: xenial +# language: java + +# ############################################################################### +# 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 '' > 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" +# # --------------------------------------------------------------------------- +# # 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 "$ADDPATH_COMMAND $TEST_COMMAND"; +# - octave -v --eval "addpath(genpath(fullfile(pwd, 'source'))); addpath(genpath(fullfile(pwd, 'source/external')); exit(~moxunit_runtests('source/tests', '-recursive', '-verbose', '-junit_xml_file', 'testresults.xml', '-with_coverage', '-cover', 'source', '-cover_exclude', source/tests, '-cover_xml_file', 'coverage.xml', '-cover_json_file', 'coveralls.json'))"; + +# ############################################################################### +# 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 \ No newline at end of file From 13aa819aafa0b748a2b4de9979a93798ce856fdf Mon Sep 17 00:00:00 2001 From: Daniel Kaminski de Souza <51767368+DanielAtKrypton@users.noreply.github.com> Date: Fri, 27 Mar 2020 07:26:01 -0400 Subject: [PATCH 126/143] Update .travis.yml --- .travis.yml | 364 +++++++++++++++++++++++++++++++++++++--------------- 1 file changed, 261 insertions(+), 103 deletions(-) diff --git a/.travis.yml b/.travis.yml index 71a2db3..f79fd58 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,107 +1,93 @@ -# We pretend to be Java because we need GNU Octave which is not -# available (as of January 2016) -os: linux +## SPDX-License-Identifier: BSD-3-Clause +## Copyright (C) 2019 Mike Miller +## +## .travis.yml - Travis CI configuration for octave-travis-ci-example + dist: xenial -language: java +language: generic -############################################################################### -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 +services: +- docker -############################################################################### env: - jobs: - - COVERAGE="false" - - COVERAGE="true" - jobs: - allow_failures: '[{ env: COVERAGE=true }]' - fast_finish: true - -############################################################################### -# Command to install dependencies +- OCTAVE_VERSION=4.2 +- OCTAVE_VERSION=4.4 +- OCTAVE_VERSION=5 + before_install: - - echo '' > 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} - -############################################################################### +- docker pull mtmiller/octave:${OCTAVE_VERSION} +- docker run mtmiller/octave:${OCTAVE_VERSION} octave --version + +- echo '' > 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 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 +# 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"; +# 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'"; @@ -116,7 +102,7 @@ before_script: # Double-check we are still in the right directory - pwd # Check what octave packages we have installed - - octave -q --eval "ver" + - docker run mtmiller/octave octave --eval "ver" # --------------------------------------------------------------------------- # Remove any cached results files from previous build, if present - rm -f testresults.xml; @@ -130,12 +116,11 @@ before_script: mkdir -p shippable/testresults; mkdir -p shippable/codecoverage; fi; -############################################################################### + script: - - octave -v --eval "$ADDPATH_COMMAND $TEST_COMMAND"; - - octave -v --eval "addpath(genpath(fullfile(pwd, 'source'))); addpath(genpath(fullfile(pwd, 'source/external')); exit(~moxunit_runtests('source/tests', '-recursive', '-verbose', '-junit_xml_file', 'testresults.xml', '-with_coverage', '-cover', 'source', '-cover_exclude', source/tests, '-cover_xml_file', 'coverage.xml', '-cover_json_file', 'coveralls.json'))"; +# - octave -v --eval "$ADDPATH_COMMAND $TEST_COMMAND"; +- docker run mtmiller/octave octave --eval "$ADDPATH_COMMAND $TEST_COMMAND" -############################################################################### after_script: # Check where we ended up and what's going on where we are - pwd @@ -168,4 +153,177 @@ after_success: ############################################################################### # Enable archiving of artifacts on Shippable (does nothing on Travis) -archive: true \ No newline at end of file +archive: true + + +# # We pretend to be Java because we need GNU Octave which is not +# # available (as of January 2016) +# os: linux +# dist: xenial +# language: java + +# ############################################################################### +# 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 '' > 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" +# # --------------------------------------------------------------------------- +# # 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 "$ADDPATH_COMMAND $TEST_COMMAND"; +# - octave -v --eval "addpath(genpath(fullfile(pwd, 'source'))); addpath(genpath(fullfile(pwd, 'source/external')); exit(~moxunit_runtests('source/tests', '-recursive', '-verbose', '-junit_xml_file', 'testresults.xml', '-with_coverage', '-cover', 'source', '-cover_exclude', source/tests, '-cover_xml_file', 'coverage.xml', '-cover_json_file', 'coveralls.json'))"; + +# ############################################################################### +# 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 From f131f8819ea81df40270caac6d9129ee3f6041cc Mon Sep 17 00:00:00 2001 From: Daniel Kaminski de Souza <51767368+DanielAtKrypton@users.noreply.github.com> Date: Fri, 27 Mar 2020 07:33:59 -0400 Subject: [PATCH 127/143] Update .travis.yml --- .travis.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.travis.yml b/.travis.yml index f79fd58..bad2a84 100644 --- a/.travis.yml +++ b/.travis.yml @@ -13,6 +13,12 @@ env: - OCTAVE_VERSION=4.2 - OCTAVE_VERSION=4.4 - OCTAVE_VERSION=5 + jobs: + - COVERAGE="false" + - COVERAGE="true" + jobs: + allow_failures: '[{ env: COVERAGE=true }]' + fast_finish: true before_install: - docker pull mtmiller/octave:${OCTAVE_VERSION} From 53070830b68d3563768b2301e94b9ae3d8033142 Mon Sep 17 00:00:00 2001 From: Daniel Kaminski de Souza <51767368+DanielAtKrypton@users.noreply.github.com> Date: Fri, 27 Mar 2020 07:35:38 -0400 Subject: [PATCH 128/143] Update .travis.yml --- .travis.yml | 192 ++-------------------------------------------------- 1 file changed, 7 insertions(+), 185 deletions(-) diff --git a/.travis.yml b/.travis.yml index bad2a84..26c1edd 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,8 +1,3 @@ -## SPDX-License-Identifier: BSD-3-Clause -## Copyright (C) 2019 Mike Miller -## -## .travis.yml - Travis CI configuration for octave-travis-ci-example - dist: xenial language: generic @@ -13,12 +8,12 @@ env: - OCTAVE_VERSION=4.2 - OCTAVE_VERSION=4.4 - OCTAVE_VERSION=5 - jobs: - - COVERAGE="false" - - COVERAGE="true" - jobs: - allow_failures: '[{ env: COVERAGE=true }]' - fast_finish: true +jobs: +- COVERAGE="false" +- COVERAGE="true" +jobs: +allow_failures: '[{ env: COVERAGE=true }]' +fast_finish: true before_install: - docker pull mtmiller/octave:${OCTAVE_VERSION} @@ -159,177 +154,4 @@ after_success: ############################################################################### # Enable archiving of artifacts on Shippable (does nothing on Travis) -archive: true - - -# # We pretend to be Java because we need GNU Octave which is not -# # available (as of January 2016) -# os: linux -# dist: xenial -# language: java - -# ############################################################################### -# 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 '' > 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" -# # --------------------------------------------------------------------------- -# # 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 "$ADDPATH_COMMAND $TEST_COMMAND"; -# - octave -v --eval "addpath(genpath(fullfile(pwd, 'source'))); addpath(genpath(fullfile(pwd, 'source/external')); exit(~moxunit_runtests('source/tests', '-recursive', '-verbose', '-junit_xml_file', 'testresults.xml', '-with_coverage', '-cover', 'source', '-cover_exclude', source/tests, '-cover_xml_file', 'coverage.xml', '-cover_json_file', 'coveralls.json'))"; - -# ############################################################################### -# 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 +archive: true From 1f1a6fcb3d01f1ff354cb8fa60a0d302a389f606 Mon Sep 17 00:00:00 2001 From: Daniel Kaminski de Souza <51767368+DanielAtKrypton@users.noreply.github.com> Date: Fri, 27 Mar 2020 07:45:40 -0400 Subject: [PATCH 129/143] Update .travis.yml --- .travis.yml | 24 ------------------------ 1 file changed, 24 deletions(-) diff --git a/.travis.yml b/.travis.yml index 26c1edd..94ddb5e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -23,30 +23,6 @@ before_install: # 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 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 -# 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; From 75ef3e119071e8b362c379764d45906e3c14d422 Mon Sep 17 00:00:00 2001 From: Daniel Kaminski de Souza <51767368+DanielAtKrypton@users.noreply.github.com> Date: Fri, 27 Mar 2020 07:51:28 -0400 Subject: [PATCH 130/143] Update .travis.yml --- .travis.yml | 36 ++++++++++++++++++++++++++++++++---- 1 file changed, 32 insertions(+), 4 deletions(-) diff --git a/.travis.yml b/.travis.yml index 94ddb5e..8ac6378 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,12 +1,16 @@ dist: xenial language: generic +cache: + # Downloading octave takes a while, so let's cache apt + apt: true + services: - docker env: -- OCTAVE_VERSION=4.2 -- OCTAVE_VERSION=4.4 +# - OCTAVE_VERSION=4.2 +# - OCTAVE_VERSION=4.4 - OCTAVE_VERSION=5 jobs: - COVERAGE="false" @@ -17,12 +21,36 @@ fast_finish: true before_install: - docker pull mtmiller/octave:${OCTAVE_VERSION} -- docker run mtmiller/octave:${OCTAVE_VERSION} octave --version +- docker run mtmiller/octave:${OCTAVE_VERSION} -it - echo '' > 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 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 +# 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; @@ -130,4 +158,4 @@ after_success: ############################################################################### # Enable archiving of artifacts on Shippable (does nothing on Travis) -archive: true +archive: true From e870f2d6b9138c2b712f02e17af24f57568a163b Mon Sep 17 00:00:00 2001 From: Daniel Kaminski de Souza <51767368+DanielAtKrypton@users.noreply.github.com> Date: Fri, 27 Mar 2020 07:54:21 -0400 Subject: [PATCH 131/143] Update .travis.yml --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 8ac6378..52e927e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -21,7 +21,7 @@ fast_finish: true before_install: - docker pull mtmiller/octave:${OCTAVE_VERSION} -- docker run mtmiller/octave:${OCTAVE_VERSION} -it +- docker run -it mtmiller/octave - echo '' > build.xml # Remember the directory where our repository to test is located From 6a0f727e27f243f5129fc081b908f3fce3330fd1 Mon Sep 17 00:00:00 2001 From: Daniel Kaminski de Souza <51767368+DanielAtKrypton@users.noreply.github.com> Date: Fri, 27 Mar 2020 08:09:33 -0400 Subject: [PATCH 132/143] Update .travis.yml --- .travis.yml | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/.travis.yml b/.travis.yml index 52e927e..0122f47 100644 --- a/.travis.yml +++ b/.travis.yml @@ -9,9 +9,6 @@ services: - docker env: -# - OCTAVE_VERSION=4.2 -# - OCTAVE_VERSION=4.4 -- OCTAVE_VERSION=5 jobs: - COVERAGE="false" - COVERAGE="true" @@ -20,8 +17,8 @@ allow_failures: '[{ env: COVERAGE=true }]' fast_finish: true before_install: -- docker pull mtmiller/octave:${OCTAVE_VERSION} -- docker run -it mtmiller/octave +- docker pull openmicroscopy/octave +- docker run --rm -it --entrypoint bash openmicroscopy/octave # Bash shell - echo '' > build.xml # Remember the directory where our repository to test is located @@ -158,4 +155,4 @@ after_success: ############################################################################### # Enable archiving of artifacts on Shippable (does nothing on Travis) -archive: true +archive: true From 6a538df6353677ecd3fb12612596d176df0071ac Mon Sep 17 00:00:00 2001 From: Daniel Kaminski de Souza <51767368+DanielAtKrypton@users.noreply.github.com> Date: Fri, 27 Mar 2020 08:13:02 -0400 Subject: [PATCH 133/143] Update .travis.yml --- .travis.yml | 184 +++++++++++++++++++++++++++------------------------- 1 file changed, 97 insertions(+), 87 deletions(-) diff --git a/.travis.yml b/.travis.yml index 0122f47..4983af2 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,95 +1,105 @@ +os: linux dist: xenial -language: generic +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 -services: -- docker - +############################################################################### env: -jobs: -- COVERAGE="false" -- COVERAGE="true" -jobs: -allow_failures: '[{ env: COVERAGE=true }]' -fast_finish: true - + jobs: + - COVERAGE="false" + - COVERAGE="true" + jobs: + allow_failures: '[{ env: COVERAGE=true }]' + fast_finish: true + +############################################################################### +# Command to install dependencies before_install: -- docker pull openmicroscopy/octave -- docker run --rm -it --entrypoint bash openmicroscopy/octave # Bash shell - -- echo '' > 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 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 -# 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} - + - echo '' > 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"; + # 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'"; @@ -104,7 +114,7 @@ before_script: # Double-check we are still in the right directory - pwd # Check what octave packages we have installed - - docker run mtmiller/octave octave --eval "ver" + - octave -q --eval "ver" # --------------------------------------------------------------------------- # Remove any cached results files from previous build, if present - rm -f testresults.xml; @@ -118,11 +128,11 @@ before_script: mkdir -p shippable/testresults; mkdir -p shippable/codecoverage; fi; - +############################################################################### script: -# - octave -v --eval "$ADDPATH_COMMAND $TEST_COMMAND"; -- docker run mtmiller/octave octave --eval "$ADDPATH_COMMAND $TEST_COMMAND" + - octave -v --eval "$ADDPATH_COMMAND $TEST_COMMAND"; +############################################################################### after_script: # Check where we ended up and what's going on where we are - pwd @@ -155,4 +165,4 @@ after_success: ############################################################################### # Enable archiving of artifacts on Shippable (does nothing on Travis) -archive: true +archive: true From d5bb911380cc9d9db5913b2e5221468f87c57221 Mon Sep 17 00:00:00 2001 From: Daniel Kaminski de Souza <51767368+DanielAtKrypton@users.noreply.github.com> Date: Fri, 27 Mar 2020 08:18:06 -0400 Subject: [PATCH 134/143] Update .travis.yml --- .travis.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.travis.yml b/.travis.yml index 4983af2..591e0c2 100644 --- a/.travis.yml +++ b/.travis.yml @@ -115,6 +115,7 @@ before_script: - 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; From 4dae77cef465d20d1c03368b59cc6cce8d6c0530 Mon Sep 17 00:00:00 2001 From: Daniel Kaminski de Souza <51767368+DanielAtKrypton@users.noreply.github.com> Date: Fri, 27 Mar 2020 08:23:23 -0400 Subject: [PATCH 135/143] Update .travis.yml --- .travis.yml | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index 591e0c2..c0e6474 100644 --- a/.travis.yml +++ b/.travis.yml @@ -114,8 +114,8 @@ before_script: # 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" + # - octave -q --eval "ver" + # - octave -q --eval "2+3" # --------------------------------------------------------------------------- # Remove any cached results files from previous build, if present - rm -f testresults.xml; @@ -131,7 +131,9 @@ before_script: fi; ############################################################################### script: - - octave -v --eval "$ADDPATH_COMMAND $TEST_COMMAND"; + - cd source/tests; + - moxunit_runtests + # - octave -v --eval "$ADDPATH_COMMAND $TEST_COMMAND"; ############################################################################### after_script: From 0905fe8470680211b403188041ad9886d16e1e19 Mon Sep 17 00:00:00 2001 From: Daniel Kaminski de Souza <51767368+DanielAtKrypton@users.noreply.github.com> Date: Fri, 27 Mar 2020 08:28:17 -0400 Subject: [PATCH 136/143] Update .travis.yml --- .travis.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index c0e6474..c7f0a79 100644 --- a/.travis.yml +++ b/.travis.yml @@ -131,7 +131,6 @@ before_script: fi; ############################################################################### script: - - cd source/tests; - moxunit_runtests # - octave -v --eval "$ADDPATH_COMMAND $TEST_COMMAND"; From 46d77896571e458c51d7526db41d411181403915 Mon Sep 17 00:00:00 2001 From: Daniel Kaminski de Souza Date: Fri, 27 Mar 2020 17:06:41 -0400 Subject: [PATCH 137/143] :heavy_plus_sign: Add travis yml file. --- .travis.yml | 363 +++++++++++++++------------------------------------- 1 file changed, 102 insertions(+), 261 deletions(-) diff --git a/.travis.yml b/.travis.yml index 02d71b0..12abc94 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,93 +1,105 @@ -## SPDX-License-Identifier: BSD-3-Clause -## Copyright (C) 2019 Mike Miller -## -## .travis.yml - Travis CI configuration for octave-travis-ci-example - +os: linux dist: xenial -language: generic +language: general -services: -- docker +############################################################################### +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: -- OCTAVE_VERSION=4.2 -- OCTAVE_VERSION=4.4 -- OCTAVE_VERSION=5 - + jobs: + - COVERAGE="false" + - COVERAGE="true" + jobs: + allow_failures: '[{ env: COVERAGE=true }]' + fast_finish: true + +############################################################################### +# Command to install dependencies before_install: -- docker pull mtmiller/octave:${OCTAVE_VERSION} -- docker run mtmiller/octave:${OCTAVE_VERSION} octave --version - -- echo '' > 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 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 -# 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} - + - echo '' > 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"; + # 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'"; @@ -102,7 +114,8 @@ before_script: # Double-check we are still in the right directory - pwd # Check what octave packages we have installed - - docker run mtmiller/octave octave --eval "ver" + # - octave -q --eval "ver" + # - octave -q --eval "2+3" # --------------------------------------------------------------------------- # Remove any cached results files from previous build, if present - rm -f testresults.xml; @@ -116,11 +129,12 @@ before_script: mkdir -p shippable/testresults; mkdir -p shippable/codecoverage; fi; - +############################################################################### script: -# - octave -v --eval "$ADDPATH_COMMAND $TEST_COMMAND"; -- docker run mtmiller/octave octave --eval "$ADDPATH_COMMAND $TEST_COMMAND" + - ../MOxUnit/moxunit_runtests + # - octave -v --eval "$ADDPATH_COMMAND $TEST_COMMAND"; +############################################################################### after_script: # Check where we ended up and what's going on where we are - pwd @@ -153,177 +167,4 @@ after_success: ############################################################################### # Enable archiving of artifacts on Shippable (does nothing on Travis) -archive: true - - -# # We pretend to be Java because we need GNU Octave which is not -# # available (as of January 2016) -# os: linux -# dist: xenial -# language: java - -# ############################################################################### -# 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 '' > 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" -# # --------------------------------------------------------------------------- -# # 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 "$ADDPATH_COMMAND $TEST_COMMAND"; -# - octave -v --eval "addpath(genpath(fullfile(pwd, 'source'))); addpath(genpath(fullfile(pwd, 'source/external')); exit(~moxunit_runtests('source/tests', '-recursive', '-verbose', '-junit_xml_file', 'testresults.xml', '-with_coverage', '-cover', 'source', '-cover_exclude', source/tests, '-cover_xml_file', 'coverage.xml', '-cover_json_file', 'coveralls.json'))"; - -# ############################################################################### -# 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 \ No newline at end of file +archive: true \ No newline at end of file From a535d51faf168c748f361dd9fea325ba22eb7f77 Mon Sep 17 00:00:00 2001 From: Daniel Kaminski de Souza <51767368+DanielAtKrypton@users.noreply.github.com> Date: Fri, 27 Mar 2020 17:07:44 -0400 Subject: [PATCH 138/143] Update .travis.yml --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index c7f0a79..2b1865d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -131,7 +131,7 @@ before_script: fi; ############################################################################### script: - - moxunit_runtests + - ../MOxUnit/moxunit_runtests # - octave -v --eval "$ADDPATH_COMMAND $TEST_COMMAND"; ############################################################################### From b1f9a0040f4014df8c37f2c78bd999f215ced0ce Mon Sep 17 00:00:00 2001 From: Daniel Kaminski de Souza <51767368+DanielAtKrypton@users.noreply.github.com> Date: Fri, 27 Mar 2020 17:17:19 -0400 Subject: [PATCH 139/143] Update .travis.yml --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 2b1865d..c5eeefe 100644 --- a/.travis.yml +++ b/.travis.yml @@ -131,7 +131,7 @@ before_script: fi; ############################################################################### script: - - ../MOxUnit/moxunit_runtests + - octave -v --eval "moxunit_runtests('${testFolder}')" # - octave -v --eval "$ADDPATH_COMMAND $TEST_COMMAND"; ############################################################################### From d722c24da5c9c28d44a176979cba163ae424cd30 Mon Sep 17 00:00:00 2001 From: Daniel Kaminski de Souza Date: Fri, 3 Apr 2020 18:26:51 -0400 Subject: [PATCH 140/143] :memo: Improve README.md. --- .travis.yml | 2 +- README.md | 89 +++++++++++++++++++++++++++++++++++++++++------------ 2 files changed, 71 insertions(+), 20 deletions(-) diff --git a/.travis.yml b/.travis.yml index 12abc94..b3de6f7 100644 --- a/.travis.yml +++ b/.travis.yml @@ -131,7 +131,7 @@ before_script: fi; ############################################################################### script: - - ../MOxUnit/moxunit_runtests + - octave -v --eval "moxunit_runtests('${testFolder}')" # - octave -v --eval "$ADDPATH_COMMAND $TEST_COMMAND"; ############################################################################### diff --git a/README.md b/README.md index 94b2517..b386fea 100644 --- a/README.md +++ b/README.md @@ -1,21 +1,51 @@ # 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":{ @@ -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) \ No newline at end of file From 2d28d62041398ab5cf0f2d5806aac01101af691f Mon Sep 17 00:00:00 2001 From: Daniel Kaminski de Souza Date: Fri, 3 Apr 2020 19:07:07 -0400 Subject: [PATCH 141/143] :construction: Improve getDepList.m --- source/getDepList.m | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/getDepList.m b/source/getDepList.m index a77f9de..e2ff7ff 100644 --- a/source/getDepList.m +++ b/source/getDepList.m @@ -9,7 +9,7 @@ % Arguments for DepMatRepo: DepMatRepo(Name, Branch, Url, FolderName, Commit, GetLatest) % Example: % depList = [... -% {'PackMan', 'dev01', 'https://github.com/DanielAtKrypton/PackMan.git', 'PackMan', '', true}; +% {'PackMan', 'release', 'https://github.com/DanielAtKrypton/PackMan.git', 'PackMan', '', true}; % {'DataHash', 'master', 'https://github.com/DanielAtKrypton/DataHash.git', 'DataHash', '', true}; % ]; % depList = cell2struct(depList, {'Name', 'Branch', 'Url', 'FolderName', 'Commit', 'GetLatest'}, 2); \ No newline at end of file From bf044d2d2fb90574d0d9bebf724028c8bad2d33b Mon Sep 17 00:00:00 2001 From: Daniel Kaminski de Souza Date: Fri, 3 Apr 2020 19:09:12 -0400 Subject: [PATCH 142/143] :shirt: Markdown lint README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index b386fea..547981e 100644 --- a/README.md +++ b/README.md @@ -112,4 +112,4 @@ testsResults = runtests('testPackMan') ## References -- [matlab-continuous-integration](https://github.com/scottclowe/matlab-continuous-integration) \ No newline at end of file +- [matlab-continuous-integration](https://github.com/scottclowe/matlab-continuous-integration) From 950cdb64b6d56556ef84f13e76ac7d110a7c5d80 Mon Sep 17 00:00:00 2001 From: Daniel Kaminski de Souza <51767368+DanielAtKrypton@users.noreply.github.com> Date: Sun, 6 Sep 2020 20:06:02 +0100 Subject: [PATCH 143/143] :bug: Fix git bug. --- source/git.m | 27 ++++----------------------- 1 file changed, 4 insertions(+), 23 deletions(-) diff --git a/source/git.m b/source/git.m index e37b2ed..6680bca 100644 --- a/source/git.m +++ b/source/git.m @@ -1,4 +1,4 @@ -function varargout = git(varargin) +function [result, status] = git(varargin) %GIT Summary of this function goes here % Detailed explanation goes here if (nargin == 0) @@ -23,13 +23,7 @@ ME = MException('Git:couldntExecuteGitCommand', ... 'git command %s resulted in a failure!', commandString); throw(ME); - end - switch(nargout) - case 0 - disp(result); - otherwise - varargout{1} = result; - end + end return; end name = getRepoName(); @@ -56,14 +50,7 @@ contents = contents{1}; fclose(fid); if ~isempty(contents) - while(exist(filename, 'file')) - try - delete(filename); - break; - catch - pause(1/desiredRate); - end - end + delete(filename) break; end if (isRoboticsToolboxAvailable) @@ -73,12 +60,6 @@ end end result = contents; - switch(nargout) - case 0 - disp(result); - otherwise - varargout{1} = result; - end function name = getRepoName() commandString = 'git rev-parse --show-toplevel'; @@ -89,4 +70,4 @@ throw(ME); end result = result(1:end-1); % remove newline. - [~,name,~] = fileparts(result); \ No newline at end of file + [~,name,~] = fileparts(result);