Skip to content
Browse files

[master] Added bin file to auto install all the node-versions availab…

…les, it's recommended that before run this script have installed one version for reference (nodester current support is 0.4.9)
  • Loading branch information...
1 parent 3e3819c commit 46c2a3f109e08aee6d4c172ce464c1b4e295dca2 @alejandro alejandro committed Feb 22, 2012
Showing with 47 additions and 0 deletions.
  1. +47 −0 bin/create_versions.js
View
47 bin/create_versions.js
@@ -0,0 +1,47 @@
+#!/usr/bin/env node
+
+var exec = require('child_process').exec;
+
+// Install all the versions
+// But ignore these because they are too old
+var ignore = [0,0.1,0.2,0.3];
+
+var installVersion = function(_version){
+ console.log('[INFO] This may take a while, go and grab some coffee');
+ // Like sudoer?
+ var execute = function(v){
+ console.log('[INFO] installing node-v'+ v.trim());
+ exec('n ' + v.trim(), function(e,d){
+ if (e) console.log(e);
+ });
+ };
+ if (_version){
+ execute(_version);
+ } else {
+ exec('n', function(error,list){
+ if (!error) {
+ exec('n list', function(e,d){
+ if (!e) {
+ var installed = list.split('\n');
+ d.split('\n').forEach(function(v){
+ var version = parseFloat(v.trim());
+ if (!isNaN(version) && ignore.indexOf(version) === -1
+ && list.indexOf(v) === -1) {
+ //execute(v);
+ }
+ });
+ } else {
+ console.log('[ERROR] getting list of node versions');
+ }
+ });
+ } else {
+ console.log('[ERROR] maybe `n` is not installed');
+ }
+ });
+ }
+};
+
+// TO execute this module you need to pass the param --run
+if (process.argv[2] === '--run') installVersion();
+
+module.exports = exports = new installVersion;

0 comments on commit 46c2a3f

Please sign in to comment.
Something went wrong with that request. Please try again.