Merge pull request #495 from travis-ci/remove_2.2_deprecations

Upgrade Ember to 2.4.5 and remove all application deprecations
This commit is contained in:
Piotr Sarnacki 2016-04-14 13:09:53 +02:00
commit 7601173aaa
20 changed files with 39 additions and 69 deletions

View File

@ -19,12 +19,8 @@ var App = Ember.Application.extend(Ember.Evented, {
podModulePrefix: config.podModulePrefix, podModulePrefix: config.podModulePrefix,
Resolver: Resolver, Resolver: Resolver,
lookup() {
return this.__container__.lookup.apply(this.__container__, arguments);
},
flash(options) { flash(options) {
return Travis.lookup('controller:flash').loadFlashes([options]); return Ember.getOwner(Travis).lookup('controller:flash').loadFlashes([options]);
}, },
toggleSidebar() { toggleSidebar() {

View File

@ -11,7 +11,7 @@ export default Ember.Controller.extend({
var user; var user;
if ((user = this.get('model')) && user.get('isSyncing') && !user.get('syncedAt')) { if ((user = this.get('model')) && user.get('isSyncing') && !user.get('syncedAt')) {
return Ember.run.scheduleOnce('routerTransitions', this, function() { 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') }.observes('isSyncing', 'auth.currentUser')

View File

@ -76,7 +76,7 @@ var Controller = Ember.Controller.extend({
possiblyRedirectToGettingStartedPage() { possiblyRedirectToGettingStartedPage() {
return Ember.run.scheduleOnce('routerTransitions', this, function() { return Ember.run.scheduleOnce('routerTransitions', this, function() {
if (this.get('tab') === 'owned' && this.get('isLoaded') && this.get('repos.length') === 0) { 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');
} }
}); });
}, },

View File

@ -2,16 +2,15 @@ import config from 'travis/config/environment';
import TravisPusher from 'travis/utils/pusher'; import TravisPusher from 'travis/utils/pusher';
var PusherInitializer, initialize; var PusherInitializer, initialize;
initialize = function(data) { initialize = function(applicationInstance) {
var application; const app = applicationInstance.application;
application = data.application;
if (config.pusher.key) { if (config.pusher.key) {
application.pusher = new TravisPusher(config.pusher, data.container.lookup('service:ajax')); app.pusher = new TravisPusher(config.pusher, applicationInstance.lookup('service:ajax'));
application.register('pusher:main', application.pusher, { app.register('pusher:main', app.pusher, {
instantiate: false instantiate: false
}); });
application.inject('route', 'pusher', 'pusher:main'); app.inject('route', 'pusher', 'pusher:main');
return application.pusher.store = data.container.lookup('service:store'); return app.pusher.store = applicationInstance.lookup('service:store');
} }
}; };

View File

@ -30,7 +30,7 @@ var Broadcast = Model.extend({
Broadcast.reopenClass({ Broadcast.reopenClass({
seen: function() { seen: function() {
var seenBroadcasts; 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) { if (seenBroadcasts != null) {
seenBroadcasts = JSON.parse(seenBroadcasts); seenBroadcasts = JSON.parse(seenBroadcasts);
} }

View File

@ -14,7 +14,7 @@ var Router = Ember.Router.extend({
// we should probably think about a more general way to // we should probably think about a more general way to
// do this, location should not know about auth status // do this, location should not know about auth status
return Location.create({ return Location.create({
auth: this.container.lookup('service:auth') auth: Ember.getOwner(this).lookup('service:auth')
}); });
} }
}.property(), }.property(),

View File

@ -1,6 +1,7 @@
import TravisRoute from 'travis/routes/basic'; import TravisRoute from 'travis/routes/basic';
import config from 'travis/config/environment'; import config from 'travis/config/environment';
import BuildFaviconMixin from 'travis/mixins/build-favicon'; import BuildFaviconMixin from 'travis/mixins/build-favicon';
import Ember from 'ember';
export default TravisRoute.extend(BuildFaviconMixin, { export default TravisRoute.extend(BuildFaviconMixin, {
needsAuth: false, needsAuth: false,
@ -99,7 +100,7 @@ export default TravisRoute.extend(BuildFaviconMixin, {
error(error) { error(error) {
var authController; var authController;
if (error === 'needs-auth') { if (error === 'needs-auth') {
authController = this.container.lookup('controller:auth'); authController = Ember.getOwner(this).lookup('controller:auth');
authController.set('redirected', true); authController.set('redirected', true);
return this.transitionTo('auth'); return this.transitionTo('auth');
} else { } else {

View File

@ -1,7 +1,8 @@
import TravisRoute from 'travis/routes/basic'; import TravisRoute from 'travis/routes/basic';
import Ember from 'ember';
export default TravisRoute.extend({ export default TravisRoute.extend({
setupController(controller) { setupController(controller) {
return this.container.lookup('controller:repos').activate('owned'); return Ember.getOwner(this).lookup('controller:repos').activate('owned');
} }
}); });

View File

@ -17,7 +17,7 @@ export default TravisRoute.extend(ScrollResetMixin, {
}, },
setupController(controller, model) { setupController(controller, model) {
this.container.lookup('controller:repos').activate('owned'); this.controllerFor('repos').activate('owned');
if (model && !model.get) { if (model && !model.get) {
model = this.get('store').find('repo', model.id); model = this.get('store').find('repo', model.id);
} }

View File

@ -3,7 +3,7 @@ import TravisRoute from 'travis/routes/basic';
export default TravisRoute.extend({ export default TravisRoute.extend({
setupController: function() { setupController: function() {
$('body').attr('id', 'simple'); $('body').attr('id', 'simple');
this.container.lookup('controller:repos').activate('owned'); this.controllerFor('repos').activate('owned');
return this._super.apply(this, arguments); return this._super.apply(this, arguments);
}, },
renderTemplate: function() { renderTemplate: function() {

View File

@ -64,7 +64,7 @@ export default Ember.Service.extend({
success = options.success || (function() {}); success = options.success || (function() {});
options.success = (data, status, xhr) => { options.success = (data, status, xhr) => {
if (data != null ? data.flash : void 0) { 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) { if (data != null) {
delete data.flash; delete data.flash;
@ -75,7 +75,7 @@ export default Ember.Service.extend({
options.error = (data, status, xhr) => { options.error = (data, status, xhr) => {
console.log("[ERROR] API responded with an error (" + status + "): " + (JSON.stringify(data))); console.log("[ERROR] API responded with an error (" + status + "): " + (JSON.stringify(data)));
if (data != null ? data.flash : void 0) { 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) { if (data != null) {
delete data.flash; delete data.flash;

View File

@ -214,7 +214,7 @@ export default Ember.Service.extend({
// as a direct response to either manual sign in or autoSignIn (right now // 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 // we treat both cases behave the same in terms of sent events which I think
// makes it more complicated than it should be). // makes it more complicated than it should be).
router = this.container.lookup('router:main'); router = Ember.getOwner(this).lookup('router:main');
try { try {
return router.send(name); return router.send(name);
} catch (error1) { } catch (error1) {

View File

@ -1,4 +1,6 @@
import config from 'travis/config/environment'; import config from 'travis/config/environment';
import Ember from 'ember';
var ccXml, email, githubAdmin, githubCommit, githubNetwork, githubPullRequest, var ccXml, email, githubAdmin, githubCommit, githubNetwork, githubPullRequest,
githubRepo, githubWatchers, gravatarImage, plainTextLog, statusImage; githubRepo, githubWatchers, gravatarImage, plainTextLog, statusImage;
@ -33,7 +35,7 @@ githubAdmin = function(slug) {
statusImage = function(slug, branch) { statusImage = function(slug, branch) {
var token; var token;
if (config.pro) { 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 : ''); return (location.protocol + "//" + location.host + "/" + slug + ".svg?token=" + token) + (branch ? "&branch=" + branch : '');
} else { } else {
return (location.protocol + "//" + location.host + "/" + slug + ".svg") + (branch ? "?branch=" + (encodeURIComponent(branch)) : ''); return (location.protocol + "//" + location.host + "/" + slug + ".svg") + (branch ? "?branch=" + (encodeURIComponent(branch)) : '');
@ -48,7 +50,7 @@ ccXml = function(slug, branch) {
} }
if (config.pro) { if (config.pro) {
delimiter = url.indexOf('?') === -1 ? '?' : '&'; 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; url = "" + url + delimiter + "token=" + token;
} }
return url; return url;

View File

@ -1,7 +1,7 @@
{ {
"name": "travis", "name": "travis",
"dependencies": { "dependencies": {
"ember": "2.2.1", "ember": "2.4.5",
"ember-cli-shims": "0.1.1", "ember-cli-shims": "0.1.1",
"ember-cli-test-loader": "0.2.2", "ember-cli-test-loader": "0.2.2",
"ember-load-initializers": "0.1.7", "ember-load-initializers": "0.1.7",
@ -22,7 +22,6 @@
"ceibo": "1.0.0" "ceibo": "1.0.0"
}, },
"resolutions": { "resolutions": {
"ember": "2.2.1", "ember": "2.4.5"
"ember-qunit-notifications": "0.1.0"
} }
} }

View File

@ -1,30 +1,4 @@
window.deprecationWorkflow = window.deprecationWorkflow || {}; window.deprecationWorkflow = window.deprecationWorkflow || {};
window.deprecationWorkflow.config = { window.deprecationWorkflow.config = {
workflow: [ 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.") },
]
}; };

View File

@ -29,7 +29,7 @@
"ember-cli-babel": "^5.1.6", "ember-cli-babel": "^5.1.6",
"ember-cli-dependency-checker": "^1.2.0", "ember-cli-dependency-checker": "^1.2.0",
"ember-cli-deprecation-workflow": "0.1.6", "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": "^1.0.3",
"ember-cli-htmlbars-inline-precompile": "^0.3.1", "ember-cli-htmlbars-inline-precompile": "^0.3.1",
"ember-cli-inject-live-reload": "^1.4.0", "ember-cli-inject-live-reload": "^1.4.0",
@ -48,6 +48,7 @@
"ember-disable-proxy-controllers": "^1.0.1", "ember-disable-proxy-controllers": "^1.0.1",
"ember-export-application-global": "^1.0.5", "ember-export-application-global": "^1.0.5",
"ember-load-initializers": "^0.5.1", "ember-load-initializers": "^0.5.1",
"ember-getowner-polyfill": "1.0.1",
"ember-resolver": "^2.0.3", "ember-resolver": "^2.0.3",
"ember-try": "0.0.7", "ember-try": "0.0.7",
"emberx-select": "2.0.2", "emberx-select": "2.0.2",

View File

@ -4,7 +4,6 @@ import hbs from 'htmlbars-inline-precompile';
import fillIn from '../../helpers/fill-in'; import fillIn from '../../helpers/fill-in';
import DS from 'ember-data'; import DS from 'ember-data';
moduleForComponent('add-env-var', 'Integration | Component | add env-var', { moduleForComponent('add-env-var', 'Integration | Component | add env-var', {
integration: true 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 shouldn't be needed, probably some bug in tests setup with new ember-data
this.registry.register('transform:boolean', DS.BooleanTransform); 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'); assert.equal(store.peekAll('envVar').get('length'), 0, 'precond: store should be empty');
var repo; var repo;
@ -66,7 +65,7 @@ test('it adds a public env var on submit', function(assert) {
assert.expect(6); assert.expect(6);
this.registry.register('transform:boolean', DS.BooleanTransform); 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'); assert.equal(store.peekAll('envVar').get('length'), 0, 'precond: store should be empty');
var repo; var repo;

View File

@ -12,7 +12,7 @@ test('it adds an ssh key on submit', function(assert) {
assert.expect(6); assert.expect(6);
this.registry.register('transform:boolean', DS.BooleanTransform); this.registry.register('transform:boolean', DS.BooleanTransform);
var store = this.container.lookup('service:store'); var store = Ember.getOwner(this).lookup('service:store');
var repo; var repo;
Ember.run(function() { Ember.run(function() {
@ -47,7 +47,7 @@ test('it throws an error if value for ssh key is blank', function(assert) {
assert.expect(5); assert.expect(5);
this.registry.register('transform:boolean', DS.BooleanTransform); this.registry.register('transform:boolean', DS.BooleanTransform);
var store = this.container.lookup('service:store'); var store = Ember.getOwner(this).lookup('service:store');
var repo; var repo;
Ember.run(function() { Ember.run(function() {

View File

@ -4,7 +4,6 @@ import hbs from 'htmlbars-inline-precompile';
import fillIn from '../../helpers/fill-in'; import fillIn from '../../helpers/fill-in';
import DS from 'ember-data'; import DS from 'ember-data';
moduleForComponent('env-var', 'Integration | Component | env-var', { moduleForComponent('env-var', 'Integration | Component | env-var', {
integration: true integration: true
}); });
@ -13,7 +12,7 @@ test('it renders an env-var with private value', function(assert) {
assert.expect(2); assert.expect(2);
this.registry.register('transform:boolean', DS.BooleanTransform); this.registry.register('transform:boolean', DS.BooleanTransform);
var store = this.container.lookup('service:store'); var store = Ember.getOwner(this).lookup('service:store');
Ember.run(() => { Ember.run(() => {
var envVar = store.push({data: { id: 1, type: 'env-var', attributes: { name: 'foo', value: 'bar', public: false}}}); var envVar = store.push({data: { id: 1, type: 'env-var', attributes: { name: 'foo', value: 'bar', public: false}}});
this.set('envVar', envVar); this.set('envVar', envVar);
@ -30,7 +29,7 @@ test('it renders an env-var with public value', function(assert) {
assert.expect(2); assert.expect(2);
this.registry.register('transform:boolean', DS.BooleanTransform); this.registry.register('transform:boolean', DS.BooleanTransform);
var store = this.container.lookup('service:store'); var store = Ember.getOwner(this).lookup('service:store');
Ember.run(() => { Ember.run(() => {
var envVar = store.push({data: { id: 1, type: 'env-var', attributes: { name: 'foo', value: 'bar', public: true}}}); var envVar = store.push({data: { id: 1, type: 'env-var', attributes: { name: 'foo', value: 'bar', public: true}}});
this.set('envVar', envVar); this.set('envVar', envVar);

View File

@ -3,7 +3,6 @@ import { moduleForComponent, test } from 'ember-qunit';
import hbs from 'htmlbars-inline-precompile'; import hbs from 'htmlbars-inline-precompile';
import fillIn from '../../helpers/fill-in'; import fillIn from '../../helpers/fill-in';
moduleForComponent('ssh-key', 'Integration | Component | ssh-key', { moduleForComponent('ssh-key', 'Integration | Component | ssh-key', {
integration: true 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) { test('it renders the default ssh key if no custom key is set', function(assert) {
assert.expect(2); 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'}); var key = Ember.Object.create({fingerprint: 'fingerprint'});
this.set('key', key); 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) { test('it renders the custom ssh key if custom key is set', function(assert) {
assert.expect(2); assert.expect(2);
var store = this.container.lookup('service:store'); var store = Ember.getOwner(this).lookup('service:store');
var key; var key;
Ember.run(function() { 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) { test('it deletes a custom key if permissions are right', function(assert) {
assert.expect(1); assert.expect(1);
var store = this.container.lookup('service:store'); var store = Ember.getOwner(this).lookup('service:store');
var key; var key;
Ember.run(function() { 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) { test('it does not delete the custom key if permissions are insufficient', function(assert) {
assert.expect(1); assert.expect(1);
var store = this.container.lookup('service:store'); var store = Ember.getOwner(this).lookup('service:store');
var key; var key;
Ember.run(function() { Ember.run(function() {