-
-
Notifications
You must be signed in to change notification settings - Fork 113
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add NVM_LAZY_LOAD_EXTRA_COMMANDS option (#67)
- Loading branch information
Showing
3 changed files
with
51 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
#!/bin/sh | ||
source ../common.sh | ||
|
||
# Node.js version to install | ||
node_version=v5.11.0 | ||
|
||
# Load zsh-nvm and install Node.js in subshell | ||
(load_zsh_nvm && nvm install "$node_version" && [[ "$(node --version)" == "$node_version" ]]) || die "node wasn't installed" | ||
|
||
# Check node isn't available | ||
[[ "$(node --version)" != "$node_version" ]] || die "node shouldn't be available $(node --version)" | ||
|
||
# Set NVM_LAZY_LOAD to true | ||
export NVM_LAZY_LOAD=true | ||
export NVM_LAZY_LOAD_EXTRA_COMMANDS=('hostname' 'whoami') | ||
|
||
# Load zsh-nvm | ||
load_zsh_nvm | ||
|
||
# Check nvm is a lazy load function | ||
[[ $(which nvm) == *"_zsh_nvm_load"* ]] || die "nvm should be a lazy load function" | ||
|
||
# Check node is a lazy load function | ||
[[ $(command -v node) == "node" ]] || die "node should be a shell function" | ||
|
||
# Check npm is a lazy load function | ||
[[ $(command -v npm) == "npm" ]] || die "npm should be a shell function" | ||
|
||
# Init lazy loader | ||
whoami || die "couldn't run lazy loader" | ||
|
||
# Check nvm is not a lazy load function | ||
[[ $(which nvm) != *"_zsh_nvm_load"* ]] || die "nvm should not be a lazy load function" | ||
|
||
# Check node is a binary | ||
[[ "$(command -v node)" == "$(nvm_version_path $node_version)/bin/node" ]] || die "node should now be a binary" | ||
|
||
# Check npm is a binary | ||
[[ "$(command -v npm)" == "$(nvm_version_path $node_version)/bin/npm" ]] || die "npm should now be a binary" |
This file contains 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