From cb9ffc97141030829378883937e9809297cb427c Mon Sep 17 00:00:00 2001 From: Andrea Giammarchi Date: Thu, 25 Jul 2013 21:37:42 -0700 Subject: [PATCH] dblite gitstrap initialized --- .gitignore | 2 + .npmignore | 7 +++ .travis.yml | 9 ++++ LICENSE.txt | 19 +++++++ Makefile | 109 ++++++++++++++++++++++++++++++++++++++++ README.md | 5 ++ build/dblite.amd.js | 2 + build/dblite.js | 2 + build/dblite.max.amd.js | 23 +++++++++ build/dblite.max.js | 23 +++++++++ build/dblite.node.js | 23 +++++++++ index.html | 88 ++++++++++++++++++++++++++++++++ package.json | 22 ++++++++ src/dblite.js | 1 + template/amd.after | 1 + template/amd.before | 1 + template/copyright | 1 + template/license.after | 2 + template/license.before | 1 + template/md.after | 2 + template/md.before | 32 ++++++++++++ template/node.after | 1 + template/node.before | 1 + template/var.after | 1 + template/var.before | 1 + test/.test.js | 40 +++++++++++++++ test/dblite.js | 13 +++++ 27 files changed, 432 insertions(+) create mode 100644 .gitignore create mode 100644 .npmignore create mode 100644 .travis.yml create mode 100644 LICENSE.txt create mode 100644 Makefile create mode 100644 README.md create mode 100644 build/dblite.amd.js create mode 100644 build/dblite.js create mode 100644 build/dblite.max.amd.js create mode 100644 build/dblite.max.js create mode 100644 build/dblite.node.js create mode 100644 index.html create mode 100644 package.json create mode 100644 src/dblite.js create mode 100644 template/amd.after create mode 100644 template/amd.before create mode 100644 template/copyright create mode 100644 template/license.after create mode 100644 template/license.before create mode 100644 template/md.after create mode 100644 template/md.before create mode 100644 template/node.after create mode 100644 template/node.before create mode 100644 template/var.after create mode 100644 template/var.before create mode 100644 test/.test.js create mode 100644 test/dblite.js diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..58b805f --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +.DS_Store +node_modules/ \ No newline at end of file diff --git a/.npmignore b/.npmignore new file mode 100644 index 0000000..0256718 --- /dev/null +++ b/.npmignore @@ -0,0 +1,7 @@ +src/* +test/* +template/* +node_modules/* +build/*.amd.js +Makefile +index.html \ No newline at end of file diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..b6c89b3 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,9 @@ +language: node_js +node_js: + - 0.8 + - 0.9 +git: + depth: 1 +branches: + only: + - master \ No newline at end of file diff --git a/LICENSE.txt b/LICENSE.txt new file mode 100644 index 0000000..468a071 --- /dev/null +++ b/LICENSE.txt @@ -0,0 +1,19 @@ +Copyright (C) 2013 by WebReflection + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..d0bc54e --- /dev/null +++ b/Makefile @@ -0,0 +1,109 @@ +.PHONY: build var node amd size hint clean test web preview pages dependencies + +# repository name +REPO = dblite + +# make var files +VAR = src/$(REPO).js + +# make node files +NODE = $(VAR) + +# make amd files +AMD = $(VAR) + +# README constant + + +# default build task +build: + make clean + make var + make node + make amd + make test +# make hint + make size + +# build generic version +var: + mkdir -p build + cat template/var.before $(VAR) template/var.after >build/no-copy.$(REPO).max.js + node node_modules/uglify-js/bin/uglifyjs --verbose build/no-copy.$(REPO).max.js >build/no-copy.$(REPO).js + cat template/license.before LICENSE.txt template/license.after build/no-copy.$(REPO).max.js >build/$(REPO).max.js + cat template/copyright build/no-copy.$(REPO).js >build/$(REPO).js + rm build/no-copy.$(REPO).max.js + rm build/no-copy.$(REPO).js + +# build node.js version +node: + mkdir -p build + cat template/license.before LICENSE.txt template/license.after template/node.before $(NODE) template/node.after >build/$(REPO).node.js + +# build AMD version +amd: + mkdir -p build + cat template/amd.before $(AMD) template/amd.after >build/no-copy.$(REPO).max.amd.js + node node_modules/uglify-js/bin/uglifyjs --verbose build/no-copy.$(REPO).max.amd.js >build/no-copy.$(REPO).amd.js + cat template/license.before LICENSE.txt template/license.after build/no-copy.$(REPO).max.amd.js >build/$(REPO).max.amd.js + cat template/copyright build/no-copy.$(REPO).amd.js >build/$(REPO).amd.js + rm build/no-copy.$(REPO).max.amd.js + rm build/no-copy.$(REPO).amd.js + +size: + wc -c build/$(REPO).max.js + gzip -c build/$(REPO).js | wc -c + +# hint built file +hint: + node node_modules/jshint/bin/jshint build/$(REPO).max.js + +# clean/remove build folder +clean: + rm -rf build + +# tests, as usual and of course +test: + npm test + +# launch polpetta (ctrl+click to open the page) +web: + node node_modules/polpetta/build/polpetta ./ + +# markdown the readme and view it +preview: + node_modules/markdown/bin/md2html.js README.md >README.md.htm + cat template/md.before README.md.htm template/md.after >README.md.html + open README.md.html + sleep 3 + rm README.md.htm README.md.html + +pages: + git pull --rebase + make var + mkdir -p ~/tmp + mkdir -p ~/tmp/$(REPO) + cp -rf src ~/tmp/$(REPO) + cp -rf build ~/tmp/$(REPO) + cp -rf test ~/tmp/$(REPO) + cp index.html ~/tmp/$(REPO) + git checkout gh-pages + mkdir -p test + rm -rf test + cp -rf ~/tmp/$(REPO) test + git add test + git add test/. + git commit -m 'automatic test generator' + git push + git checkout master + rm -r ~/tmp/$(REPO) + +# modules used in this repo +dependencies: + rm -rf node_modules + mkdir node_modules + npm install wru + npm install polpetta + npm install uglify-js@1 + npm install jshint + npm install markdown diff --git a/README.md b/README.md new file mode 100644 index 0000000..dd55623 --- /dev/null +++ b/README.md @@ -0,0 +1,5 @@ +dblite +====== + +[![build status](https://secure.travis-ci.org/WebReflection/dblite.png)](http://travis-ci.org/WebReflection/dblite) + diff --git a/build/dblite.amd.js b/build/dblite.amd.js new file mode 100644 index 0000000..f4de4bd --- /dev/null +++ b/build/dblite.amd.js @@ -0,0 +1,2 @@ +/*! (C) WebReflection Mit Style License */ +define({}); \ No newline at end of file diff --git a/build/dblite.js b/build/dblite.js new file mode 100644 index 0000000..d12511b --- /dev/null +++ b/build/dblite.js @@ -0,0 +1,2 @@ +/*! (C) WebReflection Mit Style License */ +var main={}; \ No newline at end of file diff --git a/build/dblite.max.amd.js b/build/dblite.max.amd.js new file mode 100644 index 0000000..a4ce8ac --- /dev/null +++ b/build/dblite.max.amd.js @@ -0,0 +1,23 @@ +/*! +Copyright (C) 2013 by WebReflection + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. + +*/ +define({}); \ No newline at end of file diff --git a/build/dblite.max.js b/build/dblite.max.js new file mode 100644 index 0000000..ccb14ae --- /dev/null +++ b/build/dblite.max.js @@ -0,0 +1,23 @@ +/*! +Copyright (C) 2013 by WebReflection + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. + +*/ +var main = {}; \ No newline at end of file diff --git a/build/dblite.node.js b/build/dblite.node.js new file mode 100644 index 0000000..5def4d5 --- /dev/null +++ b/build/dblite.node.js @@ -0,0 +1,23 @@ +/*! +Copyright (C) 2013 by WebReflection + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. + +*/ +module.exports = {}; \ No newline at end of file diff --git a/index.html b/index.html new file mode 100644 index 0000000..bccffa1 --- /dev/null +++ b/index.html @@ -0,0 +1,88 @@ + + + + wru test + + + + + + + + + + + +
+ + + diff --git a/package.json b/package.json new file mode 100644 index 0000000..2516792 --- /dev/null +++ b/package.json @@ -0,0 +1,22 @@ +{ + "version": "0.0.0", + "name": "dblite", + "description": "", + "homepage": "https://github.com/WebReflection/dblite", + "keywords": [], + "author": { + "name": "", + "web": "" + }, + "repository": { + "type": "git", + "url": "git://github.com/WebReflection/dblite.git" + }, + "main": "./build/dblite.node.js", + "scripts": { + "test": "node test/.test.js" + }, + "dependencies": { + "wru": ">= 0.0.0" + } +} diff --git a/src/dblite.js b/src/dblite.js new file mode 100644 index 0000000..9e26dfe --- /dev/null +++ b/src/dblite.js @@ -0,0 +1 @@ +{} \ No newline at end of file diff --git a/template/amd.after b/template/amd.after new file mode 100644 index 0000000..8916587 --- /dev/null +++ b/template/amd.after @@ -0,0 +1 @@ +); \ No newline at end of file diff --git a/template/amd.before b/template/amd.before new file mode 100644 index 0000000..4c15333 --- /dev/null +++ b/template/amd.before @@ -0,0 +1 @@ +define( \ No newline at end of file diff --git a/template/copyright b/template/copyright new file mode 100644 index 0000000..8c603a6 --- /dev/null +++ b/template/copyright @@ -0,0 +1 @@ +/*! (C) WebReflection Mit Style License */ diff --git a/template/license.after b/template/license.after new file mode 100644 index 0000000..d7365df --- /dev/null +++ b/template/license.after @@ -0,0 +1,2 @@ + +*/ diff --git a/template/license.before b/template/license.before new file mode 100644 index 0000000..bf11147 --- /dev/null +++ b/template/license.before @@ -0,0 +1 @@ +/*! diff --git a/template/md.after b/template/md.after new file mode 100644 index 0000000..691287b --- /dev/null +++ b/template/md.after @@ -0,0 +1,2 @@ + + \ No newline at end of file diff --git a/template/md.before b/template/md.before new file mode 100644 index 0000000..2e48892 --- /dev/null +++ b/template/md.before @@ -0,0 +1,32 @@ + + + + + + \ No newline at end of file diff --git a/template/node.after b/template/node.after new file mode 100644 index 0000000..1c8a0e7 --- /dev/null +++ b/template/node.after @@ -0,0 +1 @@ +; \ No newline at end of file diff --git a/template/node.before b/template/node.before new file mode 100644 index 0000000..e6bf414 --- /dev/null +++ b/template/node.before @@ -0,0 +1 @@ +module.exports = \ No newline at end of file diff --git a/template/var.after b/template/var.after new file mode 100644 index 0000000..1c8a0e7 --- /dev/null +++ b/template/var.after @@ -0,0 +1 @@ +; \ No newline at end of file diff --git a/template/var.before b/template/var.before new file mode 100644 index 0000000..5b5a4cc --- /dev/null +++ b/template/var.before @@ -0,0 +1 @@ +var main = \ No newline at end of file diff --git a/test/.test.js b/test/.test.js new file mode 100644 index 0000000..d7de3f8 --- /dev/null +++ b/test/.test.js @@ -0,0 +1,40 @@ +var + fs = require('fs'), + path = require('path'), + spawn = require('child_process').spawn, + modules = path.join(__dirname, '..', 'node_modules', 'wru', 'node', 'program.js'), + tests = [], + ext = /\.js$/, + code = 0, + many = 0; + +function exit($code) { + if ($code) { + code = $code; + } + if (!--many) { + if (!code) { + fs.writeFileSync( + path.join(__dirname, '..', 'index.html'), + fs.readFileSync( + path.join(__dirname, '..', 'index.html'), + 'utf-8' + ).replace(/var TESTS = \[.*?\];/, 'var TESTS = ' + JSON.stringify(tests) + ';'), + 'utf-8' + ); + } + process.exit(code); + } +} + +fs.readdirSync(__dirname).filter(function(file){ + if (ext.test(file) && fs.existsSync(path.join(__dirname, '..', 'src', file))) { + ++many; + tests.push(file.replace(ext, '')); + spawn( + 'node', [modules, path.join('test', file)], { + detached: false, + stdio: [process.stdin, process.stdout, process.stderr] + }).on('exit', exit); + } +}); \ No newline at end of file diff --git a/test/dblite.js b/test/dblite.js new file mode 100644 index 0000000..e621810 --- /dev/null +++ b/test/dblite.js @@ -0,0 +1,13 @@ +//remove: +var main = require('../build/dblite.node.js'); +//:remove + +wru.test([ + { + name: "main", + test: function () { + wru.assert(typeof main == "object"); + // wru.assert(0); + } + } +]);