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 2014/08/30 01:58:59 UTC

[1/7] js commit: CB-870 android: Add volume button event support

Repository: cordova-js
Updated Branches:
  refs/heads/cb-7219 4257eb2e2 -> c33a8ef70


CB-870 android: Add volume button event support

github: close #72


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

Branch: refs/heads/cb-7219
Commit: ff0358bf34b2e16820163fec21f6ff098094ac8f
Parents: 13b556e
Author: schettino72 <sc...@gmail.com>
Authored: Thu Jul 10 16:14:20 2014 +0800
Committer: Andrew Grieve <ag...@chromium.org>
Committed: Tue Aug 12 16:37:18 2014 -0400

----------------------------------------------------------------------
 src/android/platform.js           | 11 +++++++++++
 src/android/plugin/android/app.js | 15 +++++++++++++++
 2 files changed, 26 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-js/blob/ff0358bf/src/android/platform.js
----------------------------------------------------------------------
diff --git a/src/android/platform.js b/src/android/platform.js
index c6def3f..4d613c3 100644
--- a/src/android/platform.js
+++ b/src/android/platform.js
@@ -45,6 +45,17 @@ module.exports = {
         cordova.addDocumentEventHandler('menubutton');
         cordova.addDocumentEventHandler('searchbutton');
 
+        function bindButtonChannel(buttonName) {
+            // generic button bind used for volumeup/volumedown buttons
+            var volumeButtonChannel = cordova.addDocumentEventHandler(buttonName + 'button');
+            volumeButtonChannel.onHasSubscribersChange = function() {
+                exec(null, null, "App", "overrideButton", [buttonName, this.numHandlers == 1]);
+            };
+        }
+        // Inject a listener for the volume buttons on the document.
+        bindButtonChannel('volumeup');
+        bindButtonChannel('volumedown');
+
         // Let native code know we are all done on the JS side.
         // Native code will then un-hide the WebView.
         channel.onCordovaReady.subscribe(function() {

http://git-wip-us.apache.org/repos/asf/cordova-js/blob/ff0358bf/src/android/plugin/android/app.js
----------------------------------------------------------------------
diff --git a/src/android/plugin/android/app.js b/src/android/plugin/android/app.js
index c2a4df5..7fccc40 100644
--- a/src/android/plugin/android/app.js
+++ b/src/android/plugin/android/app.js
@@ -84,6 +84,21 @@ module.exports = {
     },
 
     /**
+    * Override the default behavior of the Android volume button.
+    * If overridden, when the volume button is pressed, the "volume[up|down]button"
+    * JavaScript event will be fired.
+    *
+    * Note: The user should not have to call this method.  Instead, when the user
+    *       registers for the "volume[up|down]button" event, this is automatically done.
+    *
+    * @param button          volumeup, volumedown
+    * @param override        T=override, F=cancel override
+    */
+    overrideButton:function(button, override) {
+        exec(null, null, "App", "overrideButton", [button, override]);
+    },
+
+    /**
     * Exit and terminate the application.
     */
     exitApp:function() {


[7/7] js commit: Added releasenotes.md

Posted by st...@apache.org.
Added releasenotes.md


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

Branch: refs/heads/cb-7219
Commit: c33a8ef70b18798c571bcf4e53ad601adf84b605
Parents: 5b57c59
Author: Steven Gill <st...@gmail.com>
Authored: Wed Aug 27 16:27:11 2014 -0700
Committer: Steven Gill <st...@gmail.com>
Committed: Wed Aug 27 16:27:11 2014 -0700

----------------------------------------------------------------------
 RELEASENOTES.md | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-js/blob/c33a8ef7/RELEASENOTES.md
----------------------------------------------------------------------
diff --git a/RELEASENOTES.md b/RELEASENOTES.md
new file mode 100644
index 0000000..8a8ba9f
--- /dev/null
+++ b/RELEASENOTES.md
@@ -0,0 +1,20 @@
+<!--
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+#  KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+-->


[6/7] js commit: Merge branch 'cb-7219' of https://github.com/stevengill/cordova-js into cb-7219

Posted by st...@apache.org.
Merge branch 'cb-7219' of https://github.com/stevengill/cordova-js into cb-7219


Project: http://git-wip-us.apache.org/repos/asf/cordova-js/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-js/commit/5b57c597
Tree: http://git-wip-us.apache.org/repos/asf/cordova-js/tree/5b57c597
Diff: http://git-wip-us.apache.org/repos/asf/cordova-js/diff/5b57c597

Branch: refs/heads/cb-7219
Commit: 5b57c5978ad3071417968bd96fe5e8bf4723c1c6
Parents: 6e7d645 4257eb2
Author: Steven Gill <st...@gmail.com>
Authored: Tue Aug 19 14:52:08 2014 -0700
Committer: Steven Gill <st...@gmail.com>
Committed: Tue Aug 19 14:52:08 2014 -0700

----------------------------------------------------------------------

----------------------------------------------------------------------



[3/7] js commit: CB-7219 added platformVersion, removed cordova.version

Posted by st...@apache.org.
CB-7219 added platformVersion, removed cordova.version


Project: http://git-wip-us.apache.org/repos/asf/cordova-js/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-js/commit/582a984b
Tree: http://git-wip-us.apache.org/repos/asf/cordova-js/tree/582a984b
Diff: http://git-wip-us.apache.org/repos/asf/cordova-js/diff/582a984b

Branch: refs/heads/cb-7219
Commit: 582a984b1cefb9f039a629f9d7403e07ee9d5dc6
Parents: ff0358b
Author: Steven Gill <st...@gmail.com>
Authored: Mon Aug 11 17:31:51 2014 -0700
Committer: Steven Gill <st...@gmail.com>
Committed: Mon Aug 18 17:09:08 2014 -0700

----------------------------------------------------------------------
 .jshintrc                         |  2 +-
 README.md                         | 12 ++++++++++--
 VERSION                           |  2 +-
 package.json                      |  2 +-
 src/cordova.js                    |  3 ++-
 src/cordova_b.js                  |  3 ++-
 tasks/compile-browserify.js       | 18 ++++++++++++++++--
 tasks/compile.js                  | 19 +++++++++++++++++--
 tasks/lib/bundle-browserify.js    |  5 +++--
 tasks/lib/bundle.js               |  8 +++++---
 tasks/lib/compute-commit-id.js    | 16 +++++++---------
 tasks/lib/packager-browserify.js  |  7 +++----
 tasks/lib/packager.js             |  6 +++---
 tasks/lib/write-license-header.js |  5 +++--
 14 files changed, 74 insertions(+), 34 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-js/blob/582a984b/.jshintrc
----------------------------------------------------------------------
diff --git a/.jshintrc b/.jshintrc
index 505f458..b5f288c 100644
--- a/.jshintrc
+++ b/.jshintrc
@@ -28,7 +28,7 @@
   "dojo": false,
 
   // Custom predefined globals.
-  "predef": ["jasmine", "blackberry", "define", "alert", "prompt", "org", "deviceapis", "Osp", "_cordovaExec", "WinJS", "Windows", "MSApp", "PalmSystem", "PalmServiceBridge", "Acceleration", "webworks", "CORDOVA_JS_BUILD_LABEL"],
+  "predef": ["jasmine", "blackberry", "define", "alert", "prompt", "org", "deviceapis", "Osp", "_cordovaExec", "WinJS", "Windows", "MSApp", "PalmSystem", "PalmServiceBridge", "Acceleration", "webworks", "CORDOVA_JS_BUILD_LABEL", "PLATFORM_VERSION_BUILD_LABEL"],
 
 
   // Development

http://git-wip-us.apache.org/repos/asf/cordova-js/blob/582a984b/README.md
----------------------------------------------------------------------
diff --git a/README.md b/README.md
index 600c90d..b188caa 100644
--- a/README.md
+++ b/README.md
@@ -54,7 +54,15 @@ All of the build tasks can be run via the `grunt` node module. Install it global
 
 Then from the repository root run:
 
-    grunt
+    grunt --platformVersion=3.6.0
+
+To do just one platform, run:
+
+    grunt compile:android --platformVersion=3.6.0
+
+To create the browserify version, run:
+
+    grunt compile-browserify --platformVersion=3.6.0
 	
 For integration, see the 'Integration' section below.
 
@@ -82,7 +90,7 @@ The `boot` method does all the work.  First, it grabs the common platform defini
 
 Tests run in node or the browser. To run the tests in node:
     
-    grunt test
+    grunt test --platformVersion=3.6.0
 
 To run them in the browser:
 

http://git-wip-us.apache.org/repos/asf/cordova-js/blob/582a984b/VERSION
----------------------------------------------------------------------
diff --git a/VERSION b/VERSION
index 86bab9c..7c69a55 100644
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-3.6.0-dev
+3.7.0

http://git-wip-us.apache.org/repos/asf/cordova-js/blob/582a984b/package.json
----------------------------------------------------------------------
diff --git a/package.json b/package.json
index 8c24550..923033e 100644
--- a/package.json
+++ b/package.json
@@ -2,7 +2,7 @@
   "author": "Gord Tanner <gt...@gmail.com> (http://github.com/gtanner)",
   "name": "cordova-js",
   "description": "Cordova JavaScript: a unified JavaScript layer for the Cordova suite of projects enabling cross-platform native mobile development of applications using HTML, CSS and JavaScript.",
-  "version": "3.6.2",
+  "version": "3.7.0",
   "homepage": "http://cordova.apache.org",
   "repository": {
     "type": "git",

http://git-wip-us.apache.org/repos/asf/cordova-js/blob/582a984b/src/cordova.js
----------------------------------------------------------------------
diff --git a/src/cordova.js b/src/cordova.js
index 3564d45..4d16516 100644
--- a/src/cordova.js
+++ b/src/cordova.js
@@ -93,7 +93,8 @@ function createEvent(type, data) {
 var cordova = {
     define:define,
     require:require,
-    version:CORDOVA_JS_BUILD_LABEL,
+    //version:CORDOVA_JS_BUILD_LABEL,
+    platformVersion:PLATFORM_VERSION_BUILD_LABEL,
     platformId:platform.id,
     /**
      * Methods to add/remove your own addEventListener hijacking on document + window.

http://git-wip-us.apache.org/repos/asf/cordova-js/blob/582a984b/src/cordova_b.js
----------------------------------------------------------------------
diff --git a/src/cordova_b.js b/src/cordova_b.js
index e4084ee..29177e2 100644
--- a/src/cordova_b.js
+++ b/src/cordova_b.js
@@ -91,7 +91,8 @@ function createEvent(type, data) {
 
 
 var cordova = {
-    version:CORDOVA_JS_BUILD_LABEL,
+    platformVersion:PLATFORM_VERSION_BUILD_LABEL,
+    //version:CORDOVA_JS_BUILD_LABEL,
     require: function(module) {
         if(module === "cordova/exec") {
             return cordova.exec;

http://git-wip-us.apache.org/repos/asf/cordova-js/blob/582a984b/tasks/compile-browserify.js
----------------------------------------------------------------------
diff --git a/tasks/compile-browserify.js b/tasks/compile-browserify.js
index 1d28510..f58c4f7 100644
--- a/tasks/compile-browserify.js
+++ b/tasks/compile-browserify.js
@@ -20,10 +20,24 @@ var generate = require('./lib/packager-browserify');
 
 module.exports = function(grunt) {
     grunt.registerMultiTask('compile-browserify', 'Packages cordova.js browserify style', function() {
-
         var done = this.async();
         var platformName = this.target;
         var useWindowsLineEndings = this.data.useWindowsLineEndings;
-        generate(platformName, useWindowsLineEndings, done);
+
+        //grabs --platformVersion flag
+        var flags = grunt.option.flags();
+        var platformVersion;
+        flags.forEach(function(flag) {
+            if (flag.indexOf('platformVersion') > -1) {
+                var equalIndex = flag.indexOf('=');
+                platformVersion = flag.slice(equalIndex + 1);
+            }
+        });
+        if(!platformVersion){
+            console.log('please add a platform version flag and value');
+            console.log('ex: grunt compile-browserify --platformVersion=3.6.0');
+            throw new Error("platformVersion is required!");
+        }
+        generate(platformName, useWindowsLineEndings, platformVersion, done);
     });
 }

http://git-wip-us.apache.org/repos/asf/cordova-js/blob/582a984b/tasks/compile.js
----------------------------------------------------------------------
diff --git a/tasks/compile.js b/tasks/compile.js
index 58db43c..0e8392e 100644
--- a/tasks/compile.js
+++ b/tasks/compile.js
@@ -20,11 +20,26 @@ var generate = require('./lib/packager');
 
 module.exports = function(grunt) {
     grunt.registerMultiTask('compile', 'Packages cordova.js', function() {
-
         var done = this.async();
         var platformName = this.target;
         var useWindowsLineEndings = this.data.useWindowsLineEndings;
+        var platformVersion;
+       
+        //grabs --platformVersion flag
+        var flags = grunt.option.flags();
+        var platformVersion;
+        flags.forEach(function(flag) {
+            if (flag.indexOf('platformVersion') > -1) {
+                var equalIndex = flag.indexOf('=');
+                platformVersion = flag.slice(equalIndex + 1);
+            }
+        });
+        if(!platformVersion){
+            console.log('please add a platform version flag and value');
+            console.log('ex: grunt compile-browserify --platformVersion=3.6.0');
+            throw new Error("platformVersion is required!");
+        }
 
-        generate(platformName, useWindowsLineEndings, done);
+        generate(platformName, useWindowsLineEndings, platformVersion, done);
     });
 }

http://git-wip-us.apache.org/repos/asf/cordova-js/blob/582a984b/tasks/lib/bundle-browserify.js
----------------------------------------------------------------------
diff --git a/tasks/lib/bundle-browserify.js b/tasks/lib/bundle-browserify.js
index 1d948fa..f038117 100644
--- a/tasks/lib/bundle-browserify.js
+++ b/tasks/lib/bundle-browserify.js
@@ -23,13 +23,14 @@ var require_tr   = require('./require-tr');
 var root         = path.join(__dirname, '..', '..')
 
 
-module.exports = function bundle(platform, debug, commitId) {
+module.exports = function bundle(platform, debug, commitId, platformVersion) {
     require_tr.platform = platform;
     // FIXME: need to find a way to void ignore missing
     var b = browserify({debug: debug});
     // XXX plugin_list is not present at this stage 
     b.ignore(path.join(root, 'src', 'common', 'plugin_list'));
-
+    console.log('commitID: '+ commitId);
+    console.log('platformVersion: ' + platformVersion);
     b.transform(require_tr.transform);
 
     b.add(path.join(root, 'src', platform, 'exec.js'));

http://git-wip-us.apache.org/repos/asf/cordova-js/blob/582a984b/tasks/lib/bundle.js
----------------------------------------------------------------------
diff --git a/tasks/lib/bundle.js b/tasks/lib/bundle.js
index 8cdf11e..3937c51 100644
--- a/tasks/lib/bundle.js
+++ b/tasks/lib/bundle.js
@@ -24,12 +24,13 @@ var writeModule  = require('./write-module');
 var writeScript  = require('./write-script');
 var licensePath = path.join(__dirname, '..', 'templates', 'LICENSE-for-js-file.txt');
 
-module.exports = function bundle(platform, debug, commitId) {
+module.exports = function bundle(platform, debug, commitId, platformVersion) {
     var modules = collectFiles(path.join('src', 'common'));
     var scripts = collectFiles(path.join('src', 'scripts'));
     modules[''] = path.join('src', 'cordova.js');
     copyProps(modules, collectFiles(path.join('src', platform)));
-
+    console.log('commitID: '+ commitId);
+    console.log('platformVersion: ' + platformVersion);
     if (platform === 'test') {
         // Add any platform-specific modules that have tests to the test bundle.
         var testFilesPath = path.join('src', 'android', 'android');
@@ -46,7 +47,8 @@ module.exports = function bundle(platform, debug, commitId) {
     // write header
     output.push('/*', fs.readFileSync(licensePath, 'utf8'), '*/');
     output.push(';(function() {');
-    output.push("var CORDOVA_JS_BUILD_LABEL = '"  + commitId + "';");
+    //output.push("var CORDOVA_JS_BUILD_LABEL = '"  + commitId + "';");
+    output.push("var PLATFORM_VERSION_BUILD_LABEL = '"  + platformVersion + "';");
 
     // write initial scripts
     if (!scripts['require']) {

http://git-wip-us.apache.org/repos/asf/cordova-js/blob/582a984b/tasks/lib/compute-commit-id.js
----------------------------------------------------------------------
diff --git a/tasks/lib/compute-commit-id.js b/tasks/lib/compute-commit-id.js
index 6fb5500..d768340 100644
--- a/tasks/lib/compute-commit-id.js
+++ b/tasks/lib/compute-commit-id.js
@@ -30,9 +30,9 @@ module.exports = function computeCommitId(callback, cachedGitVersion) {
 
     var versionFileId = fs.readFileSync('VERSION', { encoding: 'utf8' }).trim();
 
-    if (/-dev$/.test(versionFileId) && fs.existsSync('.git')) {
+    if (fs.existsSync('.git')) {
         var gitPath = 'git';
-        var args = 'rev-list HEAD --max-count=1 --abbrev-commit';
+        var args = 'rev-list HEAD --max-count=1';
         childProcess.exec(gitPath + ' ' + args, function(err, stdout, stderr) {
             var isWindows = process.platform.slice(0, 3) == 'win';
             if (err && isWindows) {
@@ -40,21 +40,19 @@ module.exports = function computeCommitId(callback, cachedGitVersion) {
                 childProcess.exec(gitPath + ' ' + args, function(err, stdout, stderr) {
                     if (err) {
                         console.warn('Error during git describe: ' + err);
-                        done(versionFileId + '-??');
+                        done('???');
                     } else {
-                        done(versionFileId + '-' + stdout);
+                        done(stdout);
                     }
                 });
             } else if (err) {
                 console.warn('Error during git describe: ' + err);
-                done(versionFileId + '-??');
+                done('???');
             } else {
-                done(versionFileId + '-' + stdout);
+                done(stdout);
             }
         });
-    } else {
-        done(fs.readFileSync('VERSION', { encoding: 'utf8' }));
-    }
+    } 
 
     function done(stdout) {
         var version = stdout.trim();

http://git-wip-us.apache.org/repos/asf/cordova-js/blob/582a984b/tasks/lib/packager-browserify.js
----------------------------------------------------------------------
diff --git a/tasks/lib/packager-browserify.js b/tasks/lib/packager-browserify.js
index 3e718c6..4d24592 100644
--- a/tasks/lib/packager-browserify.js
+++ b/tasks/lib/packager-browserify.js
@@ -23,15 +23,14 @@ var bundle             = require('./bundle-browserify');
 var computeCommitId    = require('./compute-commit-id');
 var writeLicenseHeader = require('./write-license-header');
 
-
-module.exports = function generate(platform, useWindowsLineEndings, done) {
+module.exports = function generate(platform, useWindowsLineEndings, platformVersion, done) {
     computeCommitId(function(commitId) {
         var outReleaseFile, outReleaseFileStream,
             outDebugFile, outDebugFileStream,
             releaseBundle, debugBundle;
         var time = new Date().valueOf();
 
-        var libraryRelease = bundle(platform, false, commitId);
+        var libraryRelease = bundle(platform, false, commitId, platformVersion);
        // if we are using windows line endings, we will also add the BOM
        // if(useWindowsLineEndings) {
        //     libraryRelease = "\ufeff" + libraryRelease.split(/\r?\n/).join("\r\n");
@@ -49,7 +48,7 @@ module.exports = function generate(platform, useWindowsLineEndings, done) {
         outReleaseFileStream = fs.createWriteStream(outReleaseFile);
         
         // write license header
-        writeLicenseHeader(outReleaseFileStream, platform, commitId);
+        writeLicenseHeader(outReleaseFileStream, platform, commitId, platformVersion);
 
         releaseBundle = libraryRelease.bundle();
 

http://git-wip-us.apache.org/repos/asf/cordova-js/blob/582a984b/tasks/lib/packager.js
----------------------------------------------------------------------
diff --git a/tasks/lib/packager.js b/tasks/lib/packager.js
index 0fd2bcc..7aba70f 100644
--- a/tasks/lib/packager.js
+++ b/tasks/lib/packager.js
@@ -22,17 +22,17 @@ var bundle          = require('./bundle');
 var computeCommitId = require('./compute-commit-id');
 
 
-module.exports = function generate(platform, useWindowsLineEndings, callback) {
+module.exports = function generate(platform, useWindowsLineEndings, platformVersion, callback) {
     computeCommitId(function(commitId) {
         var outFile;
         var time = new Date().valueOf();
 
-        var libraryRelease = bundle(platform, false, commitId);
+        var libraryRelease = bundle(platform, false, commitId, platformVersion);
         // if we are using windows line endings, we will also add the BOM
         if(useWindowsLineEndings) {
             libraryRelease = "\ufeff" + libraryRelease.split(/\r?\n/).join("\r\n");
         }
-        var libraryDebug   = bundle(platform, true, commitId);
+        var libraryDebug   = bundle(platform, true, commitId, platformVersion);
 
         time = new Date().valueOf() - time;
         if (!fs.existsSync('pkg')) {

http://git-wip-us.apache.org/repos/asf/cordova-js/blob/582a984b/tasks/lib/write-license-header.js
----------------------------------------------------------------------
diff --git a/tasks/lib/write-license-header.js b/tasks/lib/write-license-header.js
index 8b33cbd..c8d4345 100644
--- a/tasks/lib/write-license-header.js
+++ b/tasks/lib/write-license-header.js
@@ -3,14 +3,15 @@ var util        = require('util');
 var fs          = require('fs');
 var licensePath = path.join(__dirname, '..', 'templates', 'LICENSE-for-js-file.txt');
 
-module.exports = function(outStream, platform, commitId) {
+module.exports = function(outStream, platform, commitId, platformVersion) {
   // some poppycock 
   var licenseText = util.format("/*\n *%s\n */\n", fs.readFileSync(licensePath, 'utf8').replace(/\n/g, "\n *"));
 
   outStream.write("// Platform: " + platform + "\n", 'utf8');
   outStream.write("// "  + commitId + "\n", 'utf8');
   outStream.write(licenseText, 'utf8');
-  outStream.write("var CORDOVA_JS_BUILD_LABEL = '"  + commitId + "';\n", 'utf8');
+  //outStream.write("var CORDOVA_JS_BUILD_LABEL = '"  + commitId + "';\n", 'utf8');
+  outStream.write("var PLATFORM_VERSION_BUILD_LABEL = '"  + platformVersion + "';\n", 'utf8');
   outStream.write("var define = {moduleMap: []};\n", 'utf8');
 
 }


[2/7] js commit: CB-7219 Added back version file, added default value for compute-commit-id.js

Posted by st...@apache.org.
CB-7219 Added back version file, added default value for compute-commit-id.js


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

Branch: refs/heads/cb-7219
Commit: d1e0a91f89dddb97656021fc5dfae4a8237abb71
Parents: 5e9ff22
Author: Steven Gill <st...@gmail.com>
Authored: Tue Aug 12 13:55:11 2014 -0700
Committer: Steven Gill <st...@gmail.com>
Committed: Mon Aug 18 17:09:08 2014 -0700

----------------------------------------------------------------------
 VERSION                        | 1 +
 tasks/lib/bundle-browserify.js | 3 +--
 tasks/lib/bundle.js            | 3 +--
 tasks/lib/compute-commit-id.js | 2 ++
 4 files changed, 5 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-js/blob/d1e0a91f/VERSION
----------------------------------------------------------------------
diff --git a/VERSION b/VERSION
new file mode 100644
index 0000000..7c69a55
--- /dev/null
+++ b/VERSION
@@ -0,0 +1 @@
+3.7.0

http://git-wip-us.apache.org/repos/asf/cordova-js/blob/d1e0a91f/tasks/lib/bundle-browserify.js
----------------------------------------------------------------------
diff --git a/tasks/lib/bundle-browserify.js b/tasks/lib/bundle-browserify.js
index f038117..138d627 100644
--- a/tasks/lib/bundle-browserify.js
+++ b/tasks/lib/bundle-browserify.js
@@ -29,8 +29,7 @@ module.exports = function bundle(platform, debug, commitId, platformVersion) {
     var b = browserify({debug: debug});
     // XXX plugin_list is not present at this stage 
     b.ignore(path.join(root, 'src', 'common', 'plugin_list'));
-    console.log('commitID: '+ commitId);
-    console.log('platformVersion: ' + platformVersion);
+    
     b.transform(require_tr.transform);
 
     b.add(path.join(root, 'src', platform, 'exec.js'));

http://git-wip-us.apache.org/repos/asf/cordova-js/blob/d1e0a91f/tasks/lib/bundle.js
----------------------------------------------------------------------
diff --git a/tasks/lib/bundle.js b/tasks/lib/bundle.js
index d3282ec..b68eacf 100644
--- a/tasks/lib/bundle.js
+++ b/tasks/lib/bundle.js
@@ -29,8 +29,7 @@ module.exports = function bundle(platform, debug, commitId, platformVersion) {
     var scripts = collectFiles(path.join('src', 'scripts'));
     modules[''] = path.join('src', 'cordova.js');
     copyProps(modules, collectFiles(path.join('src', platform)));
-    console.log('commitID: '+ commitId);
-    console.log('platformVersion: ' + platformVersion);
+    
     if (platform === 'test') {
         // Add any platform-specific modules that have tests to the test bundle.
         var testFilesPath = path.join('src', 'android', 'android');

http://git-wip-us.apache.org/repos/asf/cordova-js/blob/d1e0a91f/tasks/lib/compute-commit-id.js
----------------------------------------------------------------------
diff --git a/tasks/lib/compute-commit-id.js b/tasks/lib/compute-commit-id.js
index 8471a05..794ebd9 100644
--- a/tasks/lib/compute-commit-id.js
+++ b/tasks/lib/compute-commit-id.js
@@ -50,6 +50,8 @@ module.exports = function computeCommitId(callback, cachedGitVersion) {
                 done(stdout);
             }
         });
+    } else {
+        done('???');
     } 
 
     function done(stdout) {


[4/7] js commit: CB-7219: cordova.version now outputs same value as cordova.platformVersion

Posted by st...@apache.org.
CB-7219: cordova.version now outputs same value as cordova.platformVersion


Project: http://git-wip-us.apache.org/repos/asf/cordova-js/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-js/commit/5e9ff22a
Tree: http://git-wip-us.apache.org/repos/asf/cordova-js/tree/5e9ff22a
Diff: http://git-wip-us.apache.org/repos/asf/cordova-js/diff/5e9ff22a

Branch: refs/heads/cb-7219
Commit: 5e9ff22aef03b77e86d0d99bbc2cdbc53a71ca8c
Parents: 582a984
Author: Steven Gill <st...@gmail.com>
Authored: Tue Aug 12 11:11:31 2014 -0700
Committer: Steven Gill <st...@gmail.com>
Committed: Mon Aug 18 17:09:08 2014 -0700

----------------------------------------------------------------------
 README.md                         | 9 +++++++--
 VERSION                           | 1 -
 src/cordova.js                    | 2 +-
 src/cordova_b.js                  | 2 +-
 tasks/compile.js                  | 2 +-
 tasks/lib/bundle.js               | 1 -
 tasks/lib/compute-commit-id.js    | 2 --
 tasks/lib/write-license-header.js | 2 +-
 8 files changed, 11 insertions(+), 10 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-js/blob/5e9ff22a/README.md
----------------------------------------------------------------------
diff --git a/README.md b/README.md
index b188caa..d8ef976 100644
--- a/README.md
+++ b/README.md
@@ -56,13 +56,18 @@ Then from the repository root run:
 
     grunt --platformVersion=3.6.0
 
-To do just one platform, run:
+To compile the js for just one platform, run:
 
     grunt compile:android --platformVersion=3.6.0
 
-To create the browserify version, run:
+To create the browserify version of the js, run:
 
     grunt compile-browserify --platformVersion=3.6.0
+
+To compile the browserify version of the js for just one platform, run:
+
+    grunt compile-browserify:android --platformVersion=3.6.0
+
 	
 For integration, see the 'Integration' section below.
 

http://git-wip-us.apache.org/repos/asf/cordova-js/blob/5e9ff22a/VERSION
----------------------------------------------------------------------
diff --git a/VERSION b/VERSION
deleted file mode 100644
index 7c69a55..0000000
--- a/VERSION
+++ /dev/null
@@ -1 +0,0 @@
-3.7.0

http://git-wip-us.apache.org/repos/asf/cordova-js/blob/5e9ff22a/src/cordova.js
----------------------------------------------------------------------
diff --git a/src/cordova.js b/src/cordova.js
index 4d16516..3602b70 100644
--- a/src/cordova.js
+++ b/src/cordova.js
@@ -93,7 +93,7 @@ function createEvent(type, data) {
 var cordova = {
     define:define,
     require:require,
-    //version:CORDOVA_JS_BUILD_LABEL,
+    version:PLATFORM_VERSION_BUILD_LABEL,
     platformVersion:PLATFORM_VERSION_BUILD_LABEL,
     platformId:platform.id,
     /**

http://git-wip-us.apache.org/repos/asf/cordova-js/blob/5e9ff22a/src/cordova_b.js
----------------------------------------------------------------------
diff --git a/src/cordova_b.js b/src/cordova_b.js
index 29177e2..3a9ed6d 100644
--- a/src/cordova_b.js
+++ b/src/cordova_b.js
@@ -92,7 +92,7 @@ function createEvent(type, data) {
 
 var cordova = {
     platformVersion:PLATFORM_VERSION_BUILD_LABEL,
-    //version:CORDOVA_JS_BUILD_LABEL,
+    version:PLATFORM_VERSION_BUILD_LABEL,
     require: function(module) {
         if(module === "cordova/exec") {
             return cordova.exec;

http://git-wip-us.apache.org/repos/asf/cordova-js/blob/5e9ff22a/tasks/compile.js
----------------------------------------------------------------------
diff --git a/tasks/compile.js b/tasks/compile.js
index 0e8392e..849e909 100644
--- a/tasks/compile.js
+++ b/tasks/compile.js
@@ -36,7 +36,7 @@ module.exports = function(grunt) {
         });
         if(!platformVersion){
             console.log('please add a platform version flag and value');
-            console.log('ex: grunt compile-browserify --platformVersion=3.6.0');
+            console.log('ex: grunt compile --platformVersion=3.6.0');
             throw new Error("platformVersion is required!");
         }
 

http://git-wip-us.apache.org/repos/asf/cordova-js/blob/5e9ff22a/tasks/lib/bundle.js
----------------------------------------------------------------------
diff --git a/tasks/lib/bundle.js b/tasks/lib/bundle.js
index 3937c51..d3282ec 100644
--- a/tasks/lib/bundle.js
+++ b/tasks/lib/bundle.js
@@ -47,7 +47,6 @@ module.exports = function bundle(platform, debug, commitId, platformVersion) {
     // write header
     output.push('/*', fs.readFileSync(licensePath, 'utf8'), '*/');
     output.push(';(function() {');
-    //output.push("var CORDOVA_JS_BUILD_LABEL = '"  + commitId + "';");
     output.push("var PLATFORM_VERSION_BUILD_LABEL = '"  + platformVersion + "';");
 
     // write initial scripts

http://git-wip-us.apache.org/repos/asf/cordova-js/blob/5e9ff22a/tasks/lib/compute-commit-id.js
----------------------------------------------------------------------
diff --git a/tasks/lib/compute-commit-id.js b/tasks/lib/compute-commit-id.js
index d768340..8471a05 100644
--- a/tasks/lib/compute-commit-id.js
+++ b/tasks/lib/compute-commit-id.js
@@ -28,8 +28,6 @@ module.exports = function computeCommitId(callback, cachedGitVersion) {
         return;
     }
 
-    var versionFileId = fs.readFileSync('VERSION', { encoding: 'utf8' }).trim();
-
     if (fs.existsSync('.git')) {
         var gitPath = 'git';
         var args = 'rev-list HEAD --max-count=1';

http://git-wip-us.apache.org/repos/asf/cordova-js/blob/5e9ff22a/tasks/lib/write-license-header.js
----------------------------------------------------------------------
diff --git a/tasks/lib/write-license-header.js b/tasks/lib/write-license-header.js
index c8d4345..8d7e24e 100644
--- a/tasks/lib/write-license-header.js
+++ b/tasks/lib/write-license-header.js
@@ -9,8 +9,8 @@ module.exports = function(outStream, platform, commitId, platformVersion) {
 
   outStream.write("// Platform: " + platform + "\n", 'utf8');
   outStream.write("// "  + commitId + "\n", 'utf8');
+  outStream.write("// browserify" + "\n", 'utf8');
   outStream.write(licenseText, 'utf8');
-  //outStream.write("var CORDOVA_JS_BUILD_LABEL = '"  + commitId + "';\n", 'utf8');
   outStream.write("var PLATFORM_VERSION_BUILD_LABEL = '"  + platformVersion + "';\n", 'utf8');
   outStream.write("var define = {moduleMap: []};\n", 'utf8');
 


[5/7] js commit: CB-7219 made sure compute commit id is run from cordova-js repo. Set cwd to cordova-js

Posted by st...@apache.org.
CB-7219 made sure compute commit id is run from cordova-js repo. Set cwd to cordova-js


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

Branch: refs/heads/cb-7219
Commit: 6e7d6458852630c595a2e73c8e99da9b18fe8794
Parents: d1e0a91
Author: Steven Gill <st...@gmail.com>
Authored: Tue Aug 12 17:37:29 2014 -0700
Committer: Steven Gill <st...@gmail.com>
Committed: Mon Aug 18 17:09:09 2014 -0700

----------------------------------------------------------------------
 tasks/lib/compute-commit-id.js | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-js/blob/6e7d6458/tasks/lib/compute-commit-id.js
----------------------------------------------------------------------
diff --git a/tasks/lib/compute-commit-id.js b/tasks/lib/compute-commit-id.js
index 794ebd9..a4c4765 100644
--- a/tasks/lib/compute-commit-id.js
+++ b/tasks/lib/compute-commit-id.js
@@ -27,11 +27,14 @@ module.exports = function computeCommitId(callback, cachedGitVersion) {
         callback(cachedGitVersion);
         return;
     }
-
-    if (fs.existsSync('.git')) {
+    
+    var cordovaJSDir = path.join(__dirname, '../../');
+    
+    //make sure .git directory exists in cordova.js repo
+    if (fs.existsSync(path.join(__dirname, '../../.git'))) {
         var gitPath = 'git';
         var args = 'rev-list HEAD --max-count=1';
-        childProcess.exec(gitPath + ' ' + args, function(err, stdout, stderr) {
+        childProcess.exec(gitPath + ' ' + args, {cwd:cordovaJSDir}, function(err, stdout, stderr) {
             var isWindows = process.platform.slice(0, 3) == 'win';
             if (err && isWindows) {
                 gitPath = '"' + path.join(process.env['ProgramFiles'], 'Git', 'bin', 'git.exe') + '"';
@@ -51,6 +54,7 @@ module.exports = function computeCommitId(callback, cachedGitVersion) {
             }
         });
     } else {
+        console.log('no git');
         done('???');
     }