Skip to content

Commit

Permalink
feat: optimise install + build scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
kkoomen committed Oct 16, 2020
1 parent a2c959d commit 06db921
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 12 deletions.
2 changes: 1 addition & 1 deletion build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
set -e
set -u

ROOT_DIR="`dirname \"$0\"`"
ROOT_DIR="$(dirname \"$0\")"

if [[ ! -d ./pkg/lib-es5 ]]; then
cd $ROOT_DIR/pkg
Expand Down
32 changes: 21 additions & 11 deletions install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,30 @@ set -u

[[ -e ./bin/vim-doge ]] && exit 0

ROOT_DIR="`dirname \"$0\"`"
ROOT_DIR="$(dirname \"$0\")"
cd $ROOT_DIR
mkdir ./bin

os="$(uname)"
outfile="./bin/vim-doge"
OS="$(uname)"
OUTFILE="./bin/vim-doge"

if [[ $os == "Darwin" ]]; then
echo "TODO: macos"
# curl "macos" > $outfile
elif [[ $os == "Linux" ]]; then
echo "TODO: linux"
# curl "linux" > $outfile
if [[ "$OS" == 'Linux' ]]; then
SED_EXTENDED='-r'
elif [[ "$OS" == 'Darwin' ]]; then
SED_EXTENDED='-E'
fi;
PKG_VERSION=$(grep -m 1 "\"version\"" $ROOT_DIR/package.json | sed ${SED_EXTENDED} 's/^ *//;s/.*: *"//;s/",?//')
RELEASE_URL="https://github.com/kkoomen/vim-doge/releases/download/$PKG_VERSION"
echo "$RELEASE_URL"

if [[ $OS == 'Darwin' ]]; then
VIM_DOGE_EXECUTABLE_URL="$RELEASE_URL/vim-doge-macos"
elif [[ $OS == 'Linux' ]]; then
VIM_DOGE_EXECUTABLE_URL="$RELEASE_URL/vim-doge-linux"
else
echo "TODO: windows"
# curl "windows" > $outfile
VIM_DOGE_EXECUTABLE_URL="$RELEASE_URL/vim-doge-win.exe"
fi

echo "Downloading $VIM_DOGE_EXECUTABLE_URL..."
curl -s $VIM_DOGE_EXECUTABLE_URL > $OUTFILE
echo "Done downloading $VIM_DOGE_EXECUTABLE_URL"

0 comments on commit 06db921

Please sign in to comment.