6 Commits
Author SHA1 Message Date
jbussdieker d1b5a1721b Merge pull request #10 from handcraftsman/master
provide cleaner output where tput doesn't exist
2012-03-25 09:19:09 -07:00
Clinton Sheppard a3bd04c4c9 provide cleaner output where tput doesn't exist
e.g. msysgit - Git for Windows
2012-03-25 08:48:24 -05:00
Joshua Bussdieker aece4141b7 Missed a reference 2012-03-24 05:13:58 -07:00
Joshua Bussdieker 0f111283cc Merge branch 'master' of github.com:moovweb/gvm
Conflicts:
	scripts/diff
	scripts/templates/binary
2012-03-24 05:00:40 -07:00
Joshua Bussdieker 42b539cadb Merge branch 'master' of https://github.com/moovweb/gvm
Conflicts:
	scripts/diff
2012-03-23 10:14:28 -07:00
Joshua Bussdieker 30e0fc52df Make zsh compatible 2012-03-23 10:11:51 -07:00
15 changed files with 101 additions and 61 deletions
+7 -3
View File
@@ -1,12 +1,16 @@
#!/bin/bash
if [ -z "$GVM_ROOT" ]; then
tput sgr0
tput setaf 1
if [ command -v tput >/dev/null 2>&1 ]; then
tput sgr0
tput setaf 1
fi
echo 'ERROR: $GVM_ROOT is not set! Please add the following line to your .bashrc or .profile
[[ -s "$HOME/.gvm/scripts/gvm" ]] && source "$HOME/.gvm/scripts/gvm"
' >&2
tput sgr0
if [ command -v tput >/dev/null 2>&1 ]; then
tput sgr0
fi
exit 1
fi
+8 -4
View File
@@ -1,9 +1,13 @@
#!/bin/bash
display_error() {
tput sgr0
tput setaf 1
echo "ERROR: $1"
tput sgr0
if [ command -v tput >/dev/null 2>&1 ]; then
tput sgr0
tput setaf 1
echo "ERROR: $1"
tput sgr0
else
echo "ERROR: $1"
fi
exit 1
}
+3 -3
View File
@@ -9,18 +9,18 @@ if [ "$version" != "" ]; then
foldername=$GVM_ROOT/gos/$fuzzy_match
else
if [ "$gvm_go_name" != "" ]; then
if [[ "$gvm_go_name" != "" ]]; then
foldername=$GVM_ROOT/gos/$gvm_go_name
else
display_error "No version selected"
fi
fi
if [ -d $foldername ]; then
if [[ -d $foldername ]]; then
cd $foldername
find . > /tmp/manifest.test
diff manifest /tmp/manifest.test
if [ "$?" == "0" ]; then
if [[ "$?" == "0" ]]; then
display_message "Clean $foldername"
else
display_message "*Dirty* $foldername"
+11 -7
View File
@@ -1,9 +1,13 @@
#!/bin/bash
function display_error() {
tput sgr0
tput setaf 1
echo "ERROR: $1" >&2
tput sgr0
if [ command -v tput >/dev/null 2>&1 ]; then
tput sgr0
tput setaf 1
echo "ERROR: $1" >&2
tput sgr0
else
echo "ERROR: $1" >&2
fi
return 1
}
@@ -27,13 +31,13 @@ function gvm() {
mkdir -p $GVM_ROOT/archive/package > /dev/null 2>&1
mkdir -p $GVM_ROOT/environments > /dev/null 2>&1
if [ "$1" == "use" ]; then
if [[ "$1" == "use" ]]; then
. $GVM_ROOT/scripts/env/use
shift
gvm_use $@
elif [ "$1" == "implode" ]; then
elif [[ "$1" == "implode" ]]; then
rm -rf $GVM_ROOT
elif [ "$1" == "pkgset" ] && [ "$2" == "use" ]; then
elif [[ "$1" == "pkgset" ]] && [[ "$2" == "use" ]]; then
. $GVM_ROOT/scripts/env/pkgset-use
shift
shift
+18 -10
View File
@@ -1,20 +1,28 @@
#!/bin/bash
. $GVM_ROOT/scripts/function/errors
. $GVM_ROOT/scripts/function/tools
function display_error() {
tput sgr0
tput setaf 1
echo "ERROR: $1" >&2
tput sgr0
if [ command -v tput >/dev/null 2>&1 ]; then
tput sgr0
tput setaf 1
echo "ERROR: $1" >&2
tput sgr0
else
echo "ERROR: $1" >&2
fi
return 1
}
function display_message() {
# GREEN!
tput sgr0
tput setaf 2
echo "$1"
tput sgr0
if [ command -v tput >/dev/null 2>&1 ]; then
# GREEN!
tput sgr0
tput setaf 2
echo "$1"
tput sgr0
else
echo "$1"
fi
}
function gvm_pkgset_use() {
+17 -9
View File
@@ -2,19 +2,27 @@
. $GVM_ROOT/scripts/function/tools
function display_error() {
tput sgr0
tput setaf 1
echo "ERROR: $1" >&2
tput sgr0
if [ command -v tput >/dev/null 2>&1 ]; then
tput sgr0
tput setaf 1
echo "ERROR: $1" >&2
tput sgr0
else
echo "ERROR: $1" >&2
fi
return 1
}
function display_message() {
# GREEN!
tput sgr0
tput setaf 2
echo "$1"
tput sgr0
if [ command -v tput >/dev/null 2>&1 ]; then
# GREEN!
tput sgr0
tput setaf 2
echo "$1"
tput sgr0
else
echo "$1"
fi
}
function gvm_use() {
+8 -4
View File
@@ -1,8 +1,12 @@
display_error() {
tput sgr0
tput setaf 1
echo "ERROR: $1" >&2
tput sgr0
if [ command -v tput >/dev/null 2>&1 ]; then
tput sgr0
tput setaf 1
echo "ERROR: $1" >&2
tput sgr0
else
echo "ERROR: $1" >&2
fi
exit 1
}
+9 -5
View File
@@ -1,7 +1,11 @@
display_message() {
# GREEN!
tput sgr0
tput setaf 2
echo "$1"
tput sgr0
if [ command -v tput >/dev/null 2>&1 ]; then
# GREEN!
tput sgr0
tput setaf 2
echo "$1"
tput sgr0
else
echo "$1"
fi
}
+9 -5
View File
@@ -1,7 +1,11 @@
display_warning() {
# YELLOW!
tput sgr0
tput setaf 3
echo "$1"
tput sgr0
if [ command -v tput >/dev/null 2>&1 ]; then
# YELLOW!
tput sgr0
tput setaf 3
echo "$1"
tput sgr0
else
echo "WARNING: $1"
fi
}
+6 -6
View File
@@ -10,7 +10,7 @@ function show_usage() {
read_command_line() {
VERSION=$1
if [ "${VERSION:0:1}" != "-" ]; then
if [[ "${VERSION:0:1}" != "-" ]]; then
shift
else
display_warning "Invalid version: $1"
@@ -41,7 +41,7 @@ read_command_line() {
download_source() {
GO_CACHE_PATH=$GVM_ROOT/archive/go
[ -d $GO_CACHE_PATH ] && return
[[ -d $GO_CACHE_PATH ]] && return
display_message "Downloading Go source..."
hg clone $GO_SOURCE_URL $GO_CACHE_PATH >> $GVM_ROOT/logs/go-download.log 2>&1 ||
display_error "Couldn't download Go source"
@@ -94,8 +94,8 @@ install_go() {
trap 'rm -rf $GO_INSTALL_ROOT; display_error "Canceled!"' INT
# Check for existing install
if [ -d "$GO_INSTALL_ROOT" ]; then
[ -f "$GO_INSTALL_ROOT/manifest" ] &&
if [[ -d "$GO_INSTALL_ROOT" ]]; then
[[ -f "$GO_INSTALL_ROOT/manifest" ]] &&
display_error "Already installed!"
display_warning "Removing corrupt install..."
gvm uninstall $version
@@ -142,7 +142,7 @@ install_goprotobuf() {
main() {
trap 'display_error "Canceled!"' INT
read_command_line $@
[ "$VERSION" == "" ] && display_error "No version specified"
[[ "$VERSION" == "" ]] && display_error "No version specified"
download_source
check_tag || (update_source && check_tag) || display_error "Unrecognized Go version"
install_go
@@ -154,7 +154,7 @@ main() {
if [[ "$?" == "1" ]]; then
install_gb || display_warning "Failed to install gb"
install_gpkg || display_warning "Failed to install gpkg"
if [ "$INSTALL_PB" == "true" ]; then
if [[ "$INSTALL_PB" == "true" ]]; then
install_goprotobuf
fi
fi
+1 -1
View File
@@ -4,7 +4,7 @@
echo
display_message "gvm gos (installed)"
echo
if [ -d $GVM_ROOT/gos ]; then
if [[ -d $GVM_ROOT/gos ]]; then
if [[ "$gvm_go_name" != "" ]]; then
$LS_PATH -1 $GVM_ROOT/gos | sed 's/^/ /g' | sed 's/^ '$gvm_go_name'/=> '$gvm_go_name'/g'
else
+1 -1
View File
@@ -9,7 +9,7 @@
display_error "Missing package set folder for this Go version"
command=$1
if [ -f $GVM_ROOT/scripts/pkgset-$command ]; then
if [[ -f $GVM_ROOT/scripts/pkgset-$command ]]; then
shift
$GVM_ROOT/scripts/pkgset-$command $@
elif [[ -n $command ]]; then
+1 -1
View File
@@ -5,7 +5,7 @@ echo
display_message "gvm go package sets ($gvm_go_name)"
echo
if [ -d $GVM_ROOT/pkgsets/$gvm_go_name ]; then
if [[ -d $GVM_ROOT/pkgsets/$gvm_go_name ]]; then
for cur_dir in $GVM_ROOT/pkgsets/$gvm_go_name/*; do
[[ "$cur_dir" == "$GVM_ROOT/pkgsets/$gvm_go_name/*" ]] && exit
pkgset=`basename $cur_dir`
+1 -1
View File
@@ -3,7 +3,7 @@
echo $1 | sed -n -e '/_.*_/ p' | $GREP_PATH "_" &> /dev/null
if [ "$?" == "0" ]; then
version=`echo $1 | sed 's/_\(.*\)_/\1/'`
if [ ! -f $GVM_ROOT/pkgsets/$gvm_go_name/$gvm_pkgset_name/pkg.gvm/{{package_name}}/$version/bin/{{binary_name}} ]; then
if [[ ! -f $GVM_ROOT/pkgsets/$gvm_go_name/$gvm_pkgset_name/pkg.gvm/{{package_name}}/$version/bin/{{binary_name}} ]]; then
echo "GVM: Invalid version"
exit 1
fi
+1 -1
View File
@@ -7,7 +7,7 @@
fuzzy_match=`$LS_PATH $GVM_ROOT/gos | $SORT_PATH | $GREP_PATH "$1" | $HEAD_PATH -n 1 | $GREP_PATH "$1"` ||
display_error "Invalid version $1"
if [ -d $GVM_ROOT/gos/$fuzzy_match ]; then
if [[ -d $GVM_ROOT/gos/$fuzzy_match ]]; then
rm -rf $GVM_ROOT/pkgsets/$fuzzy_match &> /dev/null ||
display_error "Couldn't remove pkgsets"
rm -f $GVM_ROOT/environments/$fuzzy_match &> /dev/null ||