Skip to content

Commit

Permalink
add --platform, fixes #63
Browse files Browse the repository at this point in the history
  • Loading branch information
tonylukasavage committed Oct 19, 2014
1 parent ba4855a commit efbb624
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
1 change: 1 addition & 0 deletions bin/triple
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ program.description('REPL for Titanium')
.option('-m, --module <ids>', 'Add native module(s) to REPL', function list(val) {
return val.split(',');
})
.option('-p, --platform <platform>', 'mobile platform for triple')
.option('-v, --verbose', 'Enable verbose output')

program.on('--help', function(){
Expand Down
9 changes: 9 additions & 0 deletions lib/triple.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ var _ = require('lodash'),
constants = require('./constants'),
fs = require('fs-extra'),
logger = require('./logger'),
os = require('os'),
path = require('path'),
readline = require('readline'),
request = require('request'),
Expand All @@ -15,6 +16,7 @@ var _ = require('lodash'),

var TRIPLE_DIR = path.resolve(process.env.HOME || process.env.USERPROFILE || '.', '.triple');
var TRIPLE_APP = path.join(TRIPLE_DIR, 'app');
var PLATFORMS = ['android', 'ios'];

var requireRE = /\brequire\s*\(['"](([\w\.\/-]+\/)?([\w\.\/-]*))/,
simpleExpressionRE = /(([a-zA-Z_$](?:\w|\$)*)\.)*([a-zA-Z_$](?:\w|\$)*)\.?$/,
Expand All @@ -34,6 +36,13 @@ module.exports = function(opts, callback) {
logger.verbose = true;
}

// determine which platform to build
opts.platform = opts.platform || (os.platform() === 'darwin' ? 'ios' : 'android');
if (PLATFORMS.indexOf(opts.platform) === -1) {
return callback(new Error('invalid platform "' + opts.platform +
'". Must be [' + PLATFORMS.join(',') + '].'));
}

// create .triple folder
fs.ensureDirSync(TRIPLE_DIR);

Expand Down

0 comments on commit efbb624

Please sign in to comment.