Skip to content
This repository has been archived by the owner on Jun 11, 2021. It is now read-only.

Commit

Permalink
Merge pull request #79 from kitematic/rc0.2.3
Browse files Browse the repository at this point in the history
v0.2.3
  • Loading branch information
jmorganca committed Sep 14, 2014
2 parents 82efdc7 + a70f23d commit 725d146
Show file tree
Hide file tree
Showing 15 changed files with 59 additions and 45 deletions.
13 changes: 8 additions & 5 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ var path = require('path');
var app = require('app');
var BrowserWindow = require('browser-window');

var dirname = __dirname;
console.log(dirname);

var freeport = function (callback) {
var server = net.createServer();
var port = 0;
Expand Down Expand Up @@ -47,7 +50,7 @@ var start = function (callback) {
console.log('MongoDB: ' + mongoPort);
console.log('webPort: ' + webPort);
child_process.exec('kill $(ps aux -e | grep PURPOSE=KITEMATIC | awk \'{print $2}\') && rm ' + path.join(dataPath, 'mongod.lock'), function (error, stdout, stderr) {
var mongoChild = child_process.spawn(path.join(__dirname, 'resources', 'mongod'), ['--bind_ip', '127.0.0.1', '--dbpath', dataPath, '--port', mongoPort, '--unixSocketPrefix', dataPath], {
var mongoChild = child_process.spawn(path.join(dirname, 'resources', 'mongod'), ['--bind_ip', '127.0.0.1', '--dbpath', dataPath, '--port', mongoPort, '--unixSocketPrefix', dataPath], {
env: {
PURPOSE: 'KITEMATIC'
}
Expand All @@ -71,11 +74,11 @@ var start = function (callback) {
user_env.BIND_IP = '127.0.0.1';
user_env.DB_PATH = dataPath;
user_env.MONGO_URL = 'mongodb://localhost:' + mongoPort + '/meteor';
user_env.METEOR_SETTINGS = fs.readFileSync(path.join(__dirname, 'resources', 'settings.json'), 'utf8');
user_env.DIR = __dirname;
user_env.METEOR_SETTINGS = fs.readFileSync(path.join(dirname, 'resources', 'settings.json'), 'utf8');
user_env.DIR = dirname;
user_env.NODE_ENV = 'production';
user_env.NODE_PATH = path.join(__dirname, 'node_modules');
var nodeChild = child_process.spawn(path.join(__dirname, 'resources', 'node'), [path.join(__dirname, 'bundle', 'main.js')], {
user_env.NODE_PATH = path.join(dirname, 'node_modules');
var nodeChild = child_process.spawn(path.join(dirname, 'resources', 'node'), [path.join(dirname, 'bundle', 'main.js')], {
env: user_env
});

Expand Down
2 changes: 1 addition & 1 deletion meteor/client/lib/boot2docker.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Boot2Docker = {};
Boot2Docker.REQUIRED_IP = '192.168.60.103';

Boot2Docker.command = function () {
return path.join(Util.getBinDir(), 'boot2docker-1.2.0') + ' --vm="kitematic-vm"';
return path.join(Util.getBinDir().replace(' ', '\\ '), 'boot2docker-1.2.0') + ' --vm="kitematic-vm"';
};

Boot2Docker.exec = function (command, callback) {
Expand Down
10 changes: 5 additions & 5 deletions meteor/client/lib/imageutil.js
Original file line number Diff line number Diff line change
Expand Up @@ -125,11 +125,11 @@ ImageUtil.rebuild = function (imageId) {
});
ImageUtil.rebuildHelper(image, function (err) {
if (err) { console.error(err); }
});
_.each(apps, function (app) {
app = Apps.findOne(app._id);
AppUtil.run(app, function (err) {
if (err) { console.error(err); }
_.each(apps, function (app) {
app = Apps.findOne(app._id);
AppUtil.run(app, function (err) {
if (err) { console.error(err); }
});
});
});
} else {
Expand Down
5 changes: 4 additions & 1 deletion meteor/client/lib/installer.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ Installer.steps = [
Boot2Docker.exists(function (err, exists) {
if (err) { callback(err); return; }
if (!exists) {
var vmFilesPath = path.join(Util.getHomePath(), 'VirtualBox\ VMs', 'kitematic-vm');
var vmFilesPath = path.join(Util.getHomePath(), 'VirtualBox VMs', 'kitematic-vm');
if (fs.existsSync(vmFilesPath)) {
Util.deleteFolder(vmFilesPath);
}
Expand Down Expand Up @@ -131,6 +131,7 @@ Installer.steps = [
},
pastMessage: 'Started the Kitematic VM',
message: 'Starting the Kitematic VM',
subMessage: '(This may take a few minutes)',
futureMessage: 'Start the Kitematic VM'
},

Expand Down Expand Up @@ -164,6 +165,7 @@ Installer.steps = [
];

Installer.run = function (callback) {
Session.set('installing', true);
var currentStep = 0;
Session.set('currentInstallStep', currentStep);
Session.set('numberOfInstallSteps', this.steps.length);
Expand Down Expand Up @@ -191,6 +193,7 @@ Installer.run = function (callback) {
callback(err);
} else {
// Setup Finished
Session.set('installing', false);
console.log('Setup finished.');
callback();
}
Expand Down
5 changes: 4 additions & 1 deletion meteor/client/lib/router.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,10 @@ Router.map(function () {

this.route('setup_intro', {
path: '/setup/intro',
controller: 'SetupController'
controller: 'SetupController',
onBeforeAction: function () {
Session.set('installing', true);
}
});

this.route('setup_install', {
Expand Down
2 changes: 1 addition & 1 deletion meteor/client/lib/sync.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ Sync.addAppWatcher = function (app) {
if (err.indexOf('The archive file is missing on some hosts') !== -1) {
results = archiveErrorPattern.exec(err);
location = results[1].replace(' ', '\\ ');
var fullLocation = path.join(Util.getHomePath(), 'Library/Application\\ Support/Unison', location);
var fullLocation = path.join(Util.getHomePath(), 'Library/Application Support/Unison', location);
var cmd = '/bin/rm -rf ' + fullLocation;
exec(cmd, function () {});
}
Expand Down
2 changes: 1 addition & 1 deletion meteor/client/lib/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ Util.getBinDir = function () {
};

Util.getResourceDir = function () {
return path.join(Util.getHomePath(), 'Library/Application\ Support/Kitematic/Resources');
return path.join(Util.getHomePath(), 'Library/Application Support/Kitematic/Resources');
};

Util.KITE_PATH = path.join(Util.getHomePath(), 'Kitematic');
Expand Down
4 changes: 2 additions & 2 deletions meteor/client/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ Handlebars.registerHelper('timeSince', function (date) {
return moment(date).fromNow();
});

Handlebars.registerHelper('isUpdating', function (date) {
Handlebars.registerHelper('isUpdating', function () {
return Session.get('isUpdating');
});

Expand Down Expand Up @@ -145,7 +145,7 @@ Meteor.setInterval(function () {
}, 5000);

Meteor.setInterval(function () {
if (Installer.isUpToDate()) {
if (!Session.get('installing')) {
Sync.resolveWatchers(function () {});
if (!Session.get('boot2dockerOff')) {
fixBoot2DockerVM(function (err) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,4 +52,13 @@ <h4>Usage Diagnostics</h4>
{{/if}}
</div>
</div>
<div class="section dashboard-settings">
<div class="left-section">
<h4>Repair Kitematic</h4>
<p class="help-block">You can repair Kitematic installation if the app stops working properly.</p>
</div>
<div class="right-section">
<a onclick="trackLink('repair kitematic')" class="btn btn-negative btn-repair">Repair Kitematic</a>
</div>
</div>
</template>
14 changes: 14 additions & 0 deletions meteor/client/views/dashboard/settings/dashboard-settings.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
var remote = require('remote');
var dialog = remote.require('dialog');

Template.dashboard_settings.events({
'click .btn-start-boot2docker': function (e) {
var $btn = $(e.currentTarget);
Expand Down Expand Up @@ -36,6 +39,17 @@ Template.dashboard_settings.events({
tracking: false
}
});
},
'click .btn-repair': function () {
dialog.showMessageBox({
message: 'Repairing Kitematic will clear your current Docker VM and the state of the app. Please make sure your work is backed up. Do you wish to continue?',
buttons: ['Repair', 'Cancel']
}, function (index) {
if (index !== 0) {
return;
}
Router.go('setup_intro');
});
}
});

Expand Down
2 changes: 1 addition & 1 deletion meteor/client/views/dashboard/setup/setup-finish.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Template.setup_finish.events({
'click .finish-button': function (e) {
var enableDiagnostics = $('.install-diagonistics input').attr('checked') ? true : false;
var enableDiagnostics = $('.install-diagonistics input').prop('checked');
var status = enableDiagnostics ? 'on' : 'off';
ga('send', 'event', 'link', 'click', 'turn ' + status + ' usage analytics');
Installs.insert({version: Installer.CURRENT_VERSION});
Expand Down
7 changes: 0 additions & 7 deletions meteor/client/views/dashboard/setup/setup-install.html
Original file line number Diff line number Diff line change
Expand Up @@ -52,12 +52,5 @@ <h2>Installing</h2>
</div>
{{/each}}
</div>
<div class="install-finish text-center">
{{#if installComplete}}
<a onclick="trackLink('finish install')" class="btn btn-action" href="/apps">
Start Using Kitematic
</a>
{{/if}}
</div>
</div>
</template>
18 changes: 0 additions & 18 deletions meteor/client/views/dashboard/setup/setup-install.js
Original file line number Diff line number Diff line change
@@ -1,18 +1,3 @@
var installStarted = false;
Template.setup_install.rendered = function() {
if(!installStarted) {
installStarted = true;
Installer.run(function (err) {
if (err) {
console.log('Setup failed.');
console.log(err);
} else {
Router.go('setup_finish');
}
});
}
};

Template.setup_install.steps = function () {
return Installer.steps.map(function (step, index) {
step.index = index;
Expand All @@ -27,9 +12,6 @@ Template.setup_install.helpers({
currentInstallStepProgress: function () {
return Session.get('currentInstallStepProgress');
},
installComplete: function () {
return Session.get('currentInstallStep') === Installer.steps.length;
},
failedStep: function () {
return Session.get('failedStep');
},
Expand Down
9 changes: 8 additions & 1 deletion meteor/client/views/dashboard/setup/setup-intro.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,16 @@
Template.setup_intro.events({
'click .continue-button': function (e) {
Router.go('setup_install');
Installer.run(function (err) {
if (err) {
console.log('Setup failed.');
console.log(err);
} else {
Router.go('setup_finish');
}
});
e.preventDefault();
e.stopPropagation();
return false;
}
});

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "Kitematic",
"main": "index.js",
"version": "0.2.2",
"version": "0.2.3",
"dependencies": {
"async": "^0.9.0",
"chokidar": "git+https://github.com/usekite/chokidar.git",
Expand Down

0 comments on commit 725d146

Please sign in to comment.