Make `script/build` compatible with Windows

The best way to run this is in the GitHub for Windows shell.
This commit is contained in:
Mislav & Owen 2014-12-20 17:57:39 -08:00 коммит произвёл Jingwen Owen Ou
Родитель d01968c266
Коммит 283782497b
2 изменённых файлов: 19 добавлений и 6 удалений

Просмотреть файл

@ -5,16 +5,26 @@
set -e set -e
windows=
[[ $OS == Windows* ]] && windows=1
setup_gopath() { setup_gopath() {
TMPDIR="${LOCALAPPDATA:-$TMPDIR}"
TMP_GOPATH="${TMPDIR:-/tmp}/go" TMP_GOPATH="${TMPDIR:-/tmp}/go"
TMP_SELF="${TMP_GOPATH}/src/github.com/github/hub" TMP_SELF="${TMP_GOPATH}/src/github.com/github/hub"
export GOPATH=${TMP_GOPATH} if [ -n "$windows" ]; then
export GOPATH="${TMP_GOPATH//\//\\}"
if [ ! -e "$TMP_SELF" ]; then else
mkdir -p "${TMP_SELF%/*}" export GOPATH="$TMP_GOPATH"
ln -snf "$PWD" "$TMP_SELF"
fi fi
mkdir -p "${TMP_SELF%/*}"
ln -snf "$PWD" "$TMP_SELF" 2>/dev/null || {
rm -rf "$TMP_SELF"
mkdir "$TMP_SELF"
cp -R "$PWD"/* "${TMP_SELF}/"
}
} }
find_source_files() { find_source_files() {
@ -41,7 +51,7 @@ test_hub() {
case "$1" in case "$1" in
"" ) "" )
build_hub hub build_hub hub${windows:+.exe}
;; ;;
-o ) -o )
shift shift

3
script/build.bat Normal file
Просмотреть файл

@ -0,0 +1,3 @@
@echo off
bash script\build %*