Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Do not throw an error if this.namespace is undefined on init. #89

Merged
merged 2 commits into from
Mar 15, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion dist/ember-resolver-spade.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/ember-resolver-tests.js

Large diffs are not rendered by default.

18 changes: 12 additions & 6 deletions dist/ember-resolver.js
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,17 @@ define("ember/resolver",
function resolveOther(parsedName) {
/*jshint validthis:true */

if (!this._deprecatedPodModulePrefix) {
var podModulePrefix = this.namespace.podModulePrefix || '';
var podPath = podModulePrefix.substr(podModulePrefix.lastIndexOf('/') + 1);

Ember.deprecate('`podModulePrefix` is deprecated and will be removed '+
'from future versions of ember-cli. Please move existing pods from '+
'\'app/' + podPath + '/\' to \'app/\'.', !this.namespace.podModulePrefix);

this._deprecatedPodModulePrefix = true;
}

Ember.assert('`modulePrefix` must be defined', this.namespace.modulePrefix);

var normalizedModuleName = this.findModuleName(parsedName);
Expand Down Expand Up @@ -143,13 +154,8 @@ define("ember/resolver",
if (!this.pluralizedTypes.config) {
this.pluralizedTypes.config = 'config';
}

var podModulePrefix = this.namespace.podModulePrefix || '';
var podPath = podModulePrefix.substr(podModulePrefix.lastIndexOf('/') + 1);
Ember.deprecate('`podModulePrefix` is deprecated and will be removed '+
'from future versions of ember-cli. Please move existing pods from '+
'\'app/' + podPath + '/\' to \'app/\'.', !this.namespace.podModulePrefix);

this._deprecatedPodModulePrefix = false;
},
normalize: function(fullName) {
return this._normalizeCache[fullName] || (this._normalizeCache[fullName] = this._normalize(fullName));
Expand Down
2 changes: 1 addition & 1 deletion dist/ember-resolver.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 12 additions & 6 deletions dist/ember-resolver.prod.js
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,17 @@ define("ember/resolver",
function resolveOther(parsedName) {
/*jshint validthis:true */

if (!this._deprecatedPodModulePrefix) {
var podModulePrefix = this.namespace.podModulePrefix || '';
var podPath = podModulePrefix.substr(podModulePrefix.lastIndexOf('/') + 1);

Ember.deprecate('`podModulePrefix` is deprecated and will be removed '+
'from future versions of ember-cli. Please move existing pods from '+
'\'app/' + podPath + '/\' to \'app/\'.', !this.namespace.podModulePrefix);

this._deprecatedPodModulePrefix = true;
}

Ember.assert('`modulePrefix` must be defined', this.namespace.modulePrefix);

var normalizedModuleName = this.findModuleName(parsedName);
Expand Down Expand Up @@ -143,13 +154,8 @@ define("ember/resolver",
if (!this.pluralizedTypes.config) {
this.pluralizedTypes.config = 'config';
}

var podModulePrefix = this.namespace.podModulePrefix || '';
var podPath = podModulePrefix.substr(podModulePrefix.lastIndexOf('/') + 1);
Ember.deprecate('`podModulePrefix` is deprecated and will be removed '+
'from future versions of ember-cli. Please move existing pods from '+
'\'app/' + podPath + '/\' to \'app/\'.', !this.namespace.podModulePrefix);

this._deprecatedPodModulePrefix = false;
},
normalize: function(fullName) {
return this._normalizeCache[fullName] || (this._normalizeCache[fullName] = this._normalize(fullName));
Expand Down
42 changes: 27 additions & 15 deletions dist/modules/ember-resolver-tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,12 @@ test("can access Resolver", function(){
ok(resolver);
});

test('does not require `namespace` to exist at `init` time', function() {
expect(0);

resolver = Resolver.create();
});

test("can lookup something", function(){
expect(2);

Expand Down Expand Up @@ -413,14 +419,12 @@ test("will lookup names with slashes properly", function() {
});

test("specifying a podModulePrefix overrides the general modulePrefix", function() {
expectDeprecation(function() {
setupResolver({
namespace: {
modulePrefix: 'appkit',
podModulePrefix: 'appkit/pods'
}
});
}, "`podModulePrefix` is deprecated and will be removed from future versions of ember-cli. Please move existing pods from 'app/pods/' to 'app/'.");
setupResolver({
namespace: {
modulePrefix: 'appkit',
podModulePrefix: 'appkit/pods'
}
});

define('appkit/controllers/foo', [], function(){
ok(false, 'appkit/controllers was used');
Expand All @@ -437,18 +441,26 @@ test("specifying a podModulePrefix overrides the general modulePrefix", function
return 'whatever';
});

resolver.resolve('controller:foo');
expectDeprecation(function() {
resolver.resolve('controller:foo');
}, "`podModulePrefix` is deprecated and will be removed from future versions of ember-cli. Please move existing pods from 'app/pods/' to 'app/'.");
});

test("specifying a podModulePrefix is deprecated", function() {
setupResolver({
namespace: {
modulePrefix: 'appkit',
podModulePrefix: 'appkit/pods'
}
});

expectDeprecation(function() {
setupResolver({
namespace: {
modulePrefix: 'appkit',
podModulePrefix: 'appkit/pods'
}
});
resolver.resolve('foo:bar');
}, "`podModulePrefix` is deprecated and will be removed from future versions of ember-cli. Please move existing pods from 'app/pods/' to 'app/'.");

expectNoDeprecation(function() {
resolver.resolve('foo:bar');
});
});

test("will not use custom type prefix when using POD format", function() {
Expand Down
18 changes: 12 additions & 6 deletions dist/modules/ember-resolver.js
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,17 @@ define("ember/resolver",
function resolveOther(parsedName) {
/*jshint validthis:true */

if (!this._deprecatedPodModulePrefix) {
var podModulePrefix = this.namespace.podModulePrefix || '';
var podPath = podModulePrefix.substr(podModulePrefix.lastIndexOf('/') + 1);

Ember.deprecate('`podModulePrefix` is deprecated and will be removed '+
'from future versions of ember-cli. Please move existing pods from '+
'\'app/' + podPath + '/\' to \'app/\'.', !this.namespace.podModulePrefix);

this._deprecatedPodModulePrefix = true;
}

Ember.assert('`modulePrefix` must be defined', this.namespace.modulePrefix);

var normalizedModuleName = this.findModuleName(parsedName);
Expand Down Expand Up @@ -133,13 +144,8 @@ define("ember/resolver",
if (!this.pluralizedTypes.config) {
this.pluralizedTypes.config = 'config';
}

var podModulePrefix = this.namespace.podModulePrefix || '';
var podPath = podModulePrefix.substr(podModulePrefix.lastIndexOf('/') + 1);
Ember.deprecate('`podModulePrefix` is deprecated and will be removed '+
'from future versions of ember-cli. Please move existing pods from '+
'\'app/' + podPath + '/\' to \'app/\'.', !this.namespace.podModulePrefix);

this._deprecatedPodModulePrefix = false;
},
normalize: function(fullName) {
return this._normalizeCache[fullName] || (this._normalizeCache[fullName] = this._normalize(fullName));
Expand Down
18 changes: 12 additions & 6 deletions packages/ember-resolver/lib/core.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,17 @@ define("ember/resolver",
function resolveOther(parsedName) {
/*jshint validthis:true */

if (!this._deprecatedPodModulePrefix) {
var podModulePrefix = this.namespace.podModulePrefix || '';
var podPath = podModulePrefix.substr(podModulePrefix.lastIndexOf('/') + 1);

Ember.deprecate('`podModulePrefix` is deprecated and will be removed '+
'from future versions of ember-cli. Please move existing pods from '+
'\'app/' + podPath + '/\' to \'app/\'.', !this.namespace.podModulePrefix);

this._deprecatedPodModulePrefix = true;
}

Ember.assert('`modulePrefix` must be defined', this.namespace.modulePrefix);

var normalizedModuleName = this.findModuleName(parsedName);
Expand Down Expand Up @@ -132,13 +143,8 @@ define("ember/resolver",
if (!this.pluralizedTypes.config) {
this.pluralizedTypes.config = 'config';
}

var podModulePrefix = this.namespace.podModulePrefix || '';
var podPath = podModulePrefix.substr(podModulePrefix.lastIndexOf('/') + 1);
Ember.deprecate('`podModulePrefix` is deprecated and will be removed '+
'from future versions of ember-cli. Please move existing pods from '+
'\'app/' + podPath + '/\' to \'app/\'.', !this.namespace.podModulePrefix);

this._deprecatedPodModulePrefix = false;
},
normalize: function(fullName) {
return this._normalizeCache[fullName] || (this._normalizeCache[fullName] = this._normalize(fullName));
Expand Down
Loading