Make changes requested by Arbesfeld, need to add tests

This commit is contained in:
Sashko Stubailo
2014-08-18 17:27:15 -07:00
parent 3753687c04
commit adfc7d1d76
3 changed files with 17 additions and 35 deletions

View File

@@ -215,6 +215,11 @@ cordova.ensureCordovaProject = function (localPath, appName) {
// Ensures that the Cordova platforms are synchronized with the app-level
// platforms.
cordova.ensureCordovaPlatforms = function (localPath) {
files.mkdir_p(localPath);
var appName = path.basename(options.appDir);
cordova.ensureCordovaProject(localPath, appName);
var cordovaPath = path.join(localPath, 'cordova-build');
var platforms = project.getCordovaPlatforms();
var platformsList = execFileSyncOrThrow(localCordova, ['platform', 'list'],
@@ -254,6 +259,11 @@ cordova.ensureCordovaPlatforms = function (localPath) {
// we bundle the app to find the required plugins.
cordova.ensureCordovaPlugins = function (localPath, options) {
files.mkdir_p(localPath);
var appName = path.basename(options.appDir);
cordova.ensureCordovaProject(localPath, appName);
options = options || {};
var plugins = options.packagePlugins;
if (! plugins) {
@@ -573,15 +583,7 @@ main.registerCommand({
if (platforms.length) {
var localPath = path.join(options.appDir, '.meteor', 'local');
files.mkdir_p(localPath);
var appName = path.basename(options.appDir);
cordova.ensureCordovaProject(localPath, appName);
// We checked the platforms above
if (platforms.length) {
cordova.ensureCordovaPlatforms(localPath);
}
cordova.ensureCordovaPlatforms(localPath);
}
_.each(platforms, function (platform) {
@@ -602,14 +604,7 @@ main.registerCommand({
if (platforms.length) {
var localPath = path.join(options.appDir, '.meteor', 'local');
files.mkdir_p(localPath);
var appName = path.basename(options.appDir);
cordova.ensureCordovaProject(localPath, appName);
if (platforms.length) {
cordova.ensureCordovaPlatforms(localPath);
}
cordova.ensureCordovaPlatforms(localPath);
}
_.each(platforms, function (platform) {

View File

@@ -1584,16 +1584,10 @@ main.registerCommand({
if (cordovaPlugins.length) {
var localPath = path.join(options.appDir, '.meteor', 'local');
files.mkdir_p(localPath);
var appName = path.basename(options.appDir);
cordova.ensureCordovaProject(localPath, appName);
// The plugins installation still can fail
try {
if (cordovaPlugins.length) {
cordova.ensureCordovaPlugins(localPath);
}
cordova.ensureCordovaPlugins(localPath);
} catch (err) {
project.removeCordovaPlugins(_.keys(project.getCordovaPlugins()));
project.addCordovaPlugins(oldPlugins);
@@ -1796,14 +1790,7 @@ main.registerCommand({
if (cordovaPlugins.length) {
var localPath = path.join(options.appDir, '.meteor', 'local');
files.mkdir_p(localPath);
var appName = path.basename(options.appDir);
cordova.ensureCordovaProject(localPath, appName);
if (cordovaPlugins.length) {
cordova.ensureCordovaPlugins(localPath);
}
cordova.ensureCordovaPlugins(localPath);
}
_.each(cordovaPlugins, function (plugin) {

View File

@@ -18,7 +18,7 @@ See 'meteor help <command>' for details on a command.
>>> run
[default] Run this project in local development mode.
Usage: meteor run [platform] [options]
Usage: meteor run [platform..] [options]
Searches upward from the current directory for the root directory of a
Meteor project, then runs that project in local development
@@ -32,7 +32,7 @@ The application's database persists between runs. It's stored under
the .meteor directory in the root of the project.
If you have added any platforms such as ios or android
using 'meteor add-platform', you can specify which platform to run your app on.
using 'meteor add-platform', you can specify which platforms to run your app on.
Options:
--port, -p Port to listen on (instead of the default 3000). Also