Closed retokromer closed 7 years ago
@dericed @privatezero If this PR and https://github.com/amiaopensource/ltopers/pull/78 are accepted, should we use the date-based versioning from the next releases on? In my feeling v2017-03-26
would be more informative than v0.1.13
.
How does date versioning handle more than one update on the same day?
It uses the release information, not the updates, therefore it would allow to know which release is used.
Would the results be wrong if the user uses brew switch
to revert to an earlier version of ltopers. If they did, they would still see the highest numbered installed version number in their help documentation even when they switched to an earlier one.
I'd also suggest a fall back in case a user does not have a /usr/local/Cellar/ltopers
dir.
Good point!
(In our configuration older/newer versions are automatically removed, and only the last installed is there…)
If we change to date-based versioning, then
VERSION=$(brew info ltopers | grep "/ltopers/" | grep -Eo "[0-9]{4}-[0-9]{2}-[0-9]{2}")
would give the actual active version.
@dericed @kieranjol This
VERSION=$(TMP=$(brew info ltopers | grep -Eo "/ltopers/.* \(") ; echo ${TMP:9:(${#TMP}-11)})
should work with any installed version (including e.g. 0.00.007 alpha 2017-03-27 in the morning
). BTW: it works also on Linux and Ubuntu on Windows.
This could also cause confusion when testing an uninstalled script while there is also an installed one, which may be most development scenarios. Could you also add a check to be sure that dirname $(which "${0}")
is referencing the homebrew installation directory before using the homebrew version number.
Do you mean something like
if [[ $(dirname $(which "${0}")) = "/usr/local/bin" ]]; then
VERSION=$(TMP=$(brew info ltopers | grep -Eo "/ltopers/.* \(") ; echo ${TMP:9:(${#TMP}-11)})
else
VERSION=""
fi
?
untested, but yes something like that, so that an uninstalled mountlto
doesn't provide the version of the installed one
Thank you again! I will amend again.
Thank you @privatezero for the idea!