Compare commits
13 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e562a5645b | ||
|
|
c0c5e8d7ef | ||
|
|
f00d688c87 | ||
|
|
5aa78f21cf | ||
|
|
4a7275a0c6 | ||
|
|
c77be55cdc | ||
|
|
e195fccdb7 | ||
|
|
87516039a8 | ||
|
|
80e349edb1 | ||
|
|
038c1f3d0f | ||
|
|
66455f7c77 | ||
|
|
a69eae10e3 | ||
|
|
13b87449e8 |
@@ -2,7 +2,7 @@ language: c # defaults to ruby
|
||||
install:
|
||||
- sudo apt-get install ksh zsh -y
|
||||
before_script:
|
||||
- curl -o /tmp/urchin https://raw.github.com/scraperwiki/urchin/master/urchin && chmod +x /tmp/urchin
|
||||
- curl -o /tmp/urchin https://raw.githubusercontent.com/scraperwiki/urchin/master/urchin && chmod +x /tmp/urchin
|
||||
script:
|
||||
- NVM_DIR=$TRAVIS_BUILD_DIR make URCHIN=/tmp/urchin test
|
||||
|
||||
|
||||
@@ -8,11 +8,11 @@ First you'll need to make sure your system has a c++ compiler. For OSX, XCode w
|
||||
|
||||
To install you could use the [install script][2] using cURL:
|
||||
|
||||
curl https://raw.github.com/creationix/nvm/v0.5.1/install.sh | sh
|
||||
curl https://raw.githubusercontent.com/creationix/nvm/v0.6.0/install.sh | sh
|
||||
|
||||
or Wget:
|
||||
|
||||
wget -qO- https://raw.github.com/creationix/nvm/v0.5.1/install.sh | sh
|
||||
wget -qO- https://raw.githubusercontent.com/creationix/nvm/v0.6.0/install.sh | sh
|
||||
|
||||
<sub>The script clones the nvm repository to `~/.nvm` and adds the source line to your profile (`~/.bash_profile`, `~/.zshrc` or `~/.profile`).</sub>
|
||||
|
||||
@@ -37,6 +37,9 @@ Often I also put in a line to use a specific version of node.
|
||||
|
||||
## Usage
|
||||
|
||||
You can create an `.nvmrc` file containing version number in the project root directory (or any parent directory).
|
||||
`nvm use`, `nvm install`, and `nvm run` will all respect an `.nvmrc` file.
|
||||
|
||||
To download, compile, and install the latest v0.10.x release of node, do this:
|
||||
|
||||
nvm install 0.10
|
||||
@@ -45,13 +48,9 @@ And then in any new shell just use the installed version:
|
||||
|
||||
nvm use 0.10
|
||||
|
||||
You can create an `.nvmrc` file containing version number in the project root folder; run the following command to switch versions:
|
||||
|
||||
nvm use
|
||||
|
||||
Or you can just run it:
|
||||
|
||||
nvm run 0.10
|
||||
nvm run 0.10 --version
|
||||
|
||||
If you want to see what versions are installed:
|
||||
|
||||
@@ -164,7 +163,7 @@ After the v0.8.6 release of node, nvm tries to install from binary packages. But
|
||||
nvm install -s 0.8.6
|
||||
|
||||
[1]: https://github.com/creationix/nvm.git
|
||||
[2]: https://github.com/creationix/nvm/blob/v0.5.1/install.sh
|
||||
[2]: https://github.com/creationix/nvm/blob/v0.6.0/install.sh
|
||||
[3]: https://travis-ci.org/creationix/nvm
|
||||
[Urchin]: https://github.com/scraperwiki/urchin
|
||||
|
||||
|
||||
@@ -45,7 +45,7 @@ install_from_git() {
|
||||
|
||||
install_as_script() {
|
||||
if [ -z "$NVM_SOURCE" ]; then
|
||||
NVM_SOURCE="https://raw.github.com/creationix/nvm/master/nvm.sh"
|
||||
NVM_SOURCE="https://raw.githubusercontent.com/creationix/nvm/master/nvm.sh"
|
||||
fi
|
||||
|
||||
# Downloading to $NVM_DIR
|
||||
|
||||
32
nvm.sh
32
nvm.sh
@@ -34,11 +34,30 @@ if [ -z "$NVM_NODEJS_ORG_MIRROR" ]; then
|
||||
export NVM_NODEJS_ORG_MIRROR="http://nodejs.org/dist"
|
||||
fi
|
||||
|
||||
# Traverse up in directory tree to find containing folder
|
||||
nvm_find_up() {
|
||||
local path
|
||||
path=$PWD
|
||||
while [ "$path" != "" ] && [ ! -f "$path/$1" ]; do
|
||||
path=${path%/*}
|
||||
done
|
||||
echo "$path"
|
||||
}
|
||||
|
||||
|
||||
nvm_find_nvmrc() {
|
||||
local dir="$(nvm_find_up '.nvmrc')"
|
||||
if [ -e "$dir/.nvmrc" ]; then
|
||||
echo "$dir/.nvmrc"
|
||||
fi
|
||||
}
|
||||
|
||||
# Obtain nvm version from rc file
|
||||
nvm_rc_version() {
|
||||
if [ -e .nvmrc ]; then
|
||||
NVM_RC_VERSION=`cat .nvmrc | head -n 1`
|
||||
echo "Found .nvmrc files with version <$NVM_RC_VERSION>"
|
||||
local NVMRC_PATH="$(nvm_find_nvmrc)"
|
||||
if [ -e "$NVMRC_PATH" ]; then
|
||||
NVM_RC_VERSION=`cat "$NVMRC_PATH" | head -n 1`
|
||||
echo "Found '$NVMRC_PATH' with version <$NVM_RC_VERSION>"
|
||||
fi
|
||||
}
|
||||
|
||||
@@ -289,6 +308,11 @@ nvm() {
|
||||
|
||||
[ -d "$NVM_DIR/$VERSION" ] && echo "$VERSION is already installed." && return
|
||||
|
||||
if [ "$VERSION" = "N/A" ]; then
|
||||
echo "Version '$VERSION' not found - try \`nvm ls-remote\` to browse available versions."
|
||||
return 3
|
||||
fi
|
||||
|
||||
# skip binary install if no binary option specified.
|
||||
if [ $nobinary -ne 1 ]; then
|
||||
# shortcut - try the binary if possible.
|
||||
@@ -592,7 +616,7 @@ nvm() {
|
||||
nvm_version $2
|
||||
;;
|
||||
"--version" )
|
||||
echo "nvm v0.5.1"
|
||||
echo "nvm v0.6.0"
|
||||
;;
|
||||
* )
|
||||
nvm help
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "nvm",
|
||||
"version": "0.5.1",
|
||||
"version": "0.6.0",
|
||||
"description": "Node Version Manager - Simple bash script to manage multiple active node.js versions",
|
||||
"directories": {
|
||||
"test": "test"
|
||||
|
||||
@@ -6,7 +6,8 @@ die () { echo $@ ; exit 1; }
|
||||
. ../../../nvm.sh
|
||||
|
||||
echo "0.10.7" > .nvmrc
|
||||
[ "$(nvm run --version | tail -1)" = "v0.10.7" ] || die "`nvm run` failed to run with the .nvmrc version"
|
||||
|
||||
[ "$(nvm run --version | head -1)" = "Found .nvmrc files with version <0.10.7>" ] || die "`nvm run` failed to print out the \"found in .nvmrc\" message"
|
||||
[ "$(nvm run --version | tail -1)" = "v0.10.7" ] || die "\`nvm run\` failed to run with the .nvmrc version"
|
||||
|
||||
[ "$(nvm run --version | head -1)" = "Found '$PWD/.nvmrc' with version <0.10.7>" ] || die "\`nvm run\` failed to print out the \"found in .nvmrc\" message"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user