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

Commit

Permalink
feat(webdriver-manager): allow a custom cdn for binaries
Browse files Browse the repository at this point in the history
Added a cdn value for each binary to be overrided by the cli argument
`alternate_cdn`.
  • Loading branch information
noamokman authored and juliemr committed Mar 16, 2015
1 parent 5f90016 commit ef6a09d
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions bin/webdriver-manager
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,9 @@ var binaries = {
isDefault: true,
prefix: 'selenium-server-standalone',
filename: 'selenium-server-standalone-' + versions.selenium + '.jar',
cdn: 'https://selenium-release.storage.googleapis.com/',
url: function() {
return 'https://selenium-release.storage.googleapis.com/' +
return this.cdn +
shortVersion(versions.selenium) + '/' +
'selenium-server-standalone-' + versions.selenium + '.jar';
}
Expand All @@ -42,8 +43,9 @@ var binaries = {
isDefault: true,
prefix: 'chromedriver_',
filename: 'chromedriver_' + versions.chromedriver + '.zip',
cdn: 'https://chromedriver.storage.googleapis.com/',
url: function() {
var urlPrefix = 'https://chromedriver.storage.googleapis.com/' +
var urlPrefix = this.cdn +
versions.chromedriver + '/chromedriver_';
if (os.type() == 'Darwin') {
return urlPrefix + 'mac32.zip';
Expand All @@ -63,8 +65,9 @@ var binaries = {
isDefault: false,
prefix: 'IEDriverServer',
filename: 'IEDriverServer_' + versions.iedriver + '.zip',
cdn: 'https://selenium-release.storage.googleapis.com/',
url: function() {
var urlPrefix = 'https://selenium-release.storage.googleapis.com/' +
var urlPrefix = this.cdn +
shortVersion(versions.iedriver) + '/IEDriverServer';
if (os.type() == 'Windows_NT') {
if (os.arch() == 'x64') {
Expand All @@ -88,7 +91,8 @@ var cli = optimist.
describe('seleniumPort', 'Optional port for the selenium standalone server').
describe('ignore_ssl', 'Ignore SSL certificates').boolean('ignore_ssl').
default('ignore_ssl', false).
describe('proxy', 'Proxy to use for the install or update command');
describe('proxy', 'Proxy to use for the install or update command').
describe('alternate_cdn', 'Alternate CDN to the binaries');

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

for (name in binaries) {
bin = binaries[name];
bin.cdn = argv.alternate_cdn || bin.cdn;
var exists = fs.existsSync(path.join(argv.out_dir, bin.filename));
var outOfDateExists = false;
existingFiles.forEach(function(file) {
Expand Down

0 comments on commit ef6a09d

Please sign in to comment.