[OLINGO-416] cleanup grunt file
diff --git a/odatajs/Gruntfile.js b/odatajs/Gruntfile.js
index 8c07d34..129eb51 100644
--- a/odatajs/Gruntfile.js
+++ b/odatajs/Gruntfile.js
@@ -1,33 +1,35 @@
module.exports = function(grunt) {
'use strict';
+ var pkg = grunt.file.readJSON('package.json');
+
+ // Build artifact base name
+ //<%= pkg.name %>-<%= pkg.version %>-<%= pkg.postfix %>-<%= pkg.releaseCandidate %>'
+ var artifactname = pkg.name + '-' + pkg.version +
+ (pkg.postfix.length > 0 ? "-" : "") + pkg.postfix +
+ (pkg.releaseCandidate.length > 0 ? "-" : "") + pkg.releaseCandidate;
var init = {
- pkg: grunt.file.readJSON('package.json'),
+ pkg: pkg,
banner: grunt.file.read('src/banner.txt'),
- filename : '<%= pkg.name %>-<%= pkg.version %>-<%= pkg.postfix %>',
+ artifactname : artifactname,
-
- browserify: { // convert code from nodejs style to brower style
+ browserify: { // convert code from nodejs style to browser style
src: {
- files: {
- 'build/<%= filename %>.js': ['src/index.js'],
- },
- options: {
- transform: ['./grunt-config/browserify_transforms/stripheader/stripheader.js'], // remove apache license headers before contatenating
- browserifyOptions: { } ,
- bundleOptions: { },
+ files: { 'build/<%= artifactname %>.js': ['src/index.js'] },
+ options: { // remove apache license headers before contatenating
+ transform: ['./grunt-config/browserify_transforms/stripheader/stripheader.js'],
}
}
},
uglify: { // uglify and minify the lib
options: {
sourceMap : true,
- sourceMapName : 'build/<%= filename %>.map',
+ sourceMapName : 'build/<%= artifactname %>.map',
sourceMapIncludeSources : true,
},
build: {
- src: 'build/<%= filename %>.js',
- dest: 'build/<%= filename %>.min.js'
+ src: 'build/<%= artifactname %>.js',
+ dest: 'build/<%= artifactname %>.min.js'
}
},
concat : { // add the apache license headers
@@ -35,101 +37,31 @@
banner : '<%= banner %>'
},
licence: {
- src: 'build/<%= filename %>.js',
- dest: 'build/<%= filename %>.js',
+ src: 'build/<%= artifactname %>.js',
+ dest: 'build/<%= artifactname %>.js',
},
licence_min: {
- src: 'build/<%= filename %>.min.js',
- dest: 'build/<%= filename %>.min.js',
+ src: 'build/<%= artifactname %>.min.js',
+ dest: 'build/<%= artifactname %>.min.js',
},
},
- copy: { // copy odatajs library files to demo folder withch contains samples
+ 'copy': { // copy odatajs library files to demo folder withch contains samples
forDemo: {
- files: [{ expand: true, cwd: 'build/', src: ['<%= filename %>*.*'], dest: 'demo/scripts/', filter: 'isFile'}]
+ files: [{
+ expand: true, cwd: 'build/', filter: 'isFile',
+ src: ['<%= artifactname %>*.*'],
+ dest: 'demo/scripts/'
+ }]
}
},
- connect: { // not used, start a testing server
- demo: {
- options: {
- port: 4001 ,
- hostname: "localhost",
- base: "demo",
- keepalive : true,
- middleware: function (connect, options) {
- return [
- require("grunt-connect-proxy/lib/utils").proxyRequest ,
- connect.static(options.base), // static content
- connect.directory(options.base) // browse directories
- ];
- },
- },
- },
- // start a node webserver with proxy to host the qunit-test html files
- 'test-browser': {
- options: {
- port: 4003 ,
- hostname: "localhost",
- base: "",
- keepalive : true,
- //changeOrigin: true,
- middleware: function (connect, options) {
- return [
- require("grunt-connect-proxy/lib/utils").proxyRequest ,
- connect.static(options.base), // static content
- connect.directory(options.base) // browse directories
- ];
- },
- },
- // proxy all request going to /tests/endpoints/ to the .net data services
- proxies: [{
- context: "/tests/endpoints/", // When the url contains this...
- host: "localhost",
- changeOrigin: true,
- https: false,
- port: 46541,
- rejectUnauthorized: false,
- }],
- },
- },
- 'node-qunit': {
- //used to run some background qunit test on node
- 'default-tests': {
- setup: {
- log: {
- summary: true,
- assertions: true,
- errors: true,
- globalSummary: true,
- coverage: false,
- globalCoverage: false,
- testing: true
- },
- coverage: false,
- deps: null,
- namespace: null
- },
- deps: '',
- code: './tests-tmp/common/node-test-setup.js',
- tests: ['./tests-tmp/odata-json-tests.js'],
- done: function(err, res){
- !err && publishResults("node", res, this.async());
- }
- },
- },
'jsdoc' : { // generate documentation
- 'src' : {
+ src : {
src: ['src/**/*.js'],
- options: {
- destination: 'build/doc-src',
- verbose : false
- }
+ options: { destination: 'build/doc-src', verbose : false }
},
test : {
src: ['tests/**/*.js'],
- options: {
- destination: 'build/doc-test',
- verbose : false
- }
+ options: { destination: 'build/doc-test', verbose : false }
}
},
'npm-clean': {
@@ -139,13 +71,13 @@
doc: {
src: ["build/doc"],
options: {
- force: true
- }
+ force: true
+ }
},
"doc-test": {
src: ["build/doc-test"],
options: {
- force: true
+ force: true
}
},
},
@@ -173,8 +105,6 @@
/*** Load tasks from npm modules ***/
grunt.loadNpmTasks('grunt-browserify');
grunt.loadNpmTasks('grunt-contrib-uglify');
- grunt.loadNpmTasks("grunt-connect-proxy");
- grunt.loadNpmTasks("grunt-contrib-connect");
grunt.loadNpmTasks("grunt-contrib-copy");
grunt.loadNpmTasks("grunt-contrib-concat");
grunt.loadNpmTasks('grunt-contrib-compress');
@@ -190,15 +120,15 @@
grunt.loadTasks('grunt-config');
// rename some tasks to avoid name clashes with the user tasks
- //grunt.renameTask('clean','npm-clean');
+ grunt.renameTask('clean','npm-clean');
- grunt.registerTask('clearEnv', 'iterate files', function() {
+ grunt.registerTask('clearEnv', 'clear JAVA_TOOL_OPTIONS', function() {
process.env['JAVA_TOOL_OPTIONS'] = '';
});
/*** E N D U S E R T A S K S ***/
- //grunt.registerTask('clean', ['npm-clean:doc','npm-clean:tmp']);
+ grunt.registerTask('clean', ['npm-clean:doc','npm-clean:tmp']);
// Runs the license header check to verify the any source file contains a license header
grunt.registerTask('license-check', ['custom-license-check']);
diff --git a/odatajs/grunt-config/release.js b/odatajs/grunt-config/release.js
index e20a805..57386cd 100644
--- a/odatajs/grunt-config/release.js
+++ b/odatajs/grunt-config/release.js
@@ -35,7 +35,7 @@
'clean': {
'release-dist': {
options: { force: true },
- src: [ "./../dist/<%= filename %>*"]
+ src: [ "./../dist/<%= artifactname %>*"]
}
}
});
@@ -48,7 +48,7 @@
"release-doc-src" : {
src: ['src/**/*.js'],
options: {
- destination: './../dist/<%= filename %>/doc',
+ destination: './../dist/<%= artifactname %>/doc',
verbose : false
}
},
@@ -60,23 +60,23 @@
'copy' : {
'release-lib' : {
files: [
- { expand: true, cwd: 'build', src: ['<%= filename %>*.*'], dest: './../dist/<%= filename %>/lib/lib', filter: 'isFile'},
- { expand: true, src :'LICENSE',dest: './../dist/<%= filename %>/lib', filter: 'isFile' },
- { expand: true, src :'NOTICE',dest: './../dist/<%= filename %>/lib', filter: 'isFile' },
- { expand: true, src :'DEPENDENCIES',dest: './../dist/<%= filename %>/lib', filter: 'isFile' }
+ { expand: true, cwd: 'build', src: ['<%= artifactname %>*.*'], dest: './../dist/<%= artifactname %>/lib/lib', filter: 'isFile'},
+ { expand: true, src :'LICENSE',dest: './../dist/<%= artifactname %>/lib', filter: 'isFile' },
+ { expand: true, src :'NOTICE',dest: './../dist/<%= artifactname %>/lib', filter: 'isFile' },
+ { expand: true, src :'DEPENDENCIES',dest: './../dist/<%= artifactname %>/lib', filter: 'isFile' }
]
},
'release-doc' : {
files: [
- { expand: true, cwd: 'build/doc-src', src: ['**'], dest: './../dist/<%= filename %>/doc/doc', filter: 'isFile'},
- { expand: true, src :'LICENSE',dest: './../dist/<%= filename %>/doc', filter: 'isFile' },
- { expand: true, src :'NOTICE',dest: './../dist/<%= filename %>/doc', filter: 'isFile' },
- { expand: true, src :'DEPENDENCIES',dest: './../dist/<%= filename %>/doc', filter: 'isFile' }
+ { expand: true, cwd: 'build/doc-src', src: ['**'], dest: './../dist/<%= artifactname %>/doc/doc', filter: 'isFile'},
+ { expand: true, src :'LICENSE',dest: './../dist/<%= artifactname %>/doc', filter: 'isFile' },
+ { expand: true, src :'NOTICE',dest: './../dist/<%= artifactname %>/doc', filter: 'isFile' },
+ { expand: true, src :'DEPENDENCIES',dest: './../dist/<%= artifactname %>/doc', filter: 'isFile' }
]
},
'release-sources' : {
files: [
- { dot: true, expand: true, cwd: '', src: ['**'], dest: './../dist/<%= filename %>/sources',
+ { dot: true, expand: true, cwd: '', src: ['**'], dest: './../dist/<%= artifactname %>/sources',
filter: function(srcPath) {
// no node_modules
if (srcPath === 'node_modules' || contains(srcPath, 'node_modules\\')) {
@@ -135,17 +135,17 @@
grunt.config.merge( {
compress: { // build the zip files for the release
'release-lib': { // just the lib
- options: {archive: './../dist/<%= filename %>-lib.zip'},
- files: [{expand: true, cwd: './../dist/<%= filename %>/lib', src: ['**'], dest: '/'}]
+ options: {archive: './../dist/<%= artifactname %>/<%= artifactname %>-lib.zip'},
+ files: [{expand: true, cwd: './../dist/<%= artifactname %>/lib', src: ['**'], dest: '/'}]
},
'release-doc': { // just the documentation
- options: {archive: './../dist/<%= filename %>-doc.zip'},
- files: [{expand: true, cwd: './../dist/<%= filename %>/doc', src: ['**'], dest: '/'}]
+ options: {archive: './../dist/<%= artifactname %>/<%= artifactname %>-doc.zip'},
+ files: [{expand: true, cwd: './../dist/<%= artifactname %>/doc', src: ['**'], dest: '/'}]
},
'release-sources' : { // the full repository with out the git stuff
- options: { archive: './../dist/<%= filename %>-sources.zip'},
+ options: { archive: './../dist/<%= artifactname %>/<%= artifactname %>-sources.zip'},
files: [
- {expand: true, cwd: './../dist/<%= filename %>/sources', src: ['**'], dest: '/'},
+ {expand: true, cwd: './../dist/<%= artifactname %>/sources', src: ['**'], dest: '/'},
]
}
},
diff --git a/odatajs/package.json b/odatajs/package.json
index a3727cc..36dd3d7 100644
--- a/odatajs/package.json
+++ b/odatajs/package.json
@@ -1,9 +1,11 @@
{
"name": "odatajs",
- "postfix": "beta-01",
- "title": "Olingo OData Client for Java Script",
"version": "4.0.0",
- "description": "odatajs is a new cross-browser JavaScript library that enables data-centric web applications by leveraging modern protocols such as JSON and OData and HTML5-enabled browser features. It's designed to be small, fast and easy to use.",
+ "postfix": "beta-01",
+ "releaseCandidate" : "RC01",
+
+ "title": "Olingo OData Client for Java Script",
+ "description": "the Olingo OData Client for Java Script library is a new cross-browser JavaScript library that enables data-centric web applications by leveraging modern protocols such as JSON and OData and HTML5-enabled browser features. It's designed to be small, fast and easy to use.",
"homepage": "http://olingo.apache.org",
"main": "index.js",
"repository": {
@@ -36,12 +38,10 @@
"grunt-contrib-clean": "^0.6.0",
"grunt-contrib-compress": "^0.10.0",
"grunt-contrib-concat": "^0.5.0",
- "grunt-contrib-connect": "^0.7.1",
"grunt-contrib-copy": "^0.5.0",
"grunt-contrib-uglify": "^0.4.0",
"grunt-curl": "^2.0.2",
"grunt-jsdoc": "^0.5.6",
- "grunt-node-qunit": "^2.0.2",
"through": "^2.3.4"
}
}