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%> url = pm.lib.update.weblink(silent)
23%>
24%> \endcode
25%>
26%> \example{weblink}
27%> \include{lineno} example/lib/update/weblink/main.m
28%> \output{weblink}
29%> \include{lineno} example/lib/update/weblink/main.out.m
30%>
31%> \final{weblink}
32%>
33%> \author
34%> \JoshuaOsborne, May 21 2024, 7:54 PM, University of Texas at Arlington<br>
35%> \FatemehBagheri, May 20 2024, 1:25 PM, NASA Goddard Space Flight Center (GSFC), Washington, D.C.<br>
36%> \AmirShahmoradi, May 16 2016, 9:03 AM, Oden Institute for Computational Engineering and Sciences (ICES), UT Austin<br>
37function url = weblink(silent)
38 if nargin < 1
39 silent = [];
40 end
41 if isempty(silent)
42 silent = false;
43 end
44 url = "";
45 weblinks = pm.lib.weblinks();
46 currentVersionString = pm.lib.version();
47 latestVersionString = pm.lib.update.version(silent);
48 if latestVersionString == ""
49 if ~silent
50 warning ( newline ...
51 + "Failed to capture the latest ParaMonte MATLAB library version the project repository." + newline ...
52 + "If you believe this behavior is unexpected, please report this issue at: " + newline ...
53 + newline ...
54 + pm.io.tab + pm.web.href(weblinks.github.issues.url) + newline ...
55 + newline ...
56 );
57 end
58 return
59 else
60 currentVersionTriplet = pm.str.split2real(currentVersionString);
61 latestVersionTriplet = pm.str.split2real(latestVersionString);
62 if all(currentVersionTriplet == latestVersionTriplet)
63 if ~silent
64 disp("You seem to have the latest version of the ParaMonte MATLAB library!");
65 end
66 else
67 updateAvailable = (latestVersionTriplet(1) > currentVersionTriplet(1)) ...
68 || (latestVersionTriplet(1) == currentVersionTriplet(1) && latestVersionTriplet(2) > currentVersionTriplet(2)) ...
69 || (latestVersionTriplet(1) == currentVersionTriplet(1) && latestVersionTriplet(2) == currentVersionTriplet(2) && latestVersionTriplet(3) > currentVersionTriplet(3));
70 if updateAvailable
71 url = weblinks.github.releases.latest.url + "/libparamonte_matlab_" + pm.os.namel();
72 if ispc()
73 url = url + ".zip";
74 else
75 url = url + ".tar.gz";
76 end
77 if ~silent
78 disp( newline ...
79 + "A newer ParaMonte MATLAB library version (" + latestVersionString + ") is " + newline ...
80 + "available on GitHub or is in preparation for release. " + newline ...
81 + "The currently-installed version on your system is: " + currentVersionString + newline ...
82 + "You can download the latest version of the ParaMonte MATLAB library from " + newline ...
83 + newline ...
84 + pm.io.tab + pm.web.href(url) + newline ...
85 + newline ...
86 );
87 end
88 else
89 if ~silent
90 disp( newline ...
91 + "Looks like you have a version of the ParaMonte MATLAB library (" + currentVersionString + ") " + newline ...
92 + "that is newer than the most recent release version (" + latestVersionString + ")." + newline ...
93 + "Get in touch with us at:" + newline ...
94 + newline ...
95 + pm.io.tab + pm.web.href(weblinks.github.url) + newline ...
96 + newline ...
97 + "We need your superpowers!" + newline ...
98 );
99 end
100 end
101 end
102 end
103end
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.