Last active
February 8, 2023 10:04
-
-
Save Niall47/8453cb36c2d390b54ad261576e20a6ca to your computer and use it in GitHub Desktop.
search through functional test packs and output any gem versions that could be updated. Thanks ChatGPT
This file contains 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
#!/bin/bash | |
# Search for directories with name 'functional-tests' in current directory | |
for directory in $(find . -type d -name 'functional-tests'); do | |
# Check if a Gemfile exists in the directory | |
if [ -e "$directory/Gemfile" ]; then | |
# Output which directory is being checked | |
echo -e "\033[0;34mChecking gems in directory:\033[0m $directory" | |
# Change into the directory and run the bundler outdated command | |
cd "$directory" || exit 1 | |
bundler_outdated_output=$(bundler outdated 2>&1) | |
cd - > /dev/null || exit 1 | |
# Check if the output contains 'Unable to resolve dependency' | |
if echo "$bundler_outdated_output" | grep -q 'Unable to resolve dependency'; then | |
echo -e "\033[0;31mbundler outdated FAILED in directory:\033[0m $directory" | |
else | |
echo "$bundler_outdated_output" | |
fi | |
else | |
# Output which directory is being excluded | |
echo -e "\033[0;33mExcluding directory\033[0m $directory \033[0;33m(no Gemfile found)\033[0m" | |
fi | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment