Skip to content

Commit

Permalink
index.js and test scaffolding, tidy README.
Browse files Browse the repository at this point in the history
Closes #5.
Closes #3.
  • Loading branch information
flatheadmill committed Aug 6, 2013
1 parent e509ec0 commit 9337d9f
Show file tree
Hide file tree
Showing 7 changed files with 109 additions and 1 deletion.
2 changes: 1 addition & 1 deletion README
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Xy

An R-Tree partition algorithm.
Hilbert curve in JavaScript.

Documentation: http://bigeasy.github.io/xy
Source: http://github.io/bigeasy/xy
Expand Down
1 change: 1 addition & 0 deletions index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
module.exports = 1
37 changes: 37 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
{
"name": "xy",
"version": "0.0.0",
"author": "Alan Gutierrez <alan@prettyrobots.com>",
"description": "An R-Tree partition algorithm.",
"keywords":
[
"hilbert", "hilbert curve", "cruve", "spaital", "r-tree"
],
"url": "http://bigeasy.github.com/xy",
"homepage": "https://github.com/bigeasy/xy",
"bugs": "https://github.com/bigeasy/xy/issues",
"repository":
{
"type": "git",
"url": "http://github.com/bigeasy/xy.git"
},
"contributors":
[{
"name": "Demarius Chrite",
"email": "chrite.demarius@gmail.com",
"web": "https://github.com/demarius"
}],
"devDependencies":
{
"proof": "0.0.35"
},
"licenses":
[{
"type": "MIT",
"url": "http://github.com/bigeasy/xy/raw/master/LICENSE"
}],
"scripts":
{
"test": "proof platform win32 && proof test */*/*.t.js || t/test"
}
}
18 changes: 18 additions & 0 deletions t/cover
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#!/bin/sh

set -e

rm -rf coverage

count=1;
for file in $(find t -name \*.t.js); do
node_modules/.bin/istanbul cover -x 't/**' $file > /dev/null 2>&1
mv coverage/coverage.json coverage/coverage$count.json
count=$(expr $count + 1)
done

node_modules/.bin/istanbul report --root coverage --dir coverage > /dev/null

sed -i -e s,'^SF:'`pwd`/,SF:, coverage/lcov.info

exit 0
30 changes: 30 additions & 0 deletions t/sizes
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#!/bin/sh

dir=`cd ${0%/*} && pwd`
UGLIFY_JS="${dir%/t}/node_modules/.bin/uglifyjs"

printf "%-24s %11s %11s %11s %11s\n" File Raw Min Zip Min/Zip
for file in $@; do
b_0=`cat $file | wc -c`
b_1=`cat $file | $UGLIFY_JS | wc -c`
alt=`cat $file | $UGLIFY_JS --lift-vars | wc -c`
if [ $alt -lt ${b_1} ]; then
b_1=$alt
fi
b_2=`cat $file | gzip -c | wc -c`
b_3=`cat $file | $UGLIFY_JS | gzip -c | wc -c`
alt=`cat $file | $UGLIFY_JS --lift-vars | gzip -c | wc -c`
if [ $alt -lt ${b_3} ]; then
b_3=$alt
fi
for field in 0 1 2 3; do
eval val=\$b_$field
val=`echo $val / 1024 | bc -l`
eval k_$field=$val
done
printf "%-24s" $file
for field in 0 1 2 3; do
eval printf "%6d/%05.2f" \$b_$field \$k_$field
done
printf "\n"
done
19 changes: 19 additions & 0 deletions t/test
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/bin/sh

set -e

echo ""

(proof run t/*/*.t.js | tee .proof.out | proof progress) || (proof errors < .proof.out) || exit 1

if [ "$TRAVIS" = "true" ]; then
echo "running with coverage"
t/cover

echo "submitting to coveralls.io"
(cat coverage/lcov.info | node_modules/.bin/coveralls) > /dev/null 2>&1

curl 'https://www.prettyrobots.com/travisty' | sh
fi

echo ""
3 changes: 3 additions & 0 deletions t/xy/require.t.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
require('proof')(1, function (ok) {
ok(require('../..'), 'require')
})

0 comments on commit 9337d9f

Please sign in to comment.