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%> ``str`` : 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 ``str`` 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%> str = 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 str = weblink(silent)
37 if nargin < 1
38 silent = [];
39 end
40 if isempty(silent)
41 silent = false;
42 end
43 str = "";
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( newline ...
64 + "It appears that you have the latest version of the ParaMonte MATLAB library." + newline ...
65 + newline ...
66 );
67 end
68 else
69 updateAvailable = (latestVersionTriplet(1) > currentVersionTriplet(1)) ...
70 || (latestVersionTriplet(1) == currentVersionTriplet(1) && latestVersionTriplet(2) > currentVersionTriplet(2)) ...
71 || (latestVersionTriplet(1) == currentVersionTriplet(1) && latestVersionTriplet(2) == currentVersionTriplet(2) && latestVersionTriplet(3) > currentVersionTriplet(3));
72 if updateAvailable
73 str = weblinks.github.release.latest.url + "/libparamonte_matlab_" + pm.os.namel();
74 if ispc()
75 str = str + ".zip";
76 else
77 str = str + ".tar.gz";
78 end
79 if ~silent
80 disp( newline ...
81 + "A newer ParaMonte MATLAB library version (" + latestVersionString + ") is " + newline ...
82 + "available on GitHub or is in preparation for release. " + newline ...
83 + "The currently-installed version on your system is: " + currentVersionString + newline ...
84 + "You can download the latest version of the ParaMonte MATLAB library from " + newline ...
85 + newline ...
86 + pm.io.tab + pm.web.href(str) + newline ...
87 + newline ...
88 );
89 end
90 else
91 if ~silent
92 disp( newline ...
93 + "Looks like you have a version of the ParaMonte MATLAB library (" + currentVersionString + ") " + newline ...
94 + "that is newer than the most recent release version (" + latestVersionString + ")." + newline ...
95 + "Get in touch with us at:" + newline ...
96 + newline ...
97 + pm.io.tab + pm.web.href(weblinks.github.url) + newline ...
98 + newline ...
99 + "We need your superpowers!" + newline ...
100 );
101 end
102 end
103 end
104 end
105end
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.