Beispiel #1
0
    return thru.obj((data, enc, cb) => {
        // data: {bemjson: ?File, bemdecl: ?File, levels: String[], data: ?Object}
        // data: {bemjson: ?String|File, bemdecl: ?String|File, levels: String[], data: ?Object}
        // bundle: {src: function({tech}): Stream<Vinyl>, path: function(): String}
        var bundle = new Bundle(data);
        var techs = techsCb(bundle, opts);

        /*
        builder(bundle => {
            let i18n = compileI18n();
            let js = i18n().pipe(concat()).pipe(babel());
            let css = stylus().pipe(postcss());

            return { js, css, html };
        });
         */

        let _techs = Object.keys(techs).map(name => {
            let tech = techs[name];
            return isStream(tech) ? tech :
                src({
                    decl: bundle.decl(),
                    tech: name,
                    extensions: tech.extensions,
                    levels: data.levels,
                    config: opts.config
                })
                .pipe(tech.transform);
        });

        merge.apply(null, _techs)
            .on('data', obj => cb(null, obj))
            .on('error', cb)
            .on('end', cb);
    });
Beispiel #2
0
gulp.task('combine-census-gq-race-tables', function() {
  var streams = _.map(_.keys(censusGqRaceTables), function(key, index) {
    var columnKey = censusGqRaceTables[key];
    var columnMap = _.extend(
      { GEOID: 'geoid' },
      getColumnsForGqTable(columnKey, key + '-' /* prefix */));
    // If this is the first table, then include the general census values
    if (index === 0) {
      columnMap = _.extend({}, censusColumns, columnMap);
    }

    console.log(columnMap);
    return gulp.src(['srcdata/census/gq/' + key + '/*.csv'])
      .pipe(parseCsv({ auto_parse: true }))
      .pipe(rename({ basename: key }))
      .pipe(combine())
      // We need to rename columns at this level because the column names
      // include the table name.
      .pipe(renameColumns(columnMap))
      .pipe(filterColumns(_.values(columnMap)));
  });

  var mergedStream = merge.apply(undefined, streams);

  return mergedStream
    .pipe(join({ joinColumn: 'geoid' }))
    .pipe(objectify({ indexColumn: 'geoid', unwrap: true }))
    .pipe(rename({ basename: 'gq-races', extname: '.json' }))
    .pipe(gulp.dest(DATA_DEST));
});
gulp.task('watch', false, function() {
    isWatching = true;
    gulp.watch('src/client/**/*.js',     ['lint-js']);
    gulp.watch('src/client/index.html',  ['index-html']);
    gulp.watch('src/client/**/*.less',   ['less']);
    gulp.watch('src/client/www-root/**', ['www-root']);

    // Run the browserify bundles and merge their streams
    return merge.apply(merge, _.pluck(jsBundles, 'runWatchBundle').map(function(b) {return b();}));
});