Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for Windows 7, 8 #110

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions bin/_laika
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ module.exports = {
var compilers = parseCompilers(argv.compilers);
var isSourceFileAllowed = generateIsSourceFileAllowed(compilers);

helpers.fixEnvironmentVariables();
helpers.makeAssertFiberFriendly();

//laika drops dbs after the test without any problem
Expand Down
3 changes: 3 additions & 0 deletions lib/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ function App(config) {
if (settingsFile) {
process.env.METEOR_SETTINGS = JSON.stringify(require(settingsFile));
}
process.env.NODE_PATH = config.nodePath;

var meteorBin = (config.meteorite)? 'meteorite': 'meteor';
logger.laika('using nodejs bin' + '(from ' + meteorBin + ')' + ': ' + config.nodeBinary);
Expand Down Expand Up @@ -150,6 +151,8 @@ App.touch = function touch(callback, options) {
}

function detectMeteorBinary() {
if(helpers.isWindows())
return 'meteor.bat';
return (fs.existsSync('./smart.json'))? 'mrt': 'meteor';
}
};
Expand Down
1 change: 1 addition & 0 deletions lib/app_pool.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ function AppPool(options) {
config.meteorite = false;
config.nodeBinary = helpers.getMeteorNode();
}
config.nodePath = helpers.getNodePath();

return config;
}
Expand Down
26 changes: 23 additions & 3 deletions lib/helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ exports.getMeteorToolsPath = function getMeteorToolsPath() {

var toolsPath = util.format('%s/.meteor/tools/%s', process.env.HOME, releases.tools);
return toolsPath;
}
};

exports.getMeteorNode = function getMeteorNode() {
if(process.env.METEOR_PATH) {
Expand Down Expand Up @@ -63,7 +63,18 @@ exports.getMeteoriteNode = function getMeteoriteNode(appPath) {
var parsed = url.parse(gitUrl);
return parsed.path.replace(/.git$/, '').replace(/^\//, '')
}
}
};

exports.getNodePath = function getNodePath() {
if(process.env.NODE_PATH)
return process.env.NODE_PATH;
if(process.env.METEOR_PATH) {
return path.resolve(process.env.METEOR_PATH, 'dev_bundle/lib/node_modules');
} else {
var meteorToolsPath = exports.getMeteorToolsPath();
return path.resolve(meteorToolsPath, 'lib/node_modules');
}
};

exports.makeAssertFiberFriendly = function makeAssertFiberFriendly() {
var assert = require('assert');
Expand Down Expand Up @@ -91,6 +102,12 @@ exports.makeAssertFiberFriendly = function makeAssertFiberFriendly() {
}
};

exports.fixEnvironmentVariables = function fixEnvironmentVariables() {
if(!process.env.HOME && process.env.LOCALAPPDATA) {
process.env.HOME = process.env.LOCALAPPDATA;
}
};

exports.checkForMongoDB = function checkForMongoDB(mongoUrl, callback) {
MongoClient.connect(mongoUrl, function(err, db) {
if(err) {
Expand Down Expand Up @@ -121,6 +138,9 @@ exports.dropMongoDatabase = function dropMongoDatabase(mongoUrl, callback) {
database.close();
}
}
}
};

exports.isWindows = function isWindows() {
return /^win/.test(process.platform);
};