diff --git a/+dj/setup.m b/+dj/setup.m index fc5d9eb1..2ae665bc 100644 --- a/+dj/setup.m +++ b/+dj/setup.m @@ -29,11 +29,40 @@ function setup(varargin) try ghtb.require(requiredToolboxes, 'prompt', prompt); catch ME - if strcmp(ME.identifier, 'MATLAB:undefinedVarOrClass') + installPromptMsg = { + 'Toolbox ''%s'' did not meet the minimum requirements.' + 'Would you like to proceed with an upgrade?' + }; + if strcmp(ME.identifier, 'MATLAB:undefinedVarOrClass') && (~prompt || strcmpi('yes',... + dj.internal.ask(sprintf(sprintf('%s\n', installPromptMsg{:}), 'GHToolbox')))) + % fetch + tmp_toolbox = [tempname '.mltbx']; + websave(tmp_toolbox, ['https://github.com/' requiredToolboxes{1}.ResolveTarget ... + '/releases/download/' ... + subsref(webread(['https://api.github.com/repos/' ... + requiredToolboxes{1}.ResolveTarget ... + '/releases/latest'], ... + weboptions('Timeout', 60)), ... + substruct('.', 'tag_name')) ... + '/GHToolbox.mltbx'], weboptions('Timeout', 60)); + % install + try + matlab.addons.install(tmp_toolbox, 'overwrite'); + catch ME + if strcmp(ME.identifier, 'MATLAB:undefinedVarOrClass') + matlab.addons.toolbox.installToolbox(tmp_toolbox); + else + rethrow(ME); + end + end + % remove temp toolbox file + delete(tmp_toolbox); + % retrigger dependency validation + ghtb.require(requiredToolboxes, 'prompt', prompt); + elseif strcmp(ME.identifier, 'MATLAB:undefinedVarOrClass') GHToolboxMsg = { - 'Toolbox ''GHToolbox'' did not meet the minimum minimum requirements.' - 'Please install it via instructions in ' - '''https://github.com/datajoint/GHToolbox'''.' + 'Toolbox ''GHToolbox'' did not meet the minimum requirements.' + 'Please proceed to install it.' }; error('DataJoint:verifyGHToolbox:Failed', ... sprintf('%s\n', GHToolboxMsg{:})); diff --git a/+dj/version.m b/+dj/version.m index 3efacd05..1fb2916e 100644 --- a/+dj/version.m +++ b/+dj/version.m @@ -1,7 +1,7 @@ function varargout = version % report DataJoint version -v = struct('major',3,'minor',3,'bugfix',2); +v = struct('major',3,'minor',3,'bugfix',3); if nargout varargout{1}=v; diff --git a/DataJoint.mltbx b/DataJoint.mltbx index feb1a499..d2251b34 100644 Binary files a/DataJoint.mltbx and b/DataJoint.mltbx differ diff --git a/LNX-docker-compose.yml b/LNX-docker-compose.yml index 48dbc1dc..af4361e4 100644 --- a/LNX-docker-compose.yml +++ b/LNX-docker-compose.yml @@ -41,15 +41,7 @@ services: - | mkdir ~/Documents matlab -nodisplay -r " - websave([tempdir 'GHToolbox.mltbx'],\ - ['https://github.com/datajoint/GHToolbox' \ - '/releases/download/' subsref(webread(['https://api.github.com/repos' \ - '/datajoint/GHToolbox' \ - '/releases/latest']),\ - substruct('.', 'tag_name')) \ - '/GHToolbox.mltbx']);\ - matlab.addons.toolbox.installToolbox([tempdir 'GHToolbox.mltbx']);\ - ghtb.install('DataJoint.mltbx');\ + matlab.addons.toolbox.installToolbox('DataJoint.mltbx');\ addpath('tests');\ res=run(Main);\ disp(res);\ diff --git a/tests/Prep.m b/tests/Prep.m index bea6c894..5ce9b088 100644 --- a/tests/Prep.m +++ b/tests/Prep.m @@ -31,7 +31,7 @@ function init(testCase) clear functions; addpath([testCase.test_root '/test_schemas']); dj.set('suppressPrompt', true); - + disp(dj.version); curr_conn = dj.conn(testCase.CONN_INFO_ROOT.host, ... testCase.CONN_INFO_ROOT.user, testCase.CONN_INFO_ROOT.password,'',true); % create test users