Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Update to nvm 0.12.0 #346

Merged
merged 1 commit into from

4 participants

@ljharb

Just released v0.12.0 - now reports system and none appropriately.

@ljharb

ping @joshk - it'd be great to get this in before your next VM bump :-)

@BanzaiMan
Owner

@ljharb How critical is this? What is the symptom of the problem this addresses?

@ljharb

@BanzaiMan a few points:

  • every update of every dep in every project is always critical, because the farther you are from the edge, the more an upgrade cuts.
  • this version adds proper "system" awareness to nvm. In other words, nvm deactivate && nvm current will return "system" instead of the globally installed node version, so that you can actually tell that nvm is deactivated.

Travis-CI VM updates happen so rarely and seem to take so long, that I'd love to get this in now rather than having to wait 6+ months :-)

@GrahamCampbell

The last VM update was much closer than 6 months? More like 6 weeks was it not?

@GrahamCampbell

Or was it just the php vms that got an update 6 weeks ago?

@BanzaiMan
Owner

The last VM update for all environments were at the end of April, the PHP environment had a more recent one. I'm working on tooling to make it easier for more frequent updates, so hopefully we can do better on this front. In particular for the Node.js environment one, we can get 0.10.29 out, then have a minor update with this nvm update shortly after (or release the Node.js update a bit later).

@BanzaiMan BanzaiMan merged commit 681c86f into travis-ci:master
@BanzaiMan
Owner

We'll squeeze this into the update.

@ljharb

Yay, thanks! :-)

@BanzaiMan
Owner
travis@debug-update-node-js-1406157779:~$ nvm list
     v0.6.21
     v0.8.23
     v0.8.25
     v0.8.27
    v0.10.18
    v0.10.28
->  v0.10.29
    v0.11.13
      system
0.1 -> v0.10.29
0.10 -> v0.10.29
0.6 -> v0.6.21
0.8 -> v0.8.27
default -> v0.10.29
node-unstable -> v0.11.13
travis@debug-update-node-js-1406157779:~$ nvm --version
0.12.0
@joshk
Owner

Awesome!

:heart: :heart: :heart:

@joshk
Owner

@ljharb how come there isn't an auto alias for 0.11 => 0.11.13 ?

@ljharb

@joshk i'm not sure what you mean? nvm install 0.11 definitely will install the latest 0.11, in this case 0.11.13. nvm ls-remote 0.11 will list all the available ones, for example.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Jul 23, 2014
  1. @ljharb

    Update to nvm 0.12.0

    ljharb authored
This page is out of date. Refresh to see the latest.
Showing with 39 additions and 3 deletions.
  1. +39 −3 ci_environment/nodejs/files/default/nvm.sh
View
42 ci_environment/nodejs/files/default/nvm.sh
@@ -53,6 +53,19 @@ if [ -z "$NVM_NODEJS_ORG_MIRROR" ]; then
export NVM_NODEJS_ORG_MIRROR="http://nodejs.org/dist"
fi
+nvm_tree_contains_path() {
+ local tree
+ tree="$1"
+ local path
+ path="$2"
+ local pathdir
+ pathdir=$(dirname "$path")
+ while [ "$pathdir" != "" ] && [ "$pathdir" != "." ] && [ "$pathdir" != "/" ] && [ "$pathdir" != "$tree" ]; do
+ pathdir=$(dirname "$pathdir")
+ done
+ [ "$pathdir" = "$tree" ]
+}
+
# Traverse up in directory tree to find containing folder
nvm_find_up() {
local path
@@ -147,7 +160,15 @@ nvm_binary_available() {
}
nvm_ls_current() {
- echo `node -v 2>/dev/null`
+ local NODE_PATH
+ NODE_PATH="$(which node)"
+ if [ $? -ne 0 ]; then
+ echo 'none'
+ elif nvm_tree_contains_path "$NVM_DIR" "$NODE_PATH"; then
+ echo `node -v 2>/dev/null`
+ else
+ echo 'system'
+ fi
}
nvm_ls() {
@@ -181,6 +202,9 @@ nvm_ls() {
echo "N/A"
return 3
fi
+ if [ -z "$PATTERN" ] && nvm_has_system_node; then
+ VERSIONS="$VERSIONS$(printf '\n%s' 'system')"
+ fi
echo "$VERSIONS"
return
}
@@ -238,6 +262,8 @@ nvm_print_versions() {
FORMAT='\033[0;32m-> %9s\033[0m'
elif [ -d "$NVM_DIR/$VERSION" ]; then
FORMAT='\033[0;34m%12s\033[0m'
+ elif [ "$VERSION" = "system" ]; then
+ FORMAT='\033[0;33m%12s\033[0m'
else
FORMAT='%12s'
fi
@@ -524,7 +550,17 @@ nvm() {
VERSION=`nvm_version $NVM_RC_VERSION`
fi
else
- VERSION=`nvm_version $2`
+ if [ $2 = 'system' ]; then
+ if nvm_has_system_node && nvm deactivate; then
+ echo "Now using system version of node: $(node -v 2>/dev/null)."
+ return
+ else
+ echo "System version of node not found." >&2
+ return 127
+ fi
+ else
+ VERSION=`nvm_version $2`
+ fi
fi
if [ -z "$VERSION" ]; then
nvm help
@@ -687,7 +723,7 @@ nvm() {
nvm_version $2
;;
"--version" )
- echo "0.11.2"
+ echo "0.12.0"
;;
"unload" )
unset -f nvm nvm_print_versions nvm_checksum nvm_ls_remote nvm_ls nvm_remote_version nvm_version nvm_rc_version > /dev/null 2>&1
Something went wrong with that request. Please try again.