Skip to content

Commit 8d31fc6

Browse files
authored
Merge pull request #116 from browserstack/revert-111-LOC-1636_Alpine_binary
Revert "LOC-1636 Detect Alpine linux and download specific binary"
2 parents 7d047e6 + eeedbb4 commit 8d31fc6

File tree

4 files changed

+14
-83
lines changed

4 files changed

+14
-83
lines changed

lib/Local.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ var childProcess = require('child_process'),
55
running = require('is-running'),
66
LocalBinary = require('./LocalBinary'),
77
LocalError = require('./LocalError'),
8-
version = require('../package.json').version,
98
psTree = require('ps-tree');
109

1110
function Local(){
@@ -206,7 +205,7 @@ function Local(){
206205
};
207206

208207
this.getBinaryArgs = function(){
209-
var args = ['--daemon', this.opcode, '--log-file', this.logfile, '--source', `nodejs-${version}`];
208+
var args = ['--daemon', this.opcode, '--log-file', this.logfile];
210209
if(this.key) {
211210
args.push('--key');
212211
args.push(this.key);

lib/LocalBinary.js

Lines changed: 11 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -3,41 +3,24 @@ var https = require('https'),
33
fs = require('fs'),
44
path = require('path'),
55
os = require('os'),
6-
childProcess = require('child_process'),
76
HttpsProxyAgent = require('https-proxy-agent'),
87
LocalError = require('./LocalError');
98

109
function LocalBinary(){
1110
this.hostOS = process.platform;
1211
this.is64bits = process.arch == 'x64';
1312

14-
this.getDownloadPath = function () {
15-
if(this.hostOS.match(/darwin|mac os/i)){
16-
return 'https://bstack-local-prod.s3.amazonaws.com/BrowserStackLocal-darwin-x64';
17-
} else if(this.hostOS.match(/mswin|msys|mingw|cygwin|bccwin|wince|emc|win32/i)) {
18-
this.windows = true;
19-
return 'https://bstack-local-prod.s3.amazonaws.com/BrowserStackLocal.exe';
20-
} else {
21-
if(this.isAlpine()) {
22-
return 'https://bstack-local-prod.s3.amazonaws.com/BrowserStackLocal-alpine';
23-
} else {
24-
if(this.is64bits)
25-
return 'https://bstack-local-prod.s3.amazonaws.com/BrowserStackLocal-linux-x64';
26-
else
27-
return 'https://bstack-local-prod.s3.amazonaws.com/BrowserStackLocal-linux-ia32';
28-
}
29-
}
30-
};
31-
32-
this.httpPath = this.getDownloadPath();
33-
34-
this.isAlpine = function() {
35-
try {
36-
return childProcess.execSync('grep -w "NAME" /etc/os-release').includes('Alpine');
37-
} catch(e) {
38-
return false;
39-
}
40-
};
13+
if(this.hostOS.match(/darwin|mac os/i)){
14+
this.httpPath = 'https://s3.amazonaws.com/bstack-local-prod/BrowserStackLocal-darwin-x64';
15+
} else if(this.hostOS.match(/mswin|msys|mingw|cygwin|bccwin|wince|emc|win32/i)) {
16+
this.windows = true;
17+
this.httpPath = 'https://s3.amazonaws.com/bstack-local-prod/BrowserStackLocal.exe';
18+
} else {
19+
if(this.is64bits)
20+
this.httpPath = 'https://s3.amazonaws.com/bstack-local-prod/BrowserStackLocal-linux-x64';
21+
else
22+
this.httpPath = 'https://s3.amazonaws.com/bstack-local-prod/BrowserStackLocal-linux-ia32';
23+
}
4124

4225
this.retryBinaryDownload = function(conf, destParentDir, callback, retries, binaryPath) {
4326
var that = this;

package-lock.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

test/local.js

Lines changed: 1 addition & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ describe('Local', function () {
4242
var tempLogPath = path.join(process.cwd(), 'log2.log');
4343

4444
bsLocal_2.start({ 'key': process.env.BROWSERSTACK_ACCESS_KEY, 'logfile': tempLogPath }, function(error){
45-
expect(error.toString().trim()).to.equal('LocalError: Either another browserstack local client is running on your machine or some server is listening on port 45690');
45+
expect(error.toString().trim()).to.equal('LocalError: Either another browserstack local client is running on your machine or some server is listening on port 45691');
4646
fs.unlinkSync(tempLogPath);
4747
done();
4848
});
@@ -312,57 +312,6 @@ describe('LocalBinary', function () {
312312
});
313313
});
314314

315-
describe('Download Path', function() {
316-
var sandBox;
317-
var localBinary;
318-
319-
beforeEach(function() {
320-
sandBox = sinon.sandbox.create();
321-
localBinary = new LocalBinary();
322-
});
323-
324-
it('should return download path of darwin binary', function() {
325-
var osNames = ['darwin', 'mac os'];
326-
osNames.forEach(function(os) {
327-
sandBox.stub(localBinary, 'hostOS', os);
328-
expect(localBinary.getDownloadPath()).to.equal('https://bstack-local-prod.s3.amazonaws.com/BrowserStackLocal-darwin-x64');
329-
});
330-
});
331-
332-
it('should return download path of exe binary', function() {
333-
var osNames = ['mswin', 'msys', 'mingw', 'cygwin', 'bccwin', 'wince', 'emc', 'win32'];
334-
osNames.forEach(function(os) {
335-
sandBox.stub(localBinary, 'hostOS', os);
336-
expect(localBinary.getDownloadPath()).to.equal('https://bstack-local-prod.s3.amazonaws.com/BrowserStackLocal.exe');
337-
});
338-
});
339-
340-
it('should return download path of linux 64 arch binary', function() {
341-
sandBox.stub(localBinary, 'hostOS', 'linux');
342-
sandBox.stub(localBinary, 'is64bits', true);
343-
localBinary.isAlpine = sandBox.stub(localBinary, 'isAlpine').returns(false);
344-
expect(localBinary.getDownloadPath()).to.equal('https://bstack-local-prod.s3.amazonaws.com/BrowserStackLocal-linux-x64');
345-
});
346-
347-
it('should return download path of linux 32 arch binary', function() {
348-
sandBox.stub(localBinary, 'hostOS', 'linux');
349-
sandBox.stub(localBinary, 'is64bits', false);
350-
localBinary.isAlpine = sandBox.stub(localBinary, 'isAlpine').returns(false);
351-
expect(localBinary.getDownloadPath()).to.equal('https://bstack-local-prod.s3.amazonaws.com/BrowserStackLocal-linux-ia32');
352-
});
353-
354-
it('should return download path of alpine linux binary', function() {
355-
sandBox.stub(localBinary, 'hostOS', 'linux');
356-
localBinary.isAlpine = sandBox.stub(localBinary, 'isAlpine').returns(true);
357-
expect(localBinary.getDownloadPath()).to.equal('https://bstack-local-prod.s3.amazonaws.com/BrowserStackLocal-alpine');
358-
});
359-
360-
afterEach(function(done) {
361-
sandBox.restore();
362-
done();
363-
});
364-
});
365-
366315
describe('Download', function() {
367316
var proxy;
368317
var proxyPort;

0 commit comments

Comments
 (0)