Skip to content

Commit

Permalink
Fetch server from LATEST file to get around caching
Browse files Browse the repository at this point in the history
Signed-off-by: Rob Stryker <[email protected]>
  • Loading branch information
robstryker committed Nov 6, 2023
1 parent d1399cf commit a3d5a21
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 4 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,4 @@ felix-cache/
test-resources/
*.tgz
.nyc_output/
LATEST
21 changes: 17 additions & 4 deletions build/package.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,12 @@ const decompress = require('decompress');

const qualifier = process.env.RSP_QUALIFIER === 'snapshots' ? 'snapshots' : 'stable';
console.log("The qualifier is " + qualifier);
const RSP_PREFIX = `http://download.jboss.org/jbosstools/adapters/${qualifier}/rsp-server`;
const RSP_SERVER_LATEST = 'LATEST';
const RSP_SERVER_LATEST_URL = `${RSP_PREFIX}/${RSP_SERVER_LATEST}`;
const RSP_SERVER_JAR_NAME = 'org.jboss.tools.rsp.distribution-latest.zip';
const RSP_SERVER_JAR_URL = `http://download.jboss.org/jbosstools/adapters/${qualifier}/rsp-server/${RSP_SERVER_JAR_NAME}`;
const RSP_SERVER_JAR_URL = `${RSP_PREFIX}/${RSP_SERVER_JAR_NAME}`;


function clean() {
return Promise.resolve()
Expand All @@ -16,7 +20,16 @@ function clean() {

Promise.resolve()
.then(clean)
.then(()=> console.log(`Downloading ${RSP_SERVER_JAR_URL}`))
.then(()=> download(RSP_SERVER_JAR_URL, './'))
.then(()=> decompress(RSP_SERVER_JAR_NAME, './server', { strip: 1 }))
.then(()=> console.log(`Downloading ${RSP_SERVER_LATEST_URL}`))
.then(()=> download(RSP_SERVER_LATEST_URL, './'))
.then(()=> fs.readFileSync(RSP_SERVER_LATEST).toString())
.then((v)=> { console.log(v); return v;})
.then((v)=> { console.log(typeof v); return v;})
.then((v)=> v.split('\n')[1])
.then((v)=> v.split('=')[1])
.then((v)=> {console.log("downloading " + v); return v;})
.then((v)=> {download(v, './'); return v;})
.then((v)=> v.split('/').reverse()[0])
.then((v)=> { console.log("decompressing " + v); return v;})
.then((v)=> decompress(v, './server', { strip: 1 }))
.catch((err)=>{ throw err; });

0 comments on commit a3d5a21

Please sign in to comment.