cordova-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From drk...@apache.org
Subject git commit: CB-5761 ios specific changes for couchdb url
Date Fri, 10 Jan 2014 19:49:05 GMT
Updated Branches:
  refs/heads/master 8064d2ae8 -> 6e2b04fe5


CB-5761 ios specific changes for couchdb url


Project: http://git-wip-us.apache.org/repos/asf/cordova-medic/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-medic/commit/6e2b04fe
Tree: http://git-wip-us.apache.org/repos/asf/cordova-medic/tree/6e2b04fe
Diff: http://git-wip-us.apache.org/repos/asf/cordova-medic/diff/6e2b04fe

Branch: refs/heads/master
Commit: 6e2b04fe5c9a52e467d2bcf915b8882b7c409c8b
Parents: 8064d2a
Author: David Kemp <drkemp@chromium.org>
Authored: Fri Jan 10 14:47:54 2014 -0500
Committer: David Kemp <drkemp@chromium.org>
Committed: Fri Jan 10 14:47:54 2014 -0500

----------------------------------------------------------------------
 build_ios.js            |  2 +-
 src/build/makers/ios.js | 94 +++++++++++++++++++-------------------------
 2 files changed, 42 insertions(+), 54 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-medic/blob/6e2b04fe/build_ios.js
----------------------------------------------------------------------
diff --git a/build_ios.js b/build_ios.js
index 5b602f7..ecf0a90 100644
--- a/build_ios.js
+++ b/build_ios.js
@@ -22,7 +22,7 @@ buildinfo('ios', BRANCH, function (error, sha ) {
     if(error) {
                TEST_OK=false;
     } else {
-       ios(output_location, library_location,TOOL_DIR, sha,'', config.app.entry, config.couchdb.host,
function(err){
+       ios(output_location, library_location,TOOL_DIR, sha,'', config.app.entry, config.couchdb,
function(err){
            if(err) {
                console.log('iOS test prepare failed')
                TEST_OK=false;

http://git-wip-us.apache.org/repos/asf/cordova-medic/blob/6e2b04fe/src/build/makers/ios.js
----------------------------------------------------------------------
diff --git a/src/build/makers/ios.js b/src/build/makers/ios.js
index 90f24d1..f813a6f 100644
--- a/src/build/makers/ios.js
+++ b/src/build/makers/ios.js
@@ -11,12 +11,12 @@ var keychain_location = config.ios.keychainLocation;
 var keychain_password = config.ios.keychainPassword;
 
 
-module.exports = function(output,lib_location,test_dir, sha, devices, entry_point, couchdb_host,
callback) {
+module.exports = function(output,lib_location,test_dir, sha, devices, entry_point, couchdb_cfg,
callback) {
     function log(msg) {
         console.log('[IOS] ' + msg + ' (sha: ' + sha + ')');
     }
     if (keychain_location.length === 0 || keychain_password.length === 0) {
-        log('No keychain information. Fill that shit out in config.json if you want to build
for iOS.');
+        log('No keychain information. Fill that out in config.json if you want to build for
iOS.');
         callback(true);
         return;
     } else {
@@ -29,61 +29,49 @@ module.exports = function(output,lib_location,test_dir, sha, devices,
entry_poin
             callback(true);
         } else {
           log('starting iOS prepare');
-          var mspec_out = path.join(output, 'www');
-          log('Modifying Cordova Mobilespec application at:'+mspec_out);
-          mspec(mspec_out,sha,devices,entry_point, function(err){
-              if(err) {
-                  error_writer('ios', sha, 'Error  modifying mobile spec application.', '');
-                  callback(true);
-              } else {
-                    try {
-                        var projectWww = path.join(output, 'www');
-                        // drop the iOS library SHA into the junit reporter
-                        // only applies to projects that use it
-                        var tempJasmine = path.join(projectWww, 'jasmine-jsreporter.js');
-                        if (fs.existsSync(tempJasmine)) {
-                            fs.writeFileSync(tempJasmine, "var library_sha = '" + sha + "';\n"
+ fs.readFileSync(tempJasmine, 'utf-8'), 'utf-8');
-                        }
+          try {
+            var projectWww = path.join(output, 'www');
+            // add the medic configuration (sha,host) to destination folder
+            var medic_config='{"sha":"'+sha+'","couchdb":"'+couchdb_cfg.host+'","couchdbext":"'+couchdb_cfg.exthost+'"}';
+            fs.writeFileSync(path.join(output, 'www','autotest','pages', 'medic.json'),medic_config,'utf-8');
 
-                        //  modify config.xml
-                        var configFile = path.join(output, 'mobilespec', 'config.xml');
-                        fs.writeFileSync(configFile, fs.readFileSync(configFile, 'utf-8').replace(/<content\s*src=".*"/gi,
'<content src="'+entry_point+'"'), 'utf-8');
-                        // make sure the couch db server is whitelisted
-                        fs.writeFileSync(configFile, fs.readFileSync(configFile, 'utf-8').replace(/<access
origin="http:..audio.ibeat.org" *.>/gi,'<access origin="http://audio.ibeat.org" /><access
origin="'+couchdb_host+'" />', 'utf-8'));
+            //  modify config.xml
+            var configFile = path.join(output, 'mobilespec', 'config.xml');
+            fs.writeFileSync(configFile, fs.readFileSync(configFile, 'utf-8').replace(/<content\s*src=".*"/gi,
'<content src="'+entry_point+'"'), 'utf-8');
+            // make sure the couch db server is whitelisted
+            fs.writeFileSync(configFile, fs.readFileSync(configFile, 'utf-8').replace(/<access
origin="http:..audio.ibeat.org" *.>/gi,'<access origin="http://audio.ibeat.org" /><access
origin="'+couchdb_cfg.host+'" />', 'utf-8'));
 
-                        // modify configuration to Release mode, i386 to armv7 and sdk to
iphoneos6.0 so we can use it with fruitstrap
-                        // TODO: expose which target sdk to build for
-                        var debugScript = path.join(output, 'cordova', 'build');
-                        // note that the following has to work for 3.0.0 and later and it
change just AFTER 3.0.x release
-                        fs.writeFileSync(debugScript, fs.readFileSync(debugScript, 'utf-8').replace(/PROJECT_PATH\/build"/,
'PROJECT_PATH/build/device"').replace(/i386/g,'armv7').replace(/iphonesimulator/, 'iphoneos').replace(/SDK=`.*`/,
'SDK="iphoneos"'), 'utf-8');
-                    } catch(e) {
-                        error_writer('ios', sha, 'Exception thrown modifying mobile spec
application for iOS.', e.message);
-                        callback(true);
-                        return;
-                    }
-                    // compile
-                    log('Compiling.');
-                        
-                    var debug = 'cd ' + output + ' && ./cordova/build --release';
-                    var compile = shell.exec(debug, {silent:true});
-                    if (compile.code > 0) {
+            // modify configuration to Release mode, i386 to armv7 and sdk to iphoneos6.0
so we can use it with fruitstrap
+            // TODO: expose which target sdk to build for
+            var debugScript = path.join(output, 'cordova', 'build');
+            // note that the following has to work for 3.0.0 and later and it change just
AFTER 3.0.x release
+            fs.writeFileSync(debugScript, fs.readFileSync(debugScript, 'utf-8').replace(/PROJECT_PATH\/build"/,
'PROJECT_PATH/build/device"').replace(/i386/g,'armv7').replace(/iphonesimulator/, 'iphoneos').replace(/SDK=`.*`/,
'SDK="iphoneos"'), 'utf-8');
+          } catch(e) {
+            error_writer('ios', sha, 'Exception thrown modifying mobile spec application
for iOS.', e.message);
+            callback(true);
+            return;
+          }
+          // compile
+          log('Compiling.');
+
+          var debug = 'cd ' + output + ' && ./cordova/build --release';
+          var compile = shell.exec(debug, {silent:true});
+          if (compile.code > 0) {
                             error_writer('ios', sha, 'Compilation error.', compile.output);
                             callback(true);
-                    } else {
-                            // get list of connected devices
-                            scan(test_dir, function(err, devices) {
-                                if (err) {
-                                    error_writer('ios', sha, devices, 'No further details
dude.');
-                                    callback(true);
-                                } else {
-                                    var bundle = path.join(output, 'build', 'device', 'mobilespec.app'),
-                                        bundleId = 'org.apache.mobilespec';
-                                    deploy(sha, devices, bundle, bundleId, callback);
-                                }
-                            });
-                    }
-               }
-           });
+          } else {
+             // get list of connected devices
+             scan(test_dir, function(err, devices) {
+                if (err) {
+                   error_writer('ios', sha, devices, 'No further details dude.');
+                   callback(true);
+                } else {
+                   var bundle = path.join(output, 'build', 'device', 'mobilespec.app'),
+                   bundleId = 'org.apache.mobilespec';
+                   deploy(sha, devices, bundle, bundleId, callback);
+                }
+            });
+          }
         }
     }
 }


Mime
View raw message