11let gulp = require ( 'gulp' )
2- import { src as mysqlSrc } from '../src/plugin'
2+ import * as tapMysql from '../src/plugin'
33
44import * as loglevel from 'loglevel'
55const log = loglevel . getLogger ( 'gulpfile' )
@@ -24,32 +24,6 @@ function switchToBuffer(callback: any) {
2424 callback ( ) ;
2525}
2626
27- function runTapCsv ( callback : any ) {
28- log . info ( 'gulp task starting for ' + PLUGIN_NAME )
29-
30- return gulp . src ( '../testdata/*.csv' , { buffer :gulpBufferMode } )
31- . pipe ( errorHandler ( function ( err :any ) {
32- log . error ( 'Error: ' + err )
33- callback ( err )
34- } ) )
35- . on ( 'data' , function ( file :Vinyl ) {
36- log . info ( 'Starting processing on ' + file . basename )
37- } )
38- // .pipe(tapCsv({raw:true/*, info:true */}))
39- . pipe ( rename ( {
40- extname : ".ndjson" ,
41- } ) )
42- . pipe ( gulp . dest ( '../testdata/processed' ) )
43- . on ( 'data' , function ( file :Vinyl ) {
44- log . info ( 'Finished processing on ' + file . basename )
45- } )
46- . on ( 'end' , function ( ) {
47- log . info ( 'gulp task complete' )
48- callback ( )
49- } )
50-
51- }
52-
5327export function csvParseWithoutGulp ( callback : any ) {
5428
5529 const parse = require ( 'csv-parse' )
@@ -65,13 +39,30 @@ export function csvParseWithoutGulp(callback: any) {
6539
6640
6741
68- export function testAdapter ( callback : any ) {
42+ function testAdapter ( callback : any ) {
6943 log . info ( 'gulp task starting for ' + PLUGIN_NAME )
7044
7145 try {
7246
73-
74- return mysqlSrc ( '../testdata/cars.csv' , { buffer :gulpBufferMode } )
47+ // contains secure info; store in parent folder of this project, outside of repo
48+ let configObj = require ( '../../mysql-settings.json' )
49+
50+ /*
51+ let configObj =
52+ // mysql-settings.json should look like this:
53+ {
54+ "sql": "SELECT * FROM customers LIMIT 2;",
55+ "connection": {
56+ "host" : "example.org",
57+ "user" : "bob",
58+ "password" : "secret",
59+ "database" : "schemaName"
60+ }
61+ }
62+
63+ */
64+
65+ return tapMysql . src ( 'mysqlResults' , configObj )
7566 . pipe ( errorHandler ( function ( err :any ) {
7667 log . error ( 'Error: ' + err )
7768 callback ( err )
@@ -99,5 +90,5 @@ export function testAdapter(callback: any) {
9990
10091}
10192
102- exports . default = gulp . series ( runTapCsv )
103- exports . runTapCsvBuffer = gulp . series ( switchToBuffer , runTapCsv )
93+ exports . default = gulp . series ( testAdapter )
94+ exports . runTapCsvBuffer = gulp . series ( switchToBuffer , testAdapter )
0 commit comments