mirror of https://github.com/docker/docs.git
Changing to leveldb
This commit is contained in:
parent
d524cb756c
commit
f1d1f9e155
|
@ -1,8 +1,10 @@
|
|||
var remote = require('remote');
|
||||
var app = remote.require('app');
|
||||
var crypto = require('crypto');
|
||||
var getmac = require('getmac');
|
||||
var uuid = require('node-uuid');
|
||||
var level = require('levelup');
|
||||
var path = require('path');
|
||||
var db = level(path.join(process.env[(process.platform === 'win32') ? 'USERPROFILE' : 'HOME'], 'Library/Application Support/Kitematic/data', 'db'));
|
||||
|
||||
Metrics = {};
|
||||
|
||||
|
@ -11,24 +13,28 @@ Metrics.trackEvent = function (name) {
|
|||
return;
|
||||
}
|
||||
var uuid = localStorage.getItem('metrics.uuid');
|
||||
if (localStorage.getItem('metrics.enabled') && uuid) {
|
||||
mixpanel.track('docker_gui ' + name, {
|
||||
distinct_id: uuid,
|
||||
version: app.getVersion()
|
||||
});
|
||||
}
|
||||
db.get('metrics.enabled', function (err, value) {
|
||||
if (!err && uuid) {
|
||||
mixpanel.track('docker_gui ' + name, {
|
||||
distinct_id: uuid,
|
||||
version: app.getVersion()
|
||||
});
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
Metrics.prepareTracking = function () {
|
||||
if (localStorage.getItem('metrics.enabled') === null) {
|
||||
var settings = Settings.findOne();
|
||||
if (settings && settings.tracking) {
|
||||
localStorage.setItem('metrics.enabled', !!settings.tracking);
|
||||
} else {
|
||||
localStorage.setItem('metrics.enabled', true);
|
||||
db.get('metrics.enabled', function (err, value) {
|
||||
if (err && err.notFound) {
|
||||
var settings = Settings.findOne();
|
||||
if (settings && settings.tracking) {
|
||||
db.put('metrics.enabled', !!settings.tracking);
|
||||
} else {
|
||||
db.put('metrics.enabled', true);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!localStorage.getItem('metrics.uuid')) {
|
||||
localStorage.setItem('metrics.uuid', uuid.v4());
|
||||
}
|
||||
db.get('metrics.uuid', function (err, value) {
|
||||
db.put('metrics.uuid', uuid.v4());
|
||||
});
|
||||
});
|
||||
};
|
||||
|
|
|
@ -21,6 +21,10 @@ Util.getResourceDir = function () {
|
|||
return path.join(Util.getHomePath(), 'Library/Application Support/Kitematic/Resources');
|
||||
};
|
||||
|
||||
Util.getDataDir = function () {
|
||||
return path.join(Util.getHomePath(), 'Library/Application Support/Kitematic/data');
|
||||
};
|
||||
|
||||
Util.KITE_PATH = path.join(Util.getHomePath(), 'Kitematic');
|
||||
Util.KITE_TAR_PATH = path.join(Util.KITE_PATH, '.tar');
|
||||
Util.KITE_IMAGES_PATH = path.join(Util.KITE_PATH, '.images');
|
||||
|
|
|
@ -26,6 +26,8 @@
|
|||
"request": "2.42.0",
|
||||
"request-progress": "0.3.1",
|
||||
"tar": "0.1.20",
|
||||
"node-uuid": "1.4.1"
|
||||
"node-uuid": "1.4.1",
|
||||
"leveldown": "^1.0.0",
|
||||
"levelup": "git+https://github.com/kitematic/node-levelup.git"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -56,7 +56,7 @@ cd $BASE
|
|||
# Build NPM modules
|
||||
NPM="$BASE/cache/node/bin/npm"
|
||||
export npm_config_disturl=https://gh-contractor-zcbenz.s3.amazonaws.com/atom-shell/dist
|
||||
export npm_config_target=ATOM_SHELL_VERSION
|
||||
export npm_config_arch=ia32
|
||||
export npm_config_target=$ATOM_SHELL_VERSION
|
||||
export npm_config_arch=ia64
|
||||
HOME=~/.atom-shell-gyp $NPM install
|
||||
|
||||
|
|
Loading…
Reference in New Issue