Skip to content

Commit

Permalink
Add cholocatey package
Browse files Browse the repository at this point in the history
fixes #23

(sorry this took so long @fschwiet)
  • Loading branch information
marcelklehr committed Dec 2, 2013
1 parent e3db5e7 commit fb8983f
Show file tree
Hide file tree
Showing 3 changed files with 58 additions and 9 deletions.
24 changes: 15 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,22 +1,28 @@
# nodist
A Node version manager for the windows folks out there. Inspired by [n](https://github.com/visionmedia/n).

## Install
Don't install node beforehand! If node is already installed, uninstall it first. Nodist was designed to __replace existing node.js installation__ instead of equipping it with version management functionality.
## Installation
Don't install node beforehand! If node is already installed, uninstall it first. Nodist was designed to __replace any existing node.js installation__.

### The hard way
1. Grab the code by unpacking the [zip](https://github.com/marcelklehr/nodist/zipball/master) or using `git clone git://github.com/marcelklehr/nodist.git`.

2. Place the code in a directory for use. It is not recommended to use `Program Files` since you will need to run all your commands in administrator mode (unless you are using an Administrator account). As a suggestion, use `c:\nodist` or `c:\users\username\.nodist`.
2. Place the code in a directory for use. (Note: It is not recommended to use `Program Files` since it requires admin rights if you want to manipulate it, which is exactly what nodist does.)

3. Add `...path...\nodist\bin` to system's path. ([setx not available?](http://www.computerhope.com/issues/ch000549.htm)).
3. Add `...path...\nodist\bin` to system's path. -- *([setx not available?](http://www.computerhope.com/issues/ch000549.htm))*
```batchfile
setx /M PATH "...path...\nodist\bin;%PATH%"
```

4. Now, run `nodist update`, which will install the dependencies.

### Fancy installation

## Uninstall
1. Install chocolatey: http://chocolatey.org/

2. Run `cinst nodist`

### Uninstall

1. Remove the nodist bin path from your path. ([how?](http://www.computerhope.com/issues/ch000549.htm)).

Expand Down Expand Up @@ -102,11 +108,11 @@ nodist r v0.8.1 -- foo.js -s
### Set a proxy to use for fetching the executables
Exceedingly simple: Just set an env var containing the proxy information (can be one of `HTTP_PROXY`/`http_proxy`/`HTTPS_PROXY`/`https_proxy`).

e.g. `set HTTP_PROXY=http://myproxy.com:8213` (better put it into your system global environment)
e.g. `set HTTP_PROXY=http://myproxy.com:8213` (better put it into your system's global environment)

### Installing the x64 versions
To always deal with the 64bit versions of the node you need to define the `NODIST_X64` environment variable.
e.g. `set NODIST_X64=1` (better put it into your system global environment)
e.g. `set NODIST_X64=1` (better put it into your system's global environment)

### All comands
Output of `nodist --help`:
Expand All @@ -120,7 +126,7 @@ Usage:
nodist dist List all available node versions.
nodist ds
nodist add <version> Download the specified node version.
nodist add <version> Download the specified node version.
nodist + <version>
nodist rm <version> Uninstall the specified node version.
Expand Down Expand Up @@ -174,7 +180,7 @@ Examples:

## Details
`nodist` stores your node executables in `path\to\nodist\v\`, so it can see what's installed and activate previously installed versions.
When a version is activated, `nodist` copies it from `nodist\v\<version>\node.exe` to `nodist\bin\node.exe`. You can alter the path where versions are stored, using the `NODIST_PREFIX` env variable. (The 64bit versions are stored as `x64.exe` in the appropriate version directory).
When a version is activated globally, `nodist` copies it from `nodist\v\<version>\node.exe` to `nodist\bin\node.exe`. You can alter the path where versions are stored (e.g. `path/to/nodist/v`), using the `NODIST_PREFIX` env variable. (The 64bit versions are stored as `x64.exe` in the appropriate version directory).

`nodist` comes with the latest npm version and will use this all the time, regardless of the node version you have installed.

Expand Down
21 changes: 21 additions & 0 deletions chocolatey/nodist.nuspec
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<?xml version="1.0"?>
<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
<metadata>
<id>nodist</id>
<title>nodist</title>
<version>0.3.12-beta</version>
<authors>Marcel Klehr</authors>
<owners>Marcel Klehr</owners>
<summary>A Node.js version manager for Windows.</summary>
<description>See github page https://github.com/marcelklehr/nodist for documentation.</description>
<projectUrl>https://github.com/marcelklehr/nodist</projectUrl>
<tags>node nodejs javascript admin nvm version management</tags>
<copyright>2013</copyright>
<licenseUrl>https://github.com/marcelklehr/nodist</licenseUrl>
<requireLicenseAcceptance>false</requireLicenseAcceptance>
</metadata>
<files>
<file src="tools\**" target="tools" />
<!--<file src="content\**" target="content" />-->
</files>
</package>
22 changes: 22 additions & 0 deletions chocolatey/tools/chocolateyInstall.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
$packageName = 'nodist'
$url = 'https://github.com/marcelklehr/nodist/archive/master.zip'
$unzipPath = $(Split-Path -parent $MyInvocation.MyCommand.Definition)

try {

Install-ChocolateyZipPackage $packageName $url $unzipPath
$binPath = (resolve-path (join-path $unzipPath "nodist-master\bin")).ToString()

"Installing nodist at $binPath" | write-host -fore green

Install-ChocolateyPath $binPath 'Machine'

"Running nodist update"
$validExitCodes = @(0)
Start-ChocolateyProcessAsAdmin "$(join-path $binPath "nodist.cmd") update" -validExitCodes $validExitCodes

Write-ChocolateySuccess "$packageName"
} catch {
Write-ChocolateyFailure "$packageName" "$($_.Exception.Message)"
throw
}

1 comment on commit fb8983f

@fschwiet
Copy link
Collaborator

@fschwiet fschwiet commented on fb8983f Dec 2, 2013 via email

Choose a reason for hiding this comment

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

Please sign in to comment.