Skip to content
This repository has been archived by the owner on Oct 30, 2018. It is now read-only.

Commit

Permalink
Merge pull request #955 from drewfish/static-appconfig
Browse files Browse the repository at this point in the history
prefer store.getStaticAppConfig()
  • Loading branch information
drewfish committed Jan 28, 2013
2 parents fe1bf9b + 19d5a85 commit 00b1862
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 2 deletions.
2 changes: 1 addition & 1 deletion lib/app/autoload/action-context.common.js
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,7 @@ YUI.add('mojito-action-context', function(Y, NAME) {
Y.mojito.hooks.hook('actionContext', opts.adapter.hook, 'start', my, opts);
// HookSystem::EndBlock

staticAppConfig = store.getAppConfig(store.getStaticContext());
staticAppConfig = store.getStaticAppConfig();

// It's possible to setup a route that calls "foo.", which means that
// the default action in the instance should be used instead.
Expand Down
10 changes: 10 additions & 0 deletions lib/app/autoload/store.client.js
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,16 @@ YUI.add('mojito-client-store', function(Y, NAME) {
},


/**
* Returns the static (non-runtime-sensitive) version of the application.json.
* @method getStaticAppConfig
* @return {object} the configuration from applications.json
*/
getStaticAppConfig: function(ctx) {
return this.appConfig;
},


/**
* Returns the routes configured in the application.
* @method getRoutes
Expand Down
2 changes: 1 addition & 1 deletion lib/mojito.js
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,7 @@ MojitoServer.prototype._configureAppInstance = function(app, options) {
options.context = {};
}

appConfig = store.getAppConfig(store.getStaticContext());
appConfig = store.getStaticAppConfig();
yuiConfig = (appConfig.yui && appConfig.yui.config) || {};

// redefining "combine" and/or "base" in the server side have side effects
Expand Down
20 changes: 20 additions & 0 deletions tests/unit/lib/app/autoload/test-action-context.common.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ YUI().use('mojito-action-context', 'test', function (Y) {
getAppConfig: function() {
return 'app config';
},
getStaticAppConfig: function() {
return 'static app config';
},
getStaticContext: function() {
return 'static context';
},
Expand Down Expand Up @@ -596,6 +599,9 @@ YUI().use('mojito-action-context', 'test', function (Y) {
actionTimeout: 1
};
},
getStaticAppConfig: function() {
return 'static app config';
},
getStaticContext: function() {
return 'static context';
},
Expand Down Expand Up @@ -650,6 +656,9 @@ YUI().use('mojito-action-context', 'test', function (Y) {
actionTimeout: 1000
};
},
getStaticAppConfig: function() {
return 'static app config';
},
getStaticContext: function() {
return 'static context';
},
Expand Down Expand Up @@ -702,6 +711,9 @@ YUI().use('mojito-action-context', 'test', function (Y) {
actionTimeout: 1000
};
},
getStaticAppConfig: function() {
return 'static app config';
},
getStaticContext: function() {
return 'static context';
},
Expand Down Expand Up @@ -836,6 +848,9 @@ YUI().use('mojito-action-context', 'test', function (Y) {
getAppConfig: function() {
return {};
},
getStaticAppConfig: function() {
return 'static app config';
},
getStaticContext: function() {
return {};
},
Expand Down Expand Up @@ -981,6 +996,11 @@ YUI().use('mojito-action-context', 'test', function (Y) {
pathToRoot: '/path/to/root/'
};
},
getStaticAppConfig: function() {
return {
pathToRoot: '/path/to/root/'
};
},
getStaticContext: function() {
return 'static context';
},
Expand Down

0 comments on commit 00b1862

Please sign in to comment.