Skip to content

Commit a3d5a21

Browse files
committed
Fetch server from LATEST file to get around caching
Signed-off-by: Rob Stryker <rob@oxbeef.net>
1 parent d1399cf commit a3d5a21

2 files changed

Lines changed: 18 additions & 4 deletions

File tree

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,4 @@ felix-cache/
99
test-resources/
1010
*.tgz
1111
.nyc_output/
12+
LATEST

build/package.js

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,12 @@ const decompress = require('decompress');
44

55
const qualifier = process.env.RSP_QUALIFIER === 'snapshots' ? 'snapshots' : 'stable';
66
console.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}`;
710
const 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

1014
function clean() {
1115
return Promise.resolve()
@@ -16,7 +20,16 @@ function clean() {
1620

1721
Promise.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

Comments
 (0)