mirror of
https://github.com/meteor/meteor.git
synced 2026-05-02 03:01:46 -04:00
Merge branch 'devel' into 0.9.4-second-preview
This commit is contained in:
@@ -21,7 +21,7 @@
|
||||
}
|
||||
</script>
|
||||
|
||||
<script type="text/javascript" src="cordova.js"></script>
|
||||
<script type="text/javascript" src="/cordova.js"></script>
|
||||
{{#each js}} <script type="text/javascript" src="{{../bundledJsCssPrefix}}{{url}}"></script>
|
||||
{{/each}}
|
||||
{{#each additionalStaticJs}}
|
||||
|
||||
@@ -68,5 +68,5 @@ Package.on_use(function(api) {
|
||||
|
||||
Cordova.depends({
|
||||
'org.apache.cordova.device': '0.2.11',
|
||||
'com.meteor.cordova-update': 'https://github.com/meteor/com.meteor.cordova-update/tarball/c3c3192ca318105c7aca6627a42e9a4b0ffb1f36'
|
||||
'com.meteor.cordova-update': 'https://github.com/meteor/com.meteor.cordova-update/tarball/92fe99b7248075318f6446b288995d4381d24cd2'
|
||||
});
|
||||
|
||||
@@ -2226,7 +2226,7 @@ main.registerCommand({
|
||||
if (args.length) {
|
||||
var arg = args[0];
|
||||
if (arg == "adb") {
|
||||
Android.runAdb(args.slice(1), { pipeOutput: true, detached: true, stdio: ['inherit', 'inherit', 'inherit']});
|
||||
Android.runAdb(args.slice(1), { pipeOutput: true, detached: true, stdio: 'inherit' });
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -256,7 +256,7 @@ function doRunCommand (options) {
|
||||
}
|
||||
|
||||
// If we are targeting the remote devices, warn about ports and same network
|
||||
if (_.intersection(options.args, ['ios-device', 'android-device']).length) {
|
||||
if (utils.runOnDevice(options)) {
|
||||
cordova.verboseLog('A run on a device requested');
|
||||
var warning = [
|
||||
"WARNING: You are testing your app on a remote device.",
|
||||
|
||||
@@ -49,6 +49,7 @@ _.extend(RunCommand.prototype, {
|
||||
});
|
||||
|
||||
self.process.on('error', function (err) {
|
||||
Console.debug("Error while running command", err);
|
||||
self.exitError = err;
|
||||
self.exitFuture.isResolved() || self.exitFuture['throw'](err);
|
||||
});
|
||||
|
||||
@@ -127,14 +127,34 @@ selftest.define("parse url", function () {
|
||||
});
|
||||
|
||||
selftest.define('get mobile server argument for meteor run', function () {
|
||||
// meteor run -p 3000 => mobile server should be <detected ip>:3000
|
||||
// on emulator
|
||||
|
||||
// meteor run -p 3000
|
||||
// => mobile server should be localhost:3000
|
||||
selftest.expectEqual(utils.mobileServerForRun({
|
||||
port: "3000"
|
||||
}), { host: utils.ipAddress(), port: "3000", protocol: "http://" });
|
||||
}), { host: "localhost", port: "3000", protocol: "http://" });
|
||||
|
||||
// meteor run -p example.com:3000 => mobile server should be <detected ip>:3000
|
||||
// meteor run -p example.com:3000
|
||||
// => mobile server should be localhost:3000
|
||||
selftest.expectEqual(utils.mobileServerForRun({
|
||||
port: "example.com:3000"
|
||||
}), { host: "localhost", port: "3000", protocol: "http://" });
|
||||
|
||||
// on device
|
||||
|
||||
// meteor run -p 3000 on device
|
||||
// => mobile server should be <detected ip>:3000
|
||||
selftest.expectEqual(utils.mobileServerForRun({
|
||||
port: "3000",
|
||||
args: ["ios-device"]
|
||||
}), { host: utils.ipAddress(), port: "3000", protocol: "http://" });
|
||||
|
||||
// meteor run -p example.com:3000 on device
|
||||
// => mobile server should be <detected ip>:3000
|
||||
selftest.expectEqual(utils.mobileServerForRun({
|
||||
port: "example.com:3000",
|
||||
args: ["android-device"]
|
||||
}), { host: utils.ipAddress(), port: "3000", protocol: "http://" });
|
||||
|
||||
// meteor run -p example.com:3000 --mobile-server 4000 => error, mobile
|
||||
|
||||
@@ -638,6 +638,12 @@ _.extend(exports.Patience.prototype, {
|
||||
}
|
||||
});
|
||||
|
||||
// Are we running on device?
|
||||
exports.runOnDevice = function (options) {
|
||||
return !! _.intersection(options.args,
|
||||
['ios-device', 'android-device']).length;
|
||||
};
|
||||
|
||||
// Given the options for a 'meteor run' command, returns a parsed URL ({
|
||||
// host: *, protocol: *, port: * }. The rules for --mobile-server are:
|
||||
// * If you don't specify anything for --mobile-server, then it
|
||||
@@ -645,6 +651,12 @@ _.extend(exports.Patience.prototype, {
|
||||
// * If you specify something for --mobile-server, we use that,
|
||||
// defaulting to http:// as the protocol and 80 or 443 as the port.
|
||||
exports.mobileServerForRun = function (options) {
|
||||
// we want to do different IP generation depending on whether we
|
||||
// are running for a device or simulator
|
||||
options = _.extend({}, options, {
|
||||
runOnDevice: exports.runOnDevice(options)
|
||||
});
|
||||
|
||||
var parsedUrl = parseUrl(options.port);
|
||||
if (! parsedUrl.port) {
|
||||
throw new Error("--port must include a port.");
|
||||
@@ -652,9 +664,26 @@ exports.mobileServerForRun = function (options) {
|
||||
|
||||
// XXX COMPAT WITH 0.9.2.2 -- the 'mobile-port' option is deprecated
|
||||
var mobileServer = options["mobile-server"] || options["mobile-port"];
|
||||
var parsedMobileServer;
|
||||
|
||||
if (! mobileServer) {
|
||||
|
||||
// if we specified a mobile server, use that
|
||||
|
||||
if (mobileServer) {
|
||||
var parsedMobileServer = parseUrl(mobileServer, {
|
||||
protocol: "http://"
|
||||
});
|
||||
|
||||
if (! parsedMobileServer.host) {
|
||||
throw new Error("--mobile-server must specify a hostname.");
|
||||
}
|
||||
|
||||
return parsedMobileServer;
|
||||
}
|
||||
|
||||
|
||||
// if we are running on a device, use the auto-detected IP
|
||||
|
||||
if (options.runOnDevice) {
|
||||
var myIp = ipAddress();
|
||||
if (! myIp) {
|
||||
throw new Error(
|
||||
@@ -663,20 +692,19 @@ exports.mobileServerForRun = function (options) {
|
||||
"to with --mobile-server.");
|
||||
}
|
||||
|
||||
parsedMobileServer = {
|
||||
return {
|
||||
host: myIp,
|
||||
port: parsedUrl.port,
|
||||
protocol: "http://"
|
||||
};
|
||||
} else {
|
||||
parsedMobileServer = parseUrl(mobileServer, {
|
||||
protocol: "http://"
|
||||
});
|
||||
|
||||
if (! parsedMobileServer.host) {
|
||||
throw new Error("--mobile-server must specify a hostname.");
|
||||
}
|
||||
}
|
||||
|
||||
return parsedMobileServer;
|
||||
|
||||
// we are running a simulator, use localhost:3000
|
||||
|
||||
return {
|
||||
host: "localhost",
|
||||
port: parsedUrl.port,
|
||||
protocol: "http://"
|
||||
};
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user