This repository has been archived by the owner on Oct 30, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 214
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #643 from isao/createbuild
new archetype: mojito create app hybrid myapp new build type: mojito build hybrid path/to/packages/dir new custom archetypes: mojito create custom path/to/your/archetype mything
- Loading branch information
Showing
24 changed files
with
1,014 additions
and
669 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
[ | ||
{ | ||
"settings": [ "master" ], | ||
|
||
"appPort": {{port}}, | ||
|
||
"specs": { | ||
"frame": { | ||
"base": "top_frame" | ||
} | ||
}, | ||
|
||
"staticHandling": { | ||
"appName": "yahoo.application.{{name}}", | ||
"prefix": "yahoo.application.{{name}}" | ||
}, | ||
|
||
"builds": { | ||
"hybridapp": { | ||
"urls": ["/yahoo.application.{{name}}/index.html"] | ||
} | ||
}, | ||
|
||
"yui": { | ||
"dependencyCalculations": "precomputed+ondemand", | ||
"base": "/yahoo.libs.yui/", | ||
"url": "$$yui.base$$yui/yui-min.js", | ||
"loader": "loader/loader-min.js" | ||
} | ||
} | ||
] |
Binary file not shown.
57 changes: 57 additions & 0 deletions
57
lib/app/archetypes/app/hybrid/mojits/top_frame/binders/index.js.hb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
/* | ||
* Copyright (c) 2012 Yahoo! Inc. All rights reserved. | ||
*/ | ||
/*jslint anon:true, sloppy:true, nomen:true*/ | ||
YUI.add('top_frameBinderIndex', function(Y, NAME) { | ||
|
||
/** | ||
* The top_frameBinderIndex module. | ||
* | ||
* @module top_frameBinderIndex | ||
*/ | ||
|
||
/** | ||
* Constructor for the top_frameBinderIndex class. | ||
* | ||
* @class top_frameBinderIndex | ||
* @constructor | ||
*/ | ||
Y.namespace('mojito.binders')[NAME] = { | ||
|
||
/** | ||
* Binder initialization method, invoked after all binders on the page | ||
* have been constructed. | ||
*/ | ||
init: function(mojitProxy) { | ||
this.mojitProxy = mojitProxy; | ||
}, | ||
|
||
/** | ||
* The binder method, invoked to allow the mojit to attach DOM event | ||
* handlers. | ||
* | ||
* @param node {Node} The DOM node to which this mojit is attached. | ||
*/ | ||
bind: function(node) { | ||
var me = this; | ||
this.node = node; | ||
/** | ||
* Example code for the bind method: | ||
* | ||
* node.all('dt').on('mouseenter', function(evt) { | ||
* var dd = '#dd_' + evt.target.get('text'); | ||
* me.node.one(dd).addClass('sel'); | ||
* | ||
* }); | ||
* node.all('dt').on('mouseleave', function(evt) { | ||
* | ||
* var dd = '#dd_' + evt.target.get('text'); | ||
* me.node.one(dd).removeClass('sel'); | ||
* | ||
* }); | ||
*/ | ||
} | ||
|
||
}; | ||
|
||
}, '0.0.1', {requires: ['event-mouseenter', 'mojito-client']}); |
46 changes: 46 additions & 0 deletions
46
lib/app/archetypes/app/hybrid/mojits/top_frame/controller.server.js.hb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
/* | ||
* Copyright (c) 2012 Yahoo! Inc. All rights reserved. | ||
*/ | ||
/*jslint anon:true, sloppy:true, nomen:true*/ | ||
YUI.add('top_frame', function(Y, NAME) { | ||
|
||
/** | ||
* The top_frame module. | ||
* | ||
* @module top_frame | ||
*/ | ||
|
||
/** | ||
* Constructor for the Controller class. | ||
* | ||
* @class Controller | ||
* @constructor | ||
*/ | ||
Y.namespace('mojito.controllers')[NAME] = { | ||
|
||
init: function(config) { | ||
this.config = config; | ||
}, | ||
|
||
/** | ||
* Method corresponding to the 'index' action. | ||
* | ||
* @param ac {Object} The ActionContext that provides access | ||
* to the Mojito API. | ||
*/ | ||
index: function(ac) { | ||
ac.models.top_frameModelFoo.getData(function(err, data) { | ||
if (err) { | ||
return ac.error(err); | ||
} | ||
|
||
ac.done({ | ||
status: 'Mojito is working.', | ||
data: data | ||
}); | ||
}); | ||
} | ||
|
||
}; | ||
|
||
}, '0.0.1', {requires: ['mojito', 'top_frameModelFoo']}); |
5 changes: 5 additions & 0 deletions
5
lib/app/archetypes/app/hybrid/mojits/top_frame/definition.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
[ | ||
{ | ||
"settings": [ "master" ] | ||
} | ||
] |
37 changes: 37 additions & 0 deletions
37
lib/app/archetypes/app/hybrid/mojits/top_frame/models/foo.server.js.hb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
/* | ||
* Copyright (c) 2012 Yahoo! Inc. All rights reserved. | ||
*/ | ||
/*jslint anon:true, sloppy:true, nomen:true*/ | ||
YUI.add('top_frameModelFoo', function(Y, NAME) { | ||
|
||
/** | ||
* The top_frameModelFoo module. | ||
* | ||
* @module top_frame | ||
*/ | ||
|
||
/** | ||
* Constructor for the top_frameModelFoo class. | ||
* | ||
* @class top_frameModelFoo | ||
* @constructor | ||
*/ | ||
Y.namespace('mojito.models')[NAME] = { | ||
|
||
init: function(config) { | ||
this.config = config; | ||
}, | ||
|
||
/** | ||
* Method that will be invoked by the mojit controller to obtain data. | ||
* | ||
* @param callback {function(err,data)} The callback function to call when the | ||
* data has been retrieved. | ||
*/ | ||
getData: function(callback) { | ||
callback(null, { some: 'data' }); | ||
} | ||
|
||
}; | ||
|
||
}, '0.0.1', {requires: []}); |
23 changes: 23 additions & 0 deletions
23
lib/app/archetypes/app/hybrid/mojits/top_frame/package.json.hb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
{ | ||
"name": "top_frame", | ||
"version": "0.0.1", | ||
"pkg_type": "frame", | ||
"description": "The {{name}} application's top frame (HTMLFrameMojit)", | ||
"engines": { | ||
"node": ">0.6", | ||
"npm": ">1.0", | ||
"mojito": ">0.4" | ||
}, | ||
"maintainers": [ | ||
{ | ||
"email": "[email protected]", | ||
"name": "Your Name" | ||
} | ||
], | ||
"yahoo": { | ||
"mojito": { | ||
"package": "public", | ||
"version": ">0.4" | ||
} | ||
} | ||
} |
19 changes: 19 additions & 0 deletions
19
lib/app/archetypes/app/hybrid/mojits/top_frame/specs/default.json.hb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
[ | ||
{ | ||
"settings": [ "master" ], | ||
|
||
"type": "HTMLFrameMojit", | ||
"config": { | ||
"deploy": true, | ||
"title": "{{name}} App", | ||
"child": { | ||
"type": "top_frame" | ||
}, | ||
"assets": { | ||
"bottom": { | ||
"js": ["/yahoo.crt.lib/yui-cfg.js"] | ||
} | ||
} | ||
} | ||
} | ||
] |
62 changes: 62 additions & 0 deletions
62
lib/app/archetypes/app/hybrid/mojits/top_frame/tests/controller.server-tests.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
/* | ||
* Copyright (c) 2012 Yahoo! Inc. All rights reserved. | ||
*/ | ||
|
||
YUI.add('top_frame-tests', function(Y) { | ||
|
||
var suite = new YUITest.TestSuite('top_frame-tests'), | ||
controller = null, | ||
A = YUITest.Assert; | ||
|
||
suite.add(new YUITest.TestCase({ | ||
|
||
name: 'top_frame user tests', | ||
|
||
setUp: function() { | ||
controller = Y.mojito.controllers.top_frame; | ||
}, | ||
tearDown: function() { | ||
controller = null; | ||
}, | ||
|
||
'test mojit': function() { | ||
var ac, | ||
modelData, | ||
assetsResults, | ||
doneResults; | ||
modelData = { x:'y' }; | ||
ac = { | ||
assets: { | ||
addCss: function(css) { | ||
assetsResults = css; | ||
} | ||
}, | ||
models: { | ||
top_frameModelFoo: { | ||
getData: function(cb) { | ||
cb(null, modelData); | ||
} | ||
} | ||
}, | ||
done: function(data) { | ||
doneResults = data; | ||
} | ||
}; | ||
|
||
A.isNotNull(controller); | ||
A.isFunction(controller.index); | ||
controller.index(ac); | ||
A.areSame('./index.css', assetsResults); | ||
A.isObject(doneResults); | ||
A.areSame('Mojito is working.', doneResults.status); | ||
A.isObject(doneResults.data); | ||
A.isTrue(doneResults.data.hasOwnProperty('x')); | ||
A.areEqual('y', doneResults.data['x']); | ||
|
||
} | ||
|
||
})); | ||
|
||
YUITest.TestRunner.add(suite); | ||
|
||
}, '0.0.1', {requires: ['mojito-test', 'top_frame']}); |
39 changes: 39 additions & 0 deletions
39
lib/app/archetypes/app/hybrid/mojits/top_frame/tests/models/model.server-tests.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
/* | ||
* Copyright (c) 2012 Yahoo! Inc. All rights reserved. | ||
*/ | ||
|
||
YUI.add('top_frameModelFoo-tests', function(Y, NAME) { | ||
|
||
var suite = new YUITest.TestSuite(NAME), | ||
model = null, | ||
A = YUITest.Assert; | ||
|
||
suite.add(new YUITest.TestCase({ | ||
|
||
name: 'top_frameModelFoo user tests', | ||
|
||
setUp: function() { | ||
model = Y.mojito.models.top_frameModelFoo; | ||
}, | ||
tearDown: function() { | ||
model = null; | ||
}, | ||
|
||
'test mojit model': function() { | ||
var called = false; | ||
A.isNotNull(model); | ||
A.isFunction(model.getData); | ||
model.getData(function(err, data) { | ||
called = true; | ||
A.isTrue(!err); | ||
A.isObject(data); | ||
A.areSame('data', data.some); | ||
}); | ||
A.isTrue(called); | ||
} | ||
|
||
})); | ||
|
||
YUITest.TestRunner.add(suite); | ||
|
||
}, '0.0.1', {requires: ['mojito-test', 'top_frameModelFoo']}); |
10 changes: 10 additions & 0 deletions
10
lib/app/archetypes/app/hybrid/mojits/top_frame/views/index.hb.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<div id="{{mojit_view_id}}"> | ||
<dl> | ||
<dt>status</dt> | ||
<dd id="dd_status">{{status}}</dd> | ||
<dt>data</dt> | ||
<dd id="dd_data"> | ||
<b>some:</b> {{#data}}{{some}}{{/data}} | ||
</dd> | ||
</dl> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
{ | ||
"name": "yahoo.application.{{name}}", | ||
"author": "Your Name <[email protected]>", | ||
"description": "This application's main package: yahoo.application.{{name}}", | ||
"version": "0.0.1", | ||
"type": "application", | ||
"pkg_type": "application", | ||
"dependencies": { | ||
"mojito": ">0.4", | ||
"yahoo.libs.yui": "*" | ||
}, | ||
"engines": { | ||
"node": ">0.6", | ||
"npm": ">1.0", | ||
"mojito": ">0.4" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
[ | ||
{ | ||
"settings": [ "master" ], | ||
|
||
"root": { | ||
"verbs": ["get"], | ||
"path": "/", | ||
"call": "frame.index" | ||
}, | ||
|
||
"yahoo.application.{{name}}": { | ||
"verbs": ["get"], | ||
"path": "/yahoo.application.{{name}}/index.html", | ||
"call": "frame.index" | ||
}, | ||
|
||
"any mojit/action": { | ||
"verbs": [ "GET" ], | ||
"path": "/:module/:action", | ||
"call": "{module}.{action}" | ||
} | ||
} | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
/* | ||
* Copyright (c) 2011-2012, Yahoo! Inc. All rights reserved. | ||
* Copyrights licensed under the New BSD License. | ||
* See the accompanying LICENSE file for terms. | ||
*/ | ||
|
||
|
||
/*jslint anon:true, sloppy:true*/ | ||
|
||
|
||
/** | ||
* Create and start a new Mojito server/application. | ||
*/ | ||
var Mojito = require('mojito'); | ||
var app = Mojito.createServer(); | ||
|
||
module.exports = app.start(); |
Oops, something went wrong.