mirror of
https://github.com/kdabir/has.git
synced 2024-11-10 21:26:50 +01:00
More version goodies. ability to disable version display.
This commit is contained in:
parent
45616090c8
commit
7eccca0a44
2
build.rb
2
build.rb
@ -25,7 +25,7 @@ def build *args
|
|||||||
.sort { |x, y| File.basename(x) <=> File.basename(y) } # sort alphabetically
|
.sort { |x, y| File.basename(x) <=> File.basename(y) } # sort alphabetically
|
||||||
.collect { |file| File.read(file) }.join("\n") # concat
|
.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
|
end
|
||||||
|
|
||||||
puts build *ARGV unless ARGV.empty?
|
puts build *ARGV unless ARGV.empty?
|
||||||
|
@ -4,20 +4,30 @@ KO=0
|
|||||||
PASS='✔'
|
PASS='✔'
|
||||||
FAIL='✘'
|
FAIL='✘'
|
||||||
|
|
||||||
|
# by default show installed versions
|
||||||
|
NO_VERSION=1
|
||||||
|
if [[ "$1" == "--no-version" ]]; then
|
||||||
|
NO_VERSION=0
|
||||||
|
fi
|
||||||
|
|
||||||
if [[ $TERM == xterm-*color ]]; then
|
if [[ $TERM == xterm-*color ]]; then
|
||||||
PASS="\E[32m$PASS\E[0m"
|
PASS="\E[32m$PASS\E[0m"
|
||||||
FAIL="\E[31m$FAIL\E[0m"
|
FAIL="\E[31m$FAIL\E[0m"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# $1 command name
|
# $1 command name
|
||||||
# $2 0 ok anything else
|
# $2 0 OK, anything else KO
|
||||||
# $3 version
|
# $3 optional version string, should send in quotes
|
||||||
_dq_report () {
|
_dq_report () {
|
||||||
if [ "$2" -eq 0 ]; then
|
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))
|
OK=$(($OK+1))
|
||||||
else
|
else
|
||||||
echo -e "$FAIL $1"
|
printf "$FAIL $1\n"
|
||||||
KO=$(($KO+1))
|
KO=$(($KO+1))
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
@ -1,2 +1,6 @@
|
|||||||
git --version > /dev/null 2>&1
|
command_name="git"
|
||||||
_dq_report 'git' $?
|
output=$(git --version)
|
||||||
|
status=$?
|
||||||
|
version=$(echo "$output" | grep -o "\d*\.\d*.\d*")
|
||||||
|
|
||||||
|
_dq_report "$command_name" $status "$version"
|
||||||
|
@ -1,2 +1,6 @@
|
|||||||
node --version > /dev/null 2>&1
|
command_name="node"
|
||||||
_dq_report 'node' $?
|
output=$(node --version)
|
||||||
|
status=$?
|
||||||
|
version=$(echo "$output" | grep -o "\d*\.\d*.\d*")
|
||||||
|
|
||||||
|
_dq_report "$command_name" $status "$version"
|
||||||
|
@ -1,2 +1,6 @@
|
|||||||
mongo --version > /dev/null 2>&1
|
command_name="mongo-client"
|
||||||
_dq_report 'mongo client' $?
|
output=$(mongo --version)
|
||||||
|
status=$?
|
||||||
|
version=$(echo "$output" | grep -o "\d*\.\d*.\d*" | head -1)
|
||||||
|
|
||||||
|
_dq_report "$command_name" $status "$version"
|
||||||
|
@ -1,2 +1,6 @@
|
|||||||
mongod --version > /dev/null 2>&1
|
command_name="mongodb"
|
||||||
_dq_report 'mongo server' $?
|
output=$(mongod --version)
|
||||||
|
status=$?
|
||||||
|
version=$(echo "$output" | grep -o "\d*\.\d*.\d*" | head -1)
|
||||||
|
|
||||||
|
_dq_report "$command_name" $status "$version"
|
||||||
|
@ -1,2 +1,6 @@
|
|||||||
bower --version > /dev/null 2>&1
|
command_name="bower"
|
||||||
_dq_report 'bower' $?
|
output=$(bower --version)
|
||||||
|
status=$?
|
||||||
|
version=$(echo "$output" | grep -o "\d*\.\d*.\d*")
|
||||||
|
|
||||||
|
_dq_report "$command_name" $status "$version"
|
||||||
|
@ -1,2 +1,6 @@
|
|||||||
coffee --version > /dev/null 2>&1
|
command_name="coffee"
|
||||||
_dq_report 'coffee' $?
|
output=$(coffee --version)
|
||||||
|
status=$?
|
||||||
|
version=$(echo "$output" | grep -o "\d*\.\d*.\d*")
|
||||||
|
|
||||||
|
_dq_report "$command_name" $status "$version"
|
||||||
|
@ -1,2 +1,6 @@
|
|||||||
grunt --version > /dev/null 2>&1
|
command_name="grunt"
|
||||||
_dq_report 'grunt' $?
|
output=$(grunt --version)
|
||||||
|
status=$?
|
||||||
|
version=$(echo "$output" | grep -o "\d*\.\d*.\d*")
|
||||||
|
|
||||||
|
_dq_report "$command_name" $status "$version"
|
||||||
|
@ -1,2 +1,6 @@
|
|||||||
npm --version > /dev/null 2>&1
|
command_name="npm"
|
||||||
_dq_report 'npm' $?
|
output=$(npm --version)
|
||||||
|
status=$?
|
||||||
|
version=$(echo "$output" | grep -o "\d*\.\d*.\d*")
|
||||||
|
|
||||||
|
_dq_report "$command_name" $status "$version"
|
||||||
|
@ -1,2 +1,6 @@
|
|||||||
sass --version > /dev/null 2>&1
|
command_name="sass"
|
||||||
_dq_report 'sass' $?
|
output=$(sass --version)
|
||||||
|
status=$?
|
||||||
|
version=$(echo "$output" | grep -o "\d*\.\d*.\d*")
|
||||||
|
|
||||||
|
_dq_report "$command_name" $status "$version"
|
||||||
|
@ -1,2 +1,6 @@
|
|||||||
yo --version > /dev/null 2>&1
|
command_name="yeoman"
|
||||||
_dq_report 'yeoman' $?
|
output=$(yo --version)
|
||||||
|
status=$?
|
||||||
|
version=$(echo "$output" | grep -o "\d*\.\d*.\d*")
|
||||||
|
|
||||||
|
_dq_report "$command_name" $status "$version"
|
||||||
|
@ -1,2 +1,6 @@
|
|||||||
gradle -v > /dev/null 2>&1
|
command_name="gradle"
|
||||||
_dq_report 'gradle' $?
|
output=$(gradle -v 2>&1)
|
||||||
|
status=$?
|
||||||
|
version=$(echo "$output" | grep -o "\d*\.\d*" | head -1)
|
||||||
|
|
||||||
|
_dq_report "$command_name" $status "$version"
|
Loading…
Reference in New Issue
Block a user