You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@olingo.apache.org by ko...@apache.org on 2014/09/23 10:43:27 UTC
git commit: [OLINGO-440] create asc files automatically
Repository: olingo-odata4-js
Updated Branches:
refs/heads/master e95d0a046 -> 076a5ad15
[OLINGO-440] create asc files automatically
Project: http://git-wip-us.apache.org/repos/asf/olingo-odata4-js/repo
Commit: http://git-wip-us.apache.org/repos/asf/olingo-odata4-js/commit/076a5ad1
Tree: http://git-wip-us.apache.org/repos/asf/olingo-odata4-js/tree/076a5ad1
Diff: http://git-wip-us.apache.org/repos/asf/olingo-odata4-js/diff/076a5ad1
Branch: refs/heads/master
Commit: 076a5ad15b05b008b337e8cac7342a672e30dbb6
Parents: e95d0a0
Author: Sven Kobler <sv...@sap.com>
Authored: Tue Sep 23 10:43:21 2014 +0200
Committer: Sven Kobler <sv...@sap.com>
Committed: Tue Sep 23 10:43:21 2014 +0200
----------------------------------------------------------------------
odatajs/grunt-config/custom-tasks/sign.js | 71 ++++++++++++++++++++------
odatajs/grunt-config/release.js | 5 +-
odatajs/grunt-config/sign.js | 22 +++++++-
3 files changed, 79 insertions(+), 19 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/olingo-odata4-js/blob/076a5ad1/odatajs/grunt-config/custom-tasks/sign.js
----------------------------------------------------------------------
diff --git a/odatajs/grunt-config/custom-tasks/sign.js b/odatajs/grunt-config/custom-tasks/sign.js
index d7959d3..cd09993 100644
--- a/odatajs/grunt-config/custom-tasks/sign.js
+++ b/odatajs/grunt-config/custom-tasks/sign.js
@@ -23,13 +23,14 @@ module.exports = function(grunt) {
var self = this;
var path = require('path');
- var fs = require( "fs" );
-
+ var fs = require( 'fs' );
+ var chalk = require('./rat/node_modules/chalk');
var globalDone = this.async();
var options = this.options({ types : [] });
var workLoad = [];
+ var writeToLogOk = function(data) { grunt.log.ok(data.toString()); };
// fill workLoad
for(var i = 0; i < this.files.length; i++) {
@@ -52,46 +53,82 @@ module.exports = function(grunt) {
var workItem = workLoad.pop();
// make source file releative to cwd, since cwd is used as workdir from spawn
var fileName = path.relative(self.data.cwd,workItem.src);
- var taskOptions,pipeTo;
+ var taskOptions,pipeTo,pipeSrc = 'out';
console.log (fileName);
if ( workItem.type === 'md5' ) {
- grunt.log.writeln('Signing ('+workItem.type+')' + fileName + " ...");
pipeTo = workItem.src+'.md5';
+
+ grunt.log.writeln(chalk.yellow('Signing ('+workItem.type+') ' + fileName + " ..."));
+
taskOptions = {
cmd : 'openssl',
- //args: ['dgst','-md5','-out',fileName+'.md5',fileName],
args: ['dgst','-md5',fileName],
opts : { cwd :self.data.cwd }
};
} else if ( workItem.type === 'sha' ) {
- grunt.log.writeln('Signing ('+workItem.type+')' + fileName + " ...");
- //gpg --print-md SHA512 odatajs-4.0.0-beta-01-RC02-doc.zip
pipeTo = workItem.src+'.sha';
+
+ grunt.log.writeln(chalk.yellow('Signing ('+workItem.type+') ' + fileName + " ..."));
+
+ //gpg --print-md SHA512 odatajs-4.0.0-beta-01-RC02-doc.zip
taskOptions = {
cmd : 'gpg',
args: ['--print-md','SHA512',fileName],
opts : { cwd :self.data.cwd }
};
- } else {
+ } else if ( workItem.type === 'asc' ) {
+ pipeTo = undefined; // done by gpg
+
+ grunt.log.writeln(chalk.yellow('Signing ('+workItem.type+') ' + fileName + " ..."));
+
+ //gpg --armor --detach-sign odatajs-4.0.0-beta-01-RC02-sources.zip
+ taskOptions = {
+ cmd : 'gpg',
+ args: ['--armor','--detach-sign',fileName],
+ opts : { cwd :self.data.cwd }
+ };
+ } else if ( workItem.type === 'asc-verify' ) {
+ pipeTo = 'console';
+ pipeSrc = 'err';
+
+ grunt.log.writeln(chalk.yellow('Verify ('+workItem.type+') ' +fileName+ '.asc' + " ..."));
+
+ //gpg --verify --detach-sign odatajs-4.0.0-beta-01-RC02-sources.zip.asc
+ taskOptions = {
+ cmd : 'gpg',
+ args: ['--verify', fileName+'.asc'],
+ opts : { cwd :self.data.cwd }
+ };
+ } else {
grunt.fail.warn('Unknown sign type: "'+ workItem.type + '"', 1);
}
+ //console.log(taskOptions);
+
var task = grunt.util.spawn(taskOptions, function done(err,result) {
if (err) {
grunt.fail.warn('Sign: '+err);
}
});
- //console.log('pipeTo'+pipeTo);
- //console.log('task'+JSON.stringify(task));
- var outStream = fs.createWriteStream(pipeTo/* ,{flags: 'w'}*/);
- /*task.stdout.on('data', function(data) {
- outStream.write(data.toString());
- //console.log('1'+data.toString());
- });*/
- task.stdout.pipe(outStream, { end: false });
+
+
+ if (pipeTo) {
+ if (pipeTo === 'console') {
+ if (pipeSrc ==='err') {
+ task.stderr.on('data', writeToLogOk );
+ } else {
+ task.stdout.on('data', writeToLogOk);
+ }
+ } else {
+ var outStream = fs.createWriteStream(pipeTo/* ,{flags: 'w'}*/);
+ var src = (pipeSrc ==='err') ? task.stderr : task.stdout;
+ src.pipe(outStream, { end: false });
+ }
+ }
+
task.on('close', function (code) {
- grunt.log.ok('Signed ('+workItem.type+'):' + workItem.src);
+ grunt.log.ok('Processed ('+workItem.type+') :' + workItem.src);
grunt.log.ok('with code ' + code);
process();
});
http://git-wip-us.apache.org/repos/asf/olingo-odata4-js/blob/076a5ad1/odatajs/grunt-config/release.js
----------------------------------------------------------------------
diff --git a/odatajs/grunt-config/release.js b/odatajs/grunt-config/release.js
index 935404d..99edb19 100644
--- a/odatajs/grunt-config/release.js
+++ b/odatajs/grunt-config/release.js
@@ -190,7 +190,10 @@ module.exports = function(grunt) {
'copy:release-lib','copy:release-doc','copy:release-sources',
'rat:dist', // check the license headers
'compress:release-lib','compress:release-doc','compress:release-sources',
- 'sign:release'
]);
+ grunt.registerTask('release:sign',[
+ 'sign:release','sign:asc','sign:asc-verify'
+ ]);
+
};
http://git-wip-us.apache.org/repos/asf/olingo-odata4-js/blob/076a5ad1/odatajs/grunt-config/sign.js
----------------------------------------------------------------------
diff --git a/odatajs/grunt-config/sign.js b/odatajs/grunt-config/sign.js
index 5c6d4bd..188d019 100644
--- a/odatajs/grunt-config/sign.js
+++ b/odatajs/grunt-config/sign.js
@@ -32,8 +32,28 @@ module.exports = function(grunt) {
'<%= artifactname %>-doc.zip',
'<%= artifactname %>-sources.zip'
]
+ },
+ 'asc' : {
+ options: { types : ['asc']},
+ expand : true,
+ cwd : './../dist/<%= artifactname %>/',
+ src : [
+ '<%= artifactname %>-lib.zip',
+ '<%= artifactname %>-doc.zip',
+ '<%= artifactname %>-sources.zip'
+ ]
+ },
+ 'asc-verify' : {
+ options: { types : ['asc-verify']},
+ expand : true,
+ cwd : './../dist/<%= artifactname %>/',
+ src : [
+ '<%= artifactname %>-lib.zip',
+ '<%= artifactname %>-doc.zip',
+ '<%= artifactname %>-sources.zip'
+ ]
}
- }
+ },
});
};