@@ -4,8 +4,12 @@ const decompress = require('decompress');
44
55const qualifier = process . env . RSP_QUALIFIER === 'snapshots' ? 'snapshots' : 'stable' ;
66console . log ( "The qualifier is " + qualifier ) ;
7+ const RSP_PREFIX = `http://download.jboss.org/jbosstools/adapters/${ qualifier } /rsp-server` ;
8+ const RSP_SERVER_LATEST = 'LATEST' ;
9+ const RSP_SERVER_LATEST_URL = `${ RSP_PREFIX } /${ RSP_SERVER_LATEST } ` ;
710const RSP_SERVER_JAR_NAME = 'org.jboss.tools.rsp.distribution-latest.zip' ;
8- const RSP_SERVER_JAR_URL = `http://download.jboss.org/jbosstools/adapters/${ qualifier } /rsp-server/${ RSP_SERVER_JAR_NAME } ` ;
11+ const RSP_SERVER_JAR_URL = `${ RSP_PREFIX } /${ RSP_SERVER_JAR_NAME } ` ;
12+
913
1014function clean ( ) {
1115 return Promise . resolve ( )
@@ -16,7 +20,16 @@ function clean() {
1620
1721Promise . resolve ( )
1822 . then ( clean )
19- . then ( ( ) => console . log ( `Downloading ${ RSP_SERVER_JAR_URL } ` ) )
20- . then ( ( ) => download ( RSP_SERVER_JAR_URL , './' ) )
21- . then ( ( ) => decompress ( RSP_SERVER_JAR_NAME , './server' , { strip : 1 } ) )
23+ . then ( ( ) => console . log ( `Downloading ${ RSP_SERVER_LATEST_URL } ` ) )
24+ . then ( ( ) => download ( RSP_SERVER_LATEST_URL , './' ) )
25+ . then ( ( ) => fs . readFileSync ( RSP_SERVER_LATEST ) . toString ( ) )
26+ . then ( ( v ) => { console . log ( v ) ; return v ; } )
27+ . then ( ( v ) => { console . log ( typeof v ) ; return v ; } )
28+ . then ( ( v ) => v . split ( '\n' ) [ 1 ] )
29+ . then ( ( v ) => v . split ( '=' ) [ 1 ] )
30+ . then ( ( v ) => { console . log ( "downloading " + v ) ; return v ; } )
31+ . then ( ( v ) => { download ( v , './' ) ; return v ; } )
32+ . then ( ( v ) => v . split ( '/' ) . reverse ( ) [ 0 ] )
33+ . then ( ( v ) => { console . log ( "decompressing " + v ) ; return v ; } )
34+ . then ( ( v ) => decompress ( v , './server' , { strip : 1 } ) )
2235 . catch ( ( err ) => { throw err ; } ) ;
0 commit comments