Skip to content

Commit

Permalink
Merge branch 'release/0.5.3'
Browse files Browse the repository at this point in the history
  • Loading branch information
poteto committed Dec 8, 2015
2 parents a9e8c60 + 484c405 commit 4670fe7
Show file tree
Hide file tree
Showing 17 changed files with 118 additions and 57 deletions.
1 change: 0 additions & 1 deletion .npmignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,5 @@ dist/
.npmignore
**/.gitkeep
bower.json
ember-cli-build.js
Brocfile.js
testem.json
17 changes: 9 additions & 8 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
---
language: node_js
node_js:
- "0.12"
- "4.1.2"

sudo: false
sudo: required
dist: trusty

cache:
directories:
Expand All @@ -12,7 +13,10 @@ cache:
env:
- EMBER_TRY_SCENARIO=default
- EMBER_TRY_SCENARIO=ember-1.11
- EMBER_TRY_SCENARIO=ember-1.12.1
- EMBER_TRY_SCENARIO=ember-1.12
- EMBER_TRY_SCENARIO=ember-1.13
- EMBER_TRY_SCENARIO=ember-2.0
- EMBER_TRY_SCENARIO=ember-2.1
- EMBER_TRY_SCENARIO=ember-release
- EMBER_TRY_SCENARIO=ember-beta
- EMBER_TRY_SCENARIO=ember-canary
Expand All @@ -23,12 +27,9 @@ matrix:
- env: EMBER_TRY_SCENARIO=ember-canary

before_install:
- mkdir -p travis-phantomjs
- wget https://s3.amazonaws.com/travis-phantomjs/phantomjs-2.0.0-ubuntu-12.04.tar.bz2 -O $PWD/travis-phantomjs/phantomjs-2.0.0-ubuntu-12.04.tar.bz2
- tar -xvf $PWD/travis-phantomjs/phantomjs-2.0.0-ubuntu-12.04.tar.bz2 -C $PWD/travis-phantomjs
- export PATH=$PWD/travis-phantomjs:$PATH
- export PATH=/usr/local/phantomjs-2.0.0/bin:$PATH
- "npm config set spin false"
- "npm install -g npm@^2"
- "npm install -g npm@^3"

install:
- npm install -g bower
Expand Down
2 changes: 1 addition & 1 deletion .watchmanconfig
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
"ignore_dirs": ["tmp"]
"ignore_dirs": ["tmp", "dist"]
}
11 changes: 6 additions & 5 deletions addon/services/metrics.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import Ember from 'ember';
import getOwner from 'ember-getowner-polyfill';

const {
Service,
Expand Down Expand Up @@ -56,6 +57,9 @@ export default Service.extend({
*/
init() {
const adapters = getWithDefault(this, 'options.metricsAdapters', emberArray());
const owner = getOwner(this);
owner.registerOptionsForType('ember-metrics@metrics-adapter', { instantiate: false });
owner.registerOptionsForType('metrics-adapter', { instantiate: false });
set(this, 'appEnvironment', getWithDefault(this, 'options.environment', 'development'));
set(this, '_adapters', {});
set(this, 'context', {});
Expand Down Expand Up @@ -166,14 +170,11 @@ export default Service.extend({
* @return {Adapter} a local adapter or an adapter from the addon
*/
_lookupAdapter(adapterName) {
const { container } = this;

assert('[ember-metrics] The service is missing its container.', container);
assert('[ember-metrics] Could not find metrics adapter without a name.', adapterName);

const dasherizedAdapterName = dasherize(adapterName);
const availableAdapter = container.lookupFactory(`ember-metrics@metrics-adapter:${dasherizedAdapterName}`);
const localAdapter = container.lookupFactory(`metrics-adapter:${dasherizedAdapterName}`);
const availableAdapter = getOwner(this).lookup(`ember-metrics@metrics-adapter:${dasherizedAdapterName}`);
const localAdapter = getOwner(this).lookup(`metrics-adapter:${dasherizedAdapterName}`);

return localAdapter ? localAdapter : availableAdapter;
},
Expand Down
1 change: 1 addition & 0 deletions app/metrics-adapters/segment.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { default } from 'ember-metrics/metrics-adapters/segment';
20 changes: 10 additions & 10 deletions bower.json
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
{
"name": "ember-metrics",
"dependencies": {
"ember": "1.13.7",
"ember-cli-shims": "ember-cli/ember-cli-shims#0.0.3",
"ember-cli-test-loader": "ember-cli-test-loader#0.1.3",
"ember-load-initializers": "ember-cli/ember-load-initializers#0.1.5",
"ember-qunit": "0.4.9",
"ember-qunit-notifications": "0.0.7",
"ember-resolver": "~0.1.18",
"ember": "1.13.11",
"ember-cli-shims": "0.0.6",
"ember-cli-test-loader": "0.2.1",
"ember-load-initializers": "0.1.7",
"ember-qunit": "0.4.17",
"ember-qunit-notifications": "0.1.0",
"ember-resolver": "~0.1.20",
"jquery": "^1.11.3",
"loader.js": "ember-cli/loader.js#3.2.1",
"qunit": "~1.18.0",
"sinonjs": "~1.14.1"
"loader.js": "ember-cli/loader.js#3.4.0",
"qunit": "~1.20.0",
"sinonjs": "~1.17.1"
}
}
36 changes: 31 additions & 5 deletions config/ember-try.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
/* jshint node: true */

/*jshint node:true*/
module.exports = {
scenarios: [
{
Expand All @@ -16,12 +15,39 @@ module.exports = {
}
},
{
name: 'ember-1.12.1',
name: 'ember-1.12',
dependencies: {
'ember': '1.12.1'
'ember': '~1.12.0'
},
resolutions: {
'ember': '1.12.1'
'ember': '~1.12.0'
}
},
{
name: 'ember-1.13',
dependencies: {
'ember': '~1.13.0'
},
resolutions: {
'ember': '~1.13.0'
}
},
{
name: 'ember-2.0',
dependencies: {
'ember': '~2.0.0'
},
resolutions: {
'ember': '~2.0.0'
}
},
{
name: 'ember-2.1',
dependencies: {
'ember': '~2.1.0'
},
resolutions: {
'ember': '~2.1.0'
}
},
{
Expand Down
1 change: 1 addition & 0 deletions config/environment.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/*jshint node:true*/
'use strict';

module.exports = function(/* environment, appConfig */) {
Expand Down
5 changes: 3 additions & 2 deletions ember-cli-build.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
/*jshint node:true*/
/* global require, module */
var EmberApp = require('ember-cli/lib/broccoli/ember-addon');
var EmberAddon = require('ember-cli/lib/broccoli/ember-addon');

module.exports = function(defaults) {
var app = new EmberApp(defaults, {
var app = new EmberAddon(defaults, {
// Add options here
});

Expand Down
35 changes: 18 additions & 17 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "ember-metrics",
"version": "0.5.2",
"version": "0.5.3",
"description": "Send data to multiple analytics integrations without re-implementing new API",
"directories": {
"doc": "doc",
Expand Down Expand Up @@ -28,22 +28,22 @@
],
"license": "MIT",
"devDependencies": {
"broccoli-asset-rev": "^2.1.2",
"ember-cli": "1.13.8",
"ember-cli-app-version": "0.5.0",
"ember-cli-dependency-checker": "^1.0.1",
"ember-cli-htmlbars-inline-precompile": "^0.2.0",
"ember-cli-ic-ajax": "0.2.1",
"broccoli-asset-rev": "^2.2.0",
"ember-cli": "1.13.13",
"ember-cli-app-version": "^1.0.0",
"ember-cli-dependency-checker": "^1.1.0",
"ember-cli-htmlbars-inline-precompile": "^0.3.1",
"ember-cli-ic-ajax": "0.2.4",
"ember-cli-inject-live-reload": "^1.3.1",
"ember-cli-qunit": "^1.0.0",
"ember-cli-release": "0.2.5",
"ember-cli-sri": "^1.0.3",
"ember-cli-qunit": "^1.0.4",
"ember-cli-release": "0.2.8",
"ember-cli-sri": "^1.2.0",
"ember-cli-uglify": "^1.2.0",
"ember-disable-prototype-extensions": "^1.0.1",
"ember-disable-proxy-controllers": "^1.0.0",
"ember-export-application-global": "^1.0.3",
"ember-sinon": "0.2.1",
"ember-try": "0.0.7"
"ember-disable-prototype-extensions": "^1.0.0",
"ember-disable-proxy-controllers": "^1.0.1",
"ember-export-application-global": "^1.0.4",
"ember-sinon": "0.3.0",
"ember-try": "~0.0.8"
},
"keywords": [
"ember-addon",
Expand All @@ -56,8 +56,9 @@
"mixpanel"
],
"dependencies": {
"ember-cli-htmlbars": "0.7.9",
"ember-cli-babel": "^5.1.3"
"ember-cli-babel": "^5.1.5",
"ember-cli-htmlbars": "^1.0.1",
"ember-getowner-polyfill": "^1.0.0"
},
"ember-addon": {
"configPath": "tests/dummy/config"
Expand Down
4 changes: 2 additions & 2 deletions tests/dummy/app/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@ import Resolver from 'ember/resolver';
import loadInitializers from 'ember/load-initializers';
import config from './config/environment';

var App;
let App;

Ember.MODEL_FACTORY_INJECTIONS = true;

App = Ember.Application.extend({
modulePrefix: config.modulePrefix,
podModulePrefix: config.podModulePrefix,
Resolver: Resolver
Resolver
});

loadInitializers(App, config.modulePrefix);
Expand Down
5 changes: 5 additions & 0 deletions tests/helpers/destroy-app.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import Ember from 'ember';

export default function destroyApp(application) {
Ember.run(application, 'destroy');
}
23 changes: 23 additions & 0 deletions tests/helpers/module-for-acceptance.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import { module } from 'qunit';
import startApp from '../helpers/start-app';
import destroyApp from '../helpers/destroy-app';

export default function(name, options = {}) {
module(name, {
beforeEach() {
this.application = startApp();

if (options.beforeEach) {
options.beforeEach.apply(this, arguments);
}
},

afterEach() {
destroyApp(this.application);

if (options.afterEach) {
options.afterEach.apply(this, arguments);
}
}
});
}
2 changes: 1 addition & 1 deletion tests/helpers/resolver.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import Resolver from 'ember/resolver';
import config from '../../config/environment';

var resolver = Resolver.create();
const resolver = Resolver.create();

resolver.namespace = {
modulePrefix: config.modulePrefix,
Expand Down
6 changes: 3 additions & 3 deletions tests/helpers/start-app.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@ import Application from '../../app';
import config from '../../config/environment';

export default function startApp(attrs) {
var application;
let application;

var attributes = Ember.merge({}, config.APP);
let attributes = Ember.merge({}, config.APP);
attributes = Ember.merge(attributes, attrs); // use defaults, but you can override;

Ember.run(function() {
Ember.run(() => {
application = Application.create(attributes);
application.setupForTesting();
application.injectTestHelpers();
Expand Down
5 changes: 3 additions & 2 deletions tests/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,14 @@
{{content-for 'test-head-footer'}}
</head>
<body>

{{content-for 'body'}}
{{content-for 'test-body'}}

<script src="assets/vendor.js"></script>
<script src="assets/test-support.js"></script>
<script src="assets/dummy.js"></script>
<script integrity="" src="testem.js"></script>
<script src="testem.js" integrity=""></script>
<script src="assets/tests.js"></script>
<script src="assets/test-loader.js"></script>

{{content-for 'body-footer'}}
Expand Down
1 change: 1 addition & 0 deletions tests/unit/services/metrics-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,7 @@ test('it can be disabled', function(assert) {

test('it implements standard contracts', function(assert) {
const service = this.subject({ options });
delete window.mixpanel.toString;
sandbox.stub(window.mixpanel);
sandbox.stub(window, 'ga');
const spy = sandbox.spy(service, 'invoke');
Expand Down

0 comments on commit 4670fe7

Please sign in to comment.