# must be called once after GIT checkout
setup:
#why? ${MAKE} -C./tools/htdocs mkws-js-min
- ${MAKE} -C./examples/htdocs jasmine-links
${MAKE} -C./test node-modules
check: setup check-js
chmod ugo-w $@
jasmine-links:
- ln -fs ../jasmine .
- ln -fs ../../test .
help:
@echo "make [ all | clean | jasmine-links ]"
<link rel="stylesheet" type="text/css" href="//code.jquery.com/ui/1.10.3/themes/smoothness/jquery-ui.css" />
<link rel="stylesheet" type="text/css" href="tools/htdocs/mkws.css" />
- <script type="text/javascript" src="tools/htdocs/jquery-1.10.0.min.js"></script>
+ <script type="text/javascript" src="src/jquery-1.10.0.min.js"></script>
<script type="text/javascript" src="//code.jquery.com/ui/1.10.3/jquery-ui.min.js"></script>
- <script type="text/javascript" src="tools/htdocs/pz2.js"></script>
- <script type="text/javascript" src="tools/htdocs/jquery.json-2.4.js"></script>
- <script type="text/javascript" src="tools/htdocs/handlebars-v1.1.2.js"></script>
- <script type="text/javascript" src="tools/htdocs/mkws.js"></script>
- <script type="text/javascript" src="tools/htdocs/mkws-jquery.js"></script>
+ <script type="text/javascript" src="src/pz2.js"></script>
+ <script type="text/javascript" src="src/jquery.json-2.4.js"></script>
+ <script type="text/javascript" src="src/handlebars-v1.1.2.js"></script>
+ <script type="text/javascript" src="src/mkws.js"></script>
+ <script type="text/javascript" src="src/mkws-jquery.js"></script>
<link rel="shortcut icon" type="image/png" href="jasmine/lib/jasmine-1.3.1/jasmine_favicon.png">
<link rel="stylesheet" type="text/css" href="jasmine/lib/jasmine-1.3.1/jasmine.css">
<link rel="stylesheet" type="text/css" href="//code.jquery.com/ui/1.10.3/themes/smoothness/jquery-ui.css" />
<link rel="stylesheet" type="text/css" href="tools/htdocs/mkws.css" />
- <script type="text/javascript" src="tools/htdocs/jquery-1.10.0.min.js"></script>
+ <script type="text/javascript" src="src/jquery-1.10.0.min.js"></script>
<script type="text/javascript" src="//code.jquery.com/ui/1.10.3/jquery-ui.min.js"></script>
- <script type="text/javascript" src="tools/htdocs/pz2.js"></script>
- <script type="text/javascript" src="tools/htdocs/jquery.json-2.4.js"></script>
- <script type="text/javascript" src="tools/htdocs/handlebars-v1.1.2.js"></script>
- <script type="text/javascript" src="tools/htdocs/mkws.js"></script>
- <script type="text/javascript" src="tools/htdocs/mkws-jquery.js"></script>
+ <script type="text/javascript" src="src/pz2.js"></script>
+ <script type="text/javascript" src="src/jquery.json-2.4.js"></script>
+ <script type="text/javascript" src="src/handlebars-v1.1.2.js"></script>
+ <script type="text/javascript" src="src/mkws.js"></script>
+ <script type="text/javascript" src="src/mkws-jquery.js"></script>
<link rel="shortcut icon" type="image/png" href="jasmine/lib/jasmine-1.3.1/jasmine_favicon.png">
<link rel="stylesheet" type="text/css" href="jasmine/lib/jasmine-1.3.1/jasmine.css">
};
</script>
<script type="text/javascript" src="//code.jquery.com/jquery-1.7.2.min.js"></script>
- <script type="text/javascript" src="tools/htdocs/pz2.js"></script>
- <script type="text/javascript" src="tools/htdocs/handlebars-v1.1.2.js"></script>
- <script type="text/javascript" src="tools/htdocs/jquery.json-2.4.js"></script>
- <script type="text/javascript" src="tools/htdocs/mkws.js"></script>
+ <script type="text/javascript" src="src/pz2.js"></script>
+ <script type="text/javascript" src="src/handlebars-v1.1.2.js"></script>
+ <script type="text/javascript" src="src/jquery.json-2.4.js"></script>
+ <script type="text/javascript" src="src/mkws.js"></script>
<style type="text/css">
#mkwsTermlists div.facet {
float:left;
# For running on Mike's local install of node.js
MIKE = PATH=$$PATH:/usr/local/lib/node-v0.10.24-linux-x64/bin
-PHANTOMJS_URL=https://mkws-dev.indexdata.com/jasmine-popup.html
+#PHANTOMJS_URL=https://mkws-dev.indexdata.com/jasmine-popup.html
+PHANTOMJS_URL=http://localhost:4040/jasmine-popup.html
PHANTOMJS_TIMEOUT=16
NPM_INSTALL_FLAGS=-q
PHANTOMJS= ./node_modules/phantomjs/bin/phantomjs
IMAGES= ./images
SCREENSHOT_WIDTH= 360 480 640 768 1024 1200 1440 2048
-PERL_SCRIPTS= bomb.pl
+PERL_SCRIPTS= bin/bomb.pl
+TMP_DIR= ./logs
+APACHE_HTTPD= /usr/sbin/apache2
all: check
clean:
rm -f mkws-error.png mkws-error.html images/*.png
-distclean: clean
+distclean: clean clean-tmp
rm -rf node_modules
+ rm -f ${TMP_DIR}/jasmine-dev
+
+clean-tmp:
+ rm -rf ${TMP_DIR}
+ mkdir -p ${TMP_DIR}
+ touch ${TMP_DIR}/.gitkeep
mkws-complete-syntax-check:
${MAKE} -C../src mkws-complete.min.js
terse:
$(MIKE) jasmine-node --noColor --captureExceptions --forceexit spec
-phantomjs p:
- ./bomb.pl --timeout="${PHANTOMJS_TIMEOUT}.5" ${PHANTOMJS} phantom/run-jasmine.js ${PHANTOMJS_URL} ${PHANTOMJS_TIMEOUT}
+phantomjs p: apache-stop apache-start
+ ./bin/bomb.pl --timeout="${PHANTOMJS_TIMEOUT}.5" ${PHANTOMJS} phantom/run-jasmine.js ${PHANTOMJS_URL} ${PHANTOMJS_TIMEOUT}
+ ${MAKE} apache-stop
screenshot:
${PHANTOMJS} phantom/screenshot.js ${PHANTOMJS_URL} ${IMAGES}/screenshot.png 1200 1000
node_modules node-modules:
npm install ${NPM_INSTALL_FLAGS}
+apache-start:
+ bin/apache-template-update
+ ${APACHE_HTTPD} -f `pwd`/${TMP_DIR}/jasmine-dev
+
+apache-stop:
+ @-if [ -e ${TMP_DIR}/mkws-jasmine.pid ]; then \
+ kill `cat ${TMP_DIR}/mkws-jasmine.pid`; \
+ else \
+ killall apache2 2> /dev/null; \
+ fi
+ @sleep 0.3
+
help:
@echo "make [ all | check | clean | distclean ]"
@echo " [ phantomjs | screenshot ]"
@echo " [ jsbeautifier | perltidy ]"
@echo " [ node-modules ]"
+ @echo " [ apache-stop apache-start ]"
@echo ""
- @echo "DEBUG=1 make phantomjs PHANTOMJS_TIMEOUT=8 PHANTOMJS_URL=https://mkws-dev.indexdata.com/jasmine-popup.html"
+ @echo "DEBUG=1 make phantomjs PHANTOMJS_TIMEOUT=8 PHANTOMJS_URL=${PHANTOMJS_URL}"
--- /dev/null
+#!/bin/sh
+# Copyright (c) 2014-2014 IndexData ApS. http://indexdata.com
+# Wolfram Schneider
+#
+# generate temp config file for testing
+#
+
+export APACHE_SERVER_ROOT=$(pwd)
+export APACHE_RUN_USER=$(whoami)
+export APACHE_RUN_GROUP=$(groups | awk '{ print $1 }')
+
+export APACHE_LOG_DIR=$APACHE_SERVER_ROOT/logs
+export APACHE_PID_FILE=$APACHE_LOG_DIR/mkws-jasmine.pid
+export APACHE_PORT=4040
+
+export MKWS_ROOT=$(pwd)/..
+
+: ${MKWS_APACHE_TEMPLATE="$MKWS_ROOT/tools/apache2/jasmine-dev.template"}
+: ${MKWS_APACHE_FILE="$APACHE_LOG_DIR/jasmine-dev"}
+
+perl -npe 's,\${(.*?)},$ENV{$1},g; ' $MKWS_APACHE_TEMPLATE > $MKWS_APACHE_FILE.tmp
+mv -f $MKWS_APACHE_FILE.tmp $MKWS_APACHE_FILE
+
--- /dev/null
+#!/usr/bin/perl
+# Copyright (c) 2014 IndexData ApS. http://indexdata.com
+#
+# bomb.pl - wrapper to stop a process after N seconds
+#
+
+use Getopt::Long;
+
+use strict;
+use warnings;
+
+my $debug = 0;
+my $help;
+my $timeout = 100;
+
+binmode \*STDOUT, ":utf8";
+binmode \*STDERR, ":utf8";
+
+# timeout handler
+sub set_alarm {
+ my $time = shift;
+ my $message = shift || "";
+
+ $time = 100 if !defined $time;
+
+ $SIG{ALRM} = sub {
+
+ warn "Time out alarm $time\n";
+
+ # sends a hang-up signal to all processes in the current process group
+ # and kill running java processes
+ local $SIG{HUP} = "IGNORE";
+ kill 1, -$$;
+
+ local $SIG{TERM} = "IGNORE";
+ kill 15, -$$;
+ kill 15, -$$;
+
+ warn "Send a hang-up to all childs.\n";
+
+ #exit 1;
+ };
+
+ warn "set alarm time to: $time seconds $message\n" if $debug >= 1;
+ alarm($time);
+}
+
+sub usage () {
+ <<EOF;
+usage: $0 [ options ] command args ....
+
+--debug=0..3 debug option, default: $debug
+--timeout=1..N timeout in seconds, default: $timeout
+EOF
+}
+
+GetOptions(
+ "help" => \$help,
+ "debug=i" => \$debug,
+ "timeout=f" => \$timeout,
+) or die usage;
+
+my @system = @ARGV;
+
+die usage if $help;
+die usage if !@system;
+
+set_alarm( $timeout, join( " ", @system ) );
+
+system(@system) == 0
+ or die "@system failed with exit code: $?\n";
+
+exit(0);
+++ /dev/null
-#!/usr/bin/perl
-# Copyright (c) 2014 IndexData ApS. http://indexdata.com
-#
-# bomb.pl - wrapper to stop a process after N seconds
-#
-
-use Getopt::Long;
-
-use strict;
-use warnings;
-
-my $debug = 0;
-my $help;
-my $timeout = 100;
-
-binmode \*STDOUT, ":utf8";
-binmode \*STDERR, ":utf8";
-
-# timeout handler
-sub set_alarm {
- my $time = shift;
- my $message = shift || "";
-
- $time = 100 if !defined $time;
-
- $SIG{ALRM} = sub {
-
- warn "Time out alarm $time\n";
-
- # sends a hang-up signal to all processes in the current process group
- # and kill running java processes
- local $SIG{HUP} = "IGNORE";
- kill 1, -$$;
-
- local $SIG{TERM} = "IGNORE";
- kill 15, -$$;
- kill 15, -$$;
-
- warn "Send a hang-up to all childs.\n";
-
- #exit 1;
- };
-
- warn "set alarm time to: $time seconds $message\n" if $debug >= 1;
- alarm($time);
-}
-
-sub usage () {
- <<EOF;
-usage: $0 [ options ] command args ....
-
---debug=0..3 debug option, default: $debug
---timeout=1..N timeout in seconds, default: $timeout
-EOF
-}
-
-GetOptions(
- "help" => \$help,
- "debug=i" => \$debug,
- "timeout=f" => \$timeout,
-) or die usage;
-
-my @system = @ARGV;
-
-die usage if $help;
-die usage if !@system;
-
-set_alarm( $timeout, join( " ", @system ) );
-
-system(@system) == 0
- or die "@system failed with exit code: $?\n";
-
-exit(0);
+++ /dev/null
-#!/usr/local/bin/perl
-# Copyright (c) 2014 IndexData ApS. http://indexdata.com
-#
-# bomb.pl - wrapper to stop a process after N seconds
-#
-
-use Getopt::Long;
-
-use strict;
-use warnings;
-
-my $debug = 0;
-my $help;
-my $timeout = 100;
-
-binmode \*STDOUT, ":utf8";
-binmode \*STDERR, ":utf8";
-
-# timeout handler
-sub set_alarm {
- my $time = shift;
- my $message = shift || "";
-
- $time = 100 if !defined $time;
-
- $SIG{ALRM} = sub {
-
- warn "Time out alarm $time\n";
-
- # sends a hang-up signal to all processes in the current process group
- # and kill running java processes
- local $SIG{HUP} = "IGNORE";
- kill 1, -$$;
-
- local $SIG{TERM} = "IGNORE";
- kill 15, -$$;
- kill 15, -$$;
-
- warn "Send a hang-up to all childs.\n";
-
- #exit 1;
- };
-
- warn "set alarm time to: $time seconds $message\n" if $debug >= 1;
- alarm($time);
-}
-
-sub usage () {
- <<EOF;
-usage: $0 [ options ] command args ....
-
---debug=0..3 debug option, default: $debug
---timeout=1..N timeout in seconds, default: $timeout
-EOF
-}
-
-GetOptions(
- "help" => \$help,
- "debug=i" => \$debug,
- "timeout=i" => \$timeout,
-) or die usage;
-
-my @system = @ARGV;
-
-die usage if $help;
-die usage if !@system;
-
-set_alarm( $timeout, join( " ", @system ) );
-
-system(@system) == 0
- or die "system @system failed: $?";
-
-exit(0);
--- /dev/null
+# Configuration for the apache web server -*- apache -*-
+
+#####################################################################
+# global apache2 config
+#
+User ${APACHE_RUN_USER}
+Group ${APACHE_RUN_GROUP}
+PidFile ${APACHE_PID_FILE}
+
+ServerRoot ${APACHE_SERVER_ROOT}
+NameVirtualHost *:${APACHE_PORT}
+Listen ${APACHE_PORT}
+
+LogFormat "%{X-Forwarded-For}i %l %u %t \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\"" combined
+
+Include /etc/apache2/mods-enabled/alias.load
+Include /etc/apache2/mods-enabled/authz*.load
+Include /etc/apache2/mods-enabled/proxy*.load
+Include /etc/apache2/mods-enabled/rewrite.load
+Include /etc/apache2/mods-enabled/headers.load
+Include /etc/apache2/mods-enabled/mime.load
+Include /etc/apache2/mods-enabled/deflate.load
+
+Include /etc/apache2/mods-enabled/alias*.conf
+Include /etc/apache2/mods-enabled/authz*.conf
+Include /etc/apache2/mods-enabled/proxy*.conf
+Include /etc/apache2/mods-enabled/mime.conf
+Include /etc/apache2/mods-enabled/deflate.conf
+
+# pazpar2 / service proxy config
+<VirtualHost *:${APACHE_PORT}>
+ ServerName localhost
+ ServerAlias mkws-dev a.mkws.indexdata.com a.mkws-dev.indexdata.com mkws-dev.indexdata.com 127.0.0.1
+
+ ServerAdmin webmaster@indexdata.com
+ ErrorLog ${APACHE_LOG_DIR}/mkws-jasmine-error.log
+ CustomLog ${APACHE_LOG_DIR}/mkws-jasmine-access.log combined
+
+ RewriteEngine on
+ RewriteLogLevel 1
+ RewriteLog ${APACHE_LOG_DIR}/mkws-jasmine-rewrite.log
+
+ DocumentRoot ${MKWS_ROOT}/examples/htdocs
+ Alias /tools/htdocs ${MKWS_ROOT}/tools/htdocs
+ Alias /src ${MKWS_ROOT}/src
+ Alias /test ${MKWS_ROOT}/test
+ Alias /jasmine ${MKWS_ROOT}/examples/jasmine
+
+ # CORS setting
+ Header set Access-Control-Allow-Credentials true
+ Header set Access-Control-Allow-Origin "*"
+
+ # compress text output
+ <Location />
+ AddOutputFilterByType DEFLATE text/html text/plain text/xml application/xml
+ SetOutputFilter DEFLATE
+ </Location>
+
+ # jasmine test account
+ RewriteRule /service-proxy-testauth /service-proxy/?command=auth&action=login&username=mkwstest&password=mkwstest [P] # [NE,P]
+
+ # mkws devel account (e.g. memached testing)
+ RewriteRule /service-proxy-auth /service-proxy/?command=auth&action=login&username=mkwsdev&password=mkwsdev [P] # [NE,P]
+
+ ProxyPass /service-proxy/ http://mkc.indexdata.com:9009/service-proxy/
+ ProxyPassReverse /service-proxy/ http://mkc.indexdata.com:9009/service-proxy/
+
+ ProxyPass /pazpar2/ http://localhost:8004/pazpar2/
+ ProxyPassReverse /pazpar2/ http://localhost:8004/pazpar2/
+
+</VirtualHost>
+