diff --git a/build.rb b/build.rb index aa77125..353d15a 100644 --- a/build.rb +++ b/build.rb @@ -25,7 +25,7 @@ def build *args .sort { |x, y| File.basename(x) <=> File.basename(y) } # sort alphabetically .collect { |file| File.read(file) }.join("\n") # concat - [File.read("include/setup.sh"), content, File.read("include/report.sh")].join("\n") + [File.read("include/setup.sh"), content, File.read("include/report.sh")].join("\n\n") end puts build *ARGV unless ARGV.empty? diff --git a/include/setup.sh b/include/setup.sh index f594180..1d15dfd 100644 --- a/include/setup.sh +++ b/include/setup.sh @@ -4,20 +4,30 @@ KO=0 PASS='✔' FAIL='✘' +# by default show installed versions +NO_VERSION=1 +if [[ "$1" == "--no-version" ]]; then + NO_VERSION=0 +fi + if [[ $TERM == xterm-*color ]]; then PASS="\E[32m$PASS\E[0m" FAIL="\E[31m$FAIL\E[0m" fi # $1 command name -# $2 0 ok anything else -# $3 version +# $2 0 OK, anything else KO +# $3 optional version string, should send in quotes _dq_report () { if [ "$2" -eq 0 ]; then - echo -e "$PASS $1 $3" + if [ "$NO_VERSION" -eq 0 ]; then + printf "$PASS $1\n" + else + printf "$PASS %-30s %s\n" $1 $3 + fi OK=$(($OK+1)) else - echo -e "$FAIL $1" + printf "$FAIL $1\n" KO=$(($KO+1)) fi } diff --git a/lib/core/git.sh b/lib/core/git.sh index 7b89c39..6e9b3a0 100644 --- a/lib/core/git.sh +++ b/lib/core/git.sh @@ -1,2 +1,6 @@ -git --version > /dev/null 2>&1 -_dq_report 'git' $? +command_name="git" +output=$(git --version) +status=$? +version=$(echo "$output" | grep -o "\d*\.\d*.\d*") + +_dq_report "$command_name" $status "$version" diff --git a/lib/core/node.sh b/lib/core/node.sh index 8c5224c..1f6561c 100644 --- a/lib/core/node.sh +++ b/lib/core/node.sh @@ -1,2 +1,6 @@ -node --version > /dev/null 2>&1 -_dq_report 'node' $? +command_name="node" +output=$(node --version) +status=$? +version=$(echo "$output" | grep -o "\d*\.\d*.\d*") + +_dq_report "$command_name" $status "$version" diff --git a/lib/db/mongo.sh b/lib/db/mongo.sh index 9201808..4b3cf92 100644 --- a/lib/db/mongo.sh +++ b/lib/db/mongo.sh @@ -1,2 +1,6 @@ -mongo --version > /dev/null 2>&1 -_dq_report 'mongo client' $? +command_name="mongo-client" +output=$(mongo --version) +status=$? +version=$(echo "$output" | grep -o "\d*\.\d*.\d*" | head -1) + +_dq_report "$command_name" $status "$version" diff --git a/lib/db/mongod.sh b/lib/db/mongod.sh index 19d4983..909a5de 100644 --- a/lib/db/mongod.sh +++ b/lib/db/mongod.sh @@ -1,2 +1,6 @@ -mongod --version > /dev/null 2>&1 -_dq_report 'mongo server' $? +command_name="mongodb" +output=$(mongod --version) +status=$? +version=$(echo "$output" | grep -o "\d*\.\d*.\d*" | head -1) + +_dq_report "$command_name" $status "$version" diff --git a/lib/frontend/bower.sh b/lib/frontend/bower.sh index 20632e0..128dc64 100644 --- a/lib/frontend/bower.sh +++ b/lib/frontend/bower.sh @@ -1,2 +1,6 @@ -bower --version > /dev/null 2>&1 -_dq_report 'bower' $? \ No newline at end of file +command_name="bower" +output=$(bower --version) +status=$? +version=$(echo "$output" | grep -o "\d*\.\d*.\d*") + +_dq_report "$command_name" $status "$version" diff --git a/lib/frontend/coffee.sh b/lib/frontend/coffee.sh index f09123d..dfc52fb 100644 --- a/lib/frontend/coffee.sh +++ b/lib/frontend/coffee.sh @@ -1,2 +1,6 @@ -coffee --version > /dev/null 2>&1 -_dq_report 'coffee' $? \ No newline at end of file +command_name="coffee" +output=$(coffee --version) +status=$? +version=$(echo "$output" | grep -o "\d*\.\d*.\d*") + +_dq_report "$command_name" $status "$version" diff --git a/lib/frontend/grunt.sh b/lib/frontend/grunt.sh index aba0645..364f632 100644 --- a/lib/frontend/grunt.sh +++ b/lib/frontend/grunt.sh @@ -1,2 +1,6 @@ -grunt --version > /dev/null 2>&1 -_dq_report 'grunt' $? \ No newline at end of file +command_name="grunt" +output=$(grunt --version) +status=$? +version=$(echo "$output" | grep -o "\d*\.\d*.\d*") + +_dq_report "$command_name" $status "$version" diff --git a/lib/frontend/npm.sh b/lib/frontend/npm.sh index 6d72961..027c6aa 100644 --- a/lib/frontend/npm.sh +++ b/lib/frontend/npm.sh @@ -1,2 +1,6 @@ -npm --version > /dev/null 2>&1 -_dq_report 'npm' $? \ No newline at end of file +command_name="npm" +output=$(npm --version) +status=$? +version=$(echo "$output" | grep -o "\d*\.\d*.\d*") + +_dq_report "$command_name" $status "$version" diff --git a/lib/frontend/sass.sh b/lib/frontend/sass.sh index 4338e85..a1e8fdc 100644 --- a/lib/frontend/sass.sh +++ b/lib/frontend/sass.sh @@ -1,2 +1,6 @@ -sass --version > /dev/null 2>&1 -_dq_report 'sass' $? \ No newline at end of file +command_name="sass" +output=$(sass --version) +status=$? +version=$(echo "$output" | grep -o "\d*\.\d*.\d*") + +_dq_report "$command_name" $status "$version" diff --git a/lib/frontend/yo.sh b/lib/frontend/yo.sh index 0ef5ce3..e479429 100644 --- a/lib/frontend/yo.sh +++ b/lib/frontend/yo.sh @@ -1,2 +1,6 @@ -yo --version > /dev/null 2>&1 -_dq_report 'yeoman' $? +command_name="yeoman" +output=$(yo --version) +status=$? +version=$(echo "$output" | grep -o "\d*\.\d*.\d*") + +_dq_report "$command_name" $status "$version" diff --git a/lib/java/gradle.sh b/lib/java/gradle.sh index d3bba2f..a4a67a7 100644 --- a/lib/java/gradle.sh +++ b/lib/java/gradle.sh @@ -1,2 +1,6 @@ -gradle -v > /dev/null 2>&1 -_dq_report 'gradle' $? \ No newline at end of file +command_name="gradle" +output=$(gradle -v 2>&1) +status=$? +version=$(echo "$output" | grep -o "\d*\.\d*" | head -1) + +_dq_report "$command_name" $status "$version" \ No newline at end of file