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

Commit

Permalink
build/create changes
Browse files Browse the repository at this point in the history
  • Loading branch information
Isao Yagi committed Oct 18, 2012
1 parent 9741de3 commit f2dcaa1
Show file tree
Hide file tree
Showing 6 changed files with 138 additions and 153 deletions.
File renamed without changes.
33 changes: 20 additions & 13 deletions lib/app/commands/build/index.js
@@ -1,22 +1,18 @@
/*jslint sloppy:true, stupid:true, node:true */
// see lib/management/cli.js and lib/app/commands/build.js
// this module normalizes input/options and invokes buildhtml5app

var path = require('path'),
//get path/to/mojito this way in case this is symlinked/`npm link`ed
BASE = module.parent.id.replace('lib/management/cli.js', '') || '',
BASE = path.resolve(__dirname, '../../../../') + '/',
CWD = process.cwd(),
writer = require('./lib/writer'),
writer = require('./writer'),
util = require(BASE + 'lib/management/utils'),
M = require(BASE + 'lib/mojito'),
Y = require('./lib/yuiuse')({
Y = require('./yuiuse')({
'escape': null,
'json-parse': null,
'json-stringify': null,
'mojito-util': BASE + 'lib/app/autoload/util.common.js',
'mojito-resource-store': BASE + 'lib/store.server.js'
}, BASE + 'node_modules/yui');// omit 2nd param if yuiuse moves in core

});

/**
* normalize mojito application configuration object properties
Expand Down Expand Up @@ -65,10 +61,20 @@ function run(args, opts, cb) {
context,
appconf,
builddir,
buildtype = args[0] || 'html5app';
buildtype = (args[0] + '').toLowerCase();

switch (buildtype) {
case 'html5app':
case 'hybridapp':
break;
case 'undefined':
die('Missing type');
default:
die('Invalid type');
}

if (!util.isMojitoApp(CWD)) {
return cb('Error: This is not a Mojito directory');
die('Not a Mojito directory');
}

context = typeof opts.context === 'string' ? csvctx(opts.context) : {};
Expand All @@ -92,6 +98,7 @@ function run(args, opts, cb) {
"packages": packages
},
str = JSON.stringify(data, null, 4);

beforeWrite(builddir + '/snapshot.json', str);
}

Expand All @@ -100,7 +107,7 @@ function run(args, opts, cb) {
return die('Error removing ' + builddir + "\n" + err);
}

var Build = require('./lib/' + buildtype),
var Build = require('./' + buildtype),
build = new Build(appconf, buildtype, context, store);

build.on('snapshot', makeSnapshot)
Expand Down Expand Up @@ -128,11 +135,11 @@ module.exports = {
usage: [
'mojito build {type} [destination]',
'',
'type: "html5app" is the only current type',
'type: "html5app" or "hybridapp"',
'destination: (optional) the directory where the build output goes.',
' By default this is the type i.e. "./artifacts/builds/<type>"',
'',
'OPTIONS: ',
'OPTIONS:',
' --replace: Tells the build system to delete the destination directory and replace it.',
' -r: Short for --replace',
' --context: Tells the build system what context to build with i.e. device=iphone&lang=en-GB.',
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 comments on commit f2dcaa1

Please sign in to comment.