Add migrate and fake commands to gulp.

This commit is contained in:
Christopher Charbonneau Wells 2017-10-26 12:26:09 -04:00
parent 1221367f2a
commit 28c2238423
2 changed files with 28 additions and 2 deletions

View File

@ -47,12 +47,17 @@ user name and password (`admin`/`admin`).
### Fake data
From within the pipenv shell, execute:
Add some fake data to the database with the following command:
```
python manage.py fake
gulp fake
```
By default, ``fake`` creates one child and 31 days of random data. Use the
``--children`` and ``--days`` flags to change the default values, e.g.
``gulp fake --children 5 --days 7`` to generate five fake children and seven
days of data for each.
### Testing
:exclamation: Tests require static files to be collected, it may be necessary

View File

@ -18,6 +18,27 @@ gulp.task('collectstatic', function(cb) {
).on('exit', cb);
});
gulp.task('fake', function(cb) {
var command = ['run', 'python', 'manage.py', 'fake'];
command = command.concat(process.argv.splice(3));
spawn('pipenv', command, { stdio: 'inherit' }).on('exit', cb);
});
gulp.task('migrate', function(cb) {
spawn(
'pipenv',
[
'run',
'python',
'manage.py',
'migrate'
],
{
stdio: 'inherit'
}
).on('exit', cb);
});
gulp.task('reset', function(cb) {
spawn(
'pipenv',