Skip to content

hash-bang/Gulp-Mongoose-Scenario

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Gulp-Mongoose-Scenario

Gulp wrapper for mongoose-scenario.

Installation

Install via NPM:

npm install --save-dev gulp-mongoose-scenario

Usage:

var gulp = require('gulp');
var scenario = require('gulp-mongoose-scenario');

gulp.task('db', ()=> {
	// Load all config files including your main DB handler
	global.config = require('./config/global');
	require('./config/db');

	// Load all modules
	require('./models/users');
	require('./models/projects');
	require('./models/products');
	require('./models/productCategories');

	// Slurp in all the .json files located in models/scenarios and run them though mongoose-scenario

	return gulp.src('models/scenarios/**/*.json')
		.pipe(scenario({connection: db, nuke: true}))
});

If you wish to use .js files rather than raw JSON, run use something like gulp-eval earlier in the pipeline:

var eval = require('gulp-eval');
var gulp = require('gulp');

gulp.task('scenario', ()=>
	gulp.src('models/scenarios/**/*.{js,json}')
		.pipe(eval())
		.pipe(scenario({connection: db, nuke: true}))
)

About

Gulp wrapper for mongoose-scenario

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published