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

Commit

Permalink
Initial reorganization of files, objects, and apis.
Browse files Browse the repository at this point in the history
  • Loading branch information
mojit0 committed Aug 21, 2012
1 parent bc87b17 commit c2194f5
Show file tree
Hide file tree
Showing 7 changed files with 21 additions and 487 deletions.
14 changes: 14 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
/*
* Copyright (c) 2011-2012, Yahoo! Inc. All rights reserved.
* Copyrights licensed under the New BSD License.
* See the accompanying LICENSE file for terms.
*/

/*
* By convention many node.js applications use an index.js file so we support
* that convention. In Mojito, index.js is referenced as "main" in package.json
* which means it stands in for "require('mojito')". Our goal is to redirect
* the require() to the proper location of the Mojito app/server baseline and to
* ensure whatever they export is exported to our callers.
*/
module.exports = require('./lib/mojito');
3 changes: 2 additions & 1 deletion lib/app/commands/build.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

var libpath = require('path'),
utils = require(libpath.join(__dirname, '../../management/utils')),
Mojito = require(libpath.join(__dirname, '../../mojito')),
fs = require('fs'),
libqs = require('querystring'),
MODE_755 = parseInt('755', 8),
Expand Down Expand Up @@ -463,7 +464,7 @@ writeWebPagesToFiles = function(type, store, destination, urls, config,
context: config.context
};

app = new utils.App(options);
app = Mojito.createApp(options);

app.start(function(err) {
var got = 0,
Expand Down
5 changes: 3 additions & 2 deletions lib/app/commands/compile.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ var libpath = require('path'),
libfs = require('fs'),
existsSync = libfs.existsSync || libpath.existsSync,
libutils = require(libpath.join(__dirname, '../../management/utils')),
Mojito = require(libpath.join(__dirname, '../../mojito')),

// private compilation function container
compile = {},
Expand Down Expand Up @@ -320,7 +321,7 @@ compile.inlinecss = function(context, options, callback) {
inlines,
inlineNext;

app = new libutils.App({
app = Mojito.createApp({
port: options.port || 11111,
verbose: options.verbose
});
Expand Down Expand Up @@ -749,7 +750,7 @@ compile.views = function(context, options, callback) {
compile.json = function(context, options, callback) {
var cwd = process.cwd(),
store = makeStore({root: cwd}),
app = new libutils.App({
app = Mojito.createApp({
port: options.port || 11111,
verbose: options.verbose,
appConfig: {
Expand Down
3 changes: 2 additions & 1 deletion lib/app/commands/start.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

var path = require('path'),
utils = require(path.join(__dirname, '../../management/utils')),
Mojito = require(path.join(__dirname, '../mojito')),
fs = require('fs'),
Y = require('yui').YUI({useSync: true}).use('json-parse', 'json-stringify');

Expand Down Expand Up @@ -78,7 +79,7 @@ exports.run = function(params, opts, callback) {
options.context = utils.contextCsvToObject(inputOptions.context);
}

app = new utils.App(options);
app = Mojito.createApp(options);
app.start(function(err) {
if (err) {
utils.error('There was an error starting the application:\n');
Expand Down
Loading

0 comments on commit c2194f5

Please sign in to comment.