ParaMonte MATLAB 3.0.0
Parallel Monte Carlo and Machine Learning Library
See the latest version documentation.
weblink.m
Go to the documentation of this file.
1%> \brief
2%> Return a scalar MATLAB string containing the download
3%> weblink to latest ParaMonte MATLAB library version
4%> or return an empty string ``""`` is there is none.
5%>
6%> \param[in] silent : The input scalar MATLAB logical.<br>
7%> If ``true``, all descriptive messages on
8%> the MATLAB command line will be suppressed.<br>
9%> (**optional**, default = ``false``)
10%>
11%> \return
12%> ``url`` : The output scalar MATLAB string containing the weblink to the latest
13%> available version of the ParaMonte library that is newer than the
14%> existing ParaMonte library version on the current system.<br>
15%> The output ``url`` will be set to empty string ``""``
16%> if there is no newer version or the function fails.
17%>
18%> \interface{weblink}
19%> \code{.m}
20%>
21%> url = pm.lib.update.weblink()
22%>
23%> \endcode
24%>
25%> \example{weblink}
26%> \include{lineno} example/lib/update/weblink/main.m
27%> \output{weblink}
28%> \include{lineno} example/lib/update/weblink/main.out.m
29%>
30%> \final{weblink}
31%>
32%> \author
33%> \JoshuaOsborne, May 21 2024, 7:54 PM, University of Texas at Arlington<br>
34%> \FatemehBagheri, May 20 2024, 1:25 PM, NASA Goddard Space Flight Center (GSFC), Washington, D.C.<br>
35%> \AmirShahmoradi, May 16 2016, 9:03 AM, Oden Institute for Computational Engineering and Sciences (ICES), UT Austin<br>
36function url = weblink(silent)
37 if nargin < 1
38 silent = [];
39 end
40 if isempty(silent)
41 silent = false;
42 end
43 url = "";
44 weblinks = pm.lib.weblinks();
45 currentVersionString = pm.lib.version();
46 latestVersionString = pm.lib.update.version(silent);
47 if latestVersionString == ""
48 if ~silent
49 warning ( newline ...
50 + "Failed to capture the latest ParaMonte MATLAB library version the project repository." + newline ...
51 + "If you believe this behavior is unexpected, please report this issue at: " + newline ...
52 + newline ...
53 + pm.io.tab + pm.web.href(weblinks.github.issues.url) + newline ...
54 + newline ...
55 );
56 end
57 return
58 else
59 currentVersionTriplet = pm.str.split2real(currentVersionString);
60 latestVersionTriplet = pm.str.split2real(latestVersionString);
61 if all(currentVersionTriplet == latestVersionTriplet)
62 if ~silent
63 disp("You seem to have the latest version of the ParaMonte MATLAB library!");
64 end
65 else
66 updateAvailable = (latestVersionTriplet(1) > currentVersionTriplet(1)) ...
67 || (latestVersionTriplet(1) == currentVersionTriplet(1) && latestVersionTriplet(2) > currentVersionTriplet(2)) ...
68 || (latestVersionTriplet(1) == currentVersionTriplet(1) && latestVersionTriplet(2) == currentVersionTriplet(2) && latestVersionTriplet(3) > currentVersionTriplet(3));
69 if updateAvailable
70 url = weblinks.github.releases.latest.url + "/libparamonte_matlab_" + pm.os.namel();
71 if ispc()
72 url = url + ".zip";
73 else
74 url = url + ".tar.gz";
75 end
76 if ~silent
77 disp( newline ...
78 + "A newer ParaMonte MATLAB library version (" + latestVersionString + ") is " + newline ...
79 + "available on GitHub or is in preparation for release. " + newline ...
80 + "The currently-installed version on your system is: " + currentVersionString + newline ...
81 + "You can download the latest version of the ParaMonte MATLAB library from " + newline ...
82 + newline ...
83 + pm.io.tab + pm.web.href(url) + newline ...
84 + newline ...
85 );
86 end
87 else
88 if ~silent
89 disp( newline ...
90 + "Looks like you have a version of the ParaMonte MATLAB library (" + currentVersionString + ") " + newline ...
91 + "that is newer than the most recent release version (" + latestVersionString + ")." + newline ...
92 + "Get in touch with us at:" + newline ...
93 + newline ...
94 + pm.io.tab + pm.web.href(weblinks.github.url) + newline ...
95 + newline ...
96 + "We need your superpowers!" + newline ...
97 );
98 end
99 end
100 end
101 end
102end
function version(in silent)
Return a scalar MATLAB string containing the latest available ParaMonte MATLAB version newer than the...
function href(in url)
Return an HTML-style decoration of the input URL if the ParaMonte MATLAB library is used in GUI,...
function lib()
Return a scalar MATLAB string containing the path to the lib directory of the ParaMonte library packa...
function release(in type)
Return a scalar MATLAB string containing the MATLAB release version, year, or season as requested.
function tab()
Return a scalar MATLAB string containing 4 blank characters equivalent to a tab character.
function touch()
Return the contents of the .bash_profile file in the system home folder as a scalar MATLAB string.