Home > functions > internal > dsCheckVersion.m

dsCheckVersion

PURPOSE ^

% dsCheckVersion - checks dynasim version against github

SYNOPSIS ^

function checkVersion()

DESCRIPTION ^

% dsCheckVersion - checks dynasim version against github

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function checkVersion()
0002 %% dsCheckVersion - checks dynasim version against github
0003 
0004 %% Get current commit SHA
0005 % keyboard
0006 dsGetRootPath = fullfile(thisMfileDir(), '..');
0007 vFile = fullfile(dsGetRootPath, '.ds_version');
0008 keyboard
0009 if exist(vFile, 'file')
0010   fid = fopen(vFile, 'r');%,'n','UTF-8');
0011   currentSHA = textscan(fid,'%s');
0012   currentSHA = currentSHA{1}{1};
0013   fclose(fid);
0014 else
0015   currentSHA = [];
0016 end
0017 fid = fopen(vFile, 'w');
0018   
0019 
0020 %% Get Github commit SHA
0021 request = matlab.net.http.RequestMessage;
0022 uri = 'https://api.github.com/repos/DynaSim/DynaSim/commits';
0023 response = send(request, uri);
0024 githubSHA = response.Body.Data(1).sha;
0025 
0026 %% Compare versions
0027 if ~strcmp(currentSHA, githubSHA)
0028   fprintf('\nWarning: Your version of dynasim is outdated. Please update from github.\n')
0029 end
0030 
0031 %% Update
0032 % dependencies = {...
0033 % 'https://github.com/DynaSim/DynaSim'
0034 % };
0035 %
0036 % if dsIsDevMode
0037 %   dependencies = [dependencies, {...
0038 %     'https://github.com/davestanley/MDD',...
0039 %     'https://github.com/erikthered12/GIMBL-Vis',...
0040 %     }];
0041 % end
0042 % githubSync(dependencies)
0043 % fprintf('Updating DynaSim Commit SHA to: %s\n', githubSHA);
0044 % fprintf(fid, '%s\r', githubSHA);
0045 
0046 %% Close file
0047 fclose(fid);

Generated on Tue 12-Dec-2017 11:32:10 by m2html © 2005