From 9f38bb9f89fe4d3777c820053929fb2880bec363 Mon Sep 17 00:00:00 2001 From: Egor Suvorov Date: Wed, 8 Jan 2014 01:24:50 +0200 Subject: [PATCH 1/2] windows-support: require('child_process').spawn was replaced by 'spawn-cmd' module --- lib/atmosphere.js | 2 +- lib/command.js | 2 +- lib/meteor.js | 2 +- lib/sources/git.js | 2 +- package.json | 1 + spec/lib/runner.js | 2 +- spec/lib/utils.js | 2 +- spec/support/bin/curl | 2 +- spec/support/bin/git | 2 +- 9 files changed, 9 insertions(+), 8 deletions(-) diff --git a/lib/atmosphere.js b/lib/atmosphere.js index 82fcee9..10ad9d4 100644 --- a/lib/atmosphere.js +++ b/lib/atmosphere.js @@ -3,7 +3,7 @@ var Config = require('./config'); var path = require('path'); var fs = require('fs'); var _ = require('underscore'); -var spawn = require('child_process').spawn; +var spawn = require('spawn-cmd').spawn; var exec = require('child_process').exec; var git = require('./utils/git'); var _ = require('underscore'); diff --git a/lib/command.js b/lib/command.js index 3c97a28..7a4dbda 100644 --- a/lib/command.js +++ b/lib/command.js @@ -1,4 +1,4 @@ -var spawn = require('child_process').spawn; +var spawn = require('spawn-cmd').spawn; var exec = require('child_process').exec; var path = require('path'); var fs = require('fs'); diff --git a/lib/meteor.js b/lib/meteor.js index 14cd228..ce1dec1 100644 --- a/lib/meteor.js +++ b/lib/meteor.js @@ -5,7 +5,7 @@ var Command = require('./command'); var fs = require('fs'); var fstream = require('fstream'); var wrench = require('wrench'); -var spawn = require('child_process').spawn; +var spawn = require('spawn-cmd').spawn; var exec = require('child_process').exec; diff --git a/lib/sources/git.js b/lib/sources/git.js index 2f4e3b3..6483fc2 100644 --- a/lib/sources/git.js +++ b/lib/sources/git.js @@ -3,7 +3,7 @@ var path = require('path'); var wrench = require('wrench'); var fs = require('fs'); var url = require('url'); -var spawn = require('child_process').spawn; +var spawn = require('spawn-cmd').spawn; var exec = require('child_process').exec; var fstream = require('fstream'); diff --git a/package.json b/package.json index e1c7b72..77be7f1 100644 --- a/package.json +++ b/package.json @@ -13,6 +13,7 @@ , "prompt": "0.2.11" , "colors": "0.6.0-1" , "async": "0.2.9" + , "spawn-cmd": "0.0.1" } , "devDependencies": { "mocha": ">=1.2.2" diff --git a/spec/lib/runner.js b/spec/lib/runner.js index a59afee..a301007 100644 --- a/spec/lib/runner.js +++ b/spec/lib/runner.js @@ -1,7 +1,7 @@ // run mrt against a certain app and wait for given output var path = require('path'); -var spawn = require('child_process').spawn; +var spawn = require('spawn-cmd').spawn; var exec = require('child_process').exec; var _ = require('underscore'); var utils = require('./utils.js'); diff --git a/spec/lib/utils.js b/spec/lib/utils.js index 3f85501..7bd749a 100644 --- a/spec/lib/utils.js +++ b/spec/lib/utils.js @@ -1,5 +1,5 @@ // basic filesystem utils for our tests -var spawn = require('child_process').spawn; +var spawn = require('spawn-cmd').spawn; var path = require('path'); var fs = require('fs'); var _ = require('underscore'); diff --git a/spec/support/bin/curl b/spec/support/bin/curl index ec0d4f3..9207911 100755 --- a/spec/support/bin/curl +++ b/spec/support/bin/curl @@ -1,6 +1,6 @@ #!/usr/bin/env node -var spawn = require('child_process').spawn; +var spawn = require('spawn-cmd').spawn; var fs = require('../../../lib/utils/fs'); var path = require('path'); var wrench = require('wrench'); diff --git a/spec/support/bin/git b/spec/support/bin/git index 5eb2f43..58fb978 100755 --- a/spec/support/bin/git +++ b/spec/support/bin/git @@ -1,6 +1,6 @@ #!/usr/bin/env node -var spawn = require('child_process').spawn; +var spawn = require('spawn-cmd').spawn; var path = require('path'); var fs = require('../../../lib/utils/fs'); var wrench = require('wrench'); From d96494c2e1999cecd0541e9f577e79c61f6bfc2c Mon Sep 17 00:00:00 2001 From: Egor Suvorov Date: Wed, 8 Jan 2014 01:25:53 +0200 Subject: [PATCH 2/2] windows-support: now folders are pre-created before 'git clone' --- lib/sources/git.js | 9 +++++++-- package.json | 1 + 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/lib/sources/git.js b/lib/sources/git.js index 6483fc2..36dbe7f 100644 --- a/lib/sources/git.js +++ b/lib/sources/git.js @@ -109,11 +109,16 @@ GitSource.prototype._pull = function(fn) { GitSource.prototype._clone = function(fn) { var self = this; if (!fs.existsSync(this.sourcePath)) { - exec('git clone ' + self.url + ' "' + this.sourcePath + '"', function(err, stdout, stderr) { + require('fs-extra').mkdirs(self.sourcePath, function(err) { if (err) throw "There was a problem cloning repo: " + self.url + "\nPlease check https://github.com/oortcloud/meteorite/blob/master/CONTRIBUTING.md#troubleshooting for potential explanations."; - fn(); + exec('git clone ' + self.url + ' "' + self.sourcePath + '"', function(err, stdout, stderr) { + if (err) + throw "There was a problem cloning repo: " + self.url + + "\nPlease check https://github.com/oortcloud/meteorite/blob/master/CONTRIBUTING.md#troubleshooting for potential explanations."; + fn(); + }); }); } else { fn(); diff --git a/package.json b/package.json index 77be7f1..375b0f2 100644 --- a/package.json +++ b/package.json @@ -14,6 +14,7 @@ , "colors": "0.6.0-1" , "async": "0.2.9" , "spawn-cmd": "0.0.1" + , "fs-extra": "0.8.1" } , "devDependencies": { "mocha": ">=1.2.2"