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

delinted #509

Closed
wants to merge 31 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
76b5c0a
Changed npm test and travis configuration to use arrow
Sep 6, 2012
f86909f
Refactoring travis scripts
Sep 7, 2012
680e886
Changing permissions of travis scripts
Sep 7, 2012
8805379
Merge branch 'develop' of github.com:yahoo/mojito into arrow_travis
Sep 7, 2012
74efbaa
Merge branch 'develop' of github.com:yahoo/mojito into arrow_travis
Sep 10, 2012
5ff6f89
Merge branch 'develop' of github.com:yahoo/mojito into arrow_travis
Sep 10, 2012
3a0d779
Merge branch 'develop' of github.com:yahoo/mojito into arrow_travis
Sep 10, 2012
cbc3213
Merge branch 'develop' of github.com:yahoo/mojito into arrow_travis
Sep 10, 2012
4ad4f21
Fixed unreliable example tests
Sep 10, 2012
d6ea2ca
Merge pull request #467 from mridgway/arrow_travis
mridgway Sep 10, 2012
1fe8833
release 0.4.4 (based on 0.4.3-103-gd6ea2ca)
Sep 11, 2012
8eb1993
Cleaned up functional tests and in some cases made them more stable
Sep 11, 2012
245998a
improve error handling and messaging
FabianFrank Sep 12, 2012
671bffb
Bug fix for accessing app.json builds with correct context.
Sep 12, 2012
ff5180c
Removing 0.4 build since it is unsupported
mridgway Sep 12, 2012
55f380b
Merge pull request #479 from mridgway/arrow_travis
mridgway Sep 12, 2012
50f0898
updating UT for new error message
FabianFrank Sep 12, 2012
242a030
Merge pull request #490 from isao/build-context-config
Sep 12, 2012
e1359c6
Merge pull request #482 from FabianFrank/errorenhance
Sep 12, 2012
43cd1e4
fix issue #496 package.json/engines.node:">.4",npm:">1.0"
Sep 13, 2012
87e7c98
Merge pull request #498 from isao/config
Sep 13, 2012
1dda504
fix issue #507 Add hi group in dimensions.json
Sep 13, 2012
543c0c1
replace tab with spaces
Sep 14, 2012
772ad84
Merge pull request #510 from lzhan/fix507
lzhan Sep 14, 2012
587ff0e
Adds a --path option to run.js to allow specifying a path to find the…
Sep 14, 2012
1a58bbb
Merge pull request #519 from mridgway/runPath
mridgway Sep 14, 2012
6507aae
fixed multiple typos in the code example as well as typo in explanati…
Sep 18, 2012
379ee73
Merge pull request #522 from dmitris/develop
Sep 18, 2012
8208de5
Fixed link to dimensions.json.
Sep 18, 2012
596a716
Merge branch 'develop' into develop-perf
drewfish Sep 18, 2012
8017431
delinted
drewfish Sep 18, 2012
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
3 changes: 2 additions & 1 deletion .travis.yml
Expand Up @@ -2,7 +2,8 @@ language: node_js
node_js:
- 0.8
- 0.6
- 0.4
before_script: ./travis/before_script.sh
script: ./travis/script.sh
notifications:
email:
recipients:
Expand Down
8 changes: 4 additions & 4 deletions docs/dev_guide/code_exs/route_config.rst
Expand Up @@ -33,7 +33,7 @@ is created, which can then be associated in a route defined in ``routes.json``.
]

The example ``routes.json`` below associates the ``mapped_mojit`` instance defined in ``application.json`` with a path and explicitly calls the ``index`` action. If the controller for ``RoutingMojit`` had the function ``myFunction``,
you could would use the following to call it: ``mapped_mojit.myFunction``. Based on the ``custom-route`` route below, when an HTTP GET call is made on the URL ``http:{domain}:8666/custom-route``,
you would use the following to call it: ``mapped_mojit.myFunction``. Based on the ``custom-route`` route below, when an HTTP GET call is made on the URL ``http:{domain}:8666/custom-route``,
the ``index`` action is called from the ``custom-route`` instance.

.. code-block:: javascript
Expand Down Expand Up @@ -64,11 +64,11 @@ method ``post_params`` from the ``post-route`` mojit instance.
"verbs": ["get"],
"path": "/custom-route",
"call": "mapped_mojit.index"
}
},
"another-route": {
"verbs": ["post"]
"verbs": ["post"],
"path": "/*",
"call": mojit-post-route.post_params"
"call": "mojit-post-route.post_params"
}
}
]
Expand Down
2 changes: 1 addition & 1 deletion docs/dev_guide/topics/mojito_using_contexts.rst
Expand Up @@ -83,7 +83,7 @@ following compound context: ``"environment:test,device:android"``
- ``device:palm``
- ``lang:{BCP 47 language tag}``

You can view the supported BCP 47 language tags and default contexts in the `dimensions.json <https://github.com/yahoo/mojito/blob/develop/source/lib/dimensions.json>`_ file of Mojito.
You can view the supported BCP 47 language tags and default contexts in the `dimensions.json <https://github.com/yahoo/mojito/blob/develop/lib/dimensions.json>`_ file of Mojito.

Configuration Precedence
========================
Expand Down
4 changes: 3 additions & 1 deletion lib/app/addons/ac/models.common.js
Expand Up @@ -61,7 +61,9 @@ YUI.add('mojito-models-addon', function (Y, NAME) {
// returning from cache if exists
return models[modelName];

}, this, command.instance.config /* config (first arg) */);
}, this,
command.instance.config /* config (first arg) */
);

}

Expand Down
4 changes: 2 additions & 2 deletions lib/app/addons/ac/output-adapter.common.js
Expand Up @@ -202,13 +202,13 @@ YUI.add('mojito-output-adapter-addon', function(Y, NAME) {
}

// Will use hb to render mu templates anyway
if (rendererCache['hb'] === undefined || rendererCache['mu'] === undefined) {
if (rendererCache.hb === undefined || rendererCache.mu === undefined) {
rendererCache = {
hb: new (Y.mojito.addons.viewEngines.hb)(''), // viewId
mu: new (Y.mojito.addons.viewEngines.mu)('', {}) // viewId, viewOptions
};
}
renderer = rendererCache['hb'];
renderer = rendererCache.hb;
renderer.viewId = meta.view.id;
renderer.render(data, instance.type, contentPath, adapter, meta, more);

Expand Down
5 changes: 5 additions & 0 deletions lib/app/addons/rs/url.server.js
Expand Up @@ -157,6 +157,11 @@ YUI.add('addon-rs-url', function(Y, NAME) {
*/
onGetMojitTypeDetails: function(evt) {
var ress = this.get('host').getResources(evt.args.env, evt.args.ctx, {type: 'mojit', name: evt.args.mojitType});

if (!ress || !ress[0]) {
throw new Error('Unable to compute assets root for mojit "' + evt.mojit.type + '". This usually happens when trying to run a mojit that does not exist.');
}

evt.mojit.assetsRoot = ress[0].url + '/assets';
},

Expand Down
8 changes: 4 additions & 4 deletions lib/app/autoload/action-context.common.js
Expand Up @@ -210,7 +210,6 @@ YUI.add('mojito-action-context', function(Y, NAME) {
if (CACHE[ac.type]) {
dependencies = CACHE[ac.type];
} else {
firstTime = true;
for (addonName in addons) {
if (addons.hasOwnProperty(addonName)) {
if (!dependencies[addonName]) {
Expand Down Expand Up @@ -251,7 +250,8 @@ YUI.add('mojito-action-context', function(Y, NAME) {
var controller = opts.controller,
command = opts.command,
actionFunction = command.action,
perf = Y.mojito.perf.timeline('mojito', 'ac:init', 'set up AC object', command);
perf = Y.mojito.perf.timeline('mojito', 'ac:init', 'set up AC object', command),
error;

this.action = command.action;
this.type = command.instance.type;
Expand All @@ -277,7 +277,7 @@ YUI.add('mojito-action-context', function(Y, NAME) {
actionFunction = '__call';
} else {
// If there is still no joy then die
error = new Error("No method '" + command.action + "' on controller type '" + instance.type + "'");
error = new Error("No method '" + opts.command.action + "' on controller type '" + opts.instance.type + "'");
error.code = 404;
throw error;
}
Expand Down Expand Up @@ -380,7 +380,7 @@ YUI.add('mojito-action-context', function(Y, NAME) {

}, '0.1.0', {requires: [
// following are ACPs are always available
'mojito-output-adapter-addon',
'mojito-output-adapter-addon'
// << RIC
// 'mojito-config-addon',
// 'mojito-url-addon',
Expand Down
10 changes: 8 additions & 2 deletions lib/app/autoload/controller-context.common.js
Expand Up @@ -18,7 +18,8 @@ YUI.add('mojito-controller-context', function(Y, NAME) {
this.dispatch = opts.dispatch;
this.store = opts.store;
this.Y = opts.Y;
this.shareYUIInstance = false; Y.mojito.util.shouldShareYUIInstance(opts.appShareYUIInstance, this.instance);
this.shareYUIInstance = false;
Y.mojito.util.shouldShareYUIInstance(opts.appShareYUIInstance, this.instance);
this.init();
}

Expand All @@ -27,7 +28,8 @@ YUI.add('mojito-controller-context', function(Y, NAME) {

init: function() {

var c = this.Y.mojito.controllers[this.instance['controller-module']];
var c = this.Y.mojito.controllers[this.instance['controller-module']],
controller;

controller = this.controller = Y.mojito.util.heir(c);

Expand All @@ -37,6 +39,7 @@ YUI.add('mojito-controller-context', function(Y, NAME) {

return; // << RIC

/*
var error,
// Not really an instance...more like constructor options...see
// controller.init() call below.
Expand Down Expand Up @@ -111,6 +114,7 @@ YUI.add('mojito-controller-context', function(Y, NAME) {
this.models[modelName] = modelInstance;
}
}, this);
*/
},


Expand Down Expand Up @@ -138,6 +142,7 @@ YUI.add('mojito-controller-context', function(Y, NAME) {

return; // << RIC

/*
var instance = this.instance,
config = command.instance.config,
// this is the action that will be executed
Expand Down Expand Up @@ -199,6 +204,7 @@ YUI.add('mojito-controller-context', function(Y, NAME) {
}

this.Y.mojito.perf.mark('mojito', 'core_dispatch_end', 'invoked action', perfID);
*/
}
};

Expand Down
5 changes: 2 additions & 3 deletions lib/app/autoload/dispatch.common.js
Expand Up @@ -28,7 +28,8 @@ YUI.add('mojito-dispatcher', function(Y, NAME) {
coreYuiModules = [],
usePrecomputed,
useOnDemand,
appShareYUIInstance;
appShareYUIInstance,
yuiOnce = YUI();

/* Optimization methods:

Expand Down Expand Up @@ -68,8 +69,6 @@ YUI.add('mojito-dispatcher', function(Y, NAME) {
place to see if it provides benefits.
*/

var yuiOnce = YUI();

/* See docs for the dispatch function in action-context.common.js */
function dispatch(command, adapter) {

Expand Down
2 changes: 1 addition & 1 deletion lib/app/autoload/perf.server.js
Expand Up @@ -5,7 +5,7 @@
*/


/*jslint anon:true, sloppy:true, nomen:true*/
/*jslint anon:true, sloppy:true, nomen:true, stupid:true*/
/*global YUI,require,process*/
YUI.add('mojito-perf', function (Y, NAME) {

Expand Down
11 changes: 9 additions & 2 deletions lib/app/commands/build.js
Expand Up @@ -71,7 +71,8 @@ exports.run = function(params, options, callback) {
cwd = process.cwd(),
destination,
appConfig,
config = {};
config = {},
context = {};

Y.applyConfig({
useSync: true,
Expand All @@ -84,11 +85,17 @@ exports.run = function(params, options, callback) {
}
}
});

if (typeof options.context === 'string') {
// Parse the context into an object
context = utils.contextCsvToObject(options.context);
}

Y.use('mojito-util', 'mojito-resource-store');
Y.applyConfig({useSync: false});
store = new Y.mojito.ResourceStore({
root: cwd,
context: {}
context: context
});

if (!params[0]) {
Expand Down
3 changes: 3 additions & 0 deletions lib/dimensions.json
Expand Up @@ -99,6 +99,9 @@
"fr-FR": null,
"fr-GF": null
},
"hi": {
"hi-IN": null
},
"hu": {
"hu-HU": null
},
Expand Down
5 changes: 3 additions & 2 deletions lib/index.js
Expand Up @@ -103,7 +103,8 @@ MojitoServer.prototype = {
hasMojito,
midConfig,
dispatcher,
perfConfig;
perfConfig,
ric_dispatcher;

if (!options) {
options = {};
Expand Down Expand Up @@ -254,7 +255,7 @@ MojitoServer.prototype = {
};

// Pass the "Resource Store" by wrapping it with the adapter
var ric_dispatcher = Y.mojito.Dispatcher.init(
ric_dispatcher = Y.mojito.Dispatcher.init(
Y.mojito.ResourceStoreAdapter.init('server', store, logger),
CORE_YUI_MODULES,
logger,
Expand Down
10 changes: 7 additions & 3 deletions lib/store.server.js
Expand Up @@ -227,6 +227,7 @@ YUI.add('mojito-resource-store', function(Y, NAME) {
// << RIC
return true;

/*
var k,
parts,
p,
Expand Down Expand Up @@ -266,6 +267,7 @@ YUI.add('mojito-resource-store', function(Y, NAME) {
}
}
return true;
*/
},


Expand Down Expand Up @@ -306,7 +308,7 @@ YUI.add('mojito-resource-store', function(Y, NAME) {
* @return {object} the application configuration contextualized by the "ctx" argument.
*/
getAppConfig: function(ctx) {
var appConfig,
var appConfig,
key,
ycb;

Expand Down Expand Up @@ -1450,7 +1452,9 @@ YUI.add('mojito-resource-store', function(Y, NAME) {
// The base will need to carry its ID with it.
spec.id = spec.base;
appConfig = this.getAppConfig(ctx);
base = appConfig.specs[spec.base];

// appConfig.specs might be undefined, for example in newly created apps
base = appConfig.specs && appConfig.specs[spec.base];

if (!base) {
// look in resources
Expand All @@ -1463,7 +1467,7 @@ YUI.add('mojito-resource-store', function(Y, NAME) {
}
}
if (!base) {
throw new Error('Unknown base of "' + spec.base + '"');
throw new Error('Unknown base "' + spec.base + '". You should have configured "' + spec.base + '" in application.json under specs or used "@' + spec.base + '" if you wanted to specify a mojit name.');
}

delete spec.base;
Expand Down
2 changes: 1 addition & 1 deletion lib/tests/autoload/store.server-tests.js
Expand Up @@ -300,7 +300,7 @@ YUI.add('mojito-store-server-tests', function(Y, NAME) {
var spec = { base: 'nonexistant' };
store.expandInstance(spec, {}, function(err, instance) {
A.isNotUndefined(err);
A.areSame('Unknown base of "nonexistant"', err.message);
A.areSame('Unknown base "nonexistant". You should have configured "nonexistant" in application.json under specs or used "@nonexistant" if you wanted to specify a mojit name.', err.message);
A.isUndefined(instance);
});
},
Expand Down
14 changes: 6 additions & 8 deletions package.json
@@ -1,6 +1,6 @@
{
"name": "mojito",
"version": "0.4.3",
"version": "0.4.4",
"description": "Mojito provides an architecture, components and tools for developers to build complex web applications faster.",
"preferGlobal": true,
"author": "Drew Folta <folta@yahoo-inc.com>",
Expand Down Expand Up @@ -44,10 +44,12 @@
"mojito": "bin/mojito"
},
"engines": {
"node": ">= 0.4.0 < 0.7.0",
"npm": ">= 1.0.0"
"node": ">0.4",
"npm": ">1.0"
},
"devDependencies": {
"node-static": "~0.6.1",
"yahoo-arrow": "~0.0.58"
},
"homepage": "http://developer.yahoo.com/cocktails/mojito/",
"repository": {
Expand All @@ -57,13 +59,9 @@
"bugs": "https://github.com/yahoo/mojito/issues",
"scripts": {
"start": "./bin/mojito start",
"test": "./bin/mojito jslint -p && ./bin/mojito test"
"test": "./tests/run.js test -u --group server --driver nodejs && ./tests/run.js test -u --group client --driver selenium"
},
"yahoo": {
"bugzilla": {
"product": "Mojito",
"component": "General"
},
"mojito": {
"type": "bundle",
"location": "lib/app"
Expand Down