@@ -165,46 +165,8 @@ gulp.task('watch-n-test', ['test-nodejs'], function () {
165165 return gulp . watch ( [ 'src/**/*.js' , "test/**/*.js" ] , [ 'test-nodejs' ] ) ;
166166} ) ;
167167
168- var neo4jLinuxUrl = 'http://alpha.neohq.net/dist/neo4j-enterprise-3.1.0-NIGHTLY-unix.tar.gz' ;
169- var neo4jWinUrl = 'http://alpha.neohq.net/dist/neo4j-enterprise-3.1.0-NIGHTLY-windows.zip' ;
170- var neo4jHome = './build/neo4j-enterprise-3.1.0' ;
171- var isWin = / ^ w i n / . test ( process . platform ) ;
172-
173- gulp . task ( 'download-neo4j' , function ( ) {
174- if ( ! fs . existsSync ( neo4jHome ) ) {
175- // Need to download
176- if ( isWin ) {
177- return download ( neo4jWinUrl )
178- . pipe ( decompress ( { strip : 1 } ) )
179- . pipe ( gulp . dest ( neo4jHome ) ) ;
180- }
181- else {
182- return download ( neo4jLinuxUrl )
183- . pipe ( decompress ( { strip : 1 } ) )
184- . pipe ( gulp . dest ( neo4jHome ) ) ;
185- }
186- }
187- } ) ;
188-
189- gulp . task ( 'set-password' , [ 'download-neo4j' ] , function ( ) {
190- var setPassword = gulp . src ( 'test/resources/auth' )
191- . pipe ( gulp . dest ( neo4jHome + "/data/dbms/" ) ) ;
192-
193- if ( isWin )
194- {
195- var setServerName = gulp . src ( 'test/resources/neo4j-wrapper.conf' )
196- . pipe ( gulp . dest ( neo4jHome + "/conf/" ) ) ;
197-
198- return merge ( setPassword , setServerName ) ;
199- }
200- else
201- {
202- return setPassword ;
203- }
204- } ) ;
205-
206168var featureFiles = 'https://s3-eu-west-1.amazonaws.com/remoting.neotechnology.com/driver-compliance/tck.tar.gz' ;
207- var featureHome = './build/tck' ;
169+ var featureHome = './build/tck' ;
208170
209171gulp . task ( 'download-tck' , function ( ) {
210172 return download ( featureFiles )
@@ -220,21 +182,6 @@ gulp.task('run-tck', ['download-tck', 'nodejs'], function() {
220182 } ) ) ;
221183} ) ;
222184
223- var runPowershell = function ( cmd ) {
224- var spawn = childProcess . spawn , child ;
225- child = spawn ( "powershell.exe" , [ cmd ] ) ;
226- child . stdout . on ( "data" , function ( data ) {
227- console . log ( "Powershell Data: " + data ) ;
228- } ) ;
229- child . stderr . on ( "data" , function ( data ) {
230- console . error ( "Powershell Errors: " + data ) ;
231- } ) ;
232- child . on ( "exit" , function ( ) {
233- console . log ( "Powershell Script finished" ) ;
234- } ) ;
235- child . stdin . end ( ) ; //end input
236- } ;
237-
238185/** Set the project version, controls package.json and version.js */
239186gulp . task ( 'set' , function ( ) {
240187 // Get the --version arg from command line
@@ -247,28 +194,44 @@ gulp.task('set', function() {
247194
248195} ) ;
249196
250- gulp . task ( 'start-neo4j' , [ 'set-password' ] , function ( ) {
251- if ( isWin ) {
252- return runPowershell ( neo4jHome + '/bin/neo4j.bat install-service;' + neo4jHome + '/bin/neo4j.bat start' ) ;
253- }
254- else {
255- return gulp . src ( '' ) . pipe ( shell ( [
256- 'mkdir -p ' + neo4jHome + '/logs' ,
257- 'mkdir -p ' + neo4jHome + '/run' ,
258- 'mkdir -p ' + neo4jHome + '/plugins' ,
259- 'mkdir -p ' + neo4jHome + '/import' ,
260- 'chmod +x ' + neo4jHome + '/bin/neo4j' ,
261- neo4jHome + '/bin/neo4j start' ,
262- ] ) ) ;
263- }
197+
198+ var neo4jHome = path . resolve ( './build/neo4j' ) ;
199+ var neorunPath = path . resolve ( './neokit/neorun.py' ) ;
200+ var neorunStartArgsName = "--neorun.start.args" ; // use this args to provide additional args for running neorun.start
201+
202+ gulp . task ( 'start-neo4j' , function ( ) {
203+
204+ var neorunStartArgs = '-p neo4j' ; // default args to neorun.start: change the default password to neo4j
205+ process . argv . slice ( 2 ) . forEach ( function ( val ) {
206+ if ( val . startsWith ( neorunStartArgsName ) )
207+ {
208+ neorunStartArgs = val . split ( "=" ) [ 1 ] ;
209+ }
210+ } ) ;
211+
212+ neorunStartArgs = neorunStartArgs . match ( / \S + / g) || '' ;
213+
214+ return runScript ( [
215+ neorunPath , '--start=' + neo4jHome
216+ ] . concat ( neorunStartArgs ) ) ;
264217} ) ;
265218
266219gulp . task ( 'stop-neo4j' , function ( ) {
267- if ( isWin ) {
268- return runPowershell ( neo4jHome + '/bin/neo4j.bat stop;' + neo4jHome + '/bin/neo4j.bat uninstall-service' ) ;
269- } else {
270- return gulp . src ( '' ) . pipe ( shell ( [
271- neo4jHome + '/bin/neo4j stop' ,
272- ] ) ) ;
273- }
274- } ) ;
220+ return runScript ( [
221+ neorunPath , '--stop=' + neo4jHome
222+ ] ) ;
223+ } ) ;
224+
225+ var runScript = function ( cmd ) {
226+ var spawnSync = childProcess . spawnSync , child , code ;
227+ child = spawnSync ( 'python' , cmd ) ;
228+ console . log ( "Script Outputs:\n" + child . stdout . toString ( ) ) ;
229+ var error = child . stderr . toString ( ) ;
230+ if ( error . trim ( ) !== "" )
231+ console . log ( "Script Errors:\n" + error ) ;
232+ code = child . status ;
233+ if ( code !== 0 )
234+ {
235+ throw "Script finished with code " + code
236+ }
237+ } ;
0 commit comments