Skip to content

Commit

Permalink
dblite gitstrap initialized
Browse files Browse the repository at this point in the history
  • Loading branch information
Andrea Giammarchi committed Jul 26, 2013
0 parents commit cb9ffc9
Show file tree
Hide file tree
Showing 27 changed files with 432 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
.DS_Store
node_modules/
7 changes: 7 additions & 0 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
src/*
test/*
template/*
node_modules/*
build/*.amd.js
Makefile
index.html
9 changes: 9 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
language: node_js
node_js:
- 0.8
- 0.9
git:
depth: 1
branches:
only:
- master
19 changes: 19 additions & 0 deletions LICENSE.txt
Original file line number Diff line number Diff line change
@@ -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.
109 changes: 109 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -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
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
dblite
======

[![build status](https://secure.travis-ci.org/WebReflection/dblite.png)](http://travis-ci.org/WebReflection/dblite)

2 changes: 2 additions & 0 deletions build/dblite.amd.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
/*! (C) WebReflection Mit Style License */
define({});
2 changes: 2 additions & 0 deletions build/dblite.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
/*! (C) WebReflection Mit Style License */
var main={};
23 changes: 23 additions & 0 deletions build/dblite.max.amd.js
Original file line number Diff line number Diff line change
@@ -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({});
23 changes: 23 additions & 0 deletions build/dblite.max.js
Original file line number Diff line number Diff line change
@@ -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 = {};
23 changes: 23 additions & 0 deletions build/dblite.node.js
Original file line number Diff line number Diff line change
@@ -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 = {};
88 changes: 88 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
<!doctype html>
<html>
<head>
<title>wru test</title>
<meta http-equiv="content-language" content="en-US"/>
<meta name="viewport" content="width=device-width,initial-scale=1.0,maximum-scale=1.0,user-scalable=no"/>
<meta name="apple-mobile-web-app-capable" content="yes"/>
<meta names="apple-mobile-web-app-status-bar-style" content="black"/>
<script>
// here the list of tests to run with wru
var TESTS = ["main"];
</script>
<script>// don't change code here
for(var i = 0; i < TESTS.length; ++i && document.write('<script src="src/' + TESTS + '.js"><' + '/script>'));
function wru(wru){
var
all = [],
test = wru.test,
XHR = typeof XMLHttpRequest === typeof XHR ?
function () {
return new ActiveXObject("Microsoft.XMLHTTP");
} :
function () {
return new XMLHttpRequest;
}
;
wru.test = function () {
all = all.concat.apply(all, arguments);
};
function load(file) {
var xhr = XHR();
xhr.open('get', file, false);
xhr.send(null);
Function("wru", xhr.responseText.
replace(/\/\/remove:[^\x00]*?\/\/:remove/g, '')
)(wru);
}
this.onload = function () {
for(var i = 0; i < TESTS.length; load('test/' + TESTS[i++] + '.js'));
wru.test = test;
wru.test(all);
};
}</script>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width,initial-scale=1.0,maximum-scale=1.0,user-scalable=0" />
<style type="text/css">
#wru {
font-family: sans-serif;
font-size: 11pt;
border: 1px solid #333;
}
#wru div {
cursor: default;
padding: 0;
color: #000;
}
#wru div span,
#wru div strong {
display: block;
padding: 4px;
margin: 0;
}
#wru div ul {
margin: 0;
padding-bottom: 4px;
}
#wru div.pass {
background: #90EE90;
}
#wru div.fail {
background: #FF6347;
}
#wru div.error {
background: #000;
color: #FFF;
}
</style>
</head>
<body>
<div id="wru"></div>
<script>
/*!
(C) Andrea Giammarchi, @WebReflection - Mit Style License
*/
wru(function(Y){function j(){A=K.call(m);if(A){if(typeof A=="function"){A={name:A[S]||"anonymous",test:A}}(P=l(l(Z.node,"div"),"span"))[E]=((ag(A,S)&&A[S])||(ag(A,e)&&A[e])||Q)+i+i;a=[];u=[];T=[];ab={};b("setup");T[ah]||b("test");N||r()}else{t()}}function p(aj){try{return O.call(h,aj)}catch(ai){return h.createElement(aj)}}function l(ai,aj){return ai.appendChild(p(aj))}function g(ai){P[E]=x.call(P[E],0,-2)+i+ai}function t(){var ak=Z.node.insertBefore(p("div"),Z.node.firstChild),al,aj,ai;if(ad){ai=aj="error";al="There Are Errors: "+ad}else{if(C){ai=aj="fail";al=C+" Tests Failed"}else{ai=aj="pass";al="Passed "+s+" Tests"}}Z.status=ai;ak[E]="<strong>"+al+"</strong>";ak.className=aj}function G(){var ai=this.lastChild.style;ai.display=ai.display=="none"?"block":"none"}function c(ai){P[E]+="<ul>"+D+v.call(ai,d+D)+d+"</ul>";(P.onclick=G).call(P)}function r(){f();s+=a[ah];C+=u[ah];ad+=T[ah];g("("+v.call([a[ah],M=u[ah],T[ah]],", ")+")");P=P.parentNode;T[ah]?c(T,W="error"):(M?c(u,W="fail"):W="pass");P.className=W;M=0;W=i;j()}function b(ai){if(ag(A,ai)){try{A[ai](ab)}catch(aj){aa.call(T,i+aj)}}}function ag(aj,ai){return q.call(aj,ai)}function w(){return F()<0.5?-1:1}function f(){if(R){H(R);R=0}b("teardown")}var Z={assert:function U(aj,ai){if(arguments[ah]==1){ai=aj;aj=Q}z=I;aa.call(ai?a:u,W+aj);return ai},async:function V(aj,am,ak,al){al=++N;if(typeof aj=="function"){ak=am;am=aj;aj="asynchronous test #"+al}ak=X(function(){al=0;aa.call(u,aj);--N||(R=X(r,0))},L(ak||y)||y);return function ai(){if(!al){return}z=ae;W=aj+": ";try{am.apply(this,arguments)}catch(an){z=I;aa.call(T,W+an)}W=i;if(z){H(ak);--N||(R=X(r,0))}}},test:function n(ai,aj){Z.after=aj||function(){};m=J.apply(m,[ai]);Z.random&&af.call(m,w);N||j()}},I=true,ae=!I,y=100,i=" ",Q="unknown",ah="length",S="name",e="description",D="<li>",d="</li>",k="\\|/-",q=Z.hasOwnProperty,W=i,ac=W.charAt,x=W.slice,m=[],J=m.concat,v=m.join,aa=m.push,K=m.shift,af=m.sort,N=0,M=0,s=0,C=0,ad=0,R=0,E="innerHTML",h=Y.document,O=h.createElement,B,L,F,X,H,A,P,a,u,T,ab,z;B=Y.Math;L=B.abs;F=B.random;X=Y.setTimeout;H=Y.clearTimeout;Z.node=(h.getElementById("wru")||h.body||h.documentElement);Y.setInterval(function(){N&&g(ac.call(k,M++%4))},y);undefined;Z.log=function o(aj,ai){ai?alert(aj):(typeof console!="undefined")&&console.log(aj)};y*=y;Z.random=ae;return Z}(this));
</script>
</body>
</html>
22 changes: 22 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -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"
}
}
1 change: 1 addition & 0 deletions src/dblite.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{}
1 change: 1 addition & 0 deletions template/amd.after
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
);
1 change: 1 addition & 0 deletions template/amd.before
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
define(
1 change: 1 addition & 0 deletions template/copyright
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/*! (C) WebReflection Mit Style License */
2 changes: 2 additions & 0 deletions template/license.after
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@

*/
1 change: 1 addition & 0 deletions template/license.before
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/*!
2 changes: 2 additions & 0 deletions template/md.after
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
</body>
</html>
Loading

0 comments on commit cb9ffc9

Please sign in to comment.