Last active
July 11, 2017 13:42
-
-
Save strund3r/e31ad6e08ea09e3801a2219c2947601f to your computer and use it in GitHub Desktop.
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 | |
clear | |
function version_gt() { test "$(echo "$@" | tr " " "\n" | sort -V | head -n 1)" != "$1"; } | |
function version_le() { test "$(echo "$@" | tr " " "\n" | sort -V | head -n 1)" == "$1"; } | |
function version_lt() { test "$(echo "$@" | tr " " "\n" | sort -rV | head -n 1)" != "$1"; } | |
printf "\n\n" | |
echo -e "\t\t\t\t\t\t\e[1;4m* * * * * # Checking Versions # * * * * *\e[0m" | |
printf "\n\n" | |
echo -ne '\t\t\t\t\t\t\e[1;4;38;5;226m## \e[0m \e[2m(5%)\e[22m\r' | |
docker_version=$(docker --version) | |
docker_compose_version=$(docker-compose --version) | |
docker_machine_version=$(docker-machine --version) | |
echo -ne '\t\t\t\t\t\t\e[1;4;38;5;226m##\e[1;4;38;5;56m################### \e[0m \e[2m(51%)\e[22m\r' | |
nodejs_version=$(nodejs -v) | |
ruby_version=$(ruby -v) | |
rails_version=$(rails -v) | |
bundler_version=$(bundler -v) | |
echo -ne '\t\t\t\t\t\t\e[1;4;38;5;226m##\e[1;4;38;5;56m###################\e[1;4;38;5;196m####################\e[0m \e[2m(100%)\e[22m\r' | |
sleep 0.3 | |
echo -ne '\n\n\n' | |
################################################################################ | |
echo Docker Engine version: | |
printf "\n" | |
if [[ $docker_version = "Docker version 17.06.0-ce, build 02c1d87" ]]; then | |
echo -e "\t\t\e[1;4;28;41m Docker 17.06.0 Community Edition \e[0m" | |
else | |
echo -e "\t\t\e[1;4;28;41m $docker_version \e[0m \t\e[1;4;31;40m* UPDATED *\e[0m" | |
fi | |
printf "\n" | |
sleep 0.5 | |
################################################################################ | |
echo Docker Compose version: | |
printf "\n" | |
if [[ $docker_compose_version = "docker-compose version 1.13.0, build 1719ceb" ]]; then | |
echo -e "\t\t\e[1;4;28;41m Docker Compose 1.13.0 \e[0m" | |
else | |
echo -e "\t\t\e[1;4;28;41m $docker_compose_version \e[0m \t\e[1;4;31;40m* UPDATED *\e[0m" | |
fi | |
printf "\n" | |
sleep 0.5 | |
################################################################################ | |
echo Docker Machine version: | |
printf "\n" | |
if [[ $docker_machine_version = "docker-machine version 0.12.0, build 45c69ad" ]]; then | |
echo -e "\t\t\e[1;4;28;41m Docker Machine 0.12.0 \e[0m" | |
else | |
echo -e "\t\t\e[1;4;28;41m $docker_machine_version \e[0m \t\e[1;4;31;40m* UPDATED *\e[0m" | |
fi | |
printf "\n" | |
sleep 0.5 | |
################################################################################ | |
echo NodeJS version: | |
printf "\n" | |
nodejs_latest_version="v4.3.6" | |
if version_le $nodejs_version $nodejs_latest_version; then | |
echo -e "\t\t\e[1;4;28;41m NodeJS v4.2.6 \e[0m" | |
elif version_gt $nodejs_version $nodejs_latest_version; then | |
echo -e "\t\t\e[1;4;28;41m NodeJS $nodejs_version \e[0m \t\e[1;4;31;40m* UPDATED *\e[0m" | |
else #elif version_lt $nodejs_version $nodejs_latest_version; then | |
echo -e "\t\t\e[1;4;28;41m NodeJS $nodejs_version \e[0m \t\e[1;4;31;40m* OUTDATED *\e[0m" | |
fi | |
# if [[ $nodejs_version = "v4.2.6" ]]; then | |
# echo -e "\t\t\e[1;4;28;41m NodeJS v4.2.6 \e[0m" | |
# else | |
# echo -e "\t\t\e[1;4;28;41m NodeJS $nodejs_version \e[0m \t\e[1;4;31;40m* UPDATED *\e[0m" | |
# fi | |
printf "\n" | |
sleep 0.5 | |
################################################################################ | |
echo Ruby version: | |
printf "\n" | |
if [[ $ruby_version = "ruby 2.3.3p222 (2016-11-21 revision 56859) [x86_64-linux]" ]]; then | |
echo -e "\t\t\e[1;4;28;41m Ruby 2.3.3p222 \e[0m" | |
else | |
echo -e "\t\t\e[1;4;28;41m $ruby_version \e[0m \t\e[1;4;31;40m* UPDATED *\e[0m" | |
fi | |
printf "\n" | |
sleep 0.5 | |
################################################################################ | |
echo Rails version: | |
printf "\n" | |
if [[ $rails_version = "Rails 4.2.8" ]]; then | |
echo -e "\t\t\e[1;4;28;41m Rails 4.2.8 \e[0m" | |
else | |
echo -e "\t\t\e[1;4;28;41m $rails_version \e[0m \t\e[1;4;31;40m* UPDATED *\e[0m" | |
fi | |
printf "\n" | |
################################################################################ | |
echo Bundler version: | |
printf "\n" | |
if [[ $bundler_version = "Bundler version 1.14.5" ]]; then | |
echo -e "\t\t\e[1;4;28;41m Bundler 1.14.5 \e[0m" | |
else | |
echo -e "\t\t\e[1;4;28;41m $bundler_version \e[0m \t\e[1;4;31;40m* UPDATED *\e[0m" | |
fi | |
printf "\n\n" | |
sleep 1 | |
printf "\n\n" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment