mirror of https://github.com/snachodog/mybuddy.git
Add convenience function in Gulp for simple pipenv tasks
This commit is contained in:
parent
5811755f7b
commit
c01dbee4c7
|
@ -20,7 +20,7 @@ module.exports = {
|
||||||
files: 'babybuddy/static_src/root/*'
|
files: 'babybuddy/static_src/root/*'
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
glyphFontCOnfig: {
|
glyphFontConfig: {
|
||||||
configFile: 'babybuddy/static_src/fontello/config.json',
|
configFile: 'babybuddy/static_src/fontello/config.json',
|
||||||
dest: 'babybuddy/static_src/fontello'
|
dest: 'babybuddy/static_src/fontello'
|
||||||
},
|
},
|
||||||
|
|
58
gulpfile.js
58
gulpfile.js
|
@ -17,6 +17,15 @@ var config = require('./gulpfile.config.js');
|
||||||
* Support functions for Gulp tasks.
|
* Support functions for Gulp tasks.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
function _runInPipenv(command, cb) {
|
||||||
|
command.unshift('run');
|
||||||
|
command = command.concat(process.argv.splice(3));
|
||||||
|
spawn('pipenv', command, { stdio: 'inherit' }).on('exit', function (code) {
|
||||||
|
if (code) process.exit(code);
|
||||||
|
cb();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Deletes local static files.
|
* Deletes local static files.
|
||||||
*
|
*
|
||||||
|
@ -115,12 +124,7 @@ function extras(cb) {
|
||||||
* @param cb
|
* @param cb
|
||||||
*/
|
*/
|
||||||
function lint(cb) {
|
function lint(cb) {
|
||||||
var command = ['run', 'flake8', '--exclude=.venv,etc,migrations,manage.py,node_modules,settings'];
|
_runInPipenv(['flake8', '--exclude=.venv,etc,migrations,manage.py,node_modules,settings'], cb);
|
||||||
command = command.concat(process.argv.splice(3));
|
|
||||||
spawn('pipenv', command, { stdio: 'inherit' }).on('exit', function (code) {
|
|
||||||
if (code) process.exit(code);
|
|
||||||
cb();
|
|
||||||
});
|
|
||||||
|
|
||||||
pump([
|
pump([
|
||||||
gulp.src(config.watchConfig.stylesGlob),
|
gulp.src(config.watchConfig.stylesGlob),
|
||||||
|
@ -212,9 +216,9 @@ function test(cb) {
|
||||||
*/
|
*/
|
||||||
function updateglyphs(cb) {
|
function updateglyphs(cb) {
|
||||||
pump([
|
pump([
|
||||||
gulp.src(config.glyphFontCOnfig.configFile),
|
gulp.src(config.glyphFontConfig.configFile),
|
||||||
fontello({ assetsOnly: false }),
|
fontello({ assetsOnly: false }),
|
||||||
gulp.dest(config.glyphFontCOnfig.dest)
|
gulp.dest(config.glyphFontConfig.dest)
|
||||||
], cb);
|
], cb);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -251,58 +255,34 @@ gulp.task('collectstatic', function(cb) {
|
||||||
});
|
});
|
||||||
|
|
||||||
gulp.task('compilemessages', function(cb) {
|
gulp.task('compilemessages', function(cb) {
|
||||||
var command = ['run', 'python', 'manage.py', 'compilemessages'];
|
_runInPipenv(['python', 'manage.py', 'compilemessages'], cb);
|
||||||
command = command.concat(process.argv.splice(3));
|
|
||||||
spawn('pipenv', command, { stdio: 'inherit' }).on('exit', cb);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
gulp.task('createcachetable', function(cb) {
|
gulp.task('createcachetable', function(cb) {
|
||||||
var command = ['run', 'python', 'manage.py', 'createcachetable'];
|
_runInPipenv(['python', 'manage.py', 'createcachetable'], cb);
|
||||||
command = command.concat(process.argv.splice(3));
|
|
||||||
spawn('pipenv', command, { stdio: 'inherit' }).on('exit', cb);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
gulp.task('fake', function(cb) {
|
gulp.task('fake', function(cb) {
|
||||||
var command = ['run', 'python', 'manage.py', 'fake'];
|
_runInPipenv(['python', 'manage.py', 'fake'], cb);
|
||||||
command = command.concat(process.argv.splice(3));
|
|
||||||
spawn('pipenv', command, { stdio: 'inherit' }).on('exit', cb);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
gulp.task('migrate', function(cb) {
|
gulp.task('migrate', function(cb) {
|
||||||
var command = ['run', 'python', 'manage.py', 'migrate'];
|
_runInPipenv(['python', 'manage.py', 'migrate'], cb);
|
||||||
command = command.concat(process.argv.splice(3));
|
|
||||||
spawn('pipenv', command, { stdio: 'inherit' }).on('exit', cb);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
gulp.task('makemessages', function(cb) {
|
gulp.task('makemessages', function(cb) {
|
||||||
var command = ['run', 'python', 'manage.py', 'makemessages'];
|
_runInPipenv(['python', 'manage.py', 'makemessages'], cb);
|
||||||
command = command.concat(process.argv.splice(3));
|
|
||||||
spawn('pipenv', command, { stdio: 'inherit' }).on('exit', cb);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
gulp.task('makemigrations', function(cb) {
|
gulp.task('makemigrations', function(cb) {
|
||||||
var command = ['run', 'python', 'manage.py', 'makemigrations'];
|
_runInPipenv(['python', 'manage.py', 'makemigrations'], cb);
|
||||||
command = command.concat(process.argv.splice(3));
|
|
||||||
spawn('pipenv', command, { stdio: 'inherit' }).on('exit', cb);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Runs the custom "reset" command to start a fresh database with fake data.
|
* Runs the custom "reset" command to start a fresh database with fake data.
|
||||||
*/
|
*/
|
||||||
gulp.task('reset', function(cb) {
|
gulp.task('reset', function(cb) {
|
||||||
spawn(
|
_runInPipenv(['python', 'manage.py', 'reset', '--no-input'], cb);
|
||||||
'pipenv',
|
|
||||||
[
|
|
||||||
'run',
|
|
||||||
'python',
|
|
||||||
'manage.py',
|
|
||||||
'reset',
|
|
||||||
'--no-input'
|
|
||||||
],
|
|
||||||
{
|
|
||||||
stdio: 'inherit'
|
|
||||||
}
|
|
||||||
).on('exit', cb);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
gulp.task('runserver', function(cb) {
|
gulp.task('runserver', function(cb) {
|
||||||
|
|
Loading…
Reference in New Issue