Comparing version 0.0.6 to 0.0.7
'use strict'; | ||
var Configstore = require('configstore'), | ||
Promise = require('rsvp').Promise, | ||
var Promise = require('rsvp').Promise, | ||
provider = require('./provider'), | ||
uuid = require('node-uuid'), | ||
request = require('request'), | ||
getVersions = require('./get-versions'), | ||
md5 = require('./md5'), | ||
extend = require('lodash').extend; | ||
@@ -20,23 +19,18 @@ | ||
if (!options.name) { | ||
throw new Error('You need to specify the name.'); | ||
if (!options.globalName) { | ||
throw new Error('You need to specify the global name.'); | ||
} | ||
this.trackingCode = options.trackingCode; | ||
this.name = options.name; | ||
this.name = options.name || ''; | ||
this.globalName = options.globalName; | ||
this.clientId = this.globalName + md5(this.name); | ||
this.version = options.version || ''; | ||
this.silent = options.silent || false; | ||
this.config = options.config || new Configstore('leek-' + this.name, { | ||
clientId: options.clientId || uuid.v1() | ||
}); | ||
} | ||
Object.defineProperty(Leek.prototype, 'clientId', { | ||
get: function() { | ||
return this.config.get('clientId'); | ||
}, | ||
set: function(value) { | ||
this.config.set('clientId', value); | ||
} | ||
}); | ||
Leek.prototype.setName = function(value) { | ||
this.name = value; | ||
this.clientId = this.globalName + md5(this.name); | ||
}; | ||
@@ -43,0 +37,0 @@ Leek.prototype._enqueue = function(eventType, meta) { |
@@ -16,5 +16,5 @@ 'use strict'; | ||
cid: this.clientId, | ||
an: this.name, | ||
an: this.globalName, | ||
av: this.version + ' ' + meta.platform + ', node ' + meta.version, | ||
cd: meta.name + ' ' + meta.message, | ||
cd: meta.message, | ||
qt: now - parseInt(id, 10), | ||
@@ -38,3 +38,3 @@ z: now | ||
cid: this.clientId, | ||
an: this.name, | ||
an: this.globalName, | ||
av: this.version + ' ' + meta.platform + ', node ' + meta.version, | ||
@@ -61,3 +61,3 @@ exd: meta.description, | ||
cid: this.clientId, | ||
an: this.name, | ||
an: this.globalName, | ||
av: this.version + ' ' + meta.platform + ', node ' + meta.version, | ||
@@ -86,6 +86,6 @@ utc: meta.category, | ||
cid: this.clientId, | ||
an: this.name, | ||
an: this.globalName, | ||
av: this.version + ' ' + meta.platform + ', node ' + meta.version, | ||
ec: meta.category, | ||
ea: meta.name, | ||
ea: meta.globalName, | ||
el: meta.value, | ||
@@ -92,0 +92,0 @@ ev: meta.label, |
{ | ||
"name": "leek", | ||
"description": "GA tracking", | ||
"version": "0.0.6", | ||
"version": "0.0.7", | ||
"keywords": [ | ||
@@ -26,5 +26,3 @@ "stats", | ||
"request": "^2.27.0", | ||
"lodash": "^2.4.1", | ||
"node-uuid": "^1.4.1", | ||
"configstore": "^0.3.0" | ||
"lodash": "^2.4.1" | ||
}, | ||
@@ -31,0 +29,0 @@ "devDependencies": { |
@@ -24,4 +24,5 @@ 'use strict'; | ||
leek = new Leek({ | ||
name: 'ember-cli', | ||
version: '0.0.23' | ||
globalName: 'ember-cli', | ||
name: 'cli', | ||
version: '0.0.23' | ||
}); | ||
@@ -31,15 +32,7 @@ }, 'You need to specify the tracking code.'); | ||
it('asserts if name is not specified', function() { | ||
throws(function() { | ||
leek = new Leek({ | ||
trackingCode: 'xxxxx', | ||
version: '0.0.23' | ||
}); | ||
}, 'You need to specify the name.'); | ||
}); | ||
it('should set options', function() { | ||
leek = new Leek({ | ||
trackingCode: 'xxxxx', | ||
name: 'ember-cli', | ||
globalName: 'ember-cli', | ||
name: 'cli', | ||
clientId: 'things', | ||
@@ -50,4 +43,4 @@ version: '0.0.1' | ||
equal(leek.trackingCode, 'xxxxx', 'tracking code is correct'); | ||
equal(leek.name, 'ember-cli', 'name is correct'); | ||
ok(leek.config); | ||
equal(leek.globalName, 'ember-cli', 'name is correct'); | ||
equal(leek.name, 'cli', 'name is correct'); | ||
equal(leek.version, '0.0.1', 'version is correct'); | ||
@@ -59,3 +52,4 @@ }); | ||
trackingCode: 'xxxxx', | ||
name: 'ember-cli', | ||
globalName: 'ember-cli', | ||
name: 'cli', | ||
clientId: 'things' | ||
@@ -70,3 +64,4 @@ }); | ||
trackingCode: 'xxxxx', | ||
name: 'ember-cli' | ||
globalName: 'ember-cli', | ||
name: 'cli' | ||
}); | ||
@@ -83,3 +78,4 @@ | ||
trackingCode: 'xxxxx', | ||
name: 'ember-cli' | ||
globalName: 'ember-cli', | ||
name: 'cli' | ||
}); | ||
@@ -86,0 +82,0 @@ |
@@ -36,3 +36,4 @@ 'use strict'; | ||
trackingCode: 'xxxxx', | ||
name: 'ember-cli', | ||
globalName: 'ember-cli', | ||
name: 'cli', | ||
clientId: 'things', | ||
@@ -51,2 +52,3 @@ version: '0.0.1' | ||
variable: 'test', | ||
label: 'broccoli', | ||
value: '200ms' | ||
@@ -57,8 +59,7 @@ }); | ||
equal(params.qs.v, expected.v); | ||
equal(params.qs.t, expected.t); | ||
equal(params.qs.v, expected.v); | ||
equal(params.qs.t, expected.t); | ||
equal(params.qs.aip, expected.aip); | ||
equal(params.qs.tid, expected.tid); | ||
equal(params.qs.cid, expected.cid); | ||
equal(params.qs.an, expected.an); | ||
equal(params.qs.an, expected.an); | ||
@@ -65,0 +66,0 @@ equal(params.qs.utv, expected.utv); |
@@ -16,3 +16,4 @@ 'use strict'; | ||
trackingCode: 'xxxxx', | ||
name: 'ember-cli', | ||
globalName: 'ember-cli', | ||
name: 'cli', | ||
clientId: 'things', | ||
@@ -57,3 +58,4 @@ version: '0.0.1' | ||
trackingCode: 'xxxxx', | ||
name: 'ember-cli', | ||
globalName: 'ember-cli', | ||
name: 'cli', | ||
clientId: 'things', | ||
@@ -98,3 +100,4 @@ version: '0.0.1' | ||
trackingCode: 'xxxxx', | ||
name: 'ember-cli', | ||
globalName: 'ember-cli', | ||
name: 'cli', | ||
clientId: 'things', | ||
@@ -122,2 +125,3 @@ version: '0.0.1' | ||
variable: 'foo', | ||
label: 'bar', | ||
value: '100ms' | ||
@@ -132,2 +136,3 @@ }); | ||
variable: 'foo', | ||
label: 'bar', | ||
value: '100ms' | ||
@@ -143,3 +148,4 @@ } | ||
trackingCode: 'xxxxx', | ||
name: 'ember-cli', | ||
globalName: 'ember-cli', | ||
name: 'cli', | ||
clientId: 'things', | ||
@@ -183,2 +189,1 @@ version: '0.0.1' | ||
}); | ||
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
18802
3
15
616
- Removedconfigstore@^0.3.0
- Removednode-uuid@^1.4.1
- Removedargparse@1.0.10(transitive)
- Removedconfigstore@0.3.2(transitive)
- Removedesprima@4.0.1(transitive)
- Removedgraceful-fs@3.0.12(transitive)
- Removedjs-yaml@3.14.1(transitive)
- Removedminimist@1.2.8(transitive)
- Removedmkdirp@0.5.6(transitive)
- Removednatives@1.1.6(transitive)
- Removednode-uuid@1.4.8(transitive)
- Removedobject-assign@2.1.1(transitive)
- Removedos-homedir@1.0.2(transitive)
- Removedos-tmpdir@1.0.2(transitive)
- Removedosenv@0.1.5(transitive)
- Removedsprintf-js@1.0.3(transitive)
- Removeduser-home@1.1.1(transitive)
- Removeduuid@2.0.3(transitive)
- Removedxdg-basedir@1.0.1(transitive)