You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by st...@apache.org on 2013/12/06 02:13:35 UTC

[19/32] git commit: CB-5298 Remove redundant requirements check for iOS and Android. The bin/create scripts check.

CB-5298 Remove redundant requirements check for iOS and Android. The bin/create scripts check.


Project: http://git-wip-us.apache.org/repos/asf/cordova-cli/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-cli/commit/4f8bf24e
Tree: http://git-wip-us.apache.org/repos/asf/cordova-cli/tree/4f8bf24e
Diff: http://git-wip-us.apache.org/repos/asf/cordova-cli/diff/4f8bf24e

Branch: refs/heads/fireos
Commit: 4f8bf24effae0470c5a720969aa34fab2a314cac
Parents: e325e5d
Author: Andrew Grieve <ag...@chromium.org>
Authored: Wed Dec 4 21:34:29 2013 -0500
Committer: Andrew Grieve <ag...@chromium.org>
Committed: Wed Dec 4 21:34:29 2013 -0500

----------------------------------------------------------------------
 spec/metadata/android_parser.spec.js | 12 ------------
 spec/metadata/ios_parser.spec.js     | 29 -----------------------------
 src/metadata/android_parser.js       | 10 +++-------
 src/metadata/ios_parser.js           | 22 ++--------------------
 4 files changed, 5 insertions(+), 68 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/4f8bf24e/spec/metadata/android_parser.spec.js
----------------------------------------------------------------------
diff --git a/spec/metadata/android_parser.spec.js b/spec/metadata/android_parser.spec.js
index 92e15e1..52fc78a 100644
--- a/spec/metadata/android_parser.spec.js
+++ b/spec/metadata/android_parser.spec.js
@@ -70,18 +70,6 @@ describe('android project parser', function() {
         });
     });
 
-    describe('check_requirements', function() {
-        it('should fire a callback if there is an error during shelling out', function(done) {
-            exec.andCallFake(function(cmd, opts, cb) {
-                if (!cb) cb = opts;
-                cb(50, 'there was an errorz!', '');
-            });
-            errorWrapper(platforms.android.parser.check_requirements(proj), done, function(err) {
-                expect(err).toContain('there was an errorz!');
-            });
-        });
-    });
-
     describe('instance', function() {
         var p, cp, rm, mkdir, is_cordova, write, read;
         var android_proj = path.join(proj, 'platforms', 'android');

http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/4f8bf24e/spec/metadata/ios_parser.spec.js
----------------------------------------------------------------------
diff --git a/spec/metadata/ios_parser.spec.js b/spec/metadata/ios_parser.spec.js
index 5f8664d..b56ddce 100644
--- a/spec/metadata/ios_parser.spec.js
+++ b/spec/metadata/ios_parser.spec.js
@@ -71,35 +71,6 @@ describe('ios project parser', function () {
             }).not.toThrow();
         });
     });
-    describe('check_requirements', function() {
-        it('should fire a callback if there is an error during shelling out', function(done) {
-            exec.andCallFake(function(cmd, opts, cb) {
-                if (!cb) cb = opts;
-                cb(50, 'there was an errorz!', '');
-            });
-            errorWrapper(platforms.ios.parser.check_requirements(proj), done, function(err) {
-                expect(err).toContain('there was an errorz!');
-            });
-        });
-        it('should fire a callback if the xcodebuild version is less than 4.5.x', function(done) {
-            exec.andCallFake(function(cmd, opts, cb) {
-                if (!cb) cb = opts;
-                cb(0, 'version 4.4.9', '');
-            });
-            errorWrapper(platforms.ios.parser.check_requirements(proj), done, function(err) {
-                expect(err).toEqual(new Error('Xcode version installed is too old. Minimum: >=4.5.x, yours: 4.4.9'));
-            });
-        });
-        it('should not return an error if the xcodebuild version 2 digits and not proper semver (eg: 5.0), but still satisfies the MIN_XCODE_VERSION', function(done) {
-            exec.andCallFake(function(cmd, opts, cb) {
-                if (!cb) cb = opts;
-                cb(0, 'version 5.0', '');
-            });
-            wrapper(platforms.ios.parser.check_requirements(proj), done, function() {
-                expect(1).toBe(1);
-            });
-        });
-    });
 
     describe('instance', function() {
         var p, cp, rm, mkdir, is_cordova, write, read;

http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/4f8bf24e/src/metadata/android_parser.js
----------------------------------------------------------------------
diff --git a/src/metadata/android_parser.js b/src/metadata/android_parser.js
index 4ed4ef9..5878678 100644
--- a/src/metadata/android_parser.js
+++ b/src/metadata/android_parser.js
@@ -25,8 +25,7 @@ var fs            = require('fs'),
     child_process = require('child_process'),
     project_config= require('../config'),
     Q             = require('q'),
-    config_parser = require('../config_parser'),
-    lazy_load     = require('../lazy_load');
+    config_parser = require('../config_parser');
 
 var default_prefs = {
     "useBrowserHistory":"true",
@@ -45,11 +44,8 @@ module.exports = function android_parser(project) {
 
 // Returns a promise.
 module.exports.check_requirements = function(project_root) {
-    events.emit('log', 'Checking Android requirements...');
-    return lazy_load.based_on_config(project_root, 'android').then(function(lib_path) {
-        var check_reqs = require(path.join(lib_path, 'bin', 'lib', 'check_reqs'));
-        return check_reqs.run();
-    });
+    // Rely on platform's bin/create script to check requirements.
+    return Q(true);
 };
 
 module.exports.prototype = {

http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/4f8bf24e/src/metadata/ios_parser.js
----------------------------------------------------------------------
diff --git a/src/metadata/ios_parser.js b/src/metadata/ios_parser.js
index 07a5e7b..d819bf3 100644
--- a/src/metadata/ios_parser.js
+++ b/src/metadata/ios_parser.js
@@ -64,26 +64,8 @@ module.exports = function ios_parser(project) {
 
 // Returns a promise.
 module.exports.check_requirements = function(project_root) {
-    events.emit('log', 'Checking iOS requirements...');
-    // Check xcode + version.
-    var command = 'xcodebuild -version';
-    events.emit('verbose', 'Running "' + command + '" (output to follow)');
-    var d = Q.defer();
-    child_process.exec(command, function(err, output, stderr) {
-        events.emit('verbose', output+stderr);
-        if (err) {
-            d.reject(new Error('Xcode is (probably) not installed, specifically the command `xcodebuild` is unavailable or erroring out. Output of `'+command+'` is: ' + output + stderr));
-        } else {
-            var xc_version = output.split('\n')[0].split(' ')[1];
-            if(xc_version.split('.').length === 2){
-                xc_version += '.0';
-            }
-            if (!semver.satisfies(xc_version, MIN_XCODE_VERSION)) {
-                d.reject(new Error('Xcode version installed is too old. Minimum: ' + MIN_XCODE_VERSION + ', yours: ' + xc_version));
-            } else d.resolve();
-        }
-    });
-    return d.promise;
+    // Rely on platform's bin/create script to check requirements.
+    return Q(true);
 };
 
 module.exports.prototype = {