From fc01e74f44850edf5b32b088d800d2474df64db4 Mon Sep 17 00:00:00 2001 From: Thomas Forgione Date: Mon, 3 Jun 2019 18:01:33 +0200 Subject: [PATCH] Support for wasmer --- bin/update | 23 +++++++++++++++++++++++ zsh/path.zsh | 3 ++- 2 files changed, 25 insertions(+), 1 deletion(-) diff --git a/bin/update b/bin/update index f5d63f7..3f83c3a 100755 --- a/bin/update +++ b/bin/update @@ -233,6 +233,21 @@ update-rust() { } +update-wasm() { + command -v wasmer > /dev/null 2>&1 + if [ $? -ne 0 ]; then + return + fi + + start_wasm_update=`date +%s` + + wasmer self-update + + seconds=$((`date +%s` - $start_wasm_update )) + formatted=`date -ud "@$seconds" +'%H hours %M minutes %S seconds'` + echo -e "\033[32;1m=== Wasm updated in $formatted ===\033[0m" +} + update-npm() { # Update node packages if installed @@ -323,6 +338,7 @@ _print_usage() { echo -e "\033[33mSUBCOMMANDS:\033[0m" echo -e " \033[32msystem\033[0m Updates the system (Debian, Archlinux, Fedora)" echo -e " \033[32mrust\033[0m Updates rust and rust packages (requires rustup)" + echo -e " \033[32mwasm\033[0m Updates wasmer" echo -e " \033[32mnpm\033[0m Updates npm packages (in ~/.config/npmbin)" echo -e " \033[32mdotfiles\033[0m Updates the dotfiles" echo -e " \033[32mneovim\033[0m Updates the neovim packages" @@ -336,6 +352,7 @@ partial-test() { case $1 in "system") return 0;; "rust") return 0;; + "wasm") return 0;; "npm") return 0;; "dotfiles") return 0;; "neovim") return 0;; @@ -351,6 +368,7 @@ partial-requires-lock() { case $1 in "system") return 0;; "rust") return 0;; + "wasm") return 0;; "npm") return 0;; "dotfiles") return 0;; "neovim") return 0;; @@ -366,6 +384,7 @@ partial-update() { case $1 in "system") update-system;; "rust") update-rust;; + "wasm") update-wasm;; "npm") update-npm;; "dotfiles") update-dotfiles;; "neovim") update-neovim;; @@ -396,6 +415,10 @@ main() { _check_running update-rust + # Update wasmer + _check_running + update-wasm + # Update npm and npm packages _check_running update-npm diff --git a/zsh/path.zsh b/zsh/path.zsh index 2ac4fbe..b0b3ddf 100644 --- a/zsh/path.zsh +++ b/zsh/path.zsh @@ -21,7 +21,8 @@ fi # Wasmer path if [ -d $HOME/.wasmer ]; then export WASMER_DIR="$HOME/.wasmer" - [ -s "$WASMER_DIR/wasmer.sh" ] && source "$WASMER_DIR/wasmer.sh" # This loads wasmer + export WASMER_CACHE_DIR="$WASMER_DIR/cache" + export PATH="$WASMER_DIR/bin:$WASMER_DIR/globals/wapm_packages/.bin:$PATH" fi # Node path