-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
issue-21: Add version check function and update initializer to run ch…
…eckVersion at the beginning
- Loading branch information
Showing
3 changed files
with
82 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
function isLatestVersion = checkVersion() | ||
url = 'https://github.com/OceanNetworksCanada/api-matlab-client/releases/latest'; | ||
isLatestVersion = 0; | ||
try | ||
% get latest version | ||
releaseInfo = webread(url); | ||
versionPattern = '<title>Release (\d+\.\d+\.\d+)'; | ||
version = regexp(releaseInfo, versionPattern, 'tokens', 'once'); | ||
latestVersion = version{1}; | ||
% get local version | ||
librariesVersion = ver; | ||
localVersion ='0.0.0'; | ||
for i = librariesVersion | ||
if strcmp(i.Name,'Ocean Networks Canada API Client Library') | ||
localVersion = i.Version; | ||
break; | ||
end | ||
end | ||
|
||
% compare | ||
if ~strcmp(localVersion, latestVersion) | ||
[oncFolderPath, ~, ~] = fileparts(which('Onc')); | ||
localFilePath = [oncFolderPath '\..\doc\UpdateInstruction.html']; | ||
formattedPath = ['file:///', strrep(localFilePath, '\', '/')]; | ||
link = sprintf('<a href="%s">How to update this library</a>', formattedPath); | ||
warning(['You are using an outdated version(%s) of the library. Update to the latest version(%s) to avoid potential errors. ' ... | ||
'For instructions on updating to the latest version, please visit: %s'], localVersion, latestVersion, link); | ||
else | ||
isLatestVersion = 1; | ||
end | ||
catch ME | ||
% do nothing | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
% Ocean Networks Canada API Client Library | ||
% Version 2.2.0 10-Jun-2024 | ||
% | ||
% Functions | ||
% +onc/OncDiscovery - Contains the functionality that wraps the API discovery services | ||
% +onc/OncDelivery - Contains the functionality that wraps the API data product delivery services. To be inherited by the Onc class | ||
% +onc/OncRealTime - Contains the functionality that wraps API real-time services. | ||
% +onc/OncArchive - Contains the functionality that wraps API archivefile services | ||
% | ||
% Live Scripts | ||
% examples/OncDiscoveryLocations.mat - Example Usage of OncDiscovery Location Service | ||
% examples/OncDiscoveryProperties.mat - Example Usage of OncDiscovery Properties Service | ||
% examples/OncDiscoveryDataProducts.mat - Example Usage of OncDiscovery DataProducts Service | ||
% examples/OncDiscoveryDeployments.mat - Example Usage of OncDiscovery Deployments Service | ||
% examples/OncDiscoveryDeviceCategories.mat - Example Usage of OncDiscovery Device Categories Service | ||
% examples/OncDiscoveryDevices.mat - Example Usage of OncDiscovery Devices Service | ||
% examples/OncRealTime.mat - Example Usage of OncRealTime Service | ||
% examples/OncDeliveryDataProducts.mat - Example Usage of OncDelivery Service | ||
% examples/OncArchive.mat - Example Usage of OncArchive Service | ||
% | ||
% Copyright 2024, ONC Data Team |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters