cordova-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a...@apache.org
Subject [16/45] js commit: moving license writing to other module
Date Thu, 24 Apr 2014 21:11:01 GMT
moving license writing to other module


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

Branch: refs/heads/master
Commit: 1b58859437c022d23bef546868e71746528d84a9
Parents: ef6f9b9
Author: Anis Kadri <anis@apache.org>
Authored: Fri Mar 14 16:41:44 2014 -0700
Committer: Anis Kadri <anis@apache.org>
Committed: Fri Mar 14 16:41:44 2014 -0700

----------------------------------------------------------------------
 tasks/lib/packager-browserify.js  | 24 ++++++++----------------
 tasks/lib/write-license-header.js | 16 ++++++++++++++++
 2 files changed, 24 insertions(+), 16 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-js/blob/1b588594/tasks/lib/packager-browserify.js
----------------------------------------------------------------------
diff --git a/tasks/lib/packager-browserify.js b/tasks/lib/packager-browserify.js
index 07d7774..ecc3f5f 100644
--- a/tasks/lib/packager-browserify.js
+++ b/tasks/lib/packager-browserify.js
@@ -16,13 +16,12 @@
  * specific language governing permissions and lim
  * under the License.
  */
-var fs              = require('fs');
-var path            = require('path');
-var util            = require('util');
-var bundle          = require('./bundle-browserify');
-var computeCommitId = require('./compute-commit-id');
-var licensePath     = path.join(__dirname, '..', 'templates', 'LICENSE-for-js-file.txt');
-var require_tr   = require('./require-tr');
+var fs                 = require('fs');
+var path               = require('path');
+var util               = require('util');
+var bundle             = require('./bundle-browserify');
+var computeCommitId    = require('./compute-commit-id');
+var writeLicenseHeader = require('./write-license-header');
 
 
 module.exports = function generate(platform, useWindowsLineEndings, done) {
@@ -49,17 +48,10 @@ module.exports = function generate(platform, useWindowsLineEndings, done)
{
         outReleaseFile = path.join('pkg', 'cordova.' + platform + '.js');
         outReleaseFileStream = fs.createWriteStream(outReleaseFile);
         
-        // some poppycock 
-        var licenseText = util.format("/*\n *%s\n */\n", fs.readFileSync(licensePath, 'utf8').replace(/\n/g,
"\n *"));
+        // write license header
+        writeLicenseHeader(outReleaseFileStream, platform, commitId);
 
-        outReleaseFileStream.write("// Platform: " + platform + "\n", 'utf8');
-        outReleaseFileStream.write("// "  + commitId + "\n", 'utf8');
-        outReleaseFileStream.write(licenseText, 'utf8');
-        outReleaseFileStream.write("var CORDOVA_JS_BUILD_LABEL = '"  + commitId + "';\n",
'utf8');
-        outReleaseFileStream.write("var define = {moduleMap: []};\n", 'utf8');
-        
         releaseBundle = libraryRelease.bundle();
-        //console.log(libraryRelease.deps());
 
         releaseBundle.pipe(outReleaseFileStream);
 

http://git-wip-us.apache.org/repos/asf/cordova-js/blob/1b588594/tasks/lib/write-license-header.js
----------------------------------------------------------------------
diff --git a/tasks/lib/write-license-header.js b/tasks/lib/write-license-header.js
new file mode 100644
index 0000000..8b33cbd
--- /dev/null
+++ b/tasks/lib/write-license-header.js
@@ -0,0 +1,16 @@
+var path        = require('path');
+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) {
+  // 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 define = {moduleMap: []};\n", 'utf8');
+
+}


Mime
View raw message