7 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 00ca5e9ce1 Get the clean path to common posix tools used by GVM 2012-03-24 04:57:24 -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
20 changed files with 126 additions and 82 deletions
+1 -1
View File
@@ -1 +1 @@
1.0.14
1.0.15
+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
@@ -1,7 +1,7 @@
. $GVM_ROOT/scripts/functions/tools
_gvm()
{
LS_PATH=`which ls` || return 1
local cur prev opts base
COMPREPLY=()
cur="${COMP_WORDS[COMP_CWORD]}"
@@ -58,7 +58,7 @@ _gvm()
install)
[ ! -d $GVM_ROOT/archive/go ] && return 1
[[ $COMP_CWORD > 2 ]] && return 1
local version=$(for x in `hg tags -R $GVM_ROOT/archive/go | awk '{print $1}' | grep -E "release|tip"`; do echo ${x} ; done )
local version=$(for x in `hg tags -R $GVM_ROOT/archive/go | awk '{print $1}' | $GREP_PATH -E "release|tip"`; do echo ${x} ; done )
COMPREPLY=( $(compgen -W "${version}" -- ${cur}) )
return 0
;;
+4 -5
View File
@@ -1,27 +1,26 @@
#!/bin/bash
. $GVM_ROOT/scripts/functions
LS_PATH=`which ls` || display_error "$LS_ERROR" || return 1
version=$1
if [ "$version" != "" ]; then
fuzzy_match=`$LS_PATH $GVM_ROOT/gos | sort | grep "$version" | head -n 1 | grep "$version"` ||
fuzzy_match=`$LS_PATH $GVM_ROOT/gos | $SORT_PATH | $GREP_PATH "$version" | $HEAD_PATH -n 1 | $GREP_PATH "$version"` ||
display_error "Invalid version $version"
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
+19 -13
View File
@@ -1,32 +1,38 @@
#!/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() {
LS_PATH=`which ls` || display_error "$LS_ERROR" || return 1
[[ "$1" != "" ]] ||
display_error "Please specify a package set" || return 1
[[ "$gvm_go_name" != "" ]] ||
display_error "No Go version selected" || return 1
fuzzy_match=`$LS_PATH $GVM_ROOT/environments | sort | grep "$gvm_go_name@" | grep "$1" | head -n 1` ||
fuzzy_match=`$LS_PATH $GVM_ROOT/environments | $SORT_PATH | $GREP_PATH "$gvm_go_name@" | $GREP_PATH "$1" | $HEAD_PATH -n 1` ||
display_error "Invalid package set" || return 1
export PATH=$GVM_PATH_BACKUP
+19 -13
View File
@@ -1,28 +1,34 @@
#!/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_use() {
LS_PATH=`which ls` || display_error "$LS_ERROR" || return 1
[[ "$1" != "" ]] ||
display_error "Please specifiy the version" || return 1
fuzzy_match=`$LS_PATH $GVM_ROOT/gos | sort | grep "$1" | head -n 1 | grep "$1"` ||
fuzzy_match=`$LS_PATH $GVM_ROOT/gos | $SORT_PATH | $GREP_PATH "$1" | $HEAD_PATH -n 1 | $GREP_PATH "$1"` ||
display_error "Invalid version $1" || return 1
export PATH=$GVM_PATH_BACKUP
+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
}
-1
View File
@@ -1 +0,0 @@
LS_ERROR="Couldn't find ls"
+11
View File
@@ -0,0 +1,11 @@
#!/bin/bash
LS_ERROR="Couldn't find ls"
GREP_ERROR="Couldn't find grep"
SORT_ERROR="Couldn't find sort"
HEAD_ERROR="Couldn't find head"
LS_PATH=`unalias ls &> /dev/null; which ls` || display_error "$LS_ERROR" || return 1
GREP_PATH=`unalias grep &> /dev/null; which grep` || display_error "$GREP_ERROR" || return 1
SORT_PATH=`unalias sort &> /dev/null; which sort` || display_error "$SORT_ERROR" || return 1
HEAD_PATH=`unalias head &> /dev/null; which head` || display_error "$HEAD_ERROR" || return 1
+8 -8
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,14 +41,14 @@ 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"
}
check_tag() {
version=`hg tags -R $GO_CACHE_PATH | awk '{print $1}' | sort | grep "$VERSION" | head -n 1 | grep "$VERSION"`
version=`hg tags -R $GO_CACHE_PATH | awk '{print $1}' | $SORT_PATH | $GREP_PATH "$VERSION" | $HEAD_PATH -n 1 | $GREP_PATH "$VERSION"`
}
update_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
@@ -150,11 +150,11 @@ main() {
GVM_GOINSTALL="goinstall"
which goinstall &> /dev/null ||
GVM_GOINSTALL="go get"
x="`hg tags -R ~/.gvm/archive/go`"; echo ${x#*b0819469a6df} | grep "$version " &> /dev/null
x="`hg tags -R ~/.gvm/archive/go`"; echo ${x#*b0819469a6df} | $GREP_PATH "$version " &> /dev/null
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 -2
View File
@@ -1,11 +1,10 @@
#!/bin/bash
. $GVM_ROOT/scripts/functions
LS_PATH=`which ls` || display_error "$LS_ERROR" || return 1
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
@@ -32,7 +32,7 @@ read_command_line $@
echo
display_message "gvm gos (available)"
echo
versions=`curl -s https://go.googlecode.com/hg/.hgtags | awk '{ print $2 }' | grep "$tag_filter" | sort`
versions=`curl -s https://go.googlecode.com/hg/.hgtags | awk '{ print $2 }' | $GREP_PATH "$tag_filter" | $SORT_PATH`
if [[ $? -ne 0 ]]; then
display_error "Failed to get version list from Google"
fi
+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`
+3 -2
View File
@@ -1,8 +1,9 @@
#!/bin/bash
echo $1 | sed -n -e '/_.*_/ p' | grep "_" &> /dev/null
. $GVM_ROOT/scripts/functions/tools
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
+2 -3
View File
@@ -1,14 +1,13 @@
#!/bin/bash
. $GVM_ROOT/scripts/functions
LS_PATH=`which ls` || display_error "$LS_ERROR" || return 1
[[ "$1" == "" ]] &&
display_error "Please specifiy the version"
fuzzy_match=`$LS_PATH $GVM_ROOT/gos | sort | grep "$1" | head -n 1 | grep "$1"` ||
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 ||