Skip to content

Commit

Permalink
Merge pull request #42 from euforic/TIMOB-14636
Browse files Browse the repository at this point in the history
TIMOB-14636 LiveView: 'alloy compile' command is used to recompile the Alloy code without specifying the platform
  • Loading branch information
Christian Sullivan committed Jul 25, 2013
2 parents 4667cfd + bd05173 commit 279acde
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 6 deletions.
3 changes: 2 additions & 1 deletion bin/liveview-run
Expand Up @@ -16,7 +16,8 @@ program.Command.prototype.unknownOption = function(){};

// usage

program.usage('run [options]');
program
.usage('run [options]');

// examples

Expand Down
3 changes: 2 additions & 1 deletion bin/liveview-server
Expand Up @@ -13,7 +13,8 @@ program
program
.option('-p, --project-dir [path]', 'path to project')
.option('-d, --daemonize', 'server as background daemon')
.option('--no-colors', 'disable cli coloring');
.option('--no-colors', 'disable cli coloring')
.option('--platform [platform]', 'build platform *required for alloy compiles');

// sub-command help

Expand Down
4 changes: 2 additions & 2 deletions hook/lvhook.js
Expand Up @@ -194,8 +194,8 @@ exports.init = function(logger, config, cli) {
var cmdOpts = [
binDIR,
'start',
'--project-dir',
cli.argv['project-dir']
'--project-dir', cli.argv['project-dir'],
'--platform', cli.argv['platform']
];

if (!cli.argv.colors) { cmdOpts.push('--no-colors'); }
Expand Down
7 changes: 5 additions & 2 deletions lib/fserver.js
Expand Up @@ -107,7 +107,9 @@ FServer.stop = function (env) {
*/

FServer.start = function(opts) {

opts = opts || {};
debug('Liveview File Server Opts', opts);

debug('Running PIDS:', FServer.pids());
console.log('[LiveView]'.green, 'version', pkgConf.version);
Expand All @@ -126,6 +128,7 @@ FServer.start = function(opts) {
var ALLOY_DIR = join(PROJECT_DIR, 'app');
var isBuilding = false;
var fileCount = {};
var PLATFORM = opts.platform;

if (!fs.existsSync(RESOURCE_DIR) || !fs.existsSync(join(PROJECT_DIR, 'tiapp.xml'))) {
console.error('[LiveView]'.red, 'Project directory "' + PROJECT_DIR + '" is not a valid Titanium project.\n');
Expand Down Expand Up @@ -288,8 +291,8 @@ FServer.start = function(opts) {
alloyWatcher.on('change', function (file) {
if (isBuilding) { return console.log('[LiveView]'.green, 'File changes ignored while Alloy compiling')}
isBuilding = true;
console.log('[LiveView]'.green, 'Alloy recompile initiated');
exec('alloy compile', {silent: true}, function (code, error) {
console.log('[LiveView]'.green, 'Alloy recompile initiated for', PLATFORM);
exec('alloy compile --config platform=' + PLATFORM, {silent: true}, function (code, error) {
isBuilding = false;
if(code) { return console.error('[LiveView]'.red, error); }
evtServer.emit('change', file);
Expand Down

0 comments on commit 279acde

Please sign in to comment.