Support for wasmer

This commit is contained in:
Thomas Forgione 2019-06-03 18:01:33 +02:00
parent cc029484d6
commit fc01e74f44
No known key found for this signature in database
GPG Key ID: 203DAEA747F48F41
2 changed files with 25 additions and 1 deletions

View File

@ -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-npm() {
# Update node packages if installed # Update node packages if installed
@ -323,6 +338,7 @@ _print_usage() {
echo -e "\033[33mSUBCOMMANDS:\033[0m" echo -e "\033[33mSUBCOMMANDS:\033[0m"
echo -e " \033[32msystem\033[0m Updates the system (Debian, Archlinux, Fedora)" 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[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[32mnpm\033[0m Updates npm packages (in ~/.config/npmbin)"
echo -e " \033[32mdotfiles\033[0m Updates the dotfiles" echo -e " \033[32mdotfiles\033[0m Updates the dotfiles"
echo -e " \033[32mneovim\033[0m Updates the neovim packages" echo -e " \033[32mneovim\033[0m Updates the neovim packages"
@ -336,6 +352,7 @@ partial-test() {
case $1 in case $1 in
"system") return 0;; "system") return 0;;
"rust") return 0;; "rust") return 0;;
"wasm") return 0;;
"npm") return 0;; "npm") return 0;;
"dotfiles") return 0;; "dotfiles") return 0;;
"neovim") return 0;; "neovim") return 0;;
@ -351,6 +368,7 @@ partial-requires-lock() {
case $1 in case $1 in
"system") return 0;; "system") return 0;;
"rust") return 0;; "rust") return 0;;
"wasm") return 0;;
"npm") return 0;; "npm") return 0;;
"dotfiles") return 0;; "dotfiles") return 0;;
"neovim") return 0;; "neovim") return 0;;
@ -366,6 +384,7 @@ partial-update() {
case $1 in case $1 in
"system") update-system;; "system") update-system;;
"rust") update-rust;; "rust") update-rust;;
"wasm") update-wasm;;
"npm") update-npm;; "npm") update-npm;;
"dotfiles") update-dotfiles;; "dotfiles") update-dotfiles;;
"neovim") update-neovim;; "neovim") update-neovim;;
@ -396,6 +415,10 @@ main() {
_check_running _check_running
update-rust update-rust
# Update wasmer
_check_running
update-wasm
# Update npm and npm packages # Update npm and npm packages
_check_running _check_running
update-npm update-npm

View File

@ -21,7 +21,8 @@ fi
# Wasmer path # Wasmer path
if [ -d $HOME/.wasmer ]; then if [ -d $HOME/.wasmer ]; then
export WASMER_DIR="$HOME/.wasmer" 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 fi
# Node path # Node path