diff --git a/app/app.js b/app/app.js index b3bbb3d6..439d816a 100644 --- a/app/app.js +++ b/app/app.js @@ -19,12 +19,8 @@ var App = Ember.Application.extend(Ember.Evented, { podModulePrefix: config.podModulePrefix, Resolver: Resolver, - lookup() { - return this.__container__.lookup.apply(this.__container__, arguments); - }, - flash(options) { - return Travis.lookup('controller:flash').loadFlashes([options]); + return Ember.getOwner(Travis).lookup('controller:flash').loadFlashes([options]); }, toggleSidebar() { diff --git a/app/controllers/current-user.js b/app/controllers/current-user.js index ae063eb5..4f391dd7 100644 --- a/app/controllers/current-user.js +++ b/app/controllers/current-user.js @@ -11,7 +11,7 @@ export default Ember.Controller.extend({ var user; if ((user = this.get('model')) && user.get('isSyncing') && !user.get('syncedAt')) { return Ember.run.scheduleOnce('routerTransitions', this, function() { - return this.container.lookup('router:main').send('renderFirstSync'); + return Ember.getOwner(this).lookup('router:main').send('renderFirstSync'); }); } }.observes('isSyncing', 'auth.currentUser') diff --git a/app/controllers/repos.js b/app/controllers/repos.js index 2592fa7e..ddf651ae 100644 --- a/app/controllers/repos.js +++ b/app/controllers/repos.js @@ -76,7 +76,7 @@ var Controller = Ember.Controller.extend({ possiblyRedirectToGettingStartedPage() { return Ember.run.scheduleOnce('routerTransitions', this, function() { if (this.get('tab') === 'owned' && this.get('isLoaded') && this.get('repos.length') === 0) { - return this.container.lookup('router:main').send('redirectToGettingStarted'); + return Ember.getOwner(this).lookup('router:main').send('redirectToGettingStarted'); } }); }, diff --git a/app/instance-initializers/pusher.js b/app/instance-initializers/pusher.js index c969ab91..02c95b89 100644 --- a/app/instance-initializers/pusher.js +++ b/app/instance-initializers/pusher.js @@ -2,16 +2,15 @@ import config from 'travis/config/environment'; import TravisPusher from 'travis/utils/pusher'; var PusherInitializer, initialize; -initialize = function(data) { - var application; - application = data.application; +initialize = function(applicationInstance) { + const app = applicationInstance.application; if (config.pusher.key) { - application.pusher = new TravisPusher(config.pusher, data.container.lookup('service:ajax')); - application.register('pusher:main', application.pusher, { + app.pusher = new TravisPusher(config.pusher, applicationInstance.lookup('service:ajax')); + app.register('pusher:main', app.pusher, { instantiate: false }); - application.inject('route', 'pusher', 'pusher:main'); - return application.pusher.store = data.container.lookup('service:store'); + app.inject('route', 'pusher', 'pusher:main'); + return app.pusher.store = applicationInstance.lookup('service:store'); } }; diff --git a/app/models/broadcast.js b/app/models/broadcast.js index 19996238..cece1332 100644 --- a/app/models/broadcast.js +++ b/app/models/broadcast.js @@ -30,7 +30,7 @@ var Broadcast = Model.extend({ Broadcast.reopenClass({ seen: function() { var seenBroadcasts; - seenBroadcasts = Travis.lookup('service:storage').getItem('travis.seen_broadcasts'); + seenBroadcasts = Ember.getOwner(Travis).lookup('service:storage').getItem('travis.seen_broadcasts'); if (seenBroadcasts != null) { seenBroadcasts = JSON.parse(seenBroadcasts); } diff --git a/app/router.js b/app/router.js index 982f9047..6a15f60d 100644 --- a/app/router.js +++ b/app/router.js @@ -14,7 +14,7 @@ var Router = Ember.Router.extend({ // we should probably think about a more general way to // do this, location should not know about auth status return Location.create({ - auth: this.container.lookup('service:auth') + auth: Ember.getOwner(this).lookup('service:auth') }); } }.property(), diff --git a/app/routes/application.js b/app/routes/application.js index 02b70a72..e974ebda 100644 --- a/app/routes/application.js +++ b/app/routes/application.js @@ -1,6 +1,7 @@ import TravisRoute from 'travis/routes/basic'; import config from 'travis/config/environment'; import BuildFaviconMixin from 'travis/mixins/build-favicon'; +import Ember from 'ember'; export default TravisRoute.extend(BuildFaviconMixin, { needsAuth: false, @@ -99,7 +100,7 @@ export default TravisRoute.extend(BuildFaviconMixin, { error(error) { var authController; if (error === 'needs-auth') { - authController = this.container.lookup('controller:auth'); + authController = Ember.getOwner(this).lookup('controller:auth'); authController.set('redirected', true); return this.transitionTo('auth'); } else { diff --git a/app/routes/getting-started.js b/app/routes/getting-started.js index 14348163..157f7a0b 100644 --- a/app/routes/getting-started.js +++ b/app/routes/getting-started.js @@ -1,7 +1,8 @@ import TravisRoute from 'travis/routes/basic'; +import Ember from 'ember'; export default TravisRoute.extend({ setupController(controller) { - return this.container.lookup('controller:repos').activate('owned'); + return Ember.getOwner(this).lookup('controller:repos').activate('owned'); } }); diff --git a/app/routes/repo.js b/app/routes/repo.js index 346e1e59..813d70f0 100644 --- a/app/routes/repo.js +++ b/app/routes/repo.js @@ -17,7 +17,7 @@ export default TravisRoute.extend(ScrollResetMixin, { }, setupController(controller, model) { - this.container.lookup('controller:repos').activate('owned'); + this.controllerFor('repos').activate('owned'); if (model && !model.get) { model = this.get('store').find('repo', model.id); } diff --git a/app/routes/simple-layout.js b/app/routes/simple-layout.js index b231c7a4..3f78e323 100644 --- a/app/routes/simple-layout.js +++ b/app/routes/simple-layout.js @@ -3,7 +3,7 @@ import TravisRoute from 'travis/routes/basic'; export default TravisRoute.extend({ setupController: function() { $('body').attr('id', 'simple'); - this.container.lookup('controller:repos').activate('owned'); + this.controllerFor('repos').activate('owned'); return this._super.apply(this, arguments); }, renderTemplate: function() { diff --git a/app/services/ajax.js b/app/services/ajax.js index 4f62c57e..420f623e 100644 --- a/app/services/ajax.js +++ b/app/services/ajax.js @@ -64,7 +64,7 @@ export default Ember.Service.extend({ success = options.success || (function() {}); options.success = (data, status, xhr) => { if (data != null ? data.flash : void 0) { - Travis.lookup('controller:flash').loadFlashes(data.flash); + Ember.getOwner(Travis).lookup('controller:flash').loadFlashes(data.flash); } if (data != null) { delete data.flash; @@ -75,7 +75,7 @@ export default Ember.Service.extend({ options.error = (data, status, xhr) => { console.log("[ERROR] API responded with an error (" + status + "): " + (JSON.stringify(data))); if (data != null ? data.flash : void 0) { - Travis.lookup('controller:flash').pushObject(data.flash); + Ember.getOwner(Travis).lookup('controller:flash').pushObject(data.flash); } if (data != null) { delete data.flash; diff --git a/app/services/auth.js b/app/services/auth.js index fa74fb06..ffdfced7 100644 --- a/app/services/auth.js +++ b/app/services/auth.js @@ -214,7 +214,7 @@ export default Ember.Service.extend({ // as a direct response to either manual sign in or autoSignIn (right now // we treat both cases behave the same in terms of sent events which I think // makes it more complicated than it should be). - router = this.container.lookup('router:main'); + router = Ember.getOwner(this).lookup('router:main'); try { return router.send(name); } catch (error1) { diff --git a/app/utils/urls.js b/app/utils/urls.js index 425b3107..4d793c44 100644 --- a/app/utils/urls.js +++ b/app/utils/urls.js @@ -1,4 +1,6 @@ import config from 'travis/config/environment'; +import Ember from 'ember'; + var ccXml, email, githubAdmin, githubCommit, githubNetwork, githubPullRequest, githubRepo, githubWatchers, gravatarImage, plainTextLog, statusImage; @@ -33,7 +35,7 @@ githubAdmin = function(slug) { statusImage = function(slug, branch) { var token; if (config.pro) { - token = Travis.__container__.lookup('controller:currentUser').get('model.token'); + token = Ember.getOwner(Travis).lookup('controller:currentUser').get('model.token'); return (location.protocol + "//" + location.host + "/" + slug + ".svg?token=" + token) + (branch ? "&branch=" + branch : ''); } else { return (location.protocol + "//" + location.host + "/" + slug + ".svg") + (branch ? "?branch=" + (encodeURIComponent(branch)) : ''); @@ -48,7 +50,7 @@ ccXml = function(slug, branch) { } if (config.pro) { delimiter = url.indexOf('?') === -1 ? '?' : '&'; - token = Travis.__container__.lookup('controller:currentUser').get('model.token'); + token = Ember.getOwner(Travis).lookup('controller:currentUser').get('model.token'); url = "" + url + delimiter + "token=" + token; } return url; diff --git a/bower.json b/bower.json index b18cab6c..ed121b70 100644 --- a/bower.json +++ b/bower.json @@ -1,7 +1,7 @@ { "name": "travis", "dependencies": { - "ember": "2.2.1", + "ember": "2.4.5", "ember-cli-shims": "0.1.1", "ember-cli-test-loader": "0.2.2", "ember-load-initializers": "0.1.7", @@ -22,7 +22,6 @@ "ceibo": "1.0.0" }, "resolutions": { - "ember": "2.2.1", - "ember-qunit-notifications": "0.1.0" + "ember": "2.4.5" } } diff --git a/config/deprecation-workflow.js b/config/deprecation-workflow.js index 5cb3ada9..ce51d75e 100644 --- a/config/deprecation-workflow.js +++ b/config/deprecation-workflow.js @@ -1,30 +1,4 @@ window.deprecationWorkflow = window.deprecationWorkflow || {}; window.deprecationWorkflow.config = { - workflow: [ - // DONE - { handler: "log", matchMessage: "Ember.LinkView is deprecated. Please use Ember.LinkComponent." }, - { handler: "log", matchMessage: "Calling store.find() with a query object is deprecated. Use store.query() instead." }, - { handler: "log", matchMessage: new RegExp("A property of .*? was modified inside the didInsertElement hook. You should never change properties on components, services or models during didInsertElement because it causes significant performance degradation.") }, - { handler: "log", matchMessage: "Ember.arrayComputed is deprecated. Replace it with plain array methods" }, - // this will still emit deprecations, because we use state property in - // request-icon compoenent, that makes Ember.js think that we're using - // internal component's state - { handler: "log", matchMessage: "Usage of `state` is deprecated, use `_state` instead." }, - { handler: "log", matchMessage: "RestAdapter#find has been deprecated and renamed to `findRecord`." }, - { handler: "log", matchMessage: "Usage of `typeKey` has been deprecated and will be removed in Ember Data 2.0. It has been replaced by `modelName` on the model class." }, - { handler: "log", matchMessage: "Using store.dematerializeRecord() has been deprecated since it was intended for private use only. You should use store.unloadRecord() instead." }, - { handler: "log", matchMessage: "Using the same function as getter and setter is deprecated." }, - { handler: "log", matchMessage: "`Ember.ArrayController` is deprecated." }, - { handler: "log", matchMessage: "The default behavior of `shouldBackgroundReloadRecord` will change in Ember Data 2.0 to always return true. If you would like to preserve the current behavior please override `shouldBackgroundReloadRecord` in your adapter:application and return false." }, - { handler: "log", matchMessage: "Function#observesBefore is deprecated and will be removed in the near future." }, - { handler: "log", matchMessage: "Ember.addBeforeObserver is deprecated and will be removed in the near future." }, - { handler: "log", matchMessage: "Ember.removeBeforeObserver is deprecated and will be removed in the near future." }, - { handler: "log", matchMessage: "Using DS.Snapshot.get() is deprecated. Use .attr(), .belongsTo() or .hasMany() instead." }, - { handler: "log", matchMessage: "The filter API will be moved into a plugin soon. To enable store.filter using an environment flag, or to use an alternative, you can visit the ember-data-filter addon page" }, - { handler: "log", matchMessage: "Ember.View is deprecated. Consult the Deprecations Guide for a migration strategy." }, - - // TODO - { handler: "silence", matchMessage: "Using `ApplicationInstance.container.lookup` is deprecated. Please use `ApplicationInstance.lookup` instead." }, - { handler: "silence", matchMessage: new RegExp("the component:.*? test module is implicitly running in unit test mode, which will change to integration test mode by default in an upcoming version of ember-test-helpers. Add `unit: true` or a `needs:[]` list to explicitly opt in to unit test mode.") }, - ] + workflow: [] }; diff --git a/package.json b/package.json index 557cf796..2b89d43f 100644 --- a/package.json +++ b/package.json @@ -29,7 +29,7 @@ "ember-cli-babel": "^5.1.6", "ember-cli-dependency-checker": "^1.2.0", "ember-cli-deprecation-workflow": "0.1.6", - "ember-cli-document-title": "0.2.0", + "ember-cli-document-title": "0.3.1", "ember-cli-htmlbars": "^1.0.3", "ember-cli-htmlbars-inline-precompile": "^0.3.1", "ember-cli-inject-live-reload": "^1.4.0", @@ -48,6 +48,7 @@ "ember-disable-proxy-controllers": "^1.0.1", "ember-export-application-global": "^1.0.5", "ember-load-initializers": "^0.5.1", + "ember-getowner-polyfill": "1.0.1", "ember-resolver": "^2.0.3", "ember-try": "0.0.7", "emberx-select": "2.0.2", diff --git a/tests/integration/components/add-env-var-test.js b/tests/integration/components/add-env-var-test.js index 4b0bb79e..deb15c16 100644 --- a/tests/integration/components/add-env-var-test.js +++ b/tests/integration/components/add-env-var-test.js @@ -4,7 +4,6 @@ import hbs from 'htmlbars-inline-precompile'; import fillIn from '../../helpers/fill-in'; import DS from 'ember-data'; - moduleForComponent('add-env-var', 'Integration | Component | add env-var', { integration: true }); @@ -14,7 +13,7 @@ test('it adds an env var on submit', function(assert) { // this shouldn't be needed, probably some bug in tests setup with new ember-data this.registry.register('transform:boolean', DS.BooleanTransform); - var store = this.container.lookup('service:store'); + var store = Ember.getOwner(this).lookup('service:store'); assert.equal(store.peekAll('envVar').get('length'), 0, 'precond: store should be empty'); var repo; @@ -66,7 +65,7 @@ test('it adds a public env var on submit', function(assert) { assert.expect(6); this.registry.register('transform:boolean', DS.BooleanTransform); - var store = this.container.lookup('service:store'); + var store = Ember.getOwner(this).lookup('service:store'); assert.equal(store.peekAll('envVar').get('length'), 0, 'precond: store should be empty'); var repo; diff --git a/tests/integration/components/add-ssh-key-test.js b/tests/integration/components/add-ssh-key-test.js index d221a234..d10e7891 100644 --- a/tests/integration/components/add-ssh-key-test.js +++ b/tests/integration/components/add-ssh-key-test.js @@ -12,7 +12,7 @@ test('it adds an ssh key on submit', function(assert) { assert.expect(6); this.registry.register('transform:boolean', DS.BooleanTransform); - var store = this.container.lookup('service:store'); + var store = Ember.getOwner(this).lookup('service:store'); var repo; Ember.run(function() { @@ -47,7 +47,7 @@ test('it throws an error if value for ssh key is blank', function(assert) { assert.expect(5); this.registry.register('transform:boolean', DS.BooleanTransform); - var store = this.container.lookup('service:store'); + var store = Ember.getOwner(this).lookup('service:store'); var repo; Ember.run(function() { diff --git a/tests/integration/components/env-var-test.js b/tests/integration/components/env-var-test.js index 9b8ed0c2..2c57ea49 100644 --- a/tests/integration/components/env-var-test.js +++ b/tests/integration/components/env-var-test.js @@ -4,7 +4,6 @@ import hbs from 'htmlbars-inline-precompile'; import fillIn from '../../helpers/fill-in'; import DS from 'ember-data'; - moduleForComponent('env-var', 'Integration | Component | env-var', { integration: true }); @@ -13,7 +12,7 @@ test('it renders an env-var with private value', function(assert) { assert.expect(2); this.registry.register('transform:boolean', DS.BooleanTransform); - var store = this.container.lookup('service:store'); + var store = Ember.getOwner(this).lookup('service:store'); Ember.run(() => { var envVar = store.push({data: { id: 1, type: 'env-var', attributes: { name: 'foo', value: 'bar', public: false}}}); this.set('envVar', envVar); @@ -30,7 +29,7 @@ test('it renders an env-var with public value', function(assert) { assert.expect(2); this.registry.register('transform:boolean', DS.BooleanTransform); - var store = this.container.lookup('service:store'); + var store = Ember.getOwner(this).lookup('service:store'); Ember.run(() => { var envVar = store.push({data: { id: 1, type: 'env-var', attributes: { name: 'foo', value: 'bar', public: true}}}); this.set('envVar', envVar); diff --git a/tests/integration/components/ssh-key-test.js b/tests/integration/components/ssh-key-test.js index ffb52fc1..223b31b5 100644 --- a/tests/integration/components/ssh-key-test.js +++ b/tests/integration/components/ssh-key-test.js @@ -3,7 +3,6 @@ import { moduleForComponent, test } from 'ember-qunit'; import hbs from 'htmlbars-inline-precompile'; import fillIn from '../../helpers/fill-in'; - moduleForComponent('ssh-key', 'Integration | Component | ssh-key', { integration: true }); @@ -11,7 +10,7 @@ moduleForComponent('ssh-key', 'Integration | Component | ssh-key', { test('it renders the default ssh key if no custom key is set', function(assert) { assert.expect(2); - var store = this.container.lookup('service:store'); + var store = Ember.getOwner(this).lookup('service:store'); var key = Ember.Object.create({fingerprint: 'fingerprint'}); this.set('key', key); @@ -25,7 +24,7 @@ test('it renders the default ssh key if no custom key is set', function(assert) test('it renders the custom ssh key if custom key is set', function(assert) { assert.expect(2); - var store = this.container.lookup('service:store'); + var store = Ember.getOwner(this).lookup('service:store'); var key; Ember.run(function() { @@ -44,7 +43,7 @@ test('it renders the custom ssh key if custom key is set', function(assert) { test('it deletes a custom key if permissions are right', function(assert) { assert.expect(1); - var store = this.container.lookup('service:store'); + var store = Ember.getOwner(this).lookup('service:store'); var key; Ember.run(function() { @@ -67,7 +66,7 @@ test('it deletes a custom key if permissions are right', function(assert) { test('it does not delete the custom key if permissions are insufficient', function(assert) { assert.expect(1); - var store = this.container.lookup('service:store'); + var store = Ember.getOwner(this).lookup('service:store'); var key; Ember.run(function() {