From 5cc1dcebfdbc05891b4f889dc6a4d76b741a512e Mon Sep 17 00:00:00 2001 From: MuchChaca Date: Sun, 12 Aug 2018 16:55:41 +0400 Subject: [PATCH] Patch v0.1.1 Merge Request ``Aur (#38)`` * :heavy_check_mark::+1: Working PKGBUILD i guess * :tada: v0.1.1 ready --- .gitignore | 3 +- PKGBUILD | 101 +++++++++++++++++++++++++++++++++++++++++++++++++++++ cmd/doc.go | 25 ++++++------- 3 files changed, 116 insertions(+), 13 deletions(-) create mode 100644 PKGBUILD diff --git a/.gitignore b/.gitignore index b87554e..f5f9d86 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ .vscode cmd/debug.test -tempest.exe \ No newline at end of file +tempest.exe +temp.est diff --git a/PKGBUILD b/PKGBUILD new file mode 100644 index 0000000..ffa8138 --- /dev/null +++ b/PKGBUILD @@ -0,0 +1,101 @@ +# Maintainer: ChacaS0 + +pkgname=tempest +pkgver=0.1.1 +pkgrel=1 +pkgdesc="TEMPest is CLI tool to help manage temporary content" +arch=('x86_64' 'i686') +url="https://chacas0.github.io/tempest/" +license=('MIT') +depends=('git' 'go') +makedepends=('dep') +options=('!strip' '!emptydirs') +source=("https://github.com/ChacaS0/tempest/archive/v$pkgver.tar.gz") +sha256sums=('bd27d4ac125f6d4fd23061b3e24a15aefaa7538652ca4bc607bf18b374fb336b') +_gourl=github.com/ChacaS0/tempest + +build() { + export GOROOT=/usr/lib/go + + rm -rf build + mkdir -p build/go + cd build/go + + for f in "$GOROOT/"*; do + ln -s "$f" + done + + rm pkg + mkdir pkg + cd pkg + + for f in "$GOROOT/pkg/"*; do + ln -s "$f" + done + + platform=`for f in "$GOROOT/pkg/"*; do echo \`basename $f\`; done|grep linux` + + rm -f "$platform" + mkdir "$platform" + cd "$platform" + + for f in "$GOROOT/pkg/$platform/"*.h; do + ln -s "$f" + done + + export GOROOT="$srcdir/build/go" + export GOPATH="$srcdir/build" + + go get -fix "$_gourl" + + # Prepare executable + if [ -d "$srcdir/build/src" ]; then + cd "$srcdir/build/src/$_gourl" + go build -o "$srcdir/build/$pkgname" + else + echo 'Old sources for a previous version of this package are already present!' + echo 'Build in a chroot or uninstall the previous version.' + return 1 + fi +} + +package() { + export GOROOT="$GOPATH" + + # Package go package files + for f in "$srcdir/build/go/pkg/"* "$srcdir/build/pkg/"*; do + # If it's a directory + if [ -d "$f" ]; then + cd "$f" + mkdir -p "$pkgdir/$GOROOT/pkg/`basename $f`" + for z in *; do + # Check if the directory name matches + if [ "$z" == `echo $_gourl | cut -d/ -f1` ]; then + cp -r $z "$pkgdir/$GOROOT/pkg/`basename $f`" + fi + done + cd .. + fi + done + + # Package source files + if [ -d "$srcdir/build/src" ]; then + mkdir -p "$pkgdir/$GOROOT/src/pkg" + cp -r "$srcdir/build/src/"* "$pkgdir/$GOROOT/src/pkg/" + find "$pkgdir" -depth -type d -name .git -exec rm -r {} \; + fi + + # Package license (if available) + for f in LICENSE COPYING; do + if [ -e "$srcdir/build/src/$_gourl/$f" ]; then + install -Dm644 "$srcdir/build/src/$_gourl/$f" \ + "$pkgdir/usr/share/licenses/$pkgname/$f" + fi + done + + # Package executables + if [ -e "$srcdir/build/$pkgname" ]; then + install -Dm755 "$srcdir/build/$pkgname" \ + "$pkgdir/usr/bin/$pkgname" + fi +} \ No newline at end of file diff --git a/cmd/doc.go b/cmd/doc.go index cedca3f..73d16be 100644 --- a/cmd/doc.go +++ b/cmd/doc.go @@ -21,8 +21,6 @@ package cmd import ( - "os/exec" - "github.com/fatih/color" "github.com/spf13/cobra" ) @@ -55,18 +53,21 @@ func init() { } func launchDoc() { - pathReadme := pathTempest + "README.md" + // pathReadme := pathTempest + "README.md" // TEMP // if no flag "man" added, open with Showdown if !isMan { - commShowdown := exec.Command("showdown", pathReadme) - errorShowdown := commShowdown.Run() - if errorShowdown != nil { - // then showdown is not installed - color.HiCyan("::We recommand you to install Showdown to view this") - color.HiCyan("::For more information, please visit: https://github.com/craigbarnes/showdown") - // open in browser - openBrowser("file://" + pathReadme) - } + // TODO - improve that + // commShowdown := exec.Command("showdown", pathReadme) + // errorShowdown := commShowdown.Run() + // if errorShowdown != nil { + // // then showdown is not installed + // color.HiCyan("::We recommand you to install Showdown to view this") + // color.HiCyan("::For more information, please visit: https://github.com/craigbarnes/showdown") + // // open in browser + // openBrowser("file://" + pathReadme) + // } + // TEMP - replacement + openBrowser("https://chacas0.github.io/tempest/usage") } else { /* // Else open in man mode comm := "cat " + pathReadme + " | less"