-
-
Save roktas/3320106 to your computer and use it in GitHub Desktop.
Google App Engine Go projelerini derleyen bir sarmalayıcı
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
PROGNAME=${0##*/} | |
# iletiyi stderr'de görüntüle | |
message() { | |
printf -- "$*\n" | fold -s -w ${COLS:-80} >&2 | |
} | |
# hata iletisi | |
die() { | |
message "${*}" | |
exit 1 | |
} | |
# ilklendirilmemiş bir değişken mi? | |
isnull() { | |
[[ ! ${!1} && ${!1-_} ]] | |
} | |
# güvenli geçici dizin oluştur | |
unset TEMPDIRS_ | |
usetempdir() { | |
local tempname="$1" keeptemp="$2" | |
local prefix="$PROGNAME" | |
[ -n "$prefix" ] || prefix=${0##*/} | |
# As a security measure refuse to proceed if mktemp is not available. | |
[ -x /bin/mktemp ] || die "'/bin/mktemp' bulunamadı; sonlanıyor." | |
local tempdir="$(/bin/mktemp -d -t ${prefix}.XXXXXXXX)" || | |
die "mktemp hata döndü" | |
[ -d "$tempdir" ] || die "geçici bir dizin oluşturulamadı" | |
if isnull TEMPDIRS_; then | |
trap ' | |
exitcode=$? | |
[ -z "$TEMPDIRS_" ] || rm -rf -- "${TEMPDIRS_[@]}" | |
unset TEMPDIRS_ | |
exit $exitcode | |
' EXIT HUP INT QUIT TERM | |
fi | |
eval $(echo "$tempname=\"$tempdir\"") | |
[ -n "$keeptemp" ] || TEMPDIRS_+=("$tempdir") | |
} | |
locate_conf() { | |
while [ "$PWD" != "/" ]; do | |
for f in app.yaml app.yml; do | |
if [ -f $f ]; then | |
return 0 | |
fi | |
done | |
cd .. | |
done | |
return 1 | |
} | |
if [ $# -gt 0 ]; then | |
locate_conf | |
exit $? | |
fi | |
locate_conf || \ | |
die "$PWD bir Google App Engine projesi olarak gözükmüyor" | |
appbase=$PWD | |
if [ -n "$GOOGLE_APPENGINE_DIR" ]; then | |
[ -d "$GOOGLE_APPENGINE_DIR" ] || \ | |
die "$GOOGLE_APPENGINE_DIR dizini bulunamadı" | |
else | |
for d in ~ /opt /usr/local/lib /usr/local; do | |
try="$d/google_appengine" | |
if [ -d "$try" ]; then | |
GOOGLE_APPENGINE_DIR=$try | |
break | |
fi | |
done | |
fi | |
[ -n "$GOOGLE_APPENGINE_DIR" ] || die "Google App Engine dizini bulunamadı" | |
goroot="$GOOGLE_APPENGINE_DIR/goroot" | |
[ -d "$goroot" ] || \ | |
die "$GOOGLE_APPENGINE_DIR dizininde Go kökü bulunamadı" | |
builder="$goroot/bin/go-app-builder" | |
[ -x "$builder" ] || \ | |
die "$GOOGLE_APPENGINE_DIR dizininde go-app-builder bulunamadı" | |
sources=$(find . -type f -name '*.go' 2>/dev/null) | |
[ -n "$sources" ] || die "Go kaynağı bulunamadı" | |
usetempdir CACHEDIR | |
$builder -app_base "$appbase" \ | |
-binary_name _go_app \ | |
-dynamic \ | |
-goroot $goroot \ | |
-unsafe \ | |
-work_dir $CACHEDIR $sources |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
" Syntastic checker for Google App Engine | |
" Needs the goae script in your PATH | |
if exists("g:loaded_syntastic_go_goae_checker") | |
finish | |
endif | |
let g:loaded_syntastic_go_goae_checker = 1 | |
function! SyntaxCheckers_go_goae_IsAvailable() | |
if ! executable('goae') | |
return 0 | |
endif | |
" Check if this is a Google App Engine project | |
if ! exists("g:is_google_appengine") | |
let g:is_google_appengine = 0 | |
call system("goae --check") | |
let g:is_google_appengine = !v:shell_error | |
endif | |
return g:is_google_appengine | |
endfunction | |
function! SyntaxCheckers_go_goae_GetLocList() | |
let makeprg = 'goae 1>' . syntastic#util#DevNull() | |
let errorformat = '%f:%l:%c:%m,%f:%l%m,%-G#%.%#' | |
return SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat }) | |
endfunction | |
call g:SyntasticRegistry.CreateAndRegisterChecker({ | |
\ 'filetype': 'go', | |
\ 'name': 'goae'}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment