This commit is contained in:
Jeff Morgan 2014-08-27 16:04:32 -07:00
Родитель bdf0949190
Коммит 740efe16d1
4 изменённых файлов: 41 добавлений и 37 удалений

Просмотреть файл

@ -42,25 +42,27 @@ var start = function (callback) {
freeport(function (err, webPort) {
freeport(function(err, mongoPort) {
child_process.exec('kill $(ps aux -e | grep \'DB_PURPOSE=KITEMATIC\' | awk \'{print $2}\')', function (error, stdout, stderr) {
var command = 'DB_PURPOSE=KITEMATIC ' + process.cwd() + '/resources/mongod --bind_ip 127.0.0.1 --dbpath ' + dataPath.replace(' ', '\\ ') + ' --port ' + mongoPort + ' --unixSocketPrefix ' + dataPath.replace(' ', '\\ ');
console.log(command);
var mongoChild = child_process.exec(command, function (error, stdout, stderr) {
console.log(error);
console.log(stdout);
console.log(stderr);
var mongoChild = child_process.spawn(path.join(process.cwd(), 'resources', 'mongod'), ['--bind_ip', '127.0.0.1', '--dbpath', dataPath, '--port', mongoPort, '--unixSocketPrefix', dataPath], {
env: {
DB_PURPOSE: 'KITEMATIC'
}
});
mongoChild.stdout.setEncoding('utf8');
mongoChild.stdout.on('data', function (data) {
if (data.indexOf('waiting for connections on port ' + mongoPort)) {
process.stdout.write(process.cwd());
var rootUrl = 'http://localhost:' + webPort;
var user_env = process.env;
process.env.ROOT_URL = rootUrl;
process.env.PORT = webPort;
process.env.BIND_IP = '127.0.0.1';
process.env.DB_PATH = dataPath;
process.env.MONGO_URL = 'mongodb://localhost:' + mongoPort + '/meteor';
process.argv.splice(2, 0, 'program.json');
require('./bundle/main.js');
callback(process.env.ROOT_URL);
}
});
process.stdout.write(process.cwd());
var rootUrl = 'http://localhost:' + webPort;
var user_env = process.env;
process.env.ROOT_URL = rootUrl;
process.env.PORT = webPort;
process.env.BIND_IP = '127.0.0.1';
process.env.DB_PATH = dataPath;
process.env.MONGO_URL = 'mongodb://localhost:' + mongoPort + '/meteor';
process.argv.splice(2, 0, 'program.json');
require('./bundle/main.js');
callback(process.env.ROOT_URL);
});
});
});
@ -78,7 +80,7 @@ start(function (url) {
mainWindow.on('loaded', function () {
mainWindow.show();
});
}, 600);
}, 1000);
mainWindow.on('close', function (type) {
this.hide();
if (type === 'quit') {

Просмотреть файл

@ -185,7 +185,6 @@ startBoot2Docker = function (callback) {
if (installed) {
boot2DockerVMExists(function (err, exists) {
if (exists) {
console.log('Running up (server)');
boot2dockerexec('up', function (err, stdout) {
console.log(err);
console.log(stdout);

Просмотреть файл

@ -359,23 +359,25 @@ reloadDefaultContainers = function (callback) {
var defaultNames = defaultContainerOptions().map(function (container) {
return container.name;
});
console.log('Removing old Kitematic default containers.');
killAndRemoveContainers(defaultNames, function (err) {
console.log('Removed old Kitematic default containers.');
if (err) {
console.log('Removing old Kitematic default containers ERROR.');
callback(err);
return;
}
console.log('Removing old Kitematic default images.');
removeImages(defaultNames, function () {
console.log('Removed old Kitematic default images.');
// if (err) {
// console.log('Removing old Kitematic default images ERROR.');
// console.log(err);
// callback(err);
// return;
// }
var results;
async.until(function () {
return !!results;
}, function (callback) {
docker.listContainers(function (err, containers) {
results = containers;
callback();
});
}, function (err) {
console.log(err);
console.log('Removing old Kitematic default containers.');
killAndRemoveContainers(defaultNames, function (err) {
console.log('Removed old Kitematic default containers.');
if (err) {
console.log('Removing old Kitematic default containers ERROR.');
callback(err);
return;
}
console.log('Loading new Kitematic default images.');
docker.loadImage(path.join(getBinDir(), 'base-images.tar.gz'), {}, function (err) {
if (err) {

Просмотреть файл

@ -53,6 +53,7 @@ chmod +x dist/osx/Kitematic.app/Contents/Resources/app.nw/resources/terminal
chmod +x dist/osx/Kitematic.app/Contents/Resources/app.nw/resources/unison
if [ -f $DIR/sign.sh ]; then
cecho "-----> Signing app file...." $blue
$DIR/sign.sh $BASE/dist/osx/Kitematic.app
fi