Files
old-spike/gulpfile.babel.js

69 lines
1.7 KiB
JavaScript
Raw Normal View History

2016-01-27 20:15:09 -06:00
import gulp from 'gulp';
import yargs from 'yargs';
2016-02-08 18:23:40 -06:00
import webpack from 'webpack';
import gutil from 'gulp-util';
2016-01-31 18:08:42 -06:00
import DB from './server/config/database';
import {PowerDataSeed, HouseSeed} from './server/lib/tasks/seed_data';
2016-02-08 18:23:40 -06:00
import rtCompile from './server/lib/tasks/react_template_compile';
import rt_config from './server/config/react_templates';
2016-01-27 20:15:09 -06:00
gulp.task('generate_power_csv', function(done){
DB.sync().then(()=>{
PowerDataSeed.generateCsv(yargs.argv, done);
});
});
gulp.task('save_power_csv', function(done){
DB.sync().then(()=>{
PowerDataSeed.saveCsv(yargs.argv, done);
});
});
gulp.task('save_house_csv', function(done){
DB.sync().then(()=>{
HouseSeed.saveCsv(yargs.argv, done);
});
});
2016-02-08 18:23:40 -06:00
gulp.task('compile_react_templates', function() {
2016-02-09 11:16:49 -06:00
gulp.src('./client/dashboard/**/*.rt')
2016-02-08 18:23:40 -06:00
.pipe(rtCompile(rt_config))
2016-02-09 11:16:49 -06:00
.pipe(gulp.dest('./client/dashboard'));
2016-02-08 18:23:40 -06:00
});
gulp.task('build', function(done) {
var config, env;
if (yargs.argv.production){
env = 'production';
} else if (yargs.argv.design){
env = 'design';
2016-02-19 10:49:07 -06:00
} else if (yargs.argv.test){
env = 'test';
2016-02-08 18:23:40 -06:00
} else {
2016-02-16 12:02:43 -06:00
throw new gutil.PluginError("webpack", "Must include '--production' or '--design' option.");
2016-02-08 18:23:40 -06:00
}
config = require(`${__dirname}/server/config/webpack/${env}`);
// run webpack
webpack(config, function(err, stats) {
if(err) throw new gutil.PluginError("webpack", err);
gutil.log("[webpack]", stats.toString({
// output options
}));
done();
});
2016-02-19 10:49:07 -06:00
});
gulp.task('test', function(done) {
var Jasmine = require('jasmine');
var jasmine = new Jasmine();
2016-02-08 18:23:40 -06:00
2016-02-19 10:49:07 -06:00
jasmine.loadConfigFile('test/jasmine.json');
jasmine.configureDefaultReporter({
showColors: true
});
jasmine.execute();
2016-02-08 18:23:40 -06:00
});