Compare commits
15 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0a142b7e7a | ||
|
|
3fc82d6b2f | ||
|
|
c6489440dc | ||
|
|
67e8939311 | ||
|
|
a26007ec0d | ||
|
|
3f5ce8b93a | ||
|
|
8328741792 | ||
|
|
8e45afb9f1 | ||
|
|
fd2fb24b03 | ||
|
|
4708cc73ef | ||
|
|
c91e8d0ba2 | ||
|
|
f8b143c594 | ||
|
|
9a4e9060d8 | ||
|
|
3df0caefa5 | ||
|
|
274369dc40 |
@@ -12,11 +12,11 @@ Note: `nvm` does not support Windows (see [#284](https://github.com/creationix/n
|
|||||||
|
|
||||||
To install you could use the [install script][2] using cURL:
|
To install you could use the [install script][2] using cURL:
|
||||||
|
|
||||||
curl https://raw.githubusercontent.com/creationix/nvm/v0.21.0/install.sh | bash
|
curl https://raw.githubusercontent.com/creationix/nvm/v0.22.1/install.sh | bash
|
||||||
|
|
||||||
or Wget:
|
or Wget:
|
||||||
|
|
||||||
wget -qO- https://raw.githubusercontent.com/creationix/nvm/v0.21.0/install.sh | bash
|
wget -qO- https://raw.githubusercontent.com/creationix/nvm/v0.22.1/install.sh | bash
|
||||||
|
|
||||||
<sub>The script clones the nvm repository to `~/.nvm` and adds the source line to your profile (`~/.bash_profile`, `~/.zshrc` or `~/.profile`).</sub>
|
<sub>The script clones the nvm repository to `~/.nvm` and adds the source line to your profile (`~/.bash_profile`, `~/.zshrc` or `~/.profile`).</sub>
|
||||||
|
|
||||||
@@ -191,7 +191,7 @@ After the v0.8.6 release of node, nvm tries to install from binary packages. But
|
|||||||
nvm install -s 0.8.6
|
nvm install -s 0.8.6
|
||||||
|
|
||||||
[1]: https://github.com/creationix/nvm.git
|
[1]: https://github.com/creationix/nvm.git
|
||||||
[2]: https://github.com/creationix/nvm/blob/v0.21.0/install.sh
|
[2]: https://github.com/creationix/nvm/blob/v0.22.1/install.sh
|
||||||
[3]: https://travis-ci.org/creationix/nvm
|
[3]: https://travis-ci.org/creationix/nvm
|
||||||
[Urchin]: https://github.com/scraperwiki/urchin
|
[Urchin]: https://github.com/scraperwiki/urchin
|
||||||
|
|
||||||
|
|||||||
40
install.sh
40
install.sh
@@ -4,13 +4,16 @@ set -e
|
|||||||
|
|
||||||
nvm_has() {
|
nvm_has() {
|
||||||
type "$1" > /dev/null 2>&1
|
type "$1" > /dev/null 2>&1
|
||||||
return $?
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if [ -z "$NVM_DIR" ]; then
|
if [ -z "$NVM_DIR" ]; then
|
||||||
NVM_DIR="$HOME/.nvm"
|
NVM_DIR="$HOME/.nvm"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
nvm_latest_version() {
|
||||||
|
echo "v0.22.1"
|
||||||
|
}
|
||||||
|
|
||||||
#
|
#
|
||||||
# Outputs the location to NVM depending on:
|
# Outputs the location to NVM depending on:
|
||||||
# * The availability of $NVM_SOURCE
|
# * The availability of $NVM_SOURCE
|
||||||
@@ -22,19 +25,16 @@ nvm_source() {
|
|||||||
NVM_METHOD="$1"
|
NVM_METHOD="$1"
|
||||||
if [ -z "$NVM_SOURCE" ]; then
|
if [ -z "$NVM_SOURCE" ]; then
|
||||||
local NVM_SOURCE
|
local NVM_SOURCE
|
||||||
else
|
if [ "_$NVM_METHOD" = "_script" ]; then
|
||||||
echo "$NVM_SOURCE"
|
NVM_SOURCE="https://raw.githubusercontent.com/creationix/nvm/$(nvm_latest_version)/nvm.sh"
|
||||||
return 0
|
elif [ "_$NVM_METHOD" = "_script-nvm-exec" ]; then
|
||||||
fi
|
NVM_SOURCE="https://raw.githubusercontent.com/creationix/nvm/$(nvm_latest_version)/nvm-exec"
|
||||||
if [ "_$NVM_METHOD" = "_script" ]; then
|
elif [ "_$NVM_METHOD" = "_git" ] || [ -z "$NVM_METHOD" ]; then
|
||||||
NVM_SOURCE="https://raw.githubusercontent.com/creationix/nvm/v0.21.0/nvm.sh"
|
NVM_SOURCE="https://github.com/creationix/nvm.git"
|
||||||
elif [ "_$NVM_METHOD" = "_script-nvm-exec" ]; then
|
else
|
||||||
NVM_SOURCE="https://raw.githubusercontent.com/creationix/nvm/v0.21.0/nvm-exec"
|
echo >&2 "Unexpected value \"$NVM_METHOD\" for \$NVM_METHOD"
|
||||||
elif [ "_$NVM_METHOD" = "_git" ] || [ -z "$NVM_METHOD" ]; then
|
return 1
|
||||||
NVM_SOURCE="https://github.com/creationix/nvm.git"
|
fi
|
||||||
else
|
|
||||||
echo >&2 "Unexpected value \"$NVM_METHOD\" for \$NVM_METHOD"
|
|
||||||
return 1
|
|
||||||
fi
|
fi
|
||||||
echo "$NVM_SOURCE"
|
echo "$NVM_SOURCE"
|
||||||
return 0
|
return 0
|
||||||
@@ -45,7 +45,7 @@ nvm_download() {
|
|||||||
curl $*
|
curl $*
|
||||||
elif nvm_has "wget"; then
|
elif nvm_has "wget"; then
|
||||||
# Emulate curl with wget
|
# Emulate curl with wget
|
||||||
ARGS=$(echo "$*" | sed -e 's/--progress-bar /--progress=bar /' \
|
ARGS=$(echo "$*" | command sed -e 's/--progress-bar /--progress=bar /' \
|
||||||
-e 's/-L //' \
|
-e 's/-L //' \
|
||||||
-e 's/-I /--server-response /' \
|
-e 's/-I /--server-response /' \
|
||||||
-e 's/-s /-q /' \
|
-e 's/-s /-q /' \
|
||||||
@@ -67,17 +67,17 @@ install_nvm_from_git() {
|
|||||||
echo "=> Downloading nvm from git to '$NVM_DIR'"
|
echo "=> Downloading nvm from git to '$NVM_DIR'"
|
||||||
printf "\r=> "
|
printf "\r=> "
|
||||||
mkdir -p "$NVM_DIR"
|
mkdir -p "$NVM_DIR"
|
||||||
git clone "$(nvm_source "git")" "$NVM_DIR"
|
git clone "$(nvm_source git)" "$NVM_DIR"
|
||||||
fi
|
fi
|
||||||
cd "$NVM_DIR" && git checkout --quiet v0.21.0 && git branch --quiet -D master >/dev/null 2>&1
|
cd "$NVM_DIR" && git checkout --quiet $(nvm_latest_version) && git branch --quiet -D master >/dev/null 2>&1
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
install_nvm_as_script() {
|
install_nvm_as_script() {
|
||||||
local NVM_SOURCE
|
local NVM_SOURCE
|
||||||
NVM_SOURCE=$(nvm_source "script")
|
NVM_SOURCE=$(nvm_source script)
|
||||||
local NVM_EXEC_SOURCE
|
local NVM_EXEC_SOURCE
|
||||||
NVM_EXEC_SOURCE=$(nvm_source "script-nvm-exec")
|
NVM_EXEC_SOURCE=$(nvm_source script-nvm-exec)
|
||||||
|
|
||||||
# Downloading to $NVM_DIR
|
# Downloading to $NVM_DIR
|
||||||
mkdir -p "$NVM_DIR"
|
mkdir -p "$NVM_DIR"
|
||||||
@@ -178,7 +178,7 @@ nvm_do_install() {
|
|||||||
# during the execution of the install script
|
# during the execution of the install script
|
||||||
#
|
#
|
||||||
nvm_reset() {
|
nvm_reset() {
|
||||||
unset -f nvm_do_install nvm_has nvm_download install_nvm_as_script install_nvm_from_git nvm_reset nvm_detect_profile
|
unset -f nvm_do_install nvm_has nvm_download install_nvm_as_script install_nvm_from_git nvm_reset nvm_detect_profile nvm_latest_version
|
||||||
}
|
}
|
||||||
|
|
||||||
[ "_$NVM_ENV" = "_testing" ] || nvm_do_install
|
[ "_$NVM_ENV" = "_testing" ] || nvm_do_install
|
||||||
|
|||||||
35
nvm.sh
35
nvm.sh
@@ -35,7 +35,7 @@ nvm_download() {
|
|||||||
curl $*
|
curl $*
|
||||||
elif nvm_has "wget"; then
|
elif nvm_has "wget"; then
|
||||||
# Emulate curl with wget
|
# Emulate curl with wget
|
||||||
ARGS=$(echo "$*" | sed -e 's/--progress-bar /--progress=bar /' \
|
ARGS=$(echo "$*" | command sed -e 's/--progress-bar /--progress=bar /' \
|
||||||
-e 's/-L //' \
|
-e 's/-L //' \
|
||||||
-e 's/-I /--server-response /' \
|
-e 's/-I /--server-response /' \
|
||||||
-e 's/-s /-q /' \
|
-e 's/-s /-q /' \
|
||||||
@@ -201,18 +201,18 @@ nvm_remote_version() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
nvm_normalize_version() {
|
nvm_normalize_version() {
|
||||||
echo "$1" | sed -e 's/^v//' | \awk -F. '{ printf("%d%06d%06d\n", $1,$2,$3); }'
|
echo "$1" | command sed -e 's/^v//' | \awk -F. '{ printf("%d%06d%06d\n", $1,$2,$3); }'
|
||||||
}
|
}
|
||||||
|
|
||||||
nvm_ensure_version_prefix() {
|
nvm_ensure_version_prefix() {
|
||||||
echo "$1" | sed -e 's/^\([0-9]\)/v\1/g'
|
echo "$1" | command sed -e 's/^\([0-9]\)/v\1/g'
|
||||||
}
|
}
|
||||||
|
|
||||||
nvm_format_version() {
|
nvm_format_version() {
|
||||||
local VERSION
|
local VERSION
|
||||||
VERSION="$(nvm_ensure_version_prefix "$1")"
|
VERSION="$(nvm_ensure_version_prefix "$1")"
|
||||||
if [ "_$(nvm_num_version_groups "$VERSION")" != "_3" ]; then
|
if [ "_$(nvm_num_version_groups "$VERSION")" != "_3" ]; then
|
||||||
VERSION="$(echo "$VERSION" | sed -e 's/\.*$/.0/')"
|
VERSION="$(echo "$VERSION" | command sed -e 's/\.*$/.0/')"
|
||||||
nvm_format_version "$VERSION"
|
nvm_format_version "$VERSION"
|
||||||
else
|
else
|
||||||
echo "$VERSION"
|
echo "$VERSION"
|
||||||
@@ -227,14 +227,14 @@ nvm_num_version_groups() {
|
|||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
local NVM_NUM_DOTS
|
local NVM_NUM_DOTS
|
||||||
NVM_NUM_DOTS=$(echo "$VERSION" | sed -e 's/^v//' | sed -e 's/\.$//' | sed -e 's/[^\.]//g')
|
NVM_NUM_DOTS=$(echo "$VERSION" | command sed -e 's/^v//' | command sed -e 's/\.$//' | command sed -e 's/[^\.]//g')
|
||||||
local NVM_NUM_GROUPS
|
local NVM_NUM_GROUPS
|
||||||
NVM_NUM_GROUPS=".$NVM_NUM_DOTS"
|
NVM_NUM_GROUPS=".$NVM_NUM_DOTS"
|
||||||
echo "${#NVM_NUM_GROUPS}"
|
echo "${#NVM_NUM_GROUPS}"
|
||||||
}
|
}
|
||||||
|
|
||||||
nvm_strip_path() {
|
nvm_strip_path() {
|
||||||
echo "$1" | sed -e "s#$NVM_DIR/[^/]*$2[^:]*:##g" -e "s#:$NVM_DIR/[^/]*$2[^:]*##g" -e "s#$NVM_DIR/[^/]*$2[^:]*##g"
|
echo "$1" | command sed -e "s#$NVM_DIR/[^/]*$2[^:]*:##g" -e "s#:$NVM_DIR/[^/]*$2[^:]*##g" -e "s#$NVM_DIR/[^/]*$2[^:]*##g"
|
||||||
}
|
}
|
||||||
|
|
||||||
nvm_prepend_path() {
|
nvm_prepend_path() {
|
||||||
@@ -272,7 +272,7 @@ nvm_alias() {
|
|||||||
|
|
||||||
nvm_ls_current() {
|
nvm_ls_current() {
|
||||||
local NVM_LS_CURRENT_NODE_PATH
|
local NVM_LS_CURRENT_NODE_PATH
|
||||||
NVM_LS_CURRENT_NODE_PATH="$(which node 2> /dev/null)"
|
NVM_LS_CURRENT_NODE_PATH="$(command which node 2> /dev/null)"
|
||||||
if [ $? -ne 0 ]; then
|
if [ $? -ne 0 ]; then
|
||||||
echo 'none'
|
echo 'none'
|
||||||
elif nvm_tree_contains_path "$NVM_DIR" "$NVM_LS_CURRENT_NODE_PATH"; then
|
elif nvm_tree_contains_path "$NVM_DIR" "$NVM_LS_CURRENT_NODE_PATH"; then
|
||||||
@@ -366,7 +366,7 @@ nvm_ls() {
|
|||||||
local NUM_VERSION_GROUPS
|
local NUM_VERSION_GROUPS
|
||||||
NUM_VERSION_GROUPS="$(nvm_num_version_groups "$PATTERN")"
|
NUM_VERSION_GROUPS="$(nvm_num_version_groups "$PATTERN")"
|
||||||
if [ "_$NUM_VERSION_GROUPS" = "_2" ] || [ "_$NUM_VERSION_GROUPS" = "_1" ]; then
|
if [ "_$NUM_VERSION_GROUPS" = "_2" ] || [ "_$NUM_VERSION_GROUPS" = "_1" ]; then
|
||||||
PATTERN="$(echo "$PATTERN" | sed -e 's/\.*$//g')."
|
PATTERN="$(echo "$PATTERN" | command sed -e 's/\.*$//g')."
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
if [ -d "$(nvm_version_dir new)" ]; then
|
if [ -d "$(nvm_version_dir new)" ]; then
|
||||||
@@ -984,7 +984,7 @@ nvm() {
|
|||||||
if [ "_$VERSION" = '_system' ]; then
|
if [ "_$VERSION" = '_system' ]; then
|
||||||
if nvm_has_system_node >/dev/null 2>&1; then
|
if nvm_has_system_node >/dev/null 2>&1; then
|
||||||
local NVM_BIN
|
local NVM_BIN
|
||||||
NVM_BIN="$(nvm use system >/dev/null 2>&1 && which node)"
|
NVM_BIN="$(nvm use system >/dev/null 2>&1 && command which node)"
|
||||||
if [ -n "$NVM_BIN" ]; then
|
if [ -n "$NVM_BIN" ]; then
|
||||||
echo "$NVM_BIN"
|
echo "$NVM_BIN"
|
||||||
return
|
return
|
||||||
@@ -1099,10 +1099,10 @@ nvm() {
|
|||||||
nvm_version $2
|
nvm_version $2
|
||||||
;;
|
;;
|
||||||
"--version" )
|
"--version" )
|
||||||
echo "0.21.0"
|
echo "0.22.1"
|
||||||
;;
|
;;
|
||||||
"unload" )
|
"unload" )
|
||||||
unset -f nvm nvm_print_versions nvm_checksum nvm_ls_remote nvm_ls nvm_remote_version nvm_version nvm_rc_version nvm_version_greater nvm_version_greater_than_or_equal_to > /dev/null 2>&1
|
unset -f nvm nvm_print_versions nvm_checksum nvm_ls_remote nvm_ls nvm_remote_version nvm_version nvm_rc_version nvm_version_greater nvm_version_greater_than_or_equal_to nvm_supports_source_options > /dev/null 2>&1
|
||||||
unset RC_VERSION NVM_NODEJS_ORG_MIRROR NVM_DIR NVM_CD_FLAGS > /dev/null 2>&1
|
unset RC_VERSION NVM_NODEJS_ORG_MIRROR NVM_DIR NVM_CD_FLAGS > /dev/null 2>&1
|
||||||
;;
|
;;
|
||||||
* )
|
* )
|
||||||
@@ -1111,7 +1111,18 @@ nvm() {
|
|||||||
esac
|
esac
|
||||||
}
|
}
|
||||||
|
|
||||||
if nvm ls default >/dev/null; then
|
nvm_supports_source_options() {
|
||||||
|
[ "_$(echo 'echo $1' | . /dev/stdin yes)" = "_yes" ]
|
||||||
|
}
|
||||||
|
|
||||||
|
if nvm_supports_source_options && [ "_$1" = "_--install" ]; then
|
||||||
|
VERSION="$(nvm_alias default 2>/dev/null)"
|
||||||
|
if [ -n "$VERSION" ]; then
|
||||||
|
nvm install "$VERSION" >/dev/null
|
||||||
|
elif nvm_rc_version >/dev/null 2>&1; then
|
||||||
|
nvm install >/dev/null
|
||||||
|
fi
|
||||||
|
elif nvm ls default >/dev/null; then
|
||||||
nvm use default >/dev/null
|
nvm use default >/dev/null
|
||||||
elif nvm_rc_version >/dev/null 2>&1; then
|
elif nvm_rc_version >/dev/null 2>&1; then
|
||||||
nvm use >/dev/null
|
nvm use >/dev/null
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "nvm",
|
"name": "nvm",
|
||||||
"version": "0.21.0",
|
"version": "0.22.1",
|
||||||
"description": "Node Version Manager - Simple bash script to manage multiple active node.js versions",
|
"description": "Node Version Manager - Simple bash script to manage multiple active node.js versions",
|
||||||
"directories": {
|
"directories": {
|
||||||
"test": "test"
|
"test": "test"
|
||||||
@@ -31,7 +31,7 @@
|
|||||||
"homepage": "https://github.com/creationix/nvm",
|
"homepage": "https://github.com/creationix/nvm",
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"replace": "~0.3.0",
|
"replace": "~0.3.0",
|
||||||
"semver": "~4.1.1",
|
"semver": "~4.2.0",
|
||||||
"urchin": "~0.0.5"
|
"urchin": "~0.0.5"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,10 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
die () { echo $@ ; exit 1; }
|
TEST_PWD=$(pwd)
|
||||||
|
TEST_DIR="$TEST_PWD/nvm_ls_current_tmp"
|
||||||
|
|
||||||
|
cleanup() { rm -rf "$TEST_DIR"; unset -f return_zero; unalias node; }
|
||||||
|
die () { echo $@ ; cleanup ; exit 1; }
|
||||||
|
|
||||||
. ../../../nvm.sh
|
. ../../../nvm.sh
|
||||||
|
|
||||||
@@ -8,12 +12,10 @@ return_zero () { return 0; }
|
|||||||
|
|
||||||
[ "$(nvm deactivate > /dev/null 2>&1 ; nvm_ls_current)" = "system" ] || die 'when deactivated, did not return "system"'
|
[ "$(nvm deactivate > /dev/null 2>&1 ; nvm_ls_current)" = "system" ] || die 'when deactivated, did not return "system"'
|
||||||
|
|
||||||
TEST_PWD=$(pwd)
|
|
||||||
TEST_DIR="$TEST_PWD/nvm_ls_current_tmp"
|
|
||||||
rm -rf "$TEST_DIR"
|
rm -rf "$TEST_DIR"
|
||||||
mkdir "$TEST_DIR"
|
mkdir "$TEST_DIR"
|
||||||
ln -s "$(which which)" "$TEST_DIR/which"
|
ln -s "$(command which which)" "$TEST_DIR/which"
|
||||||
ln -s "$(which dirname)" "$TEST_DIR/dirname"
|
ln -s "$(command which dirname)" "$TEST_DIR/dirname"
|
||||||
|
|
||||||
[ "$(PATH="$TEST_DIR" nvm_ls_current)" = "none" ] || die 'when node not installed, nvm_ls_current did not return "none"'
|
[ "$(PATH="$TEST_DIR" nvm_ls_current)" = "none" ] || die 'when node not installed, nvm_ls_current did not return "none"'
|
||||||
[ "@$(PATH="$TEST_DIR" nvm_ls_current 2> /dev/stdout 1> /dev/null)@" = "@@" ] || die 'when node not installed, nvm_ls_current returned error output'
|
[ "@$(PATH="$TEST_DIR" nvm_ls_current 2> /dev/stdout 1> /dev/null)@" = "@@" ] || die 'when node not installed, nvm_ls_current returned error output'
|
||||||
@@ -24,5 +26,7 @@ chmod a+x "$TEST_DIR/node"
|
|||||||
|
|
||||||
[ "$(alias nvm_tree_contains_path='return_zero' && PATH="$TEST_DIR" nvm_ls_current)" = "VERSION FOO!" ] || die 'when activated, did not return nvm node version'
|
[ "$(alias nvm_tree_contains_path='return_zero' && PATH="$TEST_DIR" nvm_ls_current)" = "VERSION FOO!" ] || die 'when activated, did not return nvm node version'
|
||||||
|
|
||||||
rm -rf "$TEST_DIR"
|
alias node='node --harmony'
|
||||||
|
[ "$(alias nvm_tree_contains_path='return_zero' && PATH="$TEST_DIR" nvm_ls_current)" = "VERSION FOO!" ] || die 'when activated and node aliased, did not return nvm node version'
|
||||||
|
|
||||||
|
cleanup
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ wget() {
|
|||||||
--2014-12-21 18:11:14-- http://latest.nvm.sh/
|
--2014-12-21 18:11:14-- http://latest.nvm.sh/
|
||||||
Resolving latest.nvm.sh... 50.31.209.229
|
Resolving latest.nvm.sh... 50.31.209.229
|
||||||
Connecting to latest.nvm.sh|50.31.209.229|:80... connected.
|
Connecting to latest.nvm.sh|50.31.209.229|:80... connected.
|
||||||
HTTP request sent, awaiting response...
|
HTTP request sent, awaiting response...
|
||||||
HTTP/1.1 301 Moved Permanently
|
HTTP/1.1 301 Moved Permanently
|
||||||
Location: https://github.com/creationix/nvm/releases/latest
|
Location: https://github.com/creationix/nvm/releases/latest
|
||||||
Content-Type: text/html; charset=utf-8
|
Content-Type: text/html; charset=utf-8
|
||||||
@@ -41,7 +41,7 @@ Location: https://github.com/creationix/nvm/releases/latest [following]
|
|||||||
--2014-12-21 18:11:15-- https://github.com/creationix/nvm/releases/latest
|
--2014-12-21 18:11:15-- https://github.com/creationix/nvm/releases/latest
|
||||||
Resolving github.com... 192.30.252.130
|
Resolving github.com... 192.30.252.130
|
||||||
Connecting to github.com|192.30.252.130|:443... connected.
|
Connecting to github.com|192.30.252.130|:443... connected.
|
||||||
HTTP request sent, awaiting response...
|
HTTP request sent, awaiting response...
|
||||||
HTTP/1.1 302 Found
|
HTTP/1.1 302 Found
|
||||||
Server: GitHub.com
|
Server: GitHub.com
|
||||||
Date: Mon, 22 Dec 2014 02:11:15 GMT
|
Date: Mon, 22 Dec 2014 02:11:15 GMT
|
||||||
@@ -68,7 +68,7 @@ HTTP request sent, awaiting response...
|
|||||||
Location: $URL [following]
|
Location: $URL [following]
|
||||||
--2014-12-21 18:11:15-- $URL
|
--2014-12-21 18:11:15-- $URL
|
||||||
Reusing existing connection to github.com:443.
|
Reusing existing connection to github.com:443.
|
||||||
HTTP request sent, awaiting response...
|
HTTP request sent, awaiting response...
|
||||||
HTTP/1.1 200 OK
|
HTTP/1.1 200 OK
|
||||||
Server: GitHub.com
|
Server: GitHub.com
|
||||||
Date: Mon, 22 Dec 2014 02:11:15 GMT
|
Date: Mon, 22 Dec 2014 02:11:15 GMT
|
||||||
|
|||||||
28
test/sourcing/Sourcing nvm.sh with --install and .nvmrc should install it
Executable file
28
test/sourcing/Sourcing nvm.sh with --install and .nvmrc should install it
Executable file
@@ -0,0 +1,28 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
die () { echo $@ ; exit 1; }
|
||||||
|
supports_source_options () {
|
||||||
|
[ "_$(echo 'echo $1' | . /dev/stdin yes)" = "_yes" ]
|
||||||
|
}
|
||||||
|
|
||||||
|
if ! supports_source_options; then
|
||||||
|
echo 'this shell does not support passing options on sourcing'
|
||||||
|
exit 0;
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo '0.10.2' > ../../.nvmrc || die 'creation of .nvmrc failed'
|
||||||
|
|
||||||
|
. ../../nvm.sh --install
|
||||||
|
EXIT_CODE="$(echo $?)"
|
||||||
|
|
||||||
|
echo 'sourcing complete.'
|
||||||
|
|
||||||
|
nvm_version 0.10.2 >/dev/null 2>&1 || die "v0.10.2 not installed: $(nvm ls)"
|
||||||
|
|
||||||
|
[ "_$(nvm_rc_version | \grep -o -e 'with version .*$')" = "_with version <0.10.2>" ] || die "nvm_rc_version $(nvm_rc_version)"
|
||||||
|
|
||||||
|
[ "_$EXIT_CODE" = "_0" ] || die "sourcing returned nonzero exit code: $EXIT_CODE"
|
||||||
|
|
||||||
|
NVM_LS_CURRENT="$(nvm ls current | \grep -o v0.10.2)"
|
||||||
|
[ "_$NVM_LS_CURRENT" = '_v0.10.2' ] || die "'nvm ls current' did not return '-> v0.10.2', got '$NVM_LS_CURRENT' `nvm ls`"
|
||||||
|
|
||||||
32
test/sourcing/Sourcing nvm.sh with --install should install the default
Executable file
32
test/sourcing/Sourcing nvm.sh with --install should install the default
Executable file
@@ -0,0 +1,32 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
die () { echo $@ ; exit 1; }
|
||||||
|
supports_source_options () {
|
||||||
|
[ "_$(echo 'echo $1' | . /dev/stdin yes)" = "_yes" ]
|
||||||
|
}
|
||||||
|
|
||||||
|
if ! supports_source_options; then
|
||||||
|
echo 'this shell does not support passing options on sourcing'
|
||||||
|
exit 0;
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo '0.10.2' > ../../alias/default || die 'creation of default alias failed'
|
||||||
|
|
||||||
|
echo 'sourcing nvm with --install...'
|
||||||
|
|
||||||
|
. ../../nvm.sh --install
|
||||||
|
EXIT_CODE="$(echo $?)"
|
||||||
|
|
||||||
|
echo 'sourcing complete.'
|
||||||
|
|
||||||
|
nvm_version 0.10.2 >/dev/null 2>&1 || die "v0.10.2 not installed: $(nvm ls)"
|
||||||
|
|
||||||
|
[ "_$EXIT_CODE" = "_0" ] || die "sourcing returned nonzero exit code: $EXIT_CODE"
|
||||||
|
|
||||||
|
NVM_LS_CURRENT="$(nvm ls current | \grep -o v0.10.2)"
|
||||||
|
[ "_$NVM_LS_CURRENT" = '_v0.10.2' ] || die "'nvm ls current' did not return '-> v0.10.2', got '$NVM_LS_CURRENT'"
|
||||||
|
|
||||||
|
NVM_ALIAS_DEFAULT="$(nvm alias default)"
|
||||||
|
[ "_$NVM_ALIAS_DEFAULT" = "_default -> 0.10.2 (-> v0.10.2)" ] \
|
||||||
|
|| die "'nvm alias default did not return 'default -> 0.10.2 (-> v0.10.2)', got '$NVM_ALIAS_DEFAULT'"
|
||||||
|
|
||||||
Reference in New Issue
Block a user