Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Remember per-environment ./configure parameters

This is to avoid breaking test.js configuration while switching
between branches.
  • Loading branch information...
commit ed23d1036479ea92235cea399171743d9dff1448 1 parent 4c95af2
Sandro Santilli strk authored
Showing with 31 additions and 10 deletions.
  1. +1 −0  .gitignore
  2. +7 −1 Makefile
  3. +23 −9 configure
1  .gitignore
View
@@ -1,4 +1,5 @@
node_modules*
+config.status*
config/environments/*.js
.idea
tools/munin/windshaft.conf
8 Makefile
View
@@ -6,9 +6,15 @@ all:
clean:
rm -rf node_modules/*
-config/environments/test.js: config/environments/test.js.example Makefile
+distclean: clean
+ rm config.status*
+
+config.status--test:
./configure --environment=test
+config/environments/test.js: config.status--test
+ ./config.status--test
+
check-local: config/environments/test.js
./run_tests.sh ${RUNTESTFLAGS} \
test/unit/cartodb/redis_pool.test.js \
32 configure
View
@@ -17,11 +17,15 @@
# --strk(2012-07-23)
#
-PGPORT=5432
-SQLAPI_PORT=8080
+ENVDIR=config/environments
+
+PGPORT=
+SQLAPI_PORT=
MAPNIK_VERSION=
ENVIRONMENT=development
+STATUS="$0 $*"
+
usage() {
echo "Usage: $0 [OPTION]"
echo
@@ -59,20 +63,30 @@ while test -n "$1"; do
shift
done
+ENVEX=./${ENVDIR}/${ENVIRONMENT}.js.example
+
+if [ -z "$PGPORT" ]; then
+ PGPORT=`node -e "console.log(require('${ENVEX}').postgres.port)"`
+fi
+if [ -z "$SQLAPI_PORT" ]; then
+ SQLAPI_PORT=`node -e "console.log(require('${ENVEX}').sqlapi.port)"`
+fi
+
echo "PGPORT: $PGPORT"
echo "SQLAPI_PORT: $SQLAPI_PORT"
echo "MAPNIK_VERSION: $MAPNIK_VERSION"
echo "ENVIRONMENT: $ENVIRONMENT"
-# TODO: allow specifying configuration settings !
-for f in config/environments/${ENVIRONMENT}.js.example; do
- o=`dirname "$f"`/`basename "$f" .example`
- echo "Writing $o"
+o=`dirname "${ENVEX}"`/`basename "${ENVEX}" .example`
+echo "Writing $o"
- # See http://austinmatzko.com/2008/04/26/sed-multi-line-search-and-replace/
- sed -n "1h;1!H;\${;g;s/\(,postgres: {[^}]*port: *'\?\)[^',]*\('\?,\)/\1$PGPORT\2/;p;}" < "$f" \
+# See http://austinmatzko.com/2008/04/26/sed-multi-line-search-and-replace/
+sed -n "1h;1!H;\${;g;s/\(,postgres: {[^}]*port: *'\?\)[^',]*\('\?,\)/\1$PGPORT\2/;p;}" < "${ENVEX}" \
| sed "s/mapnik_version:.*/mapnik_version: '$MAPNIK_VERSION'/" \
| sed -n "1h;1!H;\${;g;s/\(,sqlapi: {[^}]*port: *'\?\)[^',]*\('\?,\)/\1$SQLAPI_PORT\2/;p;}" \
> "$o"
-done
+STATUSFILE=config.status--${ENVIRONMENT}
+echo "Writing ${STATUSFILE}"
+echo ${STATUS} > ${STATUSFILE} && chmod +x ${STATUSFILE}
+
Please sign in to comment.
Something went wrong with that request. Please try again.