Skip to content

Commit

Permalink
Remove support for sync latest and stable. I never liked them. Fork i…
Browse files Browse the repository at this point in the history
…f you want them

Change-Id: I9092c5625305f54212625af0c16f7ead73a3d9fa
  • Loading branch information
creationix committed Sep 28, 2011
1 parent 273aeee commit ac9a528
Showing 1 changed file with 3 additions and 31 deletions.
34 changes: 3 additions & 31 deletions nvm.sh
Expand Up @@ -45,12 +45,6 @@ nvm_version()
if [ ! "$PATTERN" -o "$PATTERN" = 'current' ]; then
VERSION=`node -v 2>/dev/null`
fi
if [ "$PATTERN" = 'stable' ]; then
PATTERN='*.*[02468].'
fi
if [ "$PATTERN" = 'latest' ]; then
PATTERN='*.*.'
fi
if [ "$PATTERN" = 'all' ]; then
(cd $NVM_DIR; \ls -dG v* 2>/dev/null || echo "N/A")
return
Expand Down Expand Up @@ -84,21 +78,18 @@ nvm()
echo " nvm install <version> Download and install a <version>"
echo " nvm uninstall <version> Uninstall a version"
echo " nvm use <version> Modify PATH to use <version>"
echo " nvm ls List versions (installed versions are blue)"
echo " nvm ls List installed versions"
echo " nvm ls <version> List versions matching a given description"
echo " nvm deactivate Undo effects of NVM on current shell"
echo " nvm sync Update the local cache of available versions"
echo " nvm alias [<pattern>] Show all aliases beginning with <pattern>"
echo " nvm alias <name> <version> Set an alias named <name> pointing to <version>"
echo " nvm unalias <name> Deletes the alias named <name>"
echo " nvm copy-packages <version> Install global NPM packages contained in <version> to current version"
echo
echo "Example:"
echo " nvm install v0.4.0 Install a specific version number"
echo " nvm use stable Use the stable release"
echo " nvm install latest Install the latest, possibly unstable version"
echo " nvm install v0.4.12 Install a specific version number"
echo " nvm use 0.2 Use the latest available 0.2.x release"
echo " nvm alias default v0.4.0 Set v0.4.0 as the default"
echo " nvm alias default 0.4 Auto use the latest installed v0.4.x version"
echo
;;
"install" )
Expand Down Expand Up @@ -166,8 +157,6 @@ nvm()
nvm unalias `basename $A`
done

# Run sync in order to restore version stub file in $NVM_DIR.
nvm sync 1>/dev/null
;;
"deactivate" )
if [[ $PATH == *$NVM_DIR/*/bin* ]]; then
Expand Down Expand Up @@ -221,7 +210,6 @@ nvm()
echo -ne "$P: \t"; nvm_version $P
done
nvm alias
echo "# use 'nvm sync' to update from nodejs.org"
;;
"alias" )
mkdir -p $NVM_DIR/alias
Expand Down Expand Up @@ -250,7 +238,6 @@ nvm()
echo $3 > "$NVM_DIR/alias/$2"
if [ ! "$3" = "$VERSION" ]; then
echo "$2 -> $3 (-> $VERSION)"
echo "! WARNING: Moving target. Aliases to implicit versions may change without warning."
else
echo "$2 -> $3"
fi
Expand All @@ -262,21 +249,6 @@ nvm()
rm -f $NVM_DIR/alias/$2
echo "Deleted alias $2"
;;
"sync" )
[ "$NOCURL" ] && curl && return
LATEST=`nvm_version latest`
STABLE=`nvm_version stable`
(cd $NVM_DIR
rm -f v* 2>/dev/null
printf "# syncing with nodejs.org..."
for VER in `curl -s http://nodejs.org/dist/ -o - | grep 'v[0-9].*' | sed -e 's/.*node-//' -e 's/\.tar\.gz.*//' -e 's/<[^>]*>//' -e 's/\/<[^>]*>.*//'`; do
touch $VER
done
echo " done."
)
[ "$STABLE" = `nvm_version stable` ] || echo "NEW stable: `nvm_version stable`"
[ "$LATEST" = `nvm_version latest` ] || echo "NEW latest: `nvm_version latest`"
;;
"copy-packages" )
if [ $# -ne 2 ]; then
nvm help
Expand Down

6 comments on commit ac9a528

@Kampe
Copy link

@Kampe Kampe commented on ac9a528 Sep 30, 2011

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

...

@nevir
Copy link

@nevir nevir commented on ac9a528 Sep 30, 2011

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey, reducing complexity is good - I'm a fan of this change for the most part

This will be a bit goofy for people upgrading to the latest version of nvm, though (all those 'touched' versions showing up as installed)

@XooR
Copy link

@XooR XooR commented on ac9a528 Oct 1, 2011

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How NVM now knows which versions are available... Without sync to populate structure?
nvm_version don't do syncing.

@creationix
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@XooR: It won't. It's outside the scope of nvm to know what the available versions of node there are. That was only needed for the "latest" and "stable" auto-magic aliases. They really didn't work very well and I don't like them. Besides, it complicates the code and leaves lots of cruft files in my home directory. Now, I can see what's installed and available to me. If I want a new version installed it's not hard to install it.

@nevir
Copy link

@nevir nevir commented on ac9a528 Oct 1, 2011

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@XooR, you can still nvm install vX.Y.Z and it will still find and install that version like before

The main change is that you just need to manually go to http://nodejs.org/ if you want to see what the latest versions are

@XooR
Copy link

@XooR XooR commented on ac9a528 Oct 2, 2011

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, I can live with that :). Less complexity in program is always good thing

Please sign in to comment.