adding url context path to build, adding documentation on url contextpath (#737)

This commit is contained in:
Henry Megarry 2017-03-28 17:21:13 -05:00 committed by kevgliss
parent 15896a3b11
commit dd39b9ebe8
4 changed files with 55 additions and 17 deletions

View File

@ -17,7 +17,7 @@ endif
pip install "file://`pwd`#egg=lemur[dev]"
pip install "file://`pwd`#egg=lemur[tests]"
node_modules/.bin/gulp build
node_modules/.bin/gulp package
node_modules/.bin/gulp package --urlContextPath=$(urlContextPath)
@echo ""
release:
@ -32,7 +32,7 @@ endif
# order matters here, base package must install first
pip install -e .
node_modules/.bin/gulp build
node_modules/.bin/gulp package
node_modules/.bin/gulp package --urlContextPath=$(urlContextPath)
@echo ""
dev-docs:

View File

@ -89,6 +89,18 @@ And then run:
.. note:: This command will install npm dependencies as well as compile static assets.
You may also run with the urlContextPath variable set. If this is set it will add the desired context path for subsequent calls back to lemur.
::
Example:
urlContextPath=lemur
/api/1/auth/providers -> /lemur/api/1/auth/providers
.. code-block:: bash
$ make release urlContextPath={desired context path}
Creating a configuration
------------------------

View File

@ -20,12 +20,14 @@ var gulp = require('gulp'),
csso = require('gulp-csso'),
useref = require('gulp-useref'),
filter = require('gulp-filter'),
rev = require('gulp-rev'),
revReplace = require('gulp-rev-replace'),
imagemin = require('gulp-imagemin'),
minifyHtml = require('gulp-minify-html'),
bowerFiles = require('main-bower-files'),
karma = require('karma'),
replace = require('gulp-replace');
replace = require('gulp-replace'),
argv = require('yargs').argv;
gulp.task('default', ['clean'], function () {
gulp.start('fonts', 'styles');
@ -199,7 +201,6 @@ gulp.task('build:html', ['dev:styles', 'dev:scripts', 'build:ngviews', 'build:in
.pipe(csso())
.pipe(cssFilter.restore)
.pipe(useref())
.pipe(revReplace())
.pipe(gulp.dest('lemur/static/dist'))
.pipe(size());
});
@ -225,10 +226,34 @@ gulp.task('package:strip', function () {
.pipe(replace('http:\/\/localhost:3000', ''))
.pipe(replace('http:\/\/localhost:8000', ''))
.pipe(useref())
.pipe(revReplace())
.pipe(gulp.dest('lemur/static/dist/scripts'))
.pipe(size());
});
gulp.task('addUrlContextPath',['addUrlContextPath:revreplace'], function(){
var urlContextPathExists = argv.urlContextPath ? true : false;
return gulp.src('lemur/static/dist/scripts/main*.js')
.pipe(gulpif(urlContextPathExists, replace('api/', argv.urlContextPath + '/api/')))
.pipe(gulpif(urlContextPathExists, replace('angular/', argv.urlContextPath + '/angular/')))
.pipe(gulp.dest('lemur/static/dist/scripts'))
});
gulp.task('addUrlContextPath:revision', function(){
return gulp.src(['lemur/static/dist/**/*.css','lemur/static/dist/**/*.js'])
.pipe(rev())
.pipe(gulp.dest('lemur/static/dist'))
.pipe(rev.manifest())
.pipe(gulp.dest('lemur/static/dist'))
})
gulp.task('addUrlContextPath:revreplace', ['addUrlContextPath:revision'], function(){
var manifest = gulp.src("lemur/static/dist/rev-manifest.json");
var urlContextPathExists = argv.urlContextPath ? true : false;
return gulp.src( "lemur/static/dist/index.html")
.pipe(gulpif(urlContextPathExists, revReplace({prefix: argv.urlContextPath + '/', manifest: manifest}, revReplace({manifest: manifest}))))
.pipe(gulp.dest('lemur/static/dist'));
})
gulp.task('build', ['build:ngviews', 'build:inject', 'build:images', 'build:fonts', 'build:html', 'build:extras']);
gulp.task('package', ['package:strip']);
gulp.task('package', ['addUrlContextPath', 'package:strip']);

View File

@ -6,25 +6,24 @@
"url": "git://github.com/netflix/lemur.git"
},
"dependencies": {
"del": "^2.2.2",
"gulp-concat": "^2.4.1",
"gulp-foreach": "0.1.0",
"gulp-if": "^2.0.2",
"gulp-less": "^3.0.3",
"gulp-minify-css": "^1.2.4",
"gulp-util": "^3.0.1",
"merge-stream": "^1.0.1",
"bower": "~1.8.0",
"browser-sync": "^2.3.1",
"del": "^2.2.2",
"gulp": "^3.8.11",
"gulp-autoprefixer": "^3.1.1",
"gulp-cache": "^0.4.5",
"gulp-concat": "^2.4.1",
"gulp-csso": "^2.0.0",
"gulp-filter": "^4.0.0",
"gulp-flatten": "^0.3.1",
"gulp-foreach": "0.1.0",
"gulp-if": "^2.0.2",
"gulp-imagemin": "^3.1.1",
"gulp-inject": "~4.1.0",
"gulp-jshint": "^2.0.4",
"gulp-less": "^3.0.3",
"gulp-load-plugins": "^1.4.0",
"gulp-minify-css": "^1.2.4",
"gulp-minify-html": "~1.0.6",
"gulp-ng-annotate": "~2.0.0",
"gulp-ng-html2js": "~0.2.2",
@ -40,15 +39,17 @@
"gulp-size": "^2.1.0",
"gulp-uglify": "^2.0.0",
"gulp-useref": "^3.1.2",
"gulp-util": "^3.0.1",
"http-proxy": "~1.16.2",
"jshint-stylish": "^2.2.1",
"karma": "~1.3.0",
"karma-jasmine": "^1.1.0",
"main-bower-files": "^2.13.1",
"merge-stream": "^1.0.1",
"require-dir": "~0.3.0",
"streamqueue": "^1.1.1",
"uglify-save-license": "^0.4.1",
"karma": "~1.3.0",
"bower": "~1.8.0"
"yargs": "^7.0.2"
},
"scripts": {
"postinstall": "node_modules/.bin/bower install --allow-root --config.interactive=false",
@ -62,4 +63,4 @@
"jshint": "^2.8.0",
"karma-chrome-launcher": "^2.0.0"
}
}
}