1
0
mirror of /repos/Prototyper.git synced 2026-02-27 16:12:00 +01:00

moved scripts to bin

This commit is contained in:
Aiko Mastboom
2013-05-12 12:51:29 +02:00
parent 3f7c13571b
commit 2269bebdd0
6 changed files with 22 additions and 18 deletions

23
bin/coverit Executable file
View File

@@ -0,0 +1,23 @@
#!/usr/bin/env bash
current_dir=$(cd $(dirname $0) && pwd)
base_dir=${current_dir}/..
cd ${base_dir}
if [ ! -x ./opt/node-jscoverage/jscoverage ]; then
mkdir -p ./opt
cd ./opt
git clone git://github.com/visionmedia/node-jscoverage.git
cd node-jscoverage/
./configure && make
cd ${base_dir}
fi
if [ ! -x ./node_modules/.bin/mocha ]; then
npm install mocha
fi
./opt/node-jscoverage/jscoverage lib lib-cov
PROTOTYPER_COV=1 ./node_modules/.bin/mocha -R html-cov > ./doc/coverage.html
rm -rf lib-cov
echo "coverage.html generated in doc/coverage.html"

29
bin/deployit Executable file
View File

@@ -0,0 +1,29 @@
#!/usr/bin/env bash
current_dir=$(cd $(dirname $0) && pwd)
base_dir=${current_dir}/..
cd ${base_dir}
command -v fleet
fleet_installed=$?
if [ ${fleet_installed} == 1 ]; then
npm install -g http://github.com/aikomastboom/fleet/archive/0.1.9.tar.gz
fi
# deploy new commit
fleet-deploy && fleet-exec -- npm --cache-min 99999 install && fleet-exec -- npm rebuild bson
#DEPLOYED_COMMIT=${git log -n 1 | head -n 1 | cut -d " " -f 2}
# stop running one
#RUNNING_COMMIT=${fleet-ps | grep -B 2 "${PROTOTYPER}/" | grep commit | cut -d "/" -f 2}
# stop running
PROTOTYPER=$(basename $PWD)
fleet-ps | grep -B 2 "${PROTOTYPER}/" | grep pid | cut -d " " -f 2 | xargs fleet-stop
# cleanup other commits
fleet-exec -- bash -c "ls .. | grep ${PROTOTYPER} | grep -v \$(basename \${PWD}) | xargs -Icommit rm -rf ../commit"
# start new
# not using 'npm start' because when killed it doesn't kill its children (server.js)
fleet-spawn node ./server.js

18
bin/docit Executable file
View File

@@ -0,0 +1,18 @@
#!/usr/bin/env bash
current_dir=$(cd $(dirname $0) && pwd)
base_dir=${current_dir}/..
cd ${base_dir}
command -v pygmentize
pygments_installed=$?
if [ ${pygments_installed} == 1 ]; then
easy_install pygments
fi
if [ ! -x ./node_modules/.bin/groc ]; then
npm install groc
fi
./node_modules/.bin/groc lib/*.js

163
bin/installit Executable file
View File

@@ -0,0 +1,163 @@
#!/usr/bin/env bash
# TODO: rewrite in node
set -e
current_dir=$(cd $(dirname $0) && pwd)
base_dir=${current_dir}/..
cd ${base_dir}
unameStr=`uname`
if [[ "${unameStr}" == 'Linux' ]]; then
SED='sed -i_orig '
CURL='wget '
elif [[ "${unameStr}" == 'Darwin' ]]; then
SED='sed -i _orig'
CURL='curl -O '
fi
set +e
head ./node_modules/bson/ext/bson.h | grep "#define USE_MISALIGNED_MEMORY_ACCESS 1"
rebuild_bson=$?
set -e
arch=`uname -m`
if [[ "${arch}" == 'armv6l' && "${rebuild_bson}" == 0 ]]; then
# ARM support: https://github.com/mongodb/js-bson/issues/37
rm -rf ./node_modules/bson/build
${SED} -e "s/#define USE_MISALIGNED_MEMORY_ACCESS 1/#define USE_MISALIGNED_MEMORY_ACCESS 0/g" ./node_modules/bson/ext/bson.h
head ./node_modules/bson/ext/bson.h | grep USE_MISALIGNED_MEMORY_ACCESS
# npm does not let itself be called while running, so the following
# does not work when this script is called by npm install
# npm rebuild bson
fi
# patch ShareJS client
if [ ! -f ./node_modules/share/webclient/share.js_orig ]; then
${SED} -e s/removeListener/removeEventListener/g ./node_modules/share/webclient/ace.js
${SED} -e s/removeListener/removeEventListener/g ./node_modules/share/webclient/share.js
${SED} -e s/removeListener/removeEventListener/g ./node_modules/share/webclient/share-ace.js
${SED} -e s/removeListener/removeEventListener/g ./node_modules/share/webclient/share.uncompressed.js
fi
if [[ -d ${HOME}/.prototyper-cache/lib && ! -d ./public/lib ]];then
mkdir -p ./public/lib
cp -r ${HOME}/.prototyper-cache/lib ./public
fi
# Knockout
mkdir -p ./public/lib/knockout
cd ./public/lib/knockout
if [ ! -f ./knockout-min.js ]; then
${CURL} https://cdnjs.cloudflare.com/ajax/libs/knockout/2.2.1/knockout-min.js
fi
if [ ! -f ./knockout-2.2.1.debug.js ]; then
${CURL} http://knockoutjs.com/downloads/knockout-2.2.1.debug.js
fi
if [ ! -f ./knockout.mapping-latest.js ]; then
${CURL} https://raw.github.com/SteveSanderson/knockout.mapping/master/build/output/knockout.mapping-latest.js
fi
if [ ! -f ./knockout.mapping-latest.debug.js ]; then
${CURL} https://raw.github.com/SteveSanderson/knockout.mapping/master/build/output/knockout.mapping-latest.debug.js
fi
if [ ! -f ./knockout-bootstrap.min.js ]; then
${CURL} https://raw.github.com/billpull/knockout-bootstrap/master/build/knockout-bootstrap.min.js
fi
if [ ! -f ./knockout.validation.min.js ]; then
${CURL} http://cdnjs.cloudflare.com/ajax/libs/knockout-validation/1.0.2/knockout.validation.min.js
fi
if [ ! -f ./knockout-sortable.js ]; then
${CURL} https://raw.github.com/rniemeyer/knockout-sortable/master/build/knockout-sortable.js
fi
if [ ! -f ./knockout-sortable.min.js ]; then
${CURL} https://raw.github.com/rniemeyer/knockout-sortable/master/build/knockout-sortable.min.js
fi
cd ${base_dir}
# Bootstrap
mkdir -p ./public/lib/bootstrap
cd ./public/lib/bootstrap
if [ ! -f ./bootstrap-combined.min.css ]; then
${CURL} http://netdna.bootstrapcdn.com/twitter-bootstrap/2.3.1/css/bootstrap-combined.min.css
fi
if [ ! -f ./bootstrap.min.js ]; then
${CURL} http://netdna.bootstrapcdn.com/twitter-bootstrap/2.3.1/js/bootstrap.min.js
fi
cd ${base_dir}
# http://netdna.bootstrapcdn.com/twitter-bootstrap/2.3.1/img/glyphicons-halflings.png
mkdir -p ./public/lib/img
cd ./public/lib/img
if [ ! -f ./glyphicons-halflings.png ]; then
${CURL} http://netdna.bootstrapcdn.com/twitter-bootstrap/2.3.1/img/glyphicons-halflings.png
fi
if [ ! -f ./glyphicons-halflings-white.png ]; then
${CURL} http://netdna.bootstrapcdn.com/twitter-bootstrap/2.3.1/img/glyphicons-halflings-white.png
fi
cd ${base_dir}
# JQuery
mkdir -p ./public/lib/jquery
cd ./public/lib/jquery
if [ ! -f ./jquery.min.js ]; then
${CURL} http://cdnjs.cloudflare.com/ajax/libs/jquery/1.9.1/jquery.min.js
fi
cd ${base_dir}
# SockJS
mkdir -p ./public/lib/sockjs
cd ./public/lib/sockjs
if [ ! -f ./sockjs-0.3.min.js ]; then
${CURL} http://cdn.sockjs.org/sockjs-0.3.min.js
fi
cd ${base_dir}
# Underscore
mkdir -p ./public/lib/underscore
cd ./public/lib/underscore
if [ ! -f ./underscore-min.js ]; then
${CURL} http://underscorejs.org/underscore-min.js
fi
cd ${base_dir}
# //cdnjs.cloudflare.com/ajax/libs/modernizr/2.6.2/modernizr.min.js
mkdir -p ./public/lib/modernizr
cd ./public/lib/modernizr
if [ ! -f ./modernizr.min.js ]; then
${CURL} http://cdnjs.cloudflare.com/ajax/libs/modernizr/2.6.2/modernizr.min.js
fi
cd ${base_dir}
# //netdna.bootstrapcdn.com/font-awesome/3.0.2/css/font-awesome.css
mkdir -p ./public/lib/font-awesome
cd ./public/lib/font-awesome
if [ ! -f ./font-awesome.css ]; then
${CURL} http://netdna.bootstrapcdn.com/font-awesome/3.0.2/css/font-awesome.css
fi
cd ${base_dir}
# https://raw.github.com/cloudhead/less.js/master/dist/less-1.3.3.min.js
mkdir -p ./public/lib/lessjs
cd ./public/lib/lessjs
if [ ! -f ./less-1.3.3.min.js ]; then
${CURL} https://raw.github.com/cloudhead/less.js/master/dist/less-1.3.3.min.js
fi
cd ${base_dir}
if [ ! -d ${HOME}/.prototyper-cache ];then
mkdir -p ${HOME}/.prototyper-cache
fi
cp -r ./public/lib ${HOME}/.prototyper-cache
if [[ "${arch}" == 'armv6l' && ! -d ./node_modules/bson/build ]]; then
echo "need to rebuild bson: 'npm rebuild bson' before running"
fi