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 #327 from drewfish/redesign-rs
Browse files Browse the repository at this point in the history
redesigned resource store
  • Loading branch information
Isao Yagi committed Aug 2, 2012
2 parents 717b48e + d1a37d8 commit a444c1e
Show file tree
Hide file tree
Showing 99 changed files with 6,990 additions and 6,580 deletions.
3 changes: 2 additions & 1 deletion examples/developer-guide/device_assets/application.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,6 @@
}
}
}
}
},
{ "settings": [ "device:iphone" ], "selector": "iphone" }
]
5 changes: 4 additions & 1 deletion examples/developer-guide/device_views/application.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@
"type" : "device"
}
}
}
},
{ "settings": [ "device:android" ], "selector": "android" },
{ "settings": [ "device:blackberry" ], "selector": "blackberry" },
{ "settings": [ "device:iphone" ], "selector": "iphone" }
]

33 changes: 17 additions & 16 deletions examples/developer-guide/scroll_views/application.json
Original file line number Diff line number Diff line change
@@ -1,23 +1,24 @@
[
{
"settings": [ "master" ],
"specs": {
"frame" : {
"type" : "HTMLFrameMojit",
"config": {
"deploy": true,
"child" : {
"type" : "scroll"
},
"assets": {
"top": {
"css":[
"/static/scroll/assets/index.css"
]
"settings": [ "master" ],
"specs": {
"frame" : {
"type" : "HTMLFrameMojit",
"config": {
"deploy": true,
"child" : {
"type" : "scroll"
},
"assets": {
"top": {
"css":[
"/static/scroll/assets/index.css"
]
}
}
}
}
}
}
}
},
{ "settings": [ "device:iphone" ], "selector": "iphone" }
]
12 changes: 12 additions & 0 deletions examples/getting-started-guide/part4/paged-yql/application.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,17 @@
"type": "PagedFlickr"
}
}
},
{
"settings": [ "device:iphone" ],
"selector": "iphone"
},
{
"settings": [ "device:android" ],
"selector": "droid"
},
{
"settings": [ "device:android", "environment:dev" ],
"selector": "devdroid"
}
]
Original file line number Diff line number Diff line change
Expand Up @@ -50,5 +50,6 @@
"type": "FlickrDetail"
}
}
}
},
{ "settings": [ "device:iphone" ], "selector": "iphone" }
]
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"flickr_base": {
"verbs": ["get"],
"path": "/flickr",
"param": "page=1&image=0",
"params": "page=1&image=0",
"call": "flickr.index"
}

Expand Down
4 changes: 3 additions & 1 deletion examples/newsboxes/application.json
Original file line number Diff line number Diff line change
Expand Up @@ -68,4 +68,6 @@
}
}
}
}]
},
{ "settings": [ "device:opera-mini" ], "selector": "opera-mini" }
]
3 changes: 2 additions & 1 deletion examples/sandbox/ex1/application.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,5 +40,6 @@
"action": "jsonReturn"
}
}
}
},
{ "settings": [ "device:iphone" ], "selector": "iphone" }
]
50 changes: 26 additions & 24 deletions source/lib/app/addons/ac/deploy.server.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,11 +80,11 @@ YUI.add('mojito-deploy-addon', function(Y, NAME) {

var store = this.rs,
contextServer = this.ac.context,
appConfigServer = store.getAppConfig(contextServer,
'application'),
appConfigServer = store.getAppConfig(contextServer),
contextClient,
appConfigClient,
yuiConfig = {},
fwConfig,
yuiConfigEscaped,
yuiConfigStr,
yuiModules,
Expand All @@ -97,7 +97,6 @@ YUI.add('mojito-deploy-addon', function(Y, NAME) {
binder,
i,
id,
instances = {},
clientConfig = {},
clientConfigEscaped,
clientConfigStr,
Expand All @@ -109,11 +108,12 @@ YUI.add('mojito-deploy-addon', function(Y, NAME) {
type,
module,
path,
pathToRoot;
pathToRoot,
urls;

contextClient = Y.mojito.util.copy(contextServer);
contextClient.runtime = 'client';
appConfigClient = store.getAppConfig(contextClient, 'application');
appConfigClient = store.getAppConfig(contextClient);
clientConfig.context = contextClient;

if (appConfigClient.yui && appConfigClient.yui.config) {
Expand All @@ -137,8 +137,7 @@ YUI.add('mojito-deploy-addon', function(Y, NAME) {
yuiConfig.loaderPath = appConfigClient.yui.loader;
}

clientConfig.store = store.serializeClientStore(contextClient,
instances);
clientConfig.store = store.serializeClientStore(contextClient);

usePrecomputed = appConfigServer.yui &&
appConfigServer.yui.dependencyCalculations && (-1 !==
Expand All @@ -154,6 +153,8 @@ YUI.add('mojito-deploy-addon', function(Y, NAME) {
useOnDemand = true;
}

urls = store.store.getAllURLs();

// Set the YUI URL to use on the client (This has to be done
// before any other scripts are added)
if (appConfigClient.yui && appConfigClient.yui.url) {
Expand All @@ -176,6 +177,7 @@ YUI.add('mojito-deploy-addon', function(Y, NAME) {
yuiModules = ['yui'];
yuiJsUrlContains.yui = true;
if (useOnDemand) {
fwConfig = store.store.getFrameworkConfig();
yuiModules.push('get');
yuiJsUrlContains.get = true;
yuiModules.push('loader-base');
Expand All @@ -184,10 +186,8 @@ YUI.add('mojito-deploy-addon', function(Y, NAME) {
yuiJsUrlContains['loader-rollup'] = true;
yuiModules.push('loader-yui3');
yuiJsUrlContains['loader-yui3'] = true;
for (i = 0; i < store.store._fwConfig.
ondemandBaseYuiModules.length; i += 1) {
module =
store.store._fwConfig.ondemandBaseYuiModules[i];
for (i = 0; i < fwConfig.ondemandBaseYuiModules.length; i += 1) {
module = fwConfig.ondemandBaseYuiModules[i];
yuiModules.push(module);
yuiJsUrlContains[module] = true;
}
Expand All @@ -209,7 +209,7 @@ YUI.add('mojito-deploy-addon', function(Y, NAME) {
path = binder.needs[module];
// Anything we don't know about we'll assume is
// a YUI library module.
if (!store.fileFromStaticHandlerURL(path)) {
if (!urls[path]) {
yuiModules.push(module);
yuiJsUrlContains[module] = true;
}
Expand Down Expand Up @@ -240,10 +240,10 @@ YUI.add('mojito-deploy-addon', function(Y, NAME) {
// fw & app scripts.
if (useOnDemand) {
// add all framework-level and app-level code
this.addScripts('bottom', store.getYuiConfigFw('client',
contextClient).modules);
this.addScripts('bottom', store.getYuiConfigApp('client',
contextClient).modules);
this.addScripts('bottom', store.store.yui.getConfigShared(
'client',
contextClient
).modules, false);
}

// add binders' dependencies
Expand Down Expand Up @@ -312,7 +312,7 @@ YUI.add('mojito-deploy-addon', function(Y, NAME) {

// Add all the scripts we have collected
assetHandler.addAssets(
this.getScripts(appConfigServer.embedJsFilesInHtmlFrame)
this.getScripts(appConfigServer.embedJsFilesInHtmlFrame, urls)
);
// Add the boot script
assetHandler.addAsset('blob', 'bottom', initializer);
Expand Down Expand Up @@ -344,10 +344,14 @@ YUI.add('mojito-deploy-addon', function(Y, NAME) {
* @private
* @param {bool} embed Should returned scripts be embedded in script
* tags.
* @param {object} urls Mapping of URLs to filesystem paths. The keys
* are the URLs, and the values are the cooresponding filesystem
* paths.
* @return {object} An object containing script descriptors.
*/
getScripts: function(embed) {
getScripts: function(embed, urls) {
var i,
path,
x,
assets = {},
blob = {
Expand All @@ -359,16 +363,14 @@ YUI.add('mojito-deploy-addon', function(Y, NAME) {
// Walk over the scripts and check what we can do
for (i in this.scripts) {
if (this.scripts.hasOwnProperty(i)) {
if (embed && this.rs._staticURLs[i]) {
//blob.content+= fs.readFileSync(this.rs._staticURLs[i],
// 'utf8');
//delete this.scripts[i];
path = urls[i];
if (embed && path) {
this.scripts[i] = {
type: 'blob',
position: 'bottom',
content: '<script type="text/javascript">' +
minify(fs.readFileSync(this.rs._staticURLs[i],
'utf8')) + '</script>'
minify(fs.readFileSync(path, 'utf8')) +
'</script>'
};
} else {
this.scripts[i] = {
Expand Down
Loading

0 comments on commit a444c1e

Please sign in to comment.