Compare commits

..

6 Commits

Author SHA1 Message Date
Jordan Harband
0aa3118de3 v0.30.1 2015-12-28 12:46:41 -08:00
Jordan Harband
2541baaf7d [Refactor] Create nvm_get_make_jobs to abstract out “-j” logic. 2015-12-28 12:20:14 -08:00
Jordan Harband
dc8b63cb25 [Fix] nvm install -s: fix syntax errors. 2015-12-28 12:19:50 -08:00
Jordan Harband
f3cc95bc66 Merge pull request #952 from davemay99/install-fix-quotes
[Fix] install.sh: quote `$DETECTED_PROFILE`
2015-12-28 09:24:42 -08:00
Dave May
00d4520d35 Merge remote-tracking branch 'creationix/master' into install-fix-quotes 2015-12-28 12:08:57 -05:00
Dave May
f113c5d030 fix quoting for usernames with space 2015-12-28 00:34:38 -05:00
4 changed files with 51 additions and 42 deletions

View File

@@ -25,11 +25,11 @@ Homebrew installation is not supported.
To install or update nvm, you can use the [install script][2] using cURL:
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.30.0/install.sh | bash
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.30.1/install.sh | bash
or Wget:
wget -qO- https://raw.githubusercontent.com/creationix/nvm/v0.30.0/install.sh | bash
wget -qO- https://raw.githubusercontent.com/creationix/nvm/v0.30.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>
@@ -254,7 +254,7 @@ After the v0.8.6 release of node, nvm tries to install from binary packages. But
If setting the `default` alias does not establish the node version in new shells (i.e. `nvm current` yields `system`), ensure that the system's node PATH is set before the `nvm.sh` source line in your shell profile (see [#658](https://github.com/creationix/nvm/issues/658))
[1]: https://github.com/creationix/nvm.git
[2]: https://github.com/creationix/nvm/blob/v0.30.0/install.sh
[2]: https://github.com/creationix/nvm/blob/v0.30.1/install.sh
[3]: https://travis-ci.org/creationix/nvm
[Urchin]: https://github.com/scraperwiki/urchin
[Fish]: http://fishshell.com

View File

@@ -11,7 +11,7 @@ if [ -z "$NVM_DIR" ]; then
fi
nvm_latest_version() {
echo "v0.30.0"
echo "v0.30.1"
}
#
@@ -131,7 +131,7 @@ nvm_detect_profile() {
DETECTED_PROFILE="$HOME/.zshrc"
fi
if [ -z $DETECTED_PROFILE ]; then
if [ -z "$DETECTED_PROFILE" ]; then
if [ -f "$PROFILE" ]; then
DETECTED_PROFILE="$PROFILE"
elif [ -f "$HOME/.profile" ]; then
@@ -145,7 +145,7 @@ nvm_detect_profile() {
fi
fi
if [ ! -z $DETECTED_PROFILE ]; then
if [ ! -z "$DETECTED_PROFILE" ]; then
echo "$DETECTED_PROFILE"
fi
}

79
nvm.sh
View File

@@ -1200,11 +1200,48 @@ nvm_install_node_binary() {
return 2
}
nvm_get_make_jobs() {
if nvm_is_natural_num "$1"; then
NVM_MAKE_JOBS="$1"
echo "number of \`make\` jobs: $NVM_MAKE_JOBS"
return
elif [ -n "$1" ]; then
unset NVM_MAKE_JOBS
echo >&2 "$1 is invalid for number of \`make\` jobs, must be a natural number"
fi
local NVM_OS
NVM_OS="$(nvm_get_os)"
local NVM_CPU_THREADS
if [ "_$NVM_OS" = "_linux" ]; then
NVM_CPU_THREADS="$(grep -c 'core id' /proc/cpuinfo)"
elif [ "_$NVM_OS" = "_freebsd" ] || [ "_$NVM_OS" = "_darwin" ]; then
NVM_CPU_THREADS="$(sysctl -n hw.ncpu)"
elif [ "_$NVM_OS" = "_sunos" ]; then
NVM_CPU_THREADS="$(psrinfo | wc -l)"
fi
if ! nvm_is_natural_num "$NVM_CPU_THREADS" ; then
echo "Can not determine how many thread(s) we can use, set to only 1 now." >&2
echo "Please report an issue on GitHub to help us make it better and run it faster on your computer!" >&2
NVM_MAKE_JOBS=1
else
echo "Detected that you have $NVM_CPU_THREADS CPU thread(s)"
if [ $NVM_CPU_THREADS -gt 2 ]; then
NVM_MAKE_JOBS=$(($NVM_CPU_THREADS - 1))
echo "Set the number of jobs to $NVM_CPU_THREADS - 1 = $NVM_MAKE_JOBS jobs to speed up the build"
else
NVM_MAKE_JOBS=1
echo "Number of CPU thread(s) less or equal to 2 will have only one job a time for 'make'"
fi
fi
}
nvm_install_node_source() {
local VERSION
VERSION="$1"
local NVM_MAKE_JOBS
NVM_MAKE_JOBS="$2"
local ADDITIONAL_PARAMETERS
ADDITIONAL_PARAMETERS="$2"
ADDITIONAL_PARAMETERS="$3"
local NVM_ARCH
NVM_ARCH="$(nvm_get_arch)"
@@ -1232,29 +1269,6 @@ nvm_install_node_source() {
MAKE_CXX="CXX=c++"
fi
if [ -z "$NVM_MAKE_JOBS" ]; then
if [ "_$NVM_OS" = "_linux" ]; then
NVM_CPU_THREADS="$(grep -c 'core id' /proc/cpuinfo)"
elif [ "_$NVM_OS" = "_freebsd" ] || [ "_$NVM_OS" = "_darwin" ]; then
NVM_CPU_THREADS="$(sysctl -n hw.ncpu)"
elif [ "_$NVM_OS" = "_sunos" ]; then
NVM_CPU_THREADS="$(psrinfo | wc -l)"
fi
if [ ! nvm_is_natural_num "$NVM_CPU_THREADS" ] ; then
echo "Can not determine how many thread(s) we can use, set to only 1 now." 1>&2
echo "Please report an issue on GitHub to help us make it better and run it faster on your computer!" 1>&2
NVM_MAKE_JOBS="1"
else
echo "Detected that you have $NVM_CPU_THREADS CPU thread(s)"
if [ $NVM_CPU_THREADS -gt 2 ]; then
NVM_MAKE_JOBS=$(($NVM_CPU_THREADS - 1))
echo "Set the number of jobs to $NVM_CPU_THREADS - 1 = $NVM_MAKE_JOBS jobs to speed up the build"
else
NVM_MAKE_JOBS=1
echo "Number of CPU thread(s) less or equal to 2 will have only one job a time for 'make'"
fi
fi
fi
local tmpdir
tmpdir="$NVM_DIR/src"
local tmptarball
@@ -1578,6 +1592,7 @@ nvm() {
local nobinary
nobinary=0
local make_jobs
while [ $# -ne 0 ]
do
case "$1" in
@@ -1587,13 +1602,7 @@ nvm() {
;;
-j)
shift # consume "-j"
if [ nvm_is_natural_num "$1" ]; then
NVM_MAKE_JOBS=$1
echo "number of \`make\` jobs: $NVM_MAKE_JOBS"
else
unset NVM_MAKE_JOBS
echo >&2 "$1 is invalid for number of \`make\` jobs, must be a natural number"
fi
nvm_get_make_jobs "$1"
shift # consume job count
;;
*)
@@ -1693,15 +1702,15 @@ nvm() {
fi
if [ "$NVM_INSTALL_SUCCESS" != true ]; then
if [ "$NVM_IOJS" != true ] && [ "$NVM_NODE_MERGED" != true ]; then
if nvm_install_node_source "$VERSION" "$ADDITIONAL_PARAMETERS"; then
if nvm_install_node_source "$VERSION" "$NVM_MAKE_JOBS" "$ADDITIONAL_PARAMETERS"; then
NVM_INSTALL_SUCCESS=true
fi
elif [ "$NVM_IOJS" = true ]; then
# nvm_install_iojs_source "$VERSION" "$ADDITIONAL_PARAMETERS"
# nvm_install_iojs_source "$VERSION" "$NVM_MAKE_JOBS" "$ADDITIONAL_PARAMETERS"
echo "Installing iojs from source is not currently supported" >&2
return 105
elif [ "$NVM_NODE_MERGED" = true ]; then
# nvm_install_merged_node_source "$VERSION" "$ADDITIONAL_PARAMETERS"
# nvm_install_merged_node_source "$VERSION" "$NVM_MAKE_JOBS" "$ADDITIONAL_PARAMETERS"
echo "Installing node v1.0 and greater from source is not currently supported" >&2
return 106
fi
@@ -2279,7 +2288,7 @@ $NVM_LS_REMOTE_POST_MERGED_OUTPUT" | command grep -v "N/A" | command sed '/^$/d'
nvm_remote_version "$2"
;;
"--version" )
echo "0.30.0"
echo "0.30.1"
;;
"unload" )
unset -f nvm nvm_print_versions nvm_checksum \

View File

@@ -1,6 +1,6 @@
{
"name": "nvm",
"version": "0.30.0",
"version": "0.30.1",
"description": "Node Version Manager - Simple bash script to manage multiple active node.js versions",
"directories": {
"test": "test"