Last active
February 21, 2023 17:49
-
-
Save wlads/8e3690512b7cf95d487d5425acb083f4 to your computer and use it in GitHub Desktop.
[sh] Check if a ruby gem is installed
This file contains hidden or 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
# gem list -i -e 'debug' -v '>= 1.0.0' | |
# -i returns true / false | |
# -e exact match (avoid partial match), could also be a regex e.g. '^debug$' | |
# -v specify gem version (may also use pessimistic version) | |
function check_ruby_debug() { | |
debug_gem_installed=$(gem list -i -e "debug" -v ">= 1.0.0") | |
if [[ $debug_gem_installed = "false" ]]; then | |
echo -e "Ruby's debug gem not installed!" | |
echo -e "run: gem install debug" | |
exit 1 | |
fi | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment