Commit Graph

536 Commits (c07838fcc0a74a19feb84a4ed54d388aa21e60b3)

Author SHA1 Message Date
Jordan Harband 986abbf5db Create nvm_version_path 2014-08-19 16:17:00 -07:00
Jordan Harband 78a5e3fadf Attempt to improve `nvm copy-packages` 2014-08-16 00:14:29 -07:00
Jordan Harband d7849054f8 Apparently wget outputs to stderr, so let's make sure we're checking both stderr and stdout. 2014-08-15 20:47:55 -07:00
Jordan Harband 708ac80a55 Properly replace the -I curl option for the --server-response wget option. 2014-08-15 20:47:55 -07:00
Jordan Harband eef12cc2b3 v0.13.1 2014-08-08 11:48:54 -07:00
Jordan Harband 99c8b59a14 Make sure that $ARGS is evaluated natively rather than as a single string argument.
Fixes #494.
2014-08-08 11:48:38 -07:00
Jordan Harband 61709c1f97 v0.13.0 2014-08-02 19:24:39 -07:00
Jordan Harband d5c0e94166 Adding `nvm exec` command. 2014-08-01 01:26:33 -07:00
Jordan Harband 6dc602b521 Ensure that `nvm ls node` doesn't return "node_modules", for example. 2014-08-01 01:24:28 -07:00
Jordan Harband 1d37af162a v0.12.2 2014-07-29 00:35:27 -07:00
Jordan Harband 781373f7ce Make sure awk is referenced unaliased, per https://github.com/creationix/nvm/issues/162#issuecomment-50284503 2014-07-27 23:02:22 -07:00
Jordan Harband 68574cc7e8 v0.12.1 2014-07-24 14:07:26 -07:00
John Loy d181abb628 Changes $path var to $node_path
Avoids obliteration of $path set earlier by Prezto/zsh. Stomping on $path causes dirname to not be in the PATH resulting in an error.
2014-07-24 15:28:33 -04:00
Jordan Harband f5643dc7ea v0.12.0 2014-07-23 01:15:14 -07:00
Jordan Harband e7ada80d08 `nvm use system` should work as expected. 2014-07-21 02:03:18 -07:00
Jordan Harband 9912f7cc46 If nvm is deactivated, display "none" or "system" instead of the system node version 2014-07-21 02:03:18 -07:00
Jordan Harband 6e02e5a54c If `nvm_ls` is called without a pattern, and node exists, tack on "system". 2014-07-21 02:03:18 -07:00
Jordan Harband 42b010775b Add `system` support to `nvm_print_versions` 2014-07-21 02:03:18 -07:00
Jordan Harband 1c50c5c7aa Add nvm_tree_contains_path function 2014-07-21 02:03:04 -07:00
Jordan Harband 200a9aa97e v0.11.2 2014-07-20 23:58:19 -07:00
Jordan Harband 55677dba4a Avoid calling "nvm_ls current" and call "nvm_ls_current" directly 2014-07-20 23:40:20 -07:00
Jordan Harband ca43ca21f5 Fix curl/wget detection. Fixes #478 2014-07-18 13:18:09 -07:00
Koen Punt 9c2127ce33 string replacement turns out not POSIX compliant 2014-07-18 16:21:20 +02:00
Jordan Harband 7a423b7bb4 v0.11.1 2014-07-18 01:48:46 -07:00
Michał Gołębiowski 21fa84225c Hotfix: correctly map curl's `-C -` to wget
wget doesn't need or accept the `-` parameter to `-c`. This incorrect
mapping causes `nvm install` to fail on a curlless OS.
2014-07-16 11:00:56 +02:00
Jordan Harband 4895aebf0a v0.11.0 2014-07-15 10:52:30 -07:00
Jordan Harband 26ed7a003a Making sure to quote this output, so that paths with spaces don't break the method.
Although tests were passing in Travis for #470, they were failing locally - now they pass in both.
2014-07-15 02:00:48 -07:00
Jordan Harband 6d2912a2ab Adding nvm_has_system_node 2014-07-14 21:41:26 -07:00
Jordan Harband 7171cbed6f Add an `nvm_ls_current` function. 2014-07-14 11:29:24 -07:00
Jordan Harband 8f66273922 Merge pull request #467 from jsdevel/adding-current-symlink
Adding a symlink in .nvm to the current version.

Fixes #430. Closes #447. Relates to #358. Fixes #355. Closes #313. Fixes #381.
2014-07-13 11:23:27 -07:00
jsdevel 3fa004293c Adding a symlink in .nvm to the current version. 2014-07-12 12:01:35 -07:00
Jordan Harband 83efa2288d Use [0-9] instead of [[:digit:]] per https://github.com/creationix/nvm/pull/466#discussion_r14853668 - it's simpler (and probably more portable). 2014-07-12 11:02:42 -07:00
Jordan Harband 4cfe62d3d1 Fixing `nvm ls 0.x` to only include `0.x.*` instead of `0.x*.*` 2014-07-12 11:02:42 -07:00
egilkh 0534872e0f Should escape grep in nvm_ls 2014-07-12 19:33:28 +02:00
Olivier Mengué f1b8cf8fd6 Use 'read' built-in instead of $(cat ... | head -n1) 2014-07-10 12:15:27 -07:00
Jordan Harband a7b6495172 Removing unnecessary line, per #461 2014-07-10 01:24:12 -07:00
Jordan Harband 2ee4b6f414 Correcting nvm.sh comment wrt bash 2014-07-09 18:30:52 -07:00
Jordan Harband 63f72b37df Followup per https://github.com/creationix/nvm/pull/452#issuecomment-48151847 2014-07-07 15:40:59 -07:00
Koen Punt a0de15d0f7 fix nvm_curl arguments for stdout 2014-07-07 23:16:20 +02:00
Jordan Harband df4689fbd2 Removing an extra "echo" 2014-07-07 13:59:58 -07:00
Jordan Harband 018e47bec0 Make sure both wget and curl work. 2014-07-07 13:32:10 -07:00
Jordan Harband 74cc1eb022 Make `nvm_curl` do a runtime check if `curl` is available. 2014-07-07 13:32:10 -07:00
Jordan Harband eda8ffbcc4 Add some more curl → wget argument munging 2014-07-07 13:32:10 -07:00
Jordan Harband b9383c9016 Use `nvm_curl` instead of `curl` directly, which has a `wget` fallback. 2014-07-07 13:32:10 -07:00
Jordan Harband f214ffaf1f Oxford comma 2014-07-05 11:07:14 -07:00
Jordan Harband 3e5037a1be v0.10.0 2014-06-26 17:06:45 -07:00
Jordan Harband fb215546ee Don't bother trying to return the exit code of `nvm alias` or `nvm_print_versions` 2014-06-26 16:52:48 -07:00
Jordan Harband 4b593bcda2 Make sure these vars are local, where supported 2014-06-26 16:52:34 -07:00
Jordan Harband 8349f0ff48 Make sure `nvm ls foo` returns a nonzero exit code when a version is not found.
Fixes #440.
2014-06-26 10:28:35 -07:00
Jordan Harband bb250b5730 v0.9.0 2014-06-26 10:28:14 -07:00
Jordan Harband 4c9a36e9ad Separating variable declaration from first assignment, which should fix some ksh problems. 2014-06-22 15:44:22 -07:00
Jordan Harband ba7f27dead Silently support `nvm i x.x.x`. Fixes #443. 2014-06-22 09:16:30 -07:00
Jordan Harband d8b55652a5 Return the exit code of `nvm use` when `nvm install`-ing. 2014-06-20 11:49:06 -07:00
Jordan Harband 4c38f507f5 Consistently returning exit code 1 when version is not installed yet. 2014-06-20 11:45:25 -07:00
Jordan Harband f213167ef0 Returning exit code 3 when no version is found. 2014-06-20 11:45:14 -07:00
Jordan Harband 1da31aa425 v0.8.0 2014-06-20 11:35:18 -07:00
Koen Punt 8dbbc32905 redirect errors to stderr 2014-06-17 01:22:12 +02:00
Andrew Crites 0e1f2408c9 Only list extant explicit version 2014-06-12 10:56:20 -04:00
Jordan Harband 6aa45732d8 Merge pull request #376 from koenpunt/nvm-unload
Feature: nvm unload
2014-05-28 20:53:50 -07:00
Jordan Harband 578a601b27 Filter out of `nvm ls` things that start with a dot. Fixes #421, closes #422. 2014-05-20 10:36:12 -07:00
Jordan Harband db8acf11fd v0.7.0 2014-05-08 10:30:52 -07:00
Jordan Harband a6be718387 Fixing --version output format. 2014-05-08 10:30:34 -07:00
Koen Punt f6ba08253b utility method for append path, fixes #414 2014-05-08 10:20:11 +02:00
Koen Punt e3b84499c2 use regex triplet, add unit test 2014-05-07 10:58:21 +02:00
Koen Punt b313f62749 Use sed -e instead of -E 2014-05-07 10:58:18 +02:00
Jordan Harband 7f3a794d89 Merge pull request #409 from koenpunt/sed-path-replacement
Use sed for *PATH stripping
2014-05-06 01:37:49 -07:00
Jordan Harband ba1be9b4ea Making `nvm install` use the version, even if it's already installed. Fixes #410 2014-05-05 23:32:39 -07:00
Koen Punt 652a9ef9b5 always apply path stripping 2014-05-06 00:00:25 +02:00
Koen Punt 0d81a219ae add quotes 2014-05-05 22:05:02 +02:00
Koen Punt d6e457354f use nvm_strip_path utility method for path stripping 2014-05-05 22:03:11 +02:00
Koen Punt 6668dc5c47 remove parentheses 2014-05-05 21:50:59 +02:00
Koen Punt 3d9c1d7852 use sed for *PATH stripping 2014-05-05 21:43:22 +02:00
Jordan Harband 29f582611b v0.6.1 2014-05-04 12:40:02 -07:00
Jordan Harband 673cda56c4 Adding a test for `nvm install invalid` behavior, and correcting the message.
From f00d688c87 (commitcomment-6205164)
2014-05-04 12:03:26 -07:00
Jordan Harband e562a5645b v0.6.0 2014-05-04 02:20:31 -07:00
Jordan Harband f00d688c87 Nicer failure message when trying to install an invalid version. Fixes #285. 2014-05-04 00:59:08 -07:00
Jordan Harband 4a7275a0c6 Ensuring paths are in quotes, to preserve spaces. 2014-05-04 00:39:46 -07:00
Jordan Harband 87516039a8 Using portable conditional syntax. 2014-05-02 23:28:42 -07:00
Koen Punt 80e349edb1 locate .nvmrc without `find`
instead of using find and actually cd'ing into directories
we're now using simple string replacement on the `pwd`
2014-05-02 23:02:34 -07:00
Jordan Harband 038c1f3d0f Find `.nvmrc` files upwards. 2014-05-02 23:02:34 -07:00
Jordan Harband 66455f7c77 Refactor so "finding .nvmrc" can be done in a bash function. 2014-05-02 23:02:34 -07:00
Jordan Harband 222250f2d1 v0.5.1 2014-04-25 10:47:59 -07:00
Jordan Harband e6bd207624 When auto-printing "help" on a command other than "help", return a nonzero exit code. 2014-04-25 10:35:52 -07:00
Jordan Harband bad79e6d77 v0.5.0 2014-04-20 00:36:12 -07:00
Jordan Harband 20953ab04c Make sure `nvm run` works without a version argument when .nvmrc specifies a version. 2014-04-20 00:28:07 -07:00
Jordan Harband bf8abf1052 Make sure `nvm install` works without a version argument when .nvmrc specifies a version. 2014-04-19 17:07:00 -07:00
Jordan Harband c188c1b11a Correcting help text for `nvm use` 2014-04-19 16:46:22 -07:00
Jordan Harband 752c0e4ef1 Removing trailing whitespace. 2014-04-19 14:34:47 -07:00
Jordan Harband 6dde4aac38 v0.4.0 2014-03-26 21:31:48 -07:00
Koen Punt 744507b83e added nvm unload method to remove nvm from shell 2014-03-23 16:44:37 +01:00
Koen Punt ec7909dcd3 Use NVM_ prefix for variables 2014-03-23 16:42:38 +01:00
Jordan Harband ba1e2f1cdf Merge pull request #382 from koenpunt/version-normalizing
Fix nvm ls for v* numbers
2014-03-21 09:30:19 -07:00
Jordan Harband 625e54880f Merge pull request #374 from koenpunt/fix-tests
Fix NVM_DIR discovery
2014-03-21 09:27:13 -07:00
Jordan Harband cebda7d35a When curl is not present, immediately bail out of `nvm install` with a nonzero exit code. Fixes #385. 2014-03-21 09:23:30 -07:00
Koen Punt 4a9a15c404 Fix NVM_DIR discovery 2014-03-21 10:03:16 +01:00
Jordan Harband 31c5406780 Adding an `nvm --version` command 2014-03-20 23:21:01 -07:00
Koen Punt a34c080d77 Fix nvm ls for v* numbers
Previously calling nvm ls with v* number (nvm ls v0.2)
would not return any results.

So now the v is prepended if its not already there
2014-03-18 10:53:57 +01:00
Koen Punt e30424d22f define all functions with nvm_ prefix 2014-03-18 01:41:02 +01:00
Koen Punt 1d40a5bc8b Replaced echo for printf when using formatted strings
Updated version list, now also compatible with zsh
2014-03-17 13:19:39 +01:00
messju mohr f82f38be90 fixed nvm_version result when multiple versions match the given pattern 2014-03-15 20:42:38 +01:00
Koen Punt 1a19de9d20 Use has util method and use comparison opts 2014-03-15 15:59:46 +01:00
Jordan Harband 618a372f38 Unset the executable bit on nvm.sh, since it's meant to be sourced 2014-03-14 22:10:52 -07:00
Daniel Teixeira 8cceae3cc1 Overwritting GREP_OPTIONS on local script
(recommiting to automerge into current master)
2014-03-14 14:58:51 -03:00
Jordan Harband 0d44ed1126 Merge pull request #364 from frasertweedale/fix/portability
Fix/portability
2014-03-04 17:31:17 -08:00
Fraser Tweedale 3b21b76106 fix install from source on FreeBSD 10
Compile with CXX=c++ on FreeBSD, as FreeBSD >= 10.0 no longer has
GCC in the base system (c++ is hardlinked to clang++ on FreeBSD 10.0
and g++ on FreeBSD < 10).
2014-02-22 11:58:39 +10:00
Fraser Tweedale dcba513108 address remaining comments from #363 2014-02-22 11:25:45 +10:00
Fraser Tweedale e6a5374bfb colorize output only if echo supports it 2014-02-22 00:06:53 +10:00
Fraser Tweedale 8cba9c5781 avoid nullglob in alias command 2014-02-22 00:00:10 +10:00
Fraser Tweedale 1d6145de5a fix explicit version matching on FreeBSD
FreeBSD's regular expression library does not like the pattern used
for matching explicit version strings in `nvm_ls`.  Change the
pattern to something more specific that works on FreeBSD.
2014-02-21 23:25:45 +10:00
Fraser Tweedale ca0c8a7f1d handle echo implementations that do not support `-e` 2014-02-21 22:10:17 +10:00
Fraser Tweedale a3331ffdb0 fix errors due to use of unportable == operator
The `==` operator is not defined by POSIX and many test(1) (also
spelled `[`) implementations do not support it.  Replace uses of
`==` with the POSIX-conformant `=` equality operator.
2014-02-21 21:05:40 +10:00
Fraser Tweedale 4a5f5203d0 fix errors and portability issues in expr commands
Add double-quotes around all expr(1) left-hand-sides where the
argument is just a variable, to prevent syntax errors when the
variable is empty.

Also avoid the `expr match ...` variant as this is not defined in
POSIX and causes errors in some implementations, including
FreeBSD's.
2014-02-21 20:52:50 +10:00
Fraser Tweedale ee6d4ab074 fix ls command in dash
The `colorize_version` command fails in dash (default /bin/sh on
Ubuntu) with an error like:

  local: v0.2.3: bad variable name

Instead of using a local variable, interpolate the function argument
directly to avoid the error.
2014-02-21 20:24:27 +10:00
Dr. Kibitz a9be598241 Remove some new bashisms 2014-02-18 21:57:59 -08:00
Dr. Kibitz 9a0c269713 Redo https://github.com/creationix/nvm/pull/345 2014-02-18 21:51:39 -08:00
Fraser Tweedale 0c8410fcc3 support FreeBSD's sha1(1) for integrity checks
In the absense of shasum(1) (which on FreeBSD is provided by Perl,
from ports) nvm falls back to sha1sum(1) which does not exist on
FreeBSD.  But FreeBSD does have sha1(1) so look for sha1(1) and use
it if present.

As part of this change, refactor the execution of the checksum
program down into nvm_checksum and also clean up some special-casing
of empty dist checksums, which is already handled by nvm_checksum.
2014-02-18 22:22:46 +10:00
Jordan Harband 12d7b6fa0c Merge pull request #361 from drkibitz/local-vars
Declare more variables as local
2014-02-16 11:20:21 -08:00
Jordan Harband 274652e10e Fix nvm ls-remote and display uninstalled versions again. Fixes #359, closes #360 2014-02-16 09:35:05 -08:00
Dr. Kibitz 2e9558cbf9 Declare more variables as local 2014-02-16 01:05:24 -08:00
Jordan Harband 13781f242b Create a `colorize_version` function that doesn't include the padding, for `nvm version` 2014-02-15 18:12:24 -08:00
Jordan Harband b6469ee186 Preventing an extra leading newline. 2014-02-15 18:12:24 -08:00
Jordan Harband 304cc29cf0 Fixing indentation and adding a trailing newline. 2014-02-15 16:02:27 -08:00
Nicholas Hwang 9a88e3656c Change variable name to fix zsh parse issue 2014-02-11 22:55:02 -05:00
Simon Tabor 9af7409e4a don't curl if version is specified + installed
Removes CURL to match the version pattern if an explicit version (e.g. `v0.10.25`) is specified and already installed.
2014-02-06 13:02:57 +00:00
Jordan Harband ecb7a15baa Using our conventional NVM_ prefix for env vars.
Per https://github.com/creationix/nvm/pull/245#issuecomment-33821443
2014-01-31 10:01:37 -08:00
Kyle Kelley 8599ea29f9 Add dist to path, add docs 2014-01-30 19:22:44 -08:00
Kyle Kelley b1d0cfa77b Added mirror option for node binaries 2014-01-30 19:16:36 -08:00
Jordan Harband 45eff43cd0 Merge pull request #342 from txgruppi/master
export NODE_PATH on nvm use
2014-01-13 21:08:17 -08:00
Tarcisio Gruppi eb588566f2
Removed PREVIOUS_NODE_PATH 2014-01-13 09:15:45 -02:00
Dennis Hoppe 47c87b8478 Update nvm.sh
Examples should point to latest stable release. ;)
2014-01-03 14:45:46 +01:00
Tarcisio Gruppi 58dafdaedd
Update NODE_PATH on use, run and deactivate 2014-01-01 02:04:37 -02:00
Tarcisio Gruppi 4d2faba9af
export NODE_PATH on nvm use 2013-12-31 22:35:19 -02:00
Marcin Jekot 950da2b836 Merge branch 'master' into #299 2013-12-25 18:14:24 +02:00
Fraser Tweedale 591a3bb19d fix MANPATH generation on FreeBSD
On FreeBSD, if MANPATH is set it is used verbatim; configuration
files are completely ignored.  Therefore, setting MANPATH to (only)
the nvm man dir makes system man pages unreachable.

To get around this, before doing anything else to MANPATH, if it is
empty set it to the output of manpath(1).

One further complication: FreeBSD automatically adds a path to the
man pages path for each path in PATH that ends in "/bin", which
causes "~/.nvm/$VERSION/man" to be added.  This interferes with the
subsequent substitution so strip this from MANPATH before the
substitution.
2013-12-23 21:31:18 +10:00
Marcin Jekot 679c71650f fix copy-packages in zsh
fixes #299, finally, using the local var syntax
2013-12-18 17:21:00 +02:00
Jordan Harband 3eb09ab984 Merge pull request #330 from mibamur/patch-1
Update nvm.sh
2013-12-17 10:25:24 -08:00
Michael 670870e211 Update nvm.sh
fix#https://github.com/creationix/nvm/pull/330
2013-12-18 02:07:02 +09:00
Michael 74ca011704 Update nvm.sh
fix https://github.com/creationix/nvm/pull/330
2013-12-18 02:06:23 +09:00
Jordan Harband 83c5b6286d Add `nvm current` to `nvm help`. Relates to #205. 2013-12-16 23:40:47 -08:00
Timo Sand f9d5a85f05 Merge branch 'master' into add-current-command 2013-12-17 08:06:16 +02:00
Michael b2ef0cb14c Update nvm.sh
Fix - this line should be nvm use 0.10 - no 'v', and no incremental version number.
2013-12-16 23:25:50 +09:00
Michael 59c4dc735a Update nvm.sh
small fix fo nvm help info
2013-12-16 05:04:14 +09:00
Marcin Jekot 4df45ac51a merge in changes from creationix/nvm 2013-12-15 11:27:15 +02:00
Marcin Jekot 94fff5c923 fix copy-packages in zsh (without breaking sh and bash) 2013-12-14 01:14:34 +02:00
D. Stuart Freeman 56e32888ea fix copy-packages 2013-12-12 10:52:43 -05:00
Koen Punt e99fc43ab2 helper method for testing existence of commands 2013-12-12 10:46:40 +01:00
Adam Hull 037f52a55b Slurp test unsetopt stderr 2013-12-11 15:23:19 -08:00
Koen Punt aba4346a86 Universal test of unsetopt command
According to http://stackoverflow.com/a/7522866/189431 it should work in "bash, zsh, ksh and sh (as provided by dash)".
2013-12-11 13:49:58 +01:00
Jordan Harband 5686d9a3bb Addressing comments raised in #171 2013-11-29 14:26:12 -06:00
Jordan Harband 788d87774f Merge pull request #312 from quiqueg/master
Fixed bash error caused by lack of double quotes
2013-10-25 09:32:59 -07:00
Logan Smyth 7862182d6f Add -f 2013-10-24 20:09:33 -07:00
Matthew Alexander b4a9c14d4e Fixed bash error caused by lack of double quotes 2013-10-24 18:59:37 -07:00
Logan Smyth 473dd86f48 Properly remove the tar file. 2013-10-23 22:14:02 -07:00
Timo Sand dd157129a6 Added command to get current nvm environment. 2013-10-10 07:56:57 +03:00
00Davo a2a8ddb779 Use only shell builtins to avoid triggering autojump, instead of needing GNU readlink
Under Zsh, the `-q` flag to `cd` makes it not run `chpwd` hooks and hence makes it not add `~/.nvm` to `autojump`.
2013-09-19 02:50:20 +10:00
00Davo 1ad9d18257 Finds NVM_DIR without using cd
Using `cd` makes the nvm directory the number-one directory in `autojump`'s database---which is somewhat confusing since the user basically never `cd`s to it directly!---so here's an alternative method that doesn't use the `cd` command. I've checked it works in both Bash and Zsh.
2013-09-18 17:10:24 +10:00
Martin Iwanowski 41352e866d Fix for issue #196, deconfusified the scenario 2013-09-10 12:34:32 +02:00
Max Zhao 62dec72394 Fixed curl silently ignoring 302 redirections
Under certain network environments, due to poor implementation of file
download caches (immoral Chinese ISP), the direct download of Node.js
packages (http://nodejs.org/dist/node-$VERSION.tar.gz) will be
redirected to alternative urls using 302 redirections, which are not
handled by `curl --process-bar` by default. Instead, curl will "fail"
silently without creating any output file or error exitcode.
(Tested under Ubuntu 12.04 Desktop)

Fixed by adding "-L" switches to the curl commands responsible for
downloading the binary and source node.js packages.
2013-08-21 00:27:10 +08:00
Daniel Stockman e5d7d493b9 Avoid error from aliased `which` during install
The same fix as #207, just for fools like me who have `which` aliased to `type` in OS X. Without this escape, a very cryptic error message is emitted (though the install ultimately succeeds, as long as one actually has `curl` installed).
2013-07-31 12:42:19 -07:00
Jeremy Satterfield 6690aecc6c fix handle cases of grep aliases as described in to resolve #207 2013-06-26 15:55:39 -05:00
Code Whale 4a7945f8c1 support Raspberry Pi binaries 2013-06-24 13:33:19 +00:00
Cliffano Subagio 39c5d0597d Fix style, opening curly brace on the same line as function declaration. 2013-06-22 23:11:43 +10:00
Cliffano Subagio ab71d50b3a Add sh directive and replace bash function with sh function. 2013-06-21 17:56:58 +10:00
Tim Caswell 5c6af59fcd Merge pull request #236 from donovanjamesking/master
Fixes issue 232 and "nvm ls" returning "N/A" when it shouldn't
2013-06-10 06:36:16 -07:00
Derek Keller d1d53ea979 Updated fix for issues #232 and #244
Fixes issues #232 and #244 where "nvm ls" returns inconsistent results depending on the number of node versions installed.  This updated fix uses the find and sort commands only.  Tested in bash v3.2.48 and v4.2.25, and zsh v4.3.11.
2013-06-09 21:44:46 -05:00
Koen Punt 0f05655ee6 Return 1 so exit status is not null on error 2013-06-03 22:26:52 +03:00
Tim Caswell 6b932e59c3 Remove column since many common environments don't have it. 2013-06-03 10:08:13 -04:00
Donovan James King bc04ed3ece Fixes issue 232
Fixes issue 232 that occurs in at least bash v4.2.25 where "nvm ls" returns "N/A" no matter how many versions of node have been installed.  The fix uses a combination of the find, tr and basename commands instead of basename only.  Tested in bash v3.2.48 and v4.2.25 and zsh v4.3.11.
2013-05-13 14:35:36 -05:00
Miguel Cobá 335456d008 Drop invalid -a flag for basename.
basename doesn't accept options in bash. This causes the VERSIONS variable get the 'N/A' value for $ nvm ls command.

From basename man page:
NAME
       basename - strip directory and suffix from filenames

SYNOPSIS
       basename NAME [SUFFIX]
       basename OPTION

DESCRIPTION
       Print NAME with any leading directory components removed.  If specified, also remove a trailing SUFFIX.

       --help display this help and exit

       --version
              output version information and exit



coreutils version used in Linux Mint 14 Nadia.

GNU coreutils 8.12.197-032bb                                               September 2011                                                               BASENAME(1)

No idea if this flag exists on FreeBSD or other unixes (if they use gnu coreutils shouldn't be any problem)
2013-05-09 13:50:12 -04:00
Emanuele Aina 42915fc21c Reduce usage of `cd' to avoid issues with shell aliases
Since we run in interactive context the builtin `cd' may have been aliased to
print some additional info when invoked, thus it's safer for us to avoid
parsing the output from subshells which calls it.

For instance in .bash_profile I have the following function to redefine
`cd' such that it will list the destination directory contents:
cd () { builtin cd "$@" && ls -F --color=auto }
2013-05-03 17:44:02 +01:00
Emanuele Aina f1b484ee87 Silence stderr warning on `nvm uninstall' with no configured alias 2013-05-03 17:42:14 +01:00
Tim Caswell 6c3708d337 Merge pull request #195 from gpad/patch-1
Resolved Issue #194
2013-04-24 09:03:36 -07:00
jnlin db7494494c Add FreeBSD support 2013-04-24 15:42:10 +08:00
GPad 5811cb9e73 Resolved Issue #194
Issue #194
2013-02-11 19:23:25 +01:00
GPad 7226e5fb98 read the .nvmrc if present 2013-01-25 19:13:40 +01:00
GPad bc9c82cb9f read version from .nvmrc if not specified 2013-01-22 13:28:13 +01:00
Tim Caswell f605581c7d return not exit 2013-01-21 12:07:54 -06:00
Koen Punt 70e1b81ad3 Add exit code, fix #190 2013-01-21 17:26:16 +01:00
Yosiya Hinosawa a6be969403 changed shasums file url because in v0.8.6 .txt.asc file is not available. 2013-01-13 16:13:20 +09:00
Yosiya Hinosawa 184f641730 fixed the condition for the binary package availability. 2013-01-13 16:10:50 +09:00
Yoshiya Hinosawa 7013372867 added -s (install from source) option. 2013-01-12 14:42:28 +09:00
A.J 5596054445 fixed wrong condition checking for 'shasum' (I'm using Mac OS 10.8.2)
line 188, `which shasum > /dev/null 2>&1` will be replaced by:

	'/usr/bin/shasum > /dev/null 2>&1'

but, `/usr/bin/shasum` needs filename argument which is ommited and the
test results always 'false'.
2012-12-09 05:17:13 +09:00
Tim Caswell 68f7dc9cb3 Merge pull request #171 from cou929/support_sha1sum_command
support platforms which does not have shasum command
2012-12-04 17:46:04 -08:00
Marsup 2662840064 Fix #172 on ZSH 2012-11-27 23:46:04 +01:00
Kosei Moriyama 1a08edd94e support platforms which does not have shasum command
use sha1sum command if there is no shasum command
2012-11-24 00:08:49 +09:00
Sebastian Cohnen 0803e317e1 avoid environment pollution with NVM internals 2012-11-20 15:32:59 +01:00
hisanori 4ffd4bb34f fix installation problem about v0.4 2012-10-27 04:09:10 +09:00
wlaurance 21f00362b0 Account for x86 architectures 2012-10-25 15:39:08 -04:00
wlaurance a1d14ea5b8 Checksum support for binary downloads
Checksum support for source downloads

Closes #159
2012-10-23 14:26:21 -04:00
wlaurance 03b16d7a67 Account for uname -a i686 2012-10-23 12:19:42 -04:00
Joel Wietelmann 182e28f1ae Making ARM stop downloading x86 binaries 2012-10-18 21:19:08 +00:00
Tim Caswell d9f25f8f58 Merge pull request #96 from caio/dont-fail-on-source
Avoid carrying over test status when no node version is installed
2012-10-17 09:41:43 -07:00
Tim Caswell b73f0930cc Merge pull request #106 from ghost/master
nodejs.org doesnt seem to support resuming partial downloads
2012-10-17 09:40:27 -07:00
Tim Caswell 3766bff734 Merge pull request #148 from nathan-lafreniere/master
Fixes ls-remote with no parameters in linux
2012-10-17 07:27:28 -07:00
Marsup a0c4229abe Support binary installs
Heavily inspired by isaacs/nave
2012-10-12 09:39:35 +02:00
Koen Punt 4a6c696074 Made string comparison also compatible for zsh 2012-10-09 13:36:44 +02:00
Nathan LaFreniere a368227237 make ls-remote work with no parameters in linux 2012-10-07 17:19:53 -07:00
Nathan LaFreniere e1be38f90d fixup automatically prepending the v for remote requests 2012-10-05 11:39:38 -07:00
Nathan LaFreniere 9fb65cbf7b add v back to ls-remote results 2012-10-04 11:10:31 -07:00
Nathan LaFreniere 693abf3173 make install use a different nvm_version to make not specifying the v avoid clobbering aliases 2012-10-04 10:32:36 -07:00
Nathan LaFreniere e755c47d5a made ls-remote actually usable 2012-10-04 09:41:32 -07:00
Nathan LaFreniere 3d65d55b5a install requested version automatically if it isnt available 2012-10-04 09:40:00 -07:00
Nathan LaFreniere 6505c98461 add ls-remote 2012-10-04 09:38:51 -07:00
Nathan LaFreniere ebff66649e add v to version if user does not specify it to simplify commands 2012-10-04 09:36:39 -07:00
Nathan LaFreniere 07aaa91c9b Revert "add /.nvm to NVM_DIR so we dont clutter up home directories"
This reverts commit a107b12d2a.
2012-10-04 09:29:05 -07:00
Nathan LaFreniere a107b12d2a add /.nvm to NVM_DIR so we dont clutter up home directories 2012-10-04 09:28:32 -07:00
Bill Caputo 2adbe8bd7f changed npm url to use https (script has moved) 2012-10-03 16:24:43 -05:00
Matthew Metnetsky d68c38902a Fix warning when unsetopt isn't found 2012-08-22 14:19:18 -04:00
rummik ad5242ea0b Fix parse error in Zsh 4.3.17 2012-08-20 18:02:38 -03:00
Aravind Ramanathan 3bb2634d2f Added check for unsetopt
unsetopt doesn't exist on OSX by default which causes `. nvm.sh` to
fail at that line.
2012-08-07 23:22:27 -07:00
Tim Caswell e475d7e7ab Fix bug introduced by pull # 125 2012-08-01 12:48:41 -05:00
fatshotty f8c1822033 added additional options for compiling node 2012-08-01 11:10:25 +02:00
Tomas Sedovic 3dd6b29905 Supress ZSH "no matches found" error
Fixes issue #39

ZSH's default globbing behaviour differs from Bash. If there is no
match, ZSH itself will print the error message.

This means that piping a commantd's STDERR to /dev/null will not
hide it.

By unsetting the NOMATCH option we get a behaviour similar to Bash.

Signed-off-by: Tomas Sedovic <tomas@sedovic.cz>
2012-07-07 14:37:09 +02:00
Gerhard Lazu d544d8e2eb If you're using set -e (and why wouldn't you), this halts all execution 2012-07-03 10:41:15 +01:00
Gerhard Lazu 3e62657575 If cd fails, don't run pwd
Whitespace...
2012-07-03 10:36:23 +01:00
Wtfcoder a86262520a remove continue from curl arg. nodejs.org doesnt seems to support continue, CDN effect perhaps? 2012-03-13 11:51:05 +07:00
David Hagler 45051f4d43 changed the function to place the curl requirement where it belongs 2012-02-24 11:25:27 -06:00
David Hagler 7c3af21ebe Removed default check for curl, and placed it into nvm function
This fixes issue with curl not being installed before nvm is initially sourced
and then curl subsequently being installed.

removed creation of global curl function (after error detected) which
overwrites the system tool, preventing execution of later installed
curl binary
2012-02-24 10:52:25 -06:00
Chakrit Wichian a49f77135a `nvm version` and `nvm ls` not correctly reporting current version on both zsh and bash. 2012-02-19 18:12:14 +07:00
Lucian Holland b2683fdb11 Merge remote-tracking branch 'upstream/master' 2012-01-27 10:38:41 +00:00
Caio Romão 53cfd2dd9b Avoid carrying over test status when no node version is installed
When sourcing nvm.sh, if there are no version of node installed the command
`nvm ls default` silentry fails, however it's return status code (`$?`) is
still set to non-zero, which means an error.

This patch simply avoids this issue by making sure the status code after
sourcing is ok so that people that put the returned status codes in their
command line prompt don't get an error every time `nvm.sh` is sourced.
2012-01-18 17:43:28 -02:00
Jeffrey D. Van Alstine 18f4064003 Fixes npm version check for node v0.2.0, v0.2.1 and v0.2.2 2011-11-17 16:15:31 -07:00
Jeffrey D. Van Alstine 990ad81419 Check if node v0.1.x or v0.2.x before npm installs 2011-11-17 15:38:51 -07:00
Maciej Małecki 269bb008fc [doc] Update help 2011-11-14 19:35:55 +01:00
Tim Caswell a987f8e67d Merge pull request #76 from mmalecki/run
[feature] Run command
2011-11-14 08:30:06 -08:00
Maciej Małecki 53e1764a8a [feature] Allow passing additional arguments to node
For example:

    nvm run v0.6.0 myApp.js
2011-11-05 17:32:17 +01:00
Lucian Holland fda6e7f8de Rewrote version listing system
Now sorts correctly in all instances and prints highlights
even in sorted views. Also will output a list of matching versions
for commands of the form nvm ls 0.4* rather than just printing one
version. nvm version 0.4 still prints the single latest matching
version, however.
2011-11-04 20:38:16 +00:00
Lucian Holland 6f994715d6 Fixed incorrect sorting of versions 2011-11-04 20:38:15 +00:00
Tim Caswell 8dad534464 Remove broken wget emulation 2011-11-03 16:19:26 -05:00
Maciej Małecki 09483f422e [feature] Add `run` command
`run` command runs given node version without modyfing global state:

    [maciej@PC07 nvm (run)]$ node --version
    v0.4.12
    [maciej@PC07 nvm (run)]$ nvm run 0.4.12
    Running node v0.4.12
    > process.version
    'v0.4.12'
    > [maciej@PC07 nvm (run)]$ nvm run 0.5.9
    Running node v0.5.9
    > process.version
    'v0.5.9'
    > [maciej@PC07 nvm (run)]$ node --version
    v0.4.12
2011-10-29 10:08:05 +02:00
Scott Bronson 26b07fbdff remove references to stable and latest 2011-10-05 12:47:57 -07:00
Scott Bronson 656549dd44 make "list" a synonym for "ls" 2011-10-05 12:43:50 -07:00
Marcelo Diniz f939adbedb Fix wrong full version matching 2011-10-02 00:59:20 +02:00
Tim Caswell ac9a52886d Remove support for sync latest and stable. I never liked them. Fork if you want them
Change-Id: I9092c5625305f54212625af0c16f7ead73a3d9fa
2011-09-28 10:56:16 -07:00
Maciej Małecki 33c91398bf Don't allow installing already installed version.
Trying to install already installed version causes misleading message
from curl and nvm:

    $ nvm install v0.4.11
    curl: (33) HTTP server doesn't seem to support byte ranges. Cannot
    resume.
    nvm: install v0.4.11 failed!

Of course, resuming interrupted installs is still possible (script
checks for existance of `$VERSION` in `$NVM_DIR`, not `$NVM_DIR/src`).
2011-09-17 13:16:37 +02:00
Will 92703939ee uninstall should delete the extracted source files from the src directory, not nvm root 2011-09-04 14:27:04 +02:00
Christopher Roach fd1eb7559b Added a fix for issue #59 2011-08-27 18:02:41 -07:00
Geoffrey Huntley 964e7c303c updated shorthand for -# to --progress-bar on wget emulation function() 2011-08-25 14:32:47 +10:00
Geoffrey Huntley 1251684440 - version detection now works with zsh
- curl routine now compatible with zsh
- changed curl to use --progress-bar instead of unsafe shorthand (-#)
2011-08-25 14:03:13 +10:00
Evan Meagher 46302a25d2 Add unalias and uninstall commands. 2011-08-19 18:00:25 -07:00
Tim Caswell d5638cb241 Merge pull request #44 from zzen/patch-1
Added copy-packages command
2011-08-18 09:35:12 -07:00
Kieran Huggins e9f35e7b15 don't shed all over the user's shell 2011-07-28 01:31:35 -04:00
Kieran Huggins fab5db0ec8 add support for release directories ( e.g. >= v0.5.1 ) 2011-07-27 17:50:41 -04:00
Jakub Nešetřil 4c8d3a70ea Added copy-packages command 2011-07-02 09:14:48 -07:00
Tim Caswell 8d97b78da7 Fix a couple little bugs 2011-05-05 13:51:08 -07:00
Carter Thaxton 61585251f5 Force unaliased use of ls, for those of us who alias ls in their shell 2011-04-09 14:47:50 -07:00
Tim Caswell 37ffd82af4 Update readme and comment 2011-02-25 11:53:38 -08:00
Isaac Wolkerstorfer 2d4c9b0846 Merge remote-tracking branch 'origin/master'
Conflicts:
	nvm.sh
2011-02-25 20:30:08 +01:00
Tim Caswell 66a9f01a0e Fix for ZSH by wavded 2011-02-25 09:17:27 -08:00
Tim Caswell f668d354a9 Update the sample text to reflect current stable 2011-02-18 09:46:47 -08:00
Scott Bronson d13d6b199a use a subshell instead of setting the START var
also don't try to install npm if node installation fails.
2011-02-13 21:33:28 -08:00
Isaac Wolkerstorfer cd3304548f Fix some syntax issues 2011-01-29 16:24:42 +01:00
Isaac Wolkerstorfer 57d62762e1 Don't overwrite existing NVM_DIR vars 2011-01-25 17:29:49 +01:00
Isaac Wolkerstorfer 8ec6fb22fd Create alias dir on demand 2011-01-25 17:12:13 +01:00
Isaac Wolkerstorfer 3d0082fa60 Suppress unnecessary output 2011-01-24 17:11:46 +01:00
Isaac Wolkerstorfer 85566c9682 Merge curl/wget and version changes 2011-01-22 21:52:27 +01:00
Isaac Wolkerstorfer c060a287d0 Use curl or wget, whichever is available
Also spit out an error message if we have neither.
2011-01-22 21:07:27 +01:00
Isaac Wolkerstorfer 590b283e65 Change version() to nvm_version()
It's a bit less conflict-y
2011-01-22 20:54:15 +01:00
Isaac Wolkerstorfer a7328b3711 Add output to sync if stable/latest changes 2011-01-22 19:31:20 +01:00
Isaac Wolkerstorfer 861766372d Add a special "default" alias
If you set a "default" alias, it will automatically be loaded when you
start a new shell.
2011-01-22 19:16:24 +01:00
Isaac Wolkerstorfer a77c632e2a Add aliases to versions
Aliases are stored as plaintext files in the $NVM_DIR/alias dir.
They may store either an explicit version (v0.3.6) or an implied version
("latest"). The latter is a "moving target", and thus possibly
dangerous, but can be useful, too.
2011-01-22 19:12:13 +01:00
Isaac Wolkerstorfer 0f6680e8b7 Use version descriptors for 'install' and 'use'
Allows things like "nvm install latest" or "nvm use stable" or "nvm use 0.2"
2011-01-22 17:57:08 +01:00
Isaac Wolkerstorfer b2c6be9e08 Show all available versions in ls
Adds a cache of all versions available on nodejs.org using simple empty files as placeholders. When a new version is installed, it will replace the placeholder with a directory.

This makes it easier for users to see what versions are available for install, and what the latest and stable versions are.
2011-01-22 17:48:57 +01:00
Carter Thaxton d3b5853454 Set MANPATH on nvm use and deactivate 2010-12-11 20:19:23 -08:00
Tim Caswell 077a661696 zsh prompts get interfered with environment variables that are named the
directory you are in. Don't define START unless we need to.

(Thanks cgcardona)

Change-Id: I256a4db0af9b40b64bc0fe8d6e393f614132db68
2010-12-10 12:52:58 -08:00
Tim Caswell 924d965964 Clean up npm integration a little bit
Change-Id: I849f1056d0188aef264777e18270728b1535f61c
2010-12-10 12:43:27 -08:00
Tim Caswell a078d6427b Install npm automatically 2010-12-10 11:42:19 -08:00
Tim Caswell 91d2be5179 Trim and update nvm 2010-12-10 11:32:16 -08:00
Tim Caswell e0bbea635f Don't make the function definition file executable 2010-05-14 10:41:45 -07:00
Tim Caswell fefa00fac8 Merge branch 'master' of http://github.com/isaacs/nvm 2010-05-14 10:39:56 -07:00
Tim Caswell 359a83e6c5 Use NVM_PATH instead of NODE_PATH 2010-05-14 10:39:54 -07:00
isaacs 06e882b332 Add a package.json so that npm can install this. 2010-05-12 21:17:52 -07:00
Tim Caswell 7df245c569 Remove clone and update, these are better done by hand, add listlibs and a way to use the latest stable version 2010-05-06 18:30:27 -05:00
Tim Caswell 2527ff6b1f Use lib instead of modules for certain scripts that assume ../lib from the /bin folder. 2010-05-04 23:33:42 -05:00
Tim Caswell d67c7011f4 Have two module installers, one for linked modules (for ones you actively develop) and one that copies the module so that the original source tree can be deleted. 2010-04-26 12:50:18 -05:00
Tim Caswell 09e7c3227b Add a NODE_BIN env variable to the current bin folder so installers know where to put their stuff. Also add a simple installer for projects without one, but that follow the standard layout. 2010-04-26 12:40:57 -05:00
Tim Caswell 93e28c3b2f Add per/version NODE_PATH and a deactivate command to return everything back to normal. 2010-04-26 12:40:57 -05:00
Tim Caswell 54495e56ae Fix a couple bugs and enable the --debug flag for HEAD version. 2010-04-20 18:51:07 -05:00
Tim Caswell 53e64fc3b5 Put a star by the active version in "nvm list" and don't allow "nvm use" to set a version that isn't installed. 2010-04-19 10:46:58 -05:00
Tim Caswell 47d5982ef8 Update to replace an old nvm path if it exists already in $PATH. 2010-04-19 10:22:28 -05:00
Tim Caswell 4d2e6045eb Add "help" to the help message. 2010-04-15 12:22:16 -05:00
Tim Caswell 6c243e502e Make the gist work as it's own repo. 2010-04-15 12:16:23 -05:00
creationix cb87c313a9 2010-04-15 09:53:39 -07:00
creationix d5b8294497 2010-04-15 09:20:27 -07:00
creationix 4f4dec1c89 2010-04-15 09:20:00 -07:00
creationix 9cd2dd0c37 2010-04-15 09:13:33 -07:00