http://git-wip-us.apache.org/repos/asf/olingo-odata4-js/blob/503b4417/grunt-config/custom-tasks/rat/tasks/rat.js ---------------------------------------------------------------------- diff --git a/grunt-config/custom-tasks/rat/tasks/rat.js b/grunt-config/custom-tasks/rat/tasks/rat.js new file mode 100644 index 0000000..287f1a4 --- /dev/null +++ b/grunt-config/custom-tasks/rat/tasks/rat.js @@ -0,0 +1,154 @@ +/* + * 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. + */ + +module.exports = function (grunt) { + grunt.registerMultiTask('rat', 'Run Apache Rat', function () { + var async = require("async"); + var chalk = require('chalk'); + var childProcess = require('child_process'); + var path = require('path'); + var fs = require('fs'); + var xml2js = require('xml2js'); + + var globalCB = this.async(); + + var ratJarFile = path.resolve(__dirname,'./../extern-tools/apache-rat-0.11/apache-rat-0.11.jar'); + var options = this.options({ xml : true, dest : './build/tmp'}); + + //check output directory + if(!fs.existsSync(options.dest)){ + grunt.file.mkdir(options.dest,0766); + } + + //collect directories which should be checked + var checkDirs = []; + for(var i = 0; i < this.files.length; i++) { + for(var ii = 0; ii < this.files[i].src.length; ii++) { + var checkDir = { + dir : this.files[i].src[ii], + options : { + xml : options.xml, + dest : options.dest, + tag : this.files[i].options.tag, + exclude : options.exclude || this.files[i].options.exclude + } + }; + checkDirs.push(checkDir); + } + } + + var processDirectory = function processDirectory(data,cb) { + var checkDir = data.dir; + var options = data.options; + var outPutFile = options.dest + '/'+ 'rat_' + (options.tag ? options.tag:'') + (options.xml ? '.xml' : '.txt'); + + //sample command java -jar apache-rat-0.10.jar -x -d ./src > ./build/tmp/rat.txt + var cmd = 'java -jar ' + ratJarFile+ ' '; + cmd += options.xml ? ' -x' : ''; + cmd += ' --force -d ' + checkDir; + //cmd += ' -E ./grunt-config/custom-tasks/rat/.rat-excludes' + if (options.exclude) { + for (var i = 0; i< options.exclude.length; i ++) { + cmd += ' -e '+ options.exclude[i]; + } + } + cmd += ' > ' + outPutFile; + + grunt.verbose.writeln('Command:', chalk.yellow(cmd)); + var cp = childProcess.exec(cmd, options.execOptions, function (error, stdout, stderr) { + if (error) { + grunt.fail.warn('rat --> ' + error, 1); //exit grunt with error code 1 + } + checkOutFile(outPutFile,data,cb); + }); + }; + + var checkOutFile = function(outFile,data,cb) { + //check out files + if (path.extname(outFile) !== '.xml') { + grunt.log.writeln(chalk.yellow('\nrat --> ' + 'No XML output: ('+outFile+') skipped!\n')); + cb(); + return; + } + + var xml = grunt.file.read(outFile); + var parser = new xml2js.Parser(); + + parser.parseString(xml, function (err, result) { + if (err) { + grunt.fail.warn('rat --> XML parse error: ' + err, 1); + } + + if (checkRatLogFile(result)) { + grunt.fail.warn('rat --> check license error: ' + 'Missing or Invalied license header detected ( see "'+outFile+'")', 1); + } + + grunt.log.ok('rat --> check on ' + data.dir + ' ok -> see' + outFile); + }); + cb(); + }; + + var checkRatLogFile = function(result) { + var list = result['rat-report']['resource']; + for (var i = 0; i < list.length; i++ ){ + var item = list[i]; + + var headerType = list[i]['header-type']; + var attr = headerType[0]['$']; + if (attr.name.trim() !== 'AL') { + return true; + } + } + return false; + }; + + var captureOutput = function (child, output) { + if (grunt.option('color') === false) { + child.on('data', function (data) { + output.write(chalk.stripColor(data)); + }); + } else { + child.pipe(output); + } + }; + + //files + async.each(checkDirs, + function (checkDir,cb) { + processDirectory(checkDir,cb); + }, + function(err) { + grunt.log.ok('rat --> finished'); + globalCB(); + } + ); + + + /* + captureOutput(cp.stdout, process.stdout); + captureOutput(cp.stderr, process.stderr); + + if (options.stdin) { + process.stdin.resume(); + process.stdin.setEncoding('utf8'); + process.stdin.pipe(cp.stdin); + }*/ + }); +}; +
http://git-wip-us.apache.org/repos/asf/olingo-odata4-js/blob/503b4417/grunt-config/custom-tasks/sign.js ---------------------------------------------------------------------- diff --git a/grunt-config/custom-tasks/sign.js b/grunt-config/custom-tasks/sign.js new file mode 100644 index 0000000..86e0d04 --- /dev/null +++ b/grunt-config/custom-tasks/sign.js @@ -0,0 +1,141 @@ +/* + * 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. + */ + +module.exports = function(grunt) { + + grunt.registerMultiTask('sign', function() { + var self = this; + + var path = require('path'); + 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++) { + for(var ii = 0; ii < this.files[i].src.length; ii++) { + for (var iii = 0; iii < options.types.length; iii++) { + workLoad.push({ + src :this.files[i].src[ii], + type: options.types[iii] + }); + } + } + } + + function process() { + if(workLoad.length <= 0) { + globalDone(); + return; + } + + 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,pipeSrc = 'out'; + console.log (fileName); + if ( workItem.type === 'md5' ) { + pipeTo = workItem.src+'.md5'; + + grunt.log.writeln(chalk.yellow('Signing ('+workItem.type+') ' + fileName + " ...")); + //openssl dgst -md5 odatajs.4.0.0-beta01.nupkg + taskOptions = { + cmd : 'openssl', + args: ['dgst','-md5',fileName], + opts : { cwd :self.data.cwd } + }; + } else if ( workItem.type === 'sha' ) { + 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 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); + } + }); + + + + 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('Processed ('+workItem.type+') :' + workItem.src); + grunt.log.ok('with code ' + code); + process(); + }); + + } + + process(); + }); +}; + http://git-wip-us.apache.org/repos/asf/olingo-odata4-js/blob/503b4417/grunt-config/custom-tasks/toBrowser.js ---------------------------------------------------------------------- diff --git a/grunt-config/custom-tasks/toBrowser.js b/grunt-config/custom-tasks/toBrowser.js new file mode 100644 index 0000000..4712a87 --- /dev/null +++ b/grunt-config/custom-tasks/toBrowser.js @@ -0,0 +1,23 @@ +/* + * 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. + */ + + +module.exports = function(grunt) { + require('./toBrowser/toBrowser.js')(grunt); +}; http://git-wip-us.apache.org/repos/asf/olingo-odata4-js/blob/503b4417/grunt-config/custom-tasks/toBrowser/toBrowser.js ---------------------------------------------------------------------- diff --git a/grunt-config/custom-tasks/toBrowser/toBrowser.js b/grunt-config/custom-tasks/toBrowser/toBrowser.js new file mode 100644 index 0000000..ad2e8c8 --- /dev/null +++ b/grunt-config/custom-tasks/toBrowser/toBrowser.js @@ -0,0 +1,98 @@ +/* + * 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. + */ + +module.exports = function(grunt) { + + var stripHeader = function(input) { + return input.replace(/(\/\*(.|\n|\r)*?\*\/)/i,""); + }; + + grunt.registerMultiTask('toBrowser', function() { + var self = this; + + var path = require('path'); + var fs = require( 'fs' ); + + var globalDone = this.async(); + + var options = this.options({ }); + + var workLoad = []; + var writeToLogOk = function(data) { grunt.log.ok(data.toString()); }; + + + // fill workLoad + for(var i = 0; i < this.files.length; i++) { + for(var ii = 0; ii < this.files[i].src.length; ii++) { + + + var srcFile = this.files[i].src[ii]; + + var srcPath = srcFile.substring(0,srcFile.lastIndexOf('/')+1); + var srcName = srcFile.substring(srcFile.lastIndexOf('/')+1,srcFile.length-3); + + //console.log('exists :'+srcPath+srcName+'-browser.js' ); + tarName = srcName; + if (srcName.indexOf('-browser') > 0) { + tarName = tarName.substring(0,srcName.indexOf('-browser')); + //console.log('new srcName :'+srcName ); + } else if (grunt.file.exists(srcPath+srcName+'-browser.js')) { + //console.log('exists :yes'); + continue; //skip that file + } + + + workLoad.push({ + srcPath : srcPath, + srcName : srcName, + tarName : tarName + }); + + } + + var concat = '{'; + for(var x = 0; x < workLoad.length; x++) { + console.log('workLoad :'+JSON.stringify(workLoad[x] )); + var src = grunt.file.read(workLoad[x].srcPath+workLoad[x].srcName+'.js'); + // remove the first comment + src = stripHeader(src); + + if (x > 0) { + concat+= ', '; + } + + concat+= '"' + workLoad[x].tarName + '" : '; + concat+= 'function(exports, module, require) {'; + concat+= src +'}'; + } + concat+= '}'; + + var tpl = grunt.file.read('./grunt-config/custom-tasks/toBrowser/wrapper-tpl.js'); + var init = stripHeader(grunt.file.read(options.index)); + + tpl = tpl.replace('\'<% initFunction %>\'',init); + tpl = tpl.replace('\'<% filesAsFunctionList %>\'',concat); + + grunt.file.write(this.files[i].dest, tpl); + } + + globalDone(); + }); +}; + http://git-wip-us.apache.org/repos/asf/olingo-odata4-js/blob/503b4417/grunt-config/custom-tasks/toBrowser/wrapper-tpl.js ---------------------------------------------------------------------- diff --git a/grunt-config/custom-tasks/toBrowser/wrapper-tpl.js b/grunt-config/custom-tasks/toBrowser/wrapper-tpl.js new file mode 100644 index 0000000..9c335db --- /dev/null +++ b/grunt-config/custom-tasks/toBrowser/wrapper-tpl.js @@ -0,0 +1,43 @@ +/* + * 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. + */ +var init = function(exports, module, require) { + '<% initFunction %>' +}; + +var datas = '<% filesAsFunctionList %>'; + +var modules = {}; + +var require = function(path) { + var name = path.substring(path.lastIndexOf('/')+1,path.length-3); + if (modules[name]) { return modules[name].exports; } + + modules[name] = { exports : {}}; + console.log(name); + if (name === 'sou') { + var i = 0; + } + datas[name].call(this,modules[name].exports,modules[name],require); + return modules[name].exports; + }; + +window.odatajs = {}; +init.call(this,window.odatajs,window.odatajs,require); + + http://git-wip-us.apache.org/repos/asf/olingo-odata4-js/blob/503b4417/grunt-config/nugetpack.nuspec ---------------------------------------------------------------------- diff --git a/grunt-config/nugetpack.nuspec b/grunt-config/nugetpack.nuspec new file mode 100644 index 0000000..10129b4 --- /dev/null +++ b/grunt-config/nugetpack.nuspec @@ -0,0 +1,27 @@ +<?xml version="1.0"?> +<package xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> + <metadata xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd"> + <title>Olingo OData Client for JavaScript</title> + <id>odatajs</id> + <tags>restful api open protocol odata client javascript</tags> + <version>4.0.0-beta01</version> + <authors>Apache Olingo (Challen He, Kobler-Morris Sven)</authors> + <owners>Apache Olingo</owners> + <licenseUrl>http://www.apache.org/licenses/LICENSE-2.0</licenseUrl> + <copyright>Copyright 2014 The Apache Software Foundation</copyright> + <projectUrl>http://olingo.apache.org/</projectUrl> + <iconUrl>http://olingo.apache.org/img/OlingoOrangeTM.png</iconUrl> + <requireLicenseAcceptance>true</requireLicenseAcceptance> + <summary>JavaScript library to easily interact with OData V4 service.</summary> + <description>Olingo OData Client for JavaScript (odatajs) is a lightweight cross-browser JavaScript library that enables web browser to consume and interact with OData V4 service.</description> + <releaseNotes> + This odatajs library for OData V4 is a new version based on datajs(http://datajs.codeplex.com/) which is for OData V3. + </releaseNotes> + </metadata> + <files> + <file src="..\LICENS*E" target="odatajs\" /> + <file src="..\NOTIC*E" target="odatajs\" /> + <file src="..\DEPENDENCIE*S" target="odatajs\" /> + <file src="..\build\lib\*" target="odatajs\" /> + </files> +</package> http://git-wip-us.apache.org/repos/asf/olingo-odata4-js/blob/503b4417/grunt-config/rat.js ---------------------------------------------------------------------- diff --git a/grunt-config/rat.js b/grunt-config/rat.js new file mode 100644 index 0000000..30e31d3 --- /dev/null +++ b/grunt-config/rat.js @@ -0,0 +1,65 @@ +/* + * 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. + */ +module.exports = function(grunt) { + + + grunt.config('rat', { + dist: { + options: { + dest : './build/tmp', + exclude: [ + "node_modules","extern-tools",".gitignore", + "DEPENDENCIES","LICENSE","NOTICE", + "JSLib.sln","package.json", "mocha.opts" + ] }, + files: [ + /*{ src: ['./../dist/<%= artifactname %>/doc'], options:{ tag:"dist-doc"}},generated*/ + /*{ src: ['./../dist/<%= artifactname %>/lib'], options:{ tag:"dist-lib"}},very slow*/ + { src: ['./../dist/<%= artifactname %>/sources'], options:{ tag:"dist-src"}}, + ] + }, + "manual-dist": { + options: { xml:false, + dest : './build/tmp', + exclude: [ + "node_modules","extern-tools",".gitignore", + "DEPENDENCIES","LICENSE","NOTICE", + "JSLib.sln","package.json", "mocha.opts" + ] }, + files: [ + /*{ src: ['./../dist/<%= artifactname %>/doc'], options:{ tag:"dist-doc"}},generated*/ + /*{ src: ['./../dist/<%= artifactname %>/lib'], options:{ tag:"dist-lib"}},very slow*/ + { src: ['./../dist/<%= artifactname %>/sources'], options:{ tag:"dist-src"}}, + ] + }, + manual: { // with txt output + options: { xml:false, + dest : './build/tmp', + exclude: ["node_modules","extern-tools",".gitignore"] }, + files: [ + { src: ['./src'], options:{ tag:"src"}}, + { src: ['./tests'], options:{ tag:"tests"}}, + { src: ['./demo'], options:{ tag:"demo"}}, + { src: ['./grunt-config'], options:{ tag:"grunt-config" }} + ] + }, + }); + + +}; \ No newline at end of file http://git-wip-us.apache.org/repos/asf/olingo-odata4-js/blob/503b4417/grunt-config/release.js ---------------------------------------------------------------------- diff --git a/grunt-config/release.js b/grunt-config/release.js new file mode 100644 index 0000000..b808224 --- /dev/null +++ b/grunt-config/release.js @@ -0,0 +1,178 @@ +/* + * 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. + */ +module.exports = function(grunt) { + + function endsWith(hay, needle) { + return hay.indexOf(needle, hay.length - needle.length) !== -1; + } + + function startsWith(hay, needle) { + return hay.indexOf(needle) === 0; + } + + function contains(hay, needle) { + return hay.indexOf(needle) > -1; + } + + + + // clean + grunt.config.merge( { + 'npm-clean': { + 'release-dist': { + options: { force: true }, + src: [ "./../dist/<%= artifactname %>*"] + } + } + }); + + grunt.loadNpmTasks("grunt-contrib-clean"); + + // doc + grunt.config.merge( { + 'jsdoc' : { // generate documentation + "release-doc-src" : { + src: ['src/**/*.js'], + options: { + destination: './../dist/<%= artifactname %>/doc', + verbose : false + } + }, + }, + }); + + // copy + grunt.config.merge( { + "copy" : { + "release-lib" : { + files: [ + { expand: true, cwd: 'build/lib', 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' }, + { expand: true, src :'README.md',dest: './../dist/<%= artifactname %>/lib', filter: 'isFile' } + ] + }, + "release-nuget": { + files: [ + { expand: true, cwd: 'build', src: ['odatajs.4.0.0-beta01.nupkg'], dest: './../dist/<%= artifactname %>', filter: 'isFile' }, + ] + }, + "release-doc" : { + files: [ + { 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' }, + { expand: true, src :'README.md',dest: './../dist/<%= artifactname %>/doc', filter: 'isFile' } + ] + }, + "release-sources" : { + files: [ + { expand: true, src :'LICENSE',dest: './../dist/<%= artifactname %>/sources', filter: 'isFile' }, + { expand: true, src :'NOTICE',dest: './../dist/<%= artifactname %>/sources', filter: 'isFile' }, + { expand: true, src :'DEPENDENCIES',dest: './../dist/<%= artifactname %>/sources', filter: 'isFile' }, + { dot: true, expand: true, cwd: './', src: ['**'], dest: './../dist/<%= artifactname %>/sources/odatajs', + filter: function(srcPath) { + // no node_modules + if (srcPath === 'node_modules' || contains(srcPath, 'node_modules\\')|| contains(srcPath, 'node_modules/')) { + return false; + } + if (srcPath === 'extern-tools' || contains(srcPath, 'extern-tools\\')|| contains(srcPath, 'extern-tools/')) { + return false; + } + + if (contains(srcPath, 'demo\\scripts\\datajs-') || + contains(srcPath, 'demo/scripts/datajs-')) { + return false; + } + if (contains(srcPath, 'demo\\scripts\\odatajs-') || + contains(srcPath, 'demo/scripts/odatajs-')) { + return false; + } + + // no c# files + if (srcPath === 'obj' || contains(srcPath, 'obj')|| contains(srcPath, 'obj')) { + return false; + } + + if (srcPath === 'bin' || contains(srcPath, 'bin')|| contains(srcPath, 'bin')) { + return false; + } + + if (srcPath === 'packages' || contains(srcPath, 'packages')|| contains(srcPath, 'packages')) { + return false; + } + + // no build retults + if (srcPath === 'build' || contains(srcPath, 'build')|| contains(srcPath, 'build')) { + return false; + } + + if (endsWith(srcPath, '.gitignore')) { + return false; + } + if (endsWith(srcPath, 'localgrunt.config')) { + return false; + } + if (endsWith(srcPath, 'JSLib.suo')) { + return false; + } + if (endsWith(srcPath, 'JSLib.csproj.user')) { + return false; + } + + console.log(' + ' + srcPath); + return true; + }}, + ] + }, + } + }); + + grunt.loadNpmTasks("grunt-contrib-copy"); + + + + + // zip + grunt.config.merge( { + compress: { // build the zip files for the release + 'release-lib': { // just the lib + options: {archive: './../dist/<%= artifactname %>/<%= artifactname %>-lib.zip'}, + files: [{expand: true, cwd: './../dist/<%= artifactname %>/lib', src: ['**'], dest: '/'}] + }, + 'release-doc': { // just the documentation + 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/<%= artifactname %>/<%= artifactname %>-sources.zip'}, + files: [ + {expand: true, cwd: './../dist/<%= artifactname %>/sources', src: ['**'], dest: '/'}, + ] + } + }, + }); + + + grunt.loadNpmTasks('grunt-contrib-compress'); + +}; + http://git-wip-us.apache.org/repos/asf/olingo-odata4-js/blob/503b4417/grunt-config/sign.js ---------------------------------------------------------------------- diff --git a/grunt-config/sign.js b/grunt-config/sign.js new file mode 100644 index 0000000..f5bc129 --- /dev/null +++ b/grunt-config/sign.js @@ -0,0 +1,61 @@ +/* + * 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. + */ +module.exports = function(grunt) { + + + //sign + grunt.config.merge( { + 'sign' : { + 'release' : { + options: { types : ['md5', 'sha']}, + expand : true, + cwd : './../dist/<%= artifactname %>/', + src : [ + '<%= artifactname %>-lib.zip', + 'odatajs.4.0.0-beta01.nupkg', + '<%= artifactname %>-doc.zip', + '<%= artifactname %>-sources.zip' + ] + }, + 'asc' : { + options: { types : ['asc']}, + expand : true, + cwd : './../dist/<%= artifactname %>/', + src : [ + '<%= artifactname %>-lib.zip', + 'odatajs.4.0.0-beta01.nupkg', + '<%= artifactname %>-doc.zip', + '<%= artifactname %>-sources.zip' + ] + }, + 'asc-verify' : { + options: { types : ['asc-verify']}, + expand : true, + cwd : './../dist/<%= artifactname %>/', + src : [ + '<%= artifactname %>-lib.zip', + 'odatajs.4.0.0-beta01.nupkg', + '<%= artifactname %>-doc.zip', + '<%= artifactname %>-sources.zip' + ] + } + }, + }); +}; + http://git-wip-us.apache.org/repos/asf/olingo-odata4-js/blob/503b4417/odatajs/.gitignore ---------------------------------------------------------------------- diff --git a/odatajs/.gitignore b/odatajs/.gitignore deleted file mode 100644 index 16af8ff..0000000 --- a/odatajs/.gitignore +++ /dev/null @@ -1,17 +0,0 @@ -localgrunt.config - -# testing copies -demo/scripts/odatajs-4.0.0-beta-01* - -# build artefacts -build/ - -# nodejs temporary objects -node_modules/ - -# C.net server temporary objects -bin/ -obj/ -packages/ -JSLib.suo -JSLib.csproj.user http://git-wip-us.apache.org/repos/asf/olingo-odata4-js/blob/503b4417/odatajs/DEPENDENCIES ---------------------------------------------------------------------- diff --git a/odatajs/DEPENDENCIES b/odatajs/DEPENDENCIES deleted file mode 100644 index a407380..0000000 --- a/odatajs/DEPENDENCIES +++ /dev/null @@ -1,6 +0,0 @@ -// ------------------------------------------------------------------ -// Transitive dependencies of this project determined from the -// maven pom organized by organization. -// ------------------------------------------------------------------ - -Apache Olingo \ No newline at end of file http://git-wip-us.apache.org/repos/asf/olingo-odata4-js/blob/503b4417/odatajs/Gruntfile.js ---------------------------------------------------------------------- diff --git a/odatajs/Gruntfile.js b/odatajs/Gruntfile.js deleted file mode 100644 index 74a2a88..0000000 --- a/odatajs/Gruntfile.js +++ /dev/null @@ -1,161 +0,0 @@ -/* - * 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. - */ -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; - - //options - var init = { - pkg: pkg, - banner: grunt.file.read('grunt-config/banner.txt'), - artifactname : artifactname, - - "toBrowser" : { - "release" : { - options: { index : "src/index-browser.js" }, - src: ["src/lib/**/*.js", '!**/*-node.*'], - dest: "build/lib/<%= artifactname %>.js", - } - }, - "uglify": { // uglify and minify the lib - options: { - sourceMap : true, - sourceMapName : "build/lib/<%= artifactname %>.map", - sourceMapIncludeSources : true, - banner : "<%= banner %>", - }, - "browser": { - src: "build/lib/<%= artifactname %>.js", - dest: "build/lib/<%= artifactname %>.min.js" - } - }, - "jsdoc" : { - "src" : { - src: ["src/**/*.js"], - options: { destination: "build/doc-src", verbose : false } - }, - "test" : { - src: ["tests/**/*.js"], - options: { destination: "build/doc-test", verbose : false } - } - }, - "nugetpack" : { // create nuget pagckage - "dist": { - src: 'grunt-config/nugetpack.nuspec', - dest: 'build/' - } - }, - "copy" : { - "to-latest" : { - src :"build/lib/<%= artifactname %>.js", - dest: "build/lib/odatajs-latest.js" - } - }, - "npm-clean": { - options: {force: true}, - "build": { - src: [ "build"] - }, - }, - "curl": { - "license": { - src: { - url: "http://apache.org/licenses/LICENSE-2.0.txt", - proxy: "http://proxy:8080" - }, - dest: "LICENSE" - } - } - }; - - // Join local configuration for proxies and local test servers - if (grunt.file.exists('localgrunt.config')) { - console.log("merge localgrunt.config"); - var localGrundConfig = grunt.file.read('localgrunt.config'); - init.connect['test-browser'].proxies = init.connect['test-browser'].proxies.concat(JSON.parse(localGrundConfig).proxies); - } - - // Init config - grunt.initConfig(init); - - // Load tasks from npm modules ***/ - grunt.loadNpmTasks('grunt-contrib-uglify'); - grunt.loadNpmTasks("grunt-contrib-copy"); - grunt.loadNpmTasks('grunt-contrib-compress'); - grunt.loadNpmTasks('grunt-curl'); - grunt.loadNpmTasks("grunt-jsdoc"); - grunt.loadNpmTasks("grunt-nuget"); - - // Load the custom-* tasks from the grunt-config directory - grunt.loadTasks('grunt-config/custom-tasks'); - - // Load the custom-* tasks from the grunt-config directory - grunt.loadTasks('grunt-config'); - - // rename some tasks to avoid name clashes with the user tasks - grunt.renameTask('clean','npm-clean'); - - 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:build']); - - // Runs the license header check to verify the any source file contains a license header - grunt.registerTask('license-check', ['rat:manual']); - - // Create documentation in /build/doc - grunt.registerTask('doc', ['clearEnv', 'jsdoc:src']); - grunt.registerTask('doc-test', ['clearEnv', 'jsdoc:test']); - - //grunt.registerTask('test-browser', ['configureProxies:test-browser', 'connect:test-browser']); - //grunt.registerTask('test-node', ['node-qunit:default-tests']); - //grunt.registerTask('release', ['build','doc','compress']); - //grunt.registerTask('update-legal', ['curl:license']); - - // Build the odatajs library - grunt.registerTask('build', ['clean:lib','toBrowser:release', 'uglify:browser', 'copy:to-latest', 'nugetpack']); - - grunt.registerTask('get-licence', ['curl:license']); - - // R E L E A S E T A S K S - grunt.registerTask('release',[ - 'npm-clean:release-dist', - 'build', - 'doc', - 'copy:release-lib','copy:release-doc','copy:release-sources', - 'rat:dist', // check the license headers - 'compress:release-lib','compress:release-doc','compress:release-sources', - ]); - - - grunt.registerTask('release:sign',[ - 'sign:release','sign:asc','sign:asc-verify' - ]); - -}; - http://git-wip-us.apache.org/repos/asf/olingo-odata4-js/blob/503b4417/odatajs/JSLib.csproj ---------------------------------------------------------------------- diff --git a/odatajs/JSLib.csproj b/odatajs/JSLib.csproj deleted file mode 100644 index 847691f..0000000 --- a/odatajs/JSLib.csproj +++ /dev/null @@ -1,210 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<!-- -/* - * 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. - */--> -<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> - <PropertyGroup> - <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> - <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> - <ProductVersion> - </ProductVersion> - <SchemaVersion>2.0</SchemaVersion> - <ProjectGuid>{73ADF1A7-613B-4679-885B-2AE4AFAA9A6A}</ProjectGuid> - <ProjectTypeGuids>{349c5851-65df-11da-9384-00065b846f21};{fae04ec0-301f-11d3-bf4b-00c04f79efbc}</ProjectTypeGuids> - <OutputType>Library</OutputType> - <AppDesignerFolder>Properties</AppDesignerFolder> - <RootNamespace>JSLib</RootNamespace> - <AssemblyName>JSLib</AssemblyName> - <TargetFrameworkVersion>v4.0</TargetFrameworkVersion> - <SccProjectName>SAK</SccProjectName> - <SccLocalPath>SAK</SccLocalPath> - <SccAuxPath>SAK</SccAuxPath> - <SccProvider>SAK</SccProvider> - <UseIISExpress>false</UseIISExpress> - </PropertyGroup> - <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> - <DebugSymbols>true</DebugSymbols> - <DebugType>full</DebugType> - <Optimize>false</Optimize> - <OutputPath>bin\</OutputPath> - <DefineConstants>DEBUG;TRACE</DefineConstants> - <ErrorReport>prompt</ErrorReport> - <WarningLevel>4</WarningLevel> - </PropertyGroup> - <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> - <DebugType>pdbonly</DebugType> - <Optimize>true</Optimize> - <OutputPath>bin\</OutputPath> - <DefineConstants>TRACE</DefineConstants> - <ErrorReport>prompt</ErrorReport> - <WarningLevel>4</WarningLevel> - </PropertyGroup> - <ItemGroup> - <Content Include="src\index.js" /> - <Content Include="src\banner.txt" /> - <Content Include="src\lib\cache.js" /> - <Content Include="src\lib\odatajs.js" /> - <Content Include="src\lib\odata.js" /> - <Content Include="src\lib\store.js" /> - <Content Include="src\lib\cache\source.js" /> - <Content Include="src\lib\odatajs\deferred.js" /> - <Content Include="src\lib\odatajs\utils.js" /> - <Content Include="src\lib\odatajs\xml.js" /> - <Content Include="src\lib\odata\batch.js" /> - <Content Include="src\lib\odata\handler.js" /> - <Content Include="src\lib\odata\json.js" /> - <Content Include="src\lib\odata\metadata.js" /> - <Content Include="src\lib\odata\net.js" /> - <Content Include="src\lib\odata\utils.js" /> - <Content Include="src\lib\store\dom.js" /> - <Content Include="src\lib\store\indexeddb.js" /> - <Content Include="src\lib\store\memory.js" /> - <Content Include="tests\cache-tests.js" /> - <Content Include="tests\common\CacheVerifier.js" /> - <Content Include="tests\common\common.js" /> - <Content Include="tests\common\Instrument.svc" /> - <Content Include="tests\common\Instrument.js" /> - <Content Include="tests\common\mockXMLHttpRequest.js" /> - <Content Include="tests\common\mockHttpClient.js" /> - <Content Include="tests\common\djstest.js" /> - <Content Include="tests\common\gpo-ie8-tour-disable.reg" /> - <Content Include="tests\common\ObservableHttpClient.js" /> - <Content Include="tests\common\ODataVerifyReader.js" /> - <Content Include="tests\common\ODataVerifyReader.svc" /> - <Content Include="tests\common\rx.js" /> - <Content Include="tests\common\TestLogger.svc" /> - <Content Include="tests\common\TestSynchronizerClient.js" /> - <Content Include="tests\e2etest\Test.html" /> - <Content Include="tests\odata-json-light-tests.js" /> - <Content Include="tests\odatajs-startup-perf-test.html" /> - <Content Include="tests\endpoints\BasicAuthDataService.svc" /> - <Content Include="tests\endpoints\FoodStoreDataServiceV4.svc" /> - <Content Include="tests\endpoints\CustomAnnotations.xml" /> - <Content Include="tests\endpoints\CustomDataService.svc" /> - <Content Include="tests\endpoints\EpmDataService.svc" /> - <Content Include="tests\endpoints\ErrorDataService.svc" /> - <Content Include="tests\endpoints\LargeCollectionService.svc" /> - <Content Include="tests\endpoints\web.config" /> - <Content Include="tests\odatajs-cache-large-collection-functional-tests.html" /> - <Content Include="tests\odatajs-cache-large-collection-functional-tests.js" /> - <Content Include="tests\odatajs-cache-long-haul-tests.html" /> - <Content Include="tests\odata-batch-functional-tests.html" /> - <Content Include="tests\odata-batch-functional-tests.js" /> - <Content Include="tests\odata-batch-tests.js" /> - <Content Include="tests\odata-cache-filter-functional-tests.html" /> - <Content Include="tests\odata-cache-filter-functional-tests.js" /> - <Content Include="tests\odata-cache-fperf-tests.html" /> - <Content Include="tests\odata-cache-fperf-tests.js" /> - <Content Include="tests\odata-cache-functional-tests.html" /> - <Content Include="tests\odata-cache-functional-tests.js" /> - <Content Include="tests\odata-cache-rx-functional-tests.html" /> - <Content Include="tests\odata-cache-rx-functional-tests.js" /> - <Content Include="tests\odata-fuzz.html" /> - <Content Include="tests\odata-metadata-tests.js" /> - <Content Include="tests\odata-handler-tests.js" /> - <Content Include="tests\odata-json-tests.js" /> - <Content Include="tests\odata-links-functional-tests.html" /> - <Content Include="tests\odata-links-functional-tests.js" /> - <Content Include="tests\odata-metadata-awareness-functional-tests.html" /> - <Content Include="tests\odata-metadata-awareness-functional-tests.js" /> - <Content Include="tests\odata-net-tests.js" /> - <Content Include="tests\odata-perf-tests.html" /> - <Content Include="tests\odata-perf-tests.js" /> - <Content Include="tests\odata-read-crossdomain-functional-tests.html" /> - <Content Include="tests\odata-read-crossdomain-functional-tests.js" /> - <Content Include="tests\odata-read-functional-tests.html" /> - <Content Include="tests\odata-request-functional-tests.html" /> - <Content Include="tests\odata-request-functional-tests.js" /> - <Content Include="tests\odata-read-functional-tests.js" /> - <Content Include="tests\odata-qunit-tests.htm" /> - <Content Include="tests\odata-tests.js" /> - <Content Include="tests\odata-xml-tests.js" /> - <Content Include="tests\run-tests.wsf" /> - <Content Include="tests\store-indexeddb-tests.js" /> - <Content Include="tests\store-tests.js" /> - <Content Include="tests\test-list.js" /> - <Content Include="tests\test-manager.html" /> - <!-- Configuration file for the web project. --> - <Content Include="Web.config"> - <SubType>Designer</SubType> - </Content> - </ItemGroup> - <ItemGroup> - <Compile Include="tests\code\CsdlReader.cs" /> - <Compile Include="tests\code\JsDate.cs" /> - <Compile Include="tests\code\JsonObject.cs" /> - <Compile Include="tests\code\ReaderUtils.cs" /> - <Compile Include="tests\code\ReflectionDataContext.cs" /> - </ItemGroup> - <ItemGroup> - <Content Include="packages.config" /> - </ItemGroup> - <ItemGroup> - <Reference Include="Microsoft.OData.Client, Version=6.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL"> - <SpecificVersion>False</SpecificVersion> - <HintPath>packages\Microsoft.OData.Client.6.5.0\lib\net40\Microsoft.OData.Client.dll</HintPath> - </Reference> - <Reference Include="Microsoft.OData.Core, Version=6.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL"> - <SpecificVersion>False</SpecificVersion> - <HintPath>packages\Microsoft.OData.Core.6.5.0\lib\portable-net40+sl5+wp8+win8+wpa\Microsoft.OData.Core.dll</HintPath> - </Reference> - <Reference Include="Microsoft.OData.Edm, Version=6.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL"> - <SpecificVersion>False</SpecificVersion> - <HintPath>packages\Microsoft.OData.Edm.6.5.0\lib\portable-net40+sl5+wp8+win8+wpa\Microsoft.OData.Edm.dll</HintPath> - </Reference> - <Reference Include="Microsoft.OData.Service, Version=6.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL"> - <SpecificVersion>False</SpecificVersion> - <HintPath>packages\Microsoft.OData.Service.6.5.0\lib\net40\Microsoft.OData.Service.dll</HintPath> - </Reference> - <Reference Include="Microsoft.Spatial, Version=6.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL"> - <SpecificVersion>False</SpecificVersion> - <HintPath>packages\Microsoft.Spatial.6.5.0\lib\portable-net40+sl5+wp8+win8+wpa\Microsoft.Spatial.dll</HintPath> - </Reference> - <Reference Include="System" /> - <Reference Include="System.Net" /> - <Reference Include="System.Runtime.Serialization" /> - <Reference Include="System.ServiceModel" /> - <Reference Include="System.ServiceModel.Activation" /> - <Reference Include="System.ServiceModel.Web" /> - <Reference Include="System.Web.Extensions" /> - <Reference Include="System.Xml" /> - <Reference Include="System.Xml.Linq" /> - </ItemGroup> - <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" /> - <Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v10.0\WebApplications\Microsoft.WebApplication.targets" /> - <ProjectExtensions> - <VisualStudio> - <FlavorProperties GUID="{349c5851-65df-11da-9384-00065b846f21}"> - <WebProjectProperties> - <UseIIS>False</UseIIS> - <AutoAssignPort>True</AutoAssignPort> - <DevelopmentServerPort>4002</DevelopmentServerPort> - <DevelopmentServerVPath>/</DevelopmentServerVPath> - <IISUrl> - </IISUrl> - <NTLMAuthentication>False</NTLMAuthentication> - <UseCustomServer>False</UseCustomServer> - <CustomServerUrl> - </CustomServerUrl> - <SaveServerSettingsInUserFile>False</SaveServerSettingsInUserFile> - </WebProjectProperties> - </FlavorProperties> - </VisualStudio> - </ProjectExtensions> -</Project> \ No newline at end of file http://git-wip-us.apache.org/repos/asf/olingo-odata4-js/blob/503b4417/odatajs/JSLib.sln ---------------------------------------------------------------------- diff --git a/odatajs/JSLib.sln b/odatajs/JSLib.sln deleted file mode 100644 index 61927d4..0000000 --- a/odatajs/JSLib.sln +++ /dev/null @@ -1,19 +0,0 @@ -Microsoft Visual Studio Solution File, Format Version 11.00 -# Visual Studio 2010 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "JSLib", "JSLib.csproj", "{73ADF1A7-613B-4679-885B-2AE4AFAA9A6A}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Any CPU = Debug|Any CPU - Release|Any CPU = Release|Any CPU - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {73ADF1A7-613B-4679-885B-2AE4AFAA9A6A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {73ADF1A7-613B-4679-885B-2AE4AFAA9A6A}.Debug|Any CPU.Build.0 = Debug|Any CPU - {73ADF1A7-613B-4679-885B-2AE4AFAA9A6A}.Release|Any CPU.ActiveCfg = Release|Any CPU - {73ADF1A7-613B-4679-885B-2AE4AFAA9A6A}.Release|Any CPU.Build.0 = Release|Any CPU - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection -EndGlobal http://git-wip-us.apache.org/repos/asf/olingo-odata4-js/blob/503b4417/odatajs/LICENSE ---------------------------------------------------------------------- diff --git a/odatajs/LICENSE b/odatajs/LICENSE deleted file mode 100644 index d645695..0000000 --- a/odatajs/LICENSE +++ /dev/null @@ -1,202 +0,0 @@ - - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - Licensed 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. http://git-wip-us.apache.org/repos/asf/olingo-odata4-js/blob/503b4417/odatajs/NOTICE ---------------------------------------------------------------------- diff --git a/odatajs/NOTICE b/odatajs/NOTICE deleted file mode 100644 index 65d59ef..0000000 --- a/odatajs/NOTICE +++ /dev/null @@ -1,8 +0,0 @@ - -Apache Olingo -Copyright 2013-2014 The Apache Software Foundation - -This product includes software developed at -The Apache Software Foundation (http://www.apache.org/). - - http://git-wip-us.apache.org/repos/asf/olingo-odata4-js/blob/503b4417/odatajs/README.md ---------------------------------------------------------------------- diff --git a/odatajs/README.md b/odatajs/README.md deleted file mode 100644 index 83d0f68..0000000 --- a/odatajs/README.md +++ /dev/null @@ -1,39 +0,0 @@ -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. - -------------------------- -## Olingo OData Client for JavaScript -The Olingo OData Client for JavaScript (odatajs) is a library written in JavaScript that enables browser based frontend applications to easily use the OData protocol for communication with application servers. - -This library "odatajs-4.0.0-beta-01.min.js" supports only the OData V4 protocol. - -For using the OData protocols V1-V3 please refer to the [datajs library](http://datajs.codeplex.com/) - -The odatajs library can be included in any html page with the script tag (for example) -``` -<script type="text/javascript" src="./sources/odatajs-4.0.0-beta-01.min.js"></script> -``` -and its features can be used through the `odatajs` namespace (or `window.odatajs`). The odatajs library can be used together with the datajs library which uses the `window.OData` namespace. - -For API documentation please see [ODatajs API documentation](http://olingo.apache.org/doc/javascript/apidoc/) - -You may also use the documentation and the samples from the [datajs library](http://datajs.codeplex.com/documentation) because the features and API are similar. - -## Contribute to Olingo OData Client for JavaScript -If you are interested to contribute to this library please have a look into [Project setup](http://olingo.apache.org/doc/javascript/project-setup.html) and [Build instructions](http://olingo.apache.org/doc/javascript/project-build.html) where you find a manual how you can download the source code and build the odatajs library. - -If you intend so please also join the [Olingo developers group](http://olingo.apache.org/support.html) for discussion. http://git-wip-us.apache.org/repos/asf/olingo-odata4-js/blob/503b4417/odatajs/Web.config ---------------------------------------------------------------------- diff --git a/odatajs/Web.config b/odatajs/Web.config deleted file mode 100644 index 5441da1..0000000 --- a/odatajs/Web.config +++ /dev/null @@ -1,53 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<!-- -/* - * 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. - */--> -<configuration> - <system.web> - <compilation debug="true" targetFramework="4.0"> - <assemblies> - <add assembly="System.Core, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089" /> - <add assembly="System.Data.DataSetExtensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089" /> - <add assembly="System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" /> - <add assembly="System.Xml.Linq, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089" /> - <add assembly="System.Data.Entity, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089" /> - <add assembly="System.ServiceModel, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089" /> - <add assembly="System.ServiceModel.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" /> - <add assembly="Microsoft.OData.Core, Version=6.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" /> - <add assembly="Microsoft.OData.Service, Version=6.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" /> - <add assembly="Microsoft.OData.Client, Version=6.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" /> - </assemblies> - </compilation> - </system.web> - <system.webServer> - <directoryBrowse enabled="true" /> - </system.webServer> - <system.codedom> - <compilers> - <compiler language="c#;cs;csharp" extension=".cs" type="Microsoft.CSharp.CSharpCodeProvider,System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> - <providerOption name="CompilerVersion" value="v4.0" /> - </compiler> - </compilers> - </system.codedom> - <system.net> - <defaultProxy> - <proxy autoDetect="True" /> - </defaultProxy> - </system.net> -</configuration> \ No newline at end of file http://git-wip-us.apache.org/repos/asf/olingo-odata4-js/blob/503b4417/odatajs/demo/scripts/.gitignore ---------------------------------------------------------------------- diff --git a/odatajs/demo/scripts/.gitignore b/odatajs/demo/scripts/.gitignore deleted file mode 100644 index f7f55d4..0000000 --- a/odatajs/demo/scripts/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -datajs-2* -tmp/ http://git-wip-us.apache.org/repos/asf/olingo-odata4-js/blob/503b4417/odatajs/demo/scripts/datajs_demo.js ---------------------------------------------------------------------- diff --git a/odatajs/demo/scripts/datajs_demo.js b/odatajs/demo/scripts/datajs_demo.js deleted file mode 100644 index 86e93ed..0000000 --- a/odatajs/demo/scripts/datajs_demo.js +++ /dev/null @@ -1,142 +0,0 @@ -/* - * 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. - */ -var run = function() { - //testJQueryReadMetadata(); - runSimpleReadRequest(); - runSimpleReadRequestWithMetadata(); - // readWithJsonP(); - //alert(OData.odataRelatedLinksPrefix); - //OData.odataRelatedLinksPrefix = "dasfs"; - //alert(OData.odataRelatedLinksPrefix); - //var time = new Date("1992-08-06T00:00:00+01:00"); - //var jsonTime = {value : time}; - //var jsonstring = window.JSON.stringify(jsonTime); - //alert(jsonstring); - - //time.offset = 100; - //alert(time.offset); - //var offsite = time.getTimezoneOffset(); - //alert(offsite); -}; - -var runSimpleReadRequest = function() { - var oHeaders = { - 'Accept': 'application/json', - "Odata-Version": "4.0", - "OData-MaxVersion": "4.0" - }; - - var request = - { - headers: oHeaders, - // requestUri: "http://services.odata.org/OData/OData.svc/Categories", - requestUri: "http://odatasampleservices.azurewebsites.net/V4/OData/OData.svc/Categories", - data: null, - }; - var successFunction = function (data) { - document.getElementById("simpleRead").innerHTML = JSON.stringify(data, undefined, 2); - }; - var failFunction = function (err) { - alert("err"); - alert(JSON.stringify(err)); - }; - odatajs.oData.read(request, successFunction, failFunction); -}; - -var runSimpleReadRequestWithMetadata = function () { - var oHeaders = { - 'Accept': 'text/html,application/xhtml+xml,application/xml,application/json;odata.metadata=minimal', - "Odata-Version": "4.0", - "OData-MaxVersion": "4.0", - "Prefer": "odata.allow-entityreferences" - }; - - var readMetadataSuccess = function (metadata) { - document.getElementById("metadata").innerHTML = JSON.stringify(metadata, undefined, 2); - var request = - { - headers: oHeaders, - // requestUri: "http://services.odata.org/OData/OData.svc/Categories", - requestUri: "http://odatasampleservices.azurewebsites.net/V4/OData/OData.svc/Products", - data: null, - }; - var successFunction = function(data) { - document.getElementById("simpleReadWithMetadata").innerHTML = JSON.stringify(data, undefined, 2); - }; - var failFunction = function(err) { - alert("err"); - alert(JSON.stringify(err)); - }; - odatajs.oData.read(request, successFunction, failFunction, null, null, metadata); - }; - - var readMetadataFail = function (err) { - alert("err"); - alert(JSON.stringify(err)); - }; - - var metadataRequest = - { - headers: oHeaders, - // requestUri: "http://services.odata.org/OData/OData.svc/$metadata", - requestUri: "http://odatasampleservices.azurewebsites.net/V4/OData/OData.svc/$metadata", - // "http://localhost:6630/PrimitiveKeys.svc/$metadata", - data: null, - }; - - odatajs.oData.read(metadataRequest, readMetadataSuccess, readMetadataFail, odatajs.V4.oData.metadataHandler); -}; - -var readWithJsonP = function() { - var sUrl2 = "http://odatasampleservices.azurewebsites.net/V4/OData/OData.svc?$expand=Category"; - - var oRequest = { - requestUri: sUrl2, - enableJsonpCallback: true, - }; - - odatajs.oData.read(oRequest, function (data) { - document.getElementById("simpleReadWithJSONP").innerHTML = JSON.stringify(data, undefined, 2); - }, - function (oError) { - alert(oError.message); - }); -}; - -var testJQueryReadMetadata = function () { - $.ajax({ - url: "http://odatasampleservices.azurewebsites.net/V4/OData/OData.svc/$metadata", - headers: { - 'Accept': 'text/html,application/xhtml+xml,application/xml,application/json;odata.metadata=full', - "Odata-Version": "4.0", - "OData-MaxVersion": "4.0", - "Prefer": "odata.allow-entityreferences" - }, - type: "GET", - converters: { "text xml": OData.metadataParser }, - dataType: "xml", - success: function (xml, textStatus, jqXHR) { - var data = OData.metadataParser2(xml) || undefined; - document.getElementById("simpleReadWithMetadata").innerHTML = JSON.stringify(data, undefined, 2); - }, - error: function (jqXHR, textStatus, errorThrown) { - alert("err"); - } - }); -}; http://git-wip-us.apache.org/repos/asf/olingo-odata4-js/blob/503b4417/odatajs/demo/scripts/tools.js ---------------------------------------------------------------------- diff --git a/odatajs/demo/scripts/tools.js b/odatajs/demo/scripts/tools.js deleted file mode 100644 index 3d3f395..0000000 --- a/odatajs/demo/scripts/tools.js +++ /dev/null @@ -1,164 +0,0 @@ -/* - * 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. - */ -(function($) { - $.fn.prettify = function(options) { - return this.each(function() { - try { - var $code = $(document.createElement('div')).addClass('code'); - $(this).before($code).remove(); - var content = $(this).text(); - var match = /(xml|json)/.exec($(this).attr('data-type')); - var format = (match) ? match[1] : null; - var html = null; - if (format == 'xml') { - var xmlDoc = $.parseXML(content); - html = (xmlDoc) ? formatXML(xmlDoc) : null; - } else if (format == 'json') { - var jsonObj = $.parseJSON(content); - html = (jsonObj) ? formatJSON(jsonObj) : null; - } - if (html) { - $code.addClass(format).html(html).find('.list').each(function() { - if (this.parentNode.nodeName == 'LI') { - $(document.createElement('div')).addClass("toggle").text("-").click(function() { - var target = $(this).siblings('.list:first'); - if (target.size() != 1) - return; - if (target.is(':hidden')) { - target.show().siblings('.deffered').remove(); - } else { - target.hide().before($(document.createElement('span')).attr("class", "deffered").html("...")); - } - $(this).text($(this).text() == '-' ? '+' : '-'); - }).insertBefore($(this.parentNode).children(':first')); - } - }); - } - } catch (e) { - console.log(e); - } - /* encode html */ - function encodeHtml(html) { - return (html != null) ? html.toString().replace(/&/g, "&").replace(/"/g, """).replace(/</g, "<").replace(/>/g, ">") : ''; - } - /* convert json to html */ - function formatJSON(value) { - var typeofValue = typeof value; - if (value == null) { - return '<span class="null">null</span>'; - } else if (typeofValue == 'number') { - return '<span class="numeric">' + encodeHtml(value) + '</span>'; - } else if (typeofValue == 'string') { - if (/^(http|https):\/\/[^\s]+$/.test(value)) { - var fragment = ''; - var fragmentIndex = value.indexOf('#'); - if (fragmentIndex != -1) { - fragment = value.substr(fragmentIndex); - value = value.substr(0, fragmentIndex); - } - var format = (value.length > 7) ? (value.substr(value.length - 7, 7) == '/$value' ? '' : '&$format=json' ) : ''; - format = (value.length > 10) ? (value.substr(value.length - 10, 10) == '/$metadata' ? '' : '&$format=json' ) : ''; - var separator = (value.indexOf('?') == -1) ? '?' : '&'; - return '<span class="string">"<a href="' + value + format + fragment + '">' + encodeHtml(value) + encodeHtml(fragment) + '</a>"</span>'; - } else { - return '<span class="string">"' + encodeHtml(value) + '"</span>' - } - } else if (typeofValue == 'boolean') { - return '<span class="boolean">' + encodeHtml(value) + '</span>' - } else if (value && value.constructor == Array) { - return formatArray(value); - } else if (typeofValue == 'object') { - return formatObject(value); - } else { - return ''; - } - function formatArray(json) { - var html = ''; - for ( var prop in json) - html += '<li>' + formatJSON(json[prop]) + '</li>'; - return (html) ? '<span class="array">[</span><ul class="array list">' + html + '</ul><span class="array">]</span>' : '<span class="array">[]</span>' - } - function formatObject(json) { - var html = ''; - for ( var prop in json) - html += '<li><span class="property">' + encodeHtml(prop) + '</span>: ' + formatJSON(json[prop]) + '</li>'; - return (html) ? '<span class="obj">{</span><ul class="obj list">' + html + '</ul><span class="obj">}</span>' : '<span class="obj">{}</span>'; - } - } - /* convert xml to html */ - function formatXML(document) { - return formatElement(document.documentElement); - function formatElement(element) { - var html = '<span><</span><span class="tag">' + encodeHtml(element.nodeName) + '</span>'; - if (element.attributes && element.attributes.length > 0) { - html += formatAttributes(element); - } - if (element.childNodes && element.childNodes.length > 0) { - html += '<span>></span>'; - if (element.childNodes.length == 1 && element.childNodes[0].nodeType == 3) { - html += '<span class="text">' + encodeHtml(element.childNodes[0].nodeValue) + '</span>'; - } else { - html += formatChildNodes(element.childNodes); - } - html += '<span></</span><span class="tag">' + encodeHtml(element.nodeName) + '</span><span>></span>'; - } else { - html += '<span>/></span>'; - } - return html; - } - function formatChildNodes(childNodes) { - html = '<ul class="list">'; - for ( var i = 0; i < childNodes.length; i++) { - var node = childNodes[i]; - if (node.nodeType == 1) { - html += '<li>' + formatElement(node) + '</li>'; - } else if (node.nodeType == 3 && !/^\s+$/.test(node.nodeValue)) { - html += '<li><span class="text">' + encodeHtml(node.nodeValue) + '</span></li>'; - } else if (node.nodeType == 4) { - html += '<li><span class="cdata"><![CDATA[' + encodeHtml(node.nodeValue) + ']]></span></li>'; - } else if (node.nodeType == 8) { - html += '<li><span class="comment"><!--' + encodeHtml(node.nodeValue) + '--></span></li>'; - } - } - html += '</ul>'; - return html; - } - function formatAttributes(element) { - var html = ''; - for (var i = 0; i < element.attributes.length; i++) { - var attribute = element.attributes[i]; - if (/^xmlns:[^\s]+$/.test(attribute.nodeName)) { - html += ' <span class="ns">' + encodeHtml(attribute.nodeName) + '="' + encodeHtml(attribute.nodeValue) + '"</span>'; - } else { - html += ' <span class="atn">' + encodeHtml(attribute.nodeName) + '</span>='; - if (attribute.nodeName == 'href' || attribute.nodeName == 'src') { - var separator = (attribute.nodeValue.indexOf('?') == -1) ? '?' : '&'; - var href = (element.baseURI && attribute.nodeValue[0] != '/') ? element.baseURI + attribute.nodeValue : attribute.nodeValue; - html += '"<a class="link" href="' + href + '">' + encodeHtml(attribute.nodeValue) + '</a>"'; - } else { - html += '"<span class="atv">' + encodeHtml(attribute.nodeValue) + '</span>"'; - } - } - } - return html; - } - } - }); - }; -})(jQuery); \ No newline at end of file
