Skip to content

Commit

Permalink
Update dist/.
Browse files Browse the repository at this point in the history
  • Loading branch information
rwjblue committed Oct 9, 2014
1 parent facf201 commit 1620d18
Show file tree
Hide file tree
Showing 7 changed files with 99 additions and 6 deletions.
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.

13 changes: 12 additions & 1 deletion dist/ember-resolver.js
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,7 @@ define("ember/resolver",
var Resolver = Ember.DefaultResolver.extend({
resolveOther: resolveOther,
resolveTemplate: resolveOther,
pluralizedTypes: null,

makeToString: function(factory, fullName) {
return '' + this.namespace.modulePrefix + '@' + fullName + ':';
Expand All @@ -151,6 +152,12 @@ define("ember/resolver",
init: function() {
this._super();
this._normalizeCache = makeDictionary();

this.pluralizedTypes = this.pluralizedTypes || makeDictionary();

if (!this.pluralizedTypes.config) {
this.pluralizedTypes.config = 'config';
}
},
normalize: function(fullName) {
return this._normalizeCache[fullName] || (this._normalizeCache[fullName] = this._normalize(fullName));
Expand All @@ -168,6 +175,10 @@ define("ember/resolver",
}
},

pluralize: function(type) {
return this.pluralizedTypes[type] || (this.pluralizedTypes[type] = type + 's');
},

podBasedLookupWithPrefix: function(podPrefix, parsedName) {
var fullNameWithoutType = parsedName.fullNameWithoutType;

Expand Down Expand Up @@ -203,7 +214,7 @@ define("ember/resolver",
},

defaultModuleName: function(parsedName) {
return this.prefix(parsedName) + '/' + parsedName.type + 's/' + parsedName.fullNameWithoutType;
return this.prefix(parsedName) + '/' + this.pluralize(parsedName.type) + '/' + parsedName.fullNameWithoutType;
},

prefix: function(parsedName) {
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.

13 changes: 12 additions & 1 deletion dist/ember-resolver.prod.js
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,7 @@ define("ember/resolver",
var Resolver = Ember.DefaultResolver.extend({
resolveOther: resolveOther,
resolveTemplate: resolveOther,
pluralizedTypes: null,

makeToString: function(factory, fullName) {
return '' + this.namespace.modulePrefix + '@' + fullName + ':';
Expand All @@ -151,6 +152,12 @@ define("ember/resolver",
init: function() {
this._super();
this._normalizeCache = makeDictionary();

this.pluralizedTypes = this.pluralizedTypes || makeDictionary();

if (!this.pluralizedTypes.config) {
this.pluralizedTypes.config = 'config';
}
},
normalize: function(fullName) {
return this._normalizeCache[fullName] || (this._normalizeCache[fullName] = this._normalize(fullName));
Expand All @@ -168,6 +175,10 @@ define("ember/resolver",
}
},

pluralize: function(type) {
return this.pluralizedTypes[type] || (this.pluralizedTypes[type] = type + 's');
},

podBasedLookupWithPrefix: function(podPrefix, parsedName) {
var fullNameWithoutType = parsedName.fullNameWithoutType;

Expand Down Expand Up @@ -203,7 +214,7 @@ define("ember/resolver",
},

defaultModuleName: function(parsedName) {
return this.prefix(parsedName) + '/' + parsedName.type + 's/' + parsedName.fullNameWithoutType;
return this.prefix(parsedName) + '/' + this.pluralize(parsedName.type) + '/' + parsedName.fullNameWithoutType;
},

prefix: function(parsedName) {
Expand Down
60 changes: 60 additions & 0 deletions dist/modules/ember-resolver-tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -425,5 +425,65 @@ test("will not lookup non component templates in components/", function() {
resolver.resolve('template:foo-bar');
});

module("custom pluralization", {
teardown: resetRegistry
});

test("will use the pluralization specified for a given type", function() {
expect(1);

setupResolver({
namespace: {
modulePrefix: 'appkit'
},

pluralizedTypes: {
'sheep': 'sheep',
'octipus': 'octipii'
}
});

define('appkit/sheep/baaaaaa', [], function(){
ok(true, 'custom pluralization used');
return 'whatever';
});

resolver.resolve('sheep:baaaaaa');
});

test("will pluralize 'config' as 'config' by default", function() {
expect(1);

setupResolver();

define('appkit/config/environment', [], function(){
ok(true, 'config/environment is found');
return 'whatever';
});

resolver.resolve('config:environment');
});

test("'config' can be overridden", function() {
expect(1);

setupResolver({
namespace: {
modulePrefix: 'appkit'
},

pluralizedTypes: {
'config': 'super-duper-config'
}
});

define('appkit/super-duper-config/environment', [], function(){
ok(true, 'super-duper-config/environment is found');
return 'whatever';
});

resolver.resolve('config:environment');
});

})();

13 changes: 12 additions & 1 deletion dist/modules/ember-resolver.js
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@ define("ember/resolver",
var Resolver = Ember.DefaultResolver.extend({
resolveOther: resolveOther,
resolveTemplate: resolveOther,
pluralizedTypes: null,

makeToString: function(factory, fullName) {
return '' + this.namespace.modulePrefix + '@' + fullName + ':';
Expand All @@ -141,6 +142,12 @@ define("ember/resolver",
init: function() {
this._super();
this._normalizeCache = makeDictionary();

this.pluralizedTypes = this.pluralizedTypes || makeDictionary();

if (!this.pluralizedTypes.config) {
this.pluralizedTypes.config = 'config';
}
},
normalize: function(fullName) {
return this._normalizeCache[fullName] || (this._normalizeCache[fullName] = this._normalize(fullName));
Expand All @@ -158,6 +165,10 @@ define("ember/resolver",
}
},

pluralize: function(type) {
return this.pluralizedTypes[type] || (this.pluralizedTypes[type] = type + 's');
},

podBasedLookupWithPrefix: function(podPrefix, parsedName) {
var fullNameWithoutType = parsedName.fullNameWithoutType;

Expand Down Expand Up @@ -193,7 +204,7 @@ define("ember/resolver",
},

defaultModuleName: function(parsedName) {
return this.prefix(parsedName) + '/' + parsedName.type + 's/' + parsedName.fullNameWithoutType;
return this.prefix(parsedName) + '/' + this.pluralize(parsedName.type) + '/' + parsedName.fullNameWithoutType;
},

prefix: function(parsedName) {
Expand Down

0 comments on commit 1620d18

Please sign in to comment.