Merge pull request #145 from Robert-Nelson/nodejs

Add nodejs and cleanup source tree
This commit is contained in:
Tankred Hase 2014-01-09 04:37:12 -08:00
commit acb537bea3
214 changed files with 3671 additions and 3124 deletions

View File

@ -6,38 +6,21 @@ module.exports = function(grunt) {
browserify: {
openpgp_nodebug: {
files: {
'resources/openpgp_nodebug.js': []
'dist/openpgp_nodebug.js': []
},
options: {
alias: './src/:openpgp'
alias: [ './src/:openpgp' ],
external: [ 'crypto', 'node-localstorage' ]
}
},
openpgp: {
files: {
'resources/openpgp.js': []
'dist/openpgp.js': []
},
options: {
debug: true,
alias: './src/:openpgp'
}
},
keyring_nodebug: {
files: {
'resources/keyring_nodebug.js': []
},
options: {
alias: './src/keyring/:keyring',
external: [ 'openpgp' ]
}
},
keyring: {
files: {
'resources/keyring.js': []
},
options: {
debug: true,
alias: './src/keyring/:keyring',
external: [ 'openpgp' ]
alias: [ './src/:openpgp' ],
external: [ 'crypto', 'node-localstorage' ]
}
},
unittests: {
@ -47,22 +30,22 @@ module.exports = function(grunt) {
options: {
debug: true,
alias: './test/unittests.js:unittests',
external: [ 'openpgp', 'keyring' ]
external: [ 'openpgp' ]
}
}
},
replace : {
replace: {
openpgpjs: {
src: ['resources/openpgp.js'],
dest: ['resources/openpgp.js'],
src: ['dist/openpgp.js'],
dest: ['dist/openpgp.js'],
replacements: [{
from: /OpenPGP.js VERSION/g,
to: 'OpenPGP.js v<%= pkg.version %>.<%= grunt.template.today("yyyymmdd") %>'
}]
},
openpgpjs_nodebug: {
src: ['resources/openpgp_nodebug.js'],
dest: ['resources/openpgp_nodebug.js'],
src: ['dist/openpgp_nodebug.js'],
dest: ['dist/openpgp_nodebug.js'],
replacements: [{
from: /OpenPGP.js VERSION/g,
to: 'OpenPGP.js v<%= pkg.version %>.<%= grunt.template.today("yyyymmdd") %>'
@ -72,8 +55,7 @@ module.exports = function(grunt) {
uglify: {
openpgpjs: {
files: {
"resources/openpgp.min.js" : [ "resources/openpgp_nodebug.js" ],
"resources/keyring.min.js" : [ "resources/keyring_nodebug.js" ]
'dist/openpgp.min.js' : [ 'dist/openpgp_nodebug.js' ]
}
},
options: {
@ -81,9 +63,9 @@ module.exports = function(grunt) {
'<%= grunt.template.today("yyyy-mm-dd") %> */'
}
},
jsbeautifier : {
files : ["src/**/*.js"],
options : {
jsbeautifier: {
files: ['src/**/*.js'],
options: {
indent_size: 2,
preserve_newlines: true,
keep_array_indentation: false,
@ -91,20 +73,27 @@ module.exports = function(grunt) {
wrap_line_length: 120
}
},
jshint : {
all : ["src/**/*.js"]
jshint: {
all: ['src/**/*.js']
},
jsdoc : {
dist : {
src: ["README.md", "src"],
jsdoc: {
dist: {
src: ['README.md', 'src'],
options: {
destination: "doc",
destination: 'doc',
recurse: true,
template: "jsdoc.template"
template: 'jsdoc.template'
}
}
},
mochaTest: {
unittests: {
options: {
reporter: 'spec'
},
src: [ 'test/unittests.js' ]
}
},
copy: {
npm: {
expand: true,
@ -116,23 +105,23 @@ module.exports = function(grunt) {
}
});
// Load the plugin that provides the "uglify" task.
// Load the plugin(s)
grunt.loadNpmTasks('grunt-browserify');
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-text-replace');
grunt.loadNpmTasks('grunt-jsbeautifier');
grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.loadNpmTasks('grunt-jsdoc');
grunt.loadNpmTasks('grunt-mocha-test');
grunt.loadNpmTasks('grunt-contrib-copy');
grunt.registerTask('default', 'Build OpenPGP.js', function() {
grunt.task.run(['browserify', 'replace', 'uglify']);
grunt.task.run(['browserify', 'replace', 'uglify', 'npm_pack']);
//TODO jshint is not run because of too many discovered issues, once these are addressed it should autorun
grunt.log.ok('Before Submitting a Pull Request please also run `grunt jshint`.');
});
grunt.registerTask('documentation', ['jsdoc']);
// Load the plugin(s)
grunt.loadNpmTasks('grunt-contrib-copy');
grunt.registerTask('documentation', ['jsdoc']);
// Alias the `mocha_phantomjs` task to run `mocha-phantomjs`
grunt.registerTask('mocha_phantomjs', 'mocha-phantomjs', function () {
@ -144,6 +133,25 @@ module.exports = function(grunt) {
mocha.stderr.pipe(process.stderr);
});
// Test/Dev tasks
grunt.registerTask('test', ['copy', 'mocha_phantomjs']);
// Alias the `npm_pack` task to run `npm pack`
grunt.registerTask('npm_pack', 'npm pack', function () {
var done = this.async();
var npm = require('child_process').exec('npm pack ../', { cwd: 'dist'}, function (err, stdout) {
var package = stdout;
if (err === null) {
var install = require('child_process').exec('npm install dist/' + package, function (err) {
done(err);
});
install.stdout.pipe(process.stdout);
install.stderr.pipe(process.stderr);
} else {
done(err);
}
});
npm.stdout.pipe(process.stdout);
npm.stderr.pipe(process.stderr);
});
// Test/Dev tasks
grunt.registerTask('test', ['copy', 'mocha_phantomjs', 'mochaTest']);
};

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

117
doc/index.js______.html Normal file

File diff suppressed because one or more lines are too long

64
doc/index.js_______.html Normal file

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

127
doc/module-keyring.html Normal file

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

Some files were not shown because too many files have changed in this diff Show More