Skip to content
Snippets Groups Projects
Commit 758af8d1 authored by Shane Tomlinson's avatar Shane Tomlinson
Browse files

Setting up views for include.js and include.orig.js

* include.js points to include_js/include.js or production/include.js depending on environment.
* Added tests checking for correct responses to 'include.js' and 'include.orig.js'.
* Added missing tests for correct response for '/test' and '/test/'
* Remove the symlink to include.js
* Remove symlink update in compress.sh

issue #921
parent a4b3b3b4
No related branches found
No related tags found
No related merge requests found
......@@ -17,6 +17,8 @@ path = require('path');
const VIEW_PATH = path.join(__dirname, "..", "..", "resources", "views");
const DEV_INCLUDE = path.join(__dirname, "..", "..", "resources", "static", "include_js", "include.js");
const PROD_INCLUDE = path.join(__dirname, "..", "..", "resources", "static", "production", "include.js");
// none of our views include dynamic data. all of them should be served
// with reasonable cache headers. This wrapper around rendering handles
......@@ -50,6 +52,21 @@ exports.setup = function(app) {
production: config.get('use_minified_resources')
});
app.get('/include.js', function(req, res, next) {
var include = DEV_INCLUDE,
env = config.get('env');
if (env === 'production') {
include = PROD_INCLUDE;
}
res.sendfile(include);
});
app.get('/include.orig.js', function(req, res, next) {
res.sendfile(DEV_INCLUDE);
});
// this should probably be an internal redirect
// as soon as relative paths are figured out.
app.get('/sign_in', function(req, res, next ) {
......@@ -134,7 +151,7 @@ exports.setup = function(app) {
});
/**
*
*
* XXX benadida or lloyd, I tried to use straight up regexp to do this, but.
* is there a better way to do this?
*/
......
production/include.js
\ No newline at end of file
......@@ -107,7 +107,3 @@ $UGLIFY < $BUILD_PATH/communication_iframe.uncompressed.js > communication_ifram
$UGLIFYCSS $BUILD_PATH/browserid.uncompressed.css > browserid.css
$UGLIFYCSS $BUILD_PATH/dialog.uncompressed.css > dialog.css
# set up new simlink for include.js. How can this part be better?
cd ..
rm include.js
ln -s production/include.js
......@@ -73,7 +73,12 @@ suite.addBatch({
'GET /users/': respondsWith(302),
'GET /primaries': respondsWith(302),
'GET /primaries/': respondsWith(302),
'GET /developers': respondsWith(302)
'GET /developers': respondsWith(302),
'GET /developers/': respondsWith(302),
'GET /test': respondsWith(200),
'GET /test/': respondsWith(200),
'GET /include.js': respondsWith(200),
'GET /include.orig.js': respondsWith(200)
});
// shut the server down and cleanup
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment