Skip to content

Commit d7ed3b6

Browse files
committed
no-reset for db:load, more fixtures
1 parent 65c6c42 commit d7ed3b6

2 files changed

Lines changed: 6 additions & 36 deletions

File tree

fixture/openCourse.js

Lines changed: 3 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,6 @@
11
const mongoose = require('mongoose');
22

3-
var Course = require('courses').Course;
4-
var CourseGroup = require('courses').CourseGroup;
5-
var Discount = require('payments').Discount;
6-
var CourseInvite = require('courses').CourseInvite;
7-
var VideoKey = require('videoKey').VideoKey;
8-
9-
exports.Course = [
10-
{
11-
"_id": "5569b7fc097bf243c1d54e5b",
12-
slug: "js",
13-
videoKeyTag: "js",
14-
title: "Курс JavaScript/DOM/интерфейсы",
15-
shortDescription: `"Правильный" курс по профессиональному JavaScript, цель которого – научить думать на JavaScript, писать просто, быстро и красиво.`,
16-
isListed: true,
17-
weight: 1
18-
}
19-
];
20-
21-
exports.CourseInvite = [];
22-
exports.CourseParticipant = [];
23-
exports.CourseFeedback = [];
24-
25-
exports.Discount = [{
26-
module: 'courses',
27-
data: {
28-
slug: 'js-1'
29-
},
30-
discount: 1,
31-
code: '14052015'
32-
}];
3+
require('courses').CourseGroup;
334

345
exports.CourseGroup = [
356
{
@@ -46,7 +17,7 @@ exports.CourseGroup = [
4617
title: "Курс JavaScript/DOM/интерфейсы (18.06)"
4718
},
4819
{
49-
course: '5569b7fc097bf243c1d54e5b',
20+
course: '556deb46a8bc324096206ff1',
5021
dateStart: new Date(2015, 5, 16),
5122
dateEnd: new Date(2015, 6, 14),
5223
timeDesc: "вт/пт 21:30 - 23:00 GMT+3",
@@ -59,7 +30,7 @@ exports.CourseGroup = [
5930
title: "Курс Node.JS (16.06)"
6031
},
6132
{
62-
course: '5569b7fc097bf243c1d54e5b',
33+
course: '556deb46a8bc324096206ff1',
6334
dateStart: new Date(2015, 5, 30),
6435
dateEnd: new Date(2015, 6, 28),
6536
timeDesc: "вт/пт 19:30 - 21:00 GMT+3",
@@ -72,6 +43,3 @@ exports.CourseGroup = [
7243
title: "Курс Node.JS (30.06)"
7344
}
7445
];
75-
76-
exports.VideoKey = [];
77-
for(var i=0; i<50; i++) exports.VideoKey.push({key: "см. в старом кабинете-" + i.toString(36), tag: 'js'});

tasks/dbLoad.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,9 @@ module.exports = function() {
1111

1212
var args = require('yargs')
1313
.usage("gulp db:load --from fixture/init")
14+
.example("gulp db:load --from fixture/more --no-reset")
1415
.demand(['from'])
16+
.default('reset', true)
1517
.describe('from', 'file to import')
1618
.argv;
1719

@@ -21,7 +23,7 @@ module.exports = function() {
2123

2224
return co(function*() {
2325

24-
yield* dataUtil.loadModels(dbPath, { reset: true });
26+
yield* dataUtil.loadModels(dbPath, { reset: args.reset });
2527

2628
gutil.log("loaded db " + dbPath);
2729
});

0 commit comments

Comments
 (0)