Skip to content
This repository was archived by the owner on Jul 29, 2024. It is now read-only.

Commit ef6a09d

Browse files
noamokmanjuliemr
authored andcommittedMar 16, 2015
feat(webdriver-manager): allow a custom cdn for binaries
Added a cdn value for each binary to be overrided by the cli argument `alternate_cdn`.
1 parent 5f90016 commit ef6a09d

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed
 

Diff for: ‎bin/webdriver-manager

+9-4
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,9 @@ var binaries = {
3131
isDefault: true,
3232
prefix: 'selenium-server-standalone',
3333
filename: 'selenium-server-standalone-' + versions.selenium + '.jar',
34+
cdn: 'https://selenium-release.storage.googleapis.com/',
3435
url: function() {
35-
return 'https://selenium-release.storage.googleapis.com/' +
36+
return this.cdn +
3637
shortVersion(versions.selenium) + '/' +
3738
'selenium-server-standalone-' + versions.selenium + '.jar';
3839
}
@@ -42,8 +43,9 @@ var binaries = {
4243
isDefault: true,
4344
prefix: 'chromedriver_',
4445
filename: 'chromedriver_' + versions.chromedriver + '.zip',
46+
cdn: 'https://chromedriver.storage.googleapis.com/',
4547
url: function() {
46-
var urlPrefix = 'https://chromedriver.storage.googleapis.com/' +
48+
var urlPrefix = this.cdn +
4749
versions.chromedriver + '/chromedriver_';
4850
if (os.type() == 'Darwin') {
4951
return urlPrefix + 'mac32.zip';
@@ -63,8 +65,9 @@ var binaries = {
6365
isDefault: false,
6466
prefix: 'IEDriverServer',
6567
filename: 'IEDriverServer_' + versions.iedriver + '.zip',
68+
cdn: 'https://selenium-release.storage.googleapis.com/',
6669
url: function() {
67-
var urlPrefix = 'https://selenium-release.storage.googleapis.com/' +
70+
var urlPrefix = this.cdn +
6871
shortVersion(versions.iedriver) + '/IEDriverServer';
6972
if (os.type() == 'Windows_NT') {
7073
if (os.arch() == 'x64') {
@@ -88,7 +91,8 @@ var cli = optimist.
8891
describe('seleniumPort', 'Optional port for the selenium standalone server').
8992
describe('ignore_ssl', 'Ignore SSL certificates').boolean('ignore_ssl').
9093
default('ignore_ssl', false).
91-
describe('proxy', 'Proxy to use for the install or update command');
94+
describe('proxy', 'Proxy to use for the install or update command').
95+
describe('alternate_cdn', 'Alternate CDN to the binaries');
9296

9397
for (bin in binaries) {
9498
cli.describe(bin, 'Install or update ' + binaries[bin].name).
@@ -221,6 +225,7 @@ var existingFiles = fs.readdirSync(argv.out_dir);
221225

222226
for (name in binaries) {
223227
bin = binaries[name];
228+
bin.cdn = argv.alternate_cdn || bin.cdn;
224229
var exists = fs.existsSync(path.join(argv.out_dir, bin.filename));
225230
var outOfDateExists = false;
226231
existingFiles.forEach(function(file) {

0 commit comments

Comments
 (0)