Add 'public' symlink creation to runtests
Runtest now creates a symlink to the public folder when it doesn't exist, allowing the built-in server to access the js files without too much hassle refs #4303 refs #4315
This commit is contained in:
parent
0694973c88
commit
4ed11dba4c
|
@ -93,6 +93,14 @@ if (path === null)
|
||||||
var openFromBase = function(url, options) {
|
var openFromBase = function(url, options) {
|
||||||
return copenFrom.apply(casper,[this.getBaseURL(url), options]);
|
return copenFrom.apply(casper,[this.getBaseURL(url), options]);
|
||||||
};
|
};
|
||||||
|
casper.on('remote.message', function(message) {
|
||||||
|
console.log(message);
|
||||||
|
});
|
||||||
|
|
||||||
|
casper.on('page.error', function(message, trace) {
|
||||||
|
console.error(message, JSON.stringify(trace));
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
exports.getTestEnv = function() {
|
exports.getTestEnv = function() {
|
||||||
casper.getBaseURL = getBaseURL;
|
casper.getBaseURL = getBaseURL;
|
||||||
|
@ -102,6 +110,49 @@ if (path === null)
|
||||||
return casper;
|
return casper;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
exports.setupRequireJs = function(libraries) {
|
||||||
|
if (typeof libraries === "undefined") {
|
||||||
|
libraries = {
|
||||||
|
jquery: 'vendor/jquery-1.8.3',
|
||||||
|
bootstrap: 'vendor/bootstrap.min',
|
||||||
|
eve: 'vendor/raphael/eve'
|
||||||
|
};
|
||||||
|
} else {
|
||||||
|
libraries = libraries || {};
|
||||||
|
libraries.logging = 'icinga/util/logging';
|
||||||
|
libraries.jquery = 'vendor/jquery-1.8.3';
|
||||||
|
libraries["modules/list"] = "/moduleMock";
|
||||||
|
if (libraries.bootstrap || libraries.icinga) {
|
||||||
|
libraries.bootstrap = 'vendor/bootstrap.min';
|
||||||
|
libraries.history = 'vendor/history';
|
||||||
|
libraries.eve = 'vendor/raphael/eve';
|
||||||
|
libraries.raphael = 'vendor/raphael/raphael.amd';
|
||||||
|
libraries["raphael.core"] = 'vendor/raphael/raphael.core';
|
||||||
|
libraries["raphael.svg"] = 'vendor/raphael/raphael.svg';
|
||||||
|
libraries["raphael.vml"] = 'vendor/raphael/raphael.vml';
|
||||||
|
}
|
||||||
|
if (libraries.ace) {
|
||||||
|
libraries.ace = 'vendor/ace/ace';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
var bootstrap = libraries.icinga;
|
||||||
|
delete(libraries.icinga);
|
||||||
|
requirejs.config({
|
||||||
|
baseUrl: window.base_url + '/js',
|
||||||
|
paths: libraries
|
||||||
|
});
|
||||||
|
if (bootstrap) {
|
||||||
|
|
||||||
|
requirejs(['jquery', 'history']);
|
||||||
|
requirejs(['bootstrap']);
|
||||||
|
requirejs(['icinga/icinga'], function (Icinga) {
|
||||||
|
window.$ = $;
|
||||||
|
window.jQuery = $;
|
||||||
|
window.Icinga = Icinga;
|
||||||
|
window.History = History;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
};
|
||||||
})();
|
})();
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -16,6 +16,11 @@ if [ ! -x $CASPER ]; then
|
||||||
"Take a look at http://casperjs.org/installation.html to see how the installation works for your system"
|
"Take a look at http://casperjs.org/installation.html to see how the installation works for your system"
|
||||||
exit 1
|
exit 1
|
||||||
fi;
|
fi;
|
||||||
|
if [ ! -e "${DIR}/static/public" ]; then
|
||||||
|
echo "!"
|
||||||
|
ln -s "${DIR}/../../public" "${DIR}/static/public"
|
||||||
|
fi;
|
||||||
|
|
||||||
|
|
||||||
PARAM="0"
|
PARAM="0"
|
||||||
for arg in $@;do
|
for arg in $@;do
|
||||||
|
@ -108,10 +113,16 @@ if [ "$EXCLUDE" != "" ];then
|
||||||
fi
|
fi
|
||||||
FILELIST=`echo $FILELIST | grep -v "$NAME"`
|
FILELIST=`echo $FILELIST | grep -v "$NAME"`
|
||||||
fi;
|
fi;
|
||||||
|
|
||||||
cd $DIR/static
|
cd $DIR/static
|
||||||
|
PROC=`ps ax|grep "SimpleHTTPServer 12999"|awk '{ print $1 }'`
|
||||||
|
if [ "$PROC" != "" ]; then
|
||||||
|
kill $PROC
|
||||||
|
fi;
|
||||||
python -m SimpleHTTPServer 12999&
|
python -m SimpleHTTPServer 12999&
|
||||||
PID=$!
|
PID=$!
|
||||||
cd $DIR
|
cd $DIR
|
||||||
|
|
||||||
echo $EXEC $FILELIST
|
echo $EXEC $FILELIST
|
||||||
$EXEC $FILELIST
|
$EXEC $FILELIST
|
||||||
kill $PID
|
kill $PID
|
||||||
|
|
Loading…
Reference in New Issue