Skip to content
This repository was archived by the owner on Apr 28, 2025. It is now read-only.

Commit 2b7315d

Browse files
grpn-bulk-nlmMark Owsiak
authored andcommitted
chore: Apply latest nlm generator
1 parent 25fe05b commit 2b7315d

File tree

18 files changed

+267
-196
lines changed

18 files changed

+267
-196
lines changed

.eslintrc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
{
2-
"extends": "groupon-es5"
2+
"extends": "groupon/node4"
33
}

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
/yarn.lock
2+
/package-lock.json
13
node_modules/
24
npm-debug.log
35
/tmp

.travis.yml

Lines changed: 10 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,16 @@
11
language: node_js
22
node_js:
3-
- '0.10'
4-
- '4'
5-
- '6'
3+
- 4.6.1
4+
- 6.11.5
5+
- 8.9.0
6+
deploy:
7+
- provider: script
8+
script: ./node_modules/.bin/nlm release
9+
skip_cleanup: true
10+
'on':
11+
branch: master
12+
node: 8.9.0
613
addons:
714
apt:
815
packages:
916
- oracle-java8-set-default
10-
before_install:
11-
- npm install -g npm@latest-2
12-
before_deploy:
13-
- git config --global user.email "[email protected]"
14-
- git config --global user.name "Groupon"
15-
deploy:
16-
provider: script
17-
script: ./node_modules/.bin/nlm release
18-
skip_cleanup: true
19-
'on':
20-
branch: master
21-
node: '6'

CONTRIBUTING.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<!-- Generated by generator-nlm -->
1+
<!-- Generated by generator-js -->
22

33
# Contributing
44

@@ -31,7 +31,7 @@ If you report a bug, please follow these guidelines:
3131

3232
For small documentation changes, you can use [Github's editing feature](https://help.github.com/articles/editing-files-in-another-user-s-repository/).
3333
The only thing to keep in mind is to prefix the commit message with "docs: ".
34-
The detault commit message generated by Github will lead to a failing CI build.
34+
The default commit message generated by Github will lead to a failing CI build.
3535

3636
For larger updates to the documentation
3737
it might be better to follow the [instructions for contributing code below](#contributing-code).
@@ -52,7 +52,7 @@ The general steps for creating a pull request are:
5252
1. If you're fixing a bug, be sure to write a test *first*.
5353
That way you can validate that the test actually catches the bug and doesn't pass.
5454
1. Make your changes to the code.
55-
Remember to update the tests if you add new features or change behavior.
55+
Remember to update the tests if you add new features or change behavior.
5656
1. Run the tests via `npm test`. This will also run style checks and other validations.
5757
You might see errors about uncommitted files.
5858
This is expected until you commit your changes.

lib/checksum.js

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -29,24 +29,26 @@
2929
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
3030
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
3131
*/
32+
3233
'use strict';
33-
var fs = require('fs');
34-
var createHash = require('crypto').createHash;
34+
35+
const fs = require('fs');
36+
const createHash = require('crypto').createHash;
3537

3638
function verifyChecksum(filePath, checksum, callback) {
37-
var hash = createHash('md5');
38-
var stream = fs.createReadStream(filePath);
39+
const hash = createHash('md5');
40+
const stream = fs.createReadStream(filePath);
3941
stream.on('data', function updateHash(data) {
4042
return hash.update(data);
4143
});
4244

4345
function digestAndVerify() {
44-
var digest = hash.digest('base64');
46+
const digest = hash.digest('base64');
4547
if (digest === checksum) return callback();
4648

47-
var message =
48-
'File ' + filePath + ' did not match checksum: ' +
49-
'expected ' + checksum + ' but saw ' + digest;
49+
const message =
50+
`File ${filePath} did not match checksum: ` +
51+
`expected ${checksum} but saw ${digest}`;
5052
return callback(new Error(message));
5153
}
5254

lib/chromedriver/download.js

Lines changed: 30 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -29,32 +29,33 @@
2929
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
3030
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
3131
*/
32+
3233
'use strict';
33-
var fs = require('fs');
3434

35-
var async = require('async');
36-
var debug = require('debug')('selenium-download:chromedriver:download');
37-
var fsExtra = require('fs.extra');
38-
var AdmZip = require('adm-zip');
39-
var _ = require('lodash');
35+
const fs = require('fs');
36+
37+
const async = require('async');
38+
const debug = require('debug')('selenium-download:chromedriver:download');
39+
const fsExtra = require('fs.extra');
40+
const AdmZip = require('adm-zip');
41+
const _ = require('lodash');
4042

41-
var downloadFile = require('../download');
42-
var validate = require('../checksum');
43+
const downloadFile = require('../download');
44+
const validate = require('../checksum');
4345

44-
var copy = fsExtra.copy;
45-
var move = fsExtra.move;
46+
const copy = fsExtra.copy;
47+
const move = fsExtra.move;
4648

47-
var extension = process.platform === 'win32' ? '.exe' : '';
49+
const extension = process.platform === 'win32' ? '.exe' : '';
4850

4951
function unzip(tempPath, filePath, callback) {
50-
var tempFilePath = filePath + '.tmp';
52+
const tempFilePath = `${filePath}.tmp`;
5153

5254
function onMoved(error) {
53-
var zip;
5455
if (error != null) {
5556
return callback(error);
5657
}
57-
zip = new AdmZip(tempFilePath);
58+
const zip = new AdmZip(tempFilePath);
5859
zip.extractAllTo(tempPath);
5960
fs.unlinkSync(tempFilePath);
6061
return callback();
@@ -64,7 +65,7 @@ function unzip(tempPath, filePath, callback) {
6465
}
6566

6667
function isValidExecutable(filename) {
67-
var stat;
68+
let stat;
6869
try {
6970
stat = fs.statSync(filename);
7071
} catch (err) {
@@ -91,13 +92,13 @@ function copyReplace(source, dest, callback) {
9192
}
9293

9394
function downloadChromeDriver(binPath, tempPath, version, url, callback) {
94-
var chromedriverPath = binPath + '/chromedriver';
95+
const chromedriverPath = `${binPath}/chromedriver`;
9596
if (isValidExecutable(chromedriverPath)) {
9697
debug('already downloaded', chromedriverPath);
9798
return callback();
9899
}
99-
var tempFileName = 'chromedriver_' + version;
100-
var tempFilePath = tempPath + '/' + tempFileName;
100+
const tempFileName = `chromedriver_${version}`;
101+
const tempFilePath = `${tempPath}/${tempFileName}`;
101102

102103
function makeExecutable(error) {
103104
if (error != null) {
@@ -115,13 +116,16 @@ function downloadChromeDriver(binPath, tempPath, version, url, callback) {
115116
debug('tmp file', tempFilePath);
116117
debug('target file', chromedriverPath);
117118

118-
var unzippedFilePath = tempPath + '/chromedriver' + extension;
119-
return async.waterfall([
120-
_.partial(downloadFile, url, tempPath, tempFileName),
121-
_.partial(validate, tempFilePath),
122-
_.partial(unzip, tempPath, tempFilePath),
123-
_.partial(move, unzippedFilePath, tempFilePath),
124-
_.partial(copyReplace, tempFilePath, chromedriverPath)
125-
], makeExecutable);
119+
const unzippedFilePath = `${tempPath}/chromedriver${extension}`;
120+
return async.waterfall(
121+
[
122+
_.partial(downloadFile, url, tempPath, tempFileName),
123+
_.partial(validate, tempFilePath),
124+
_.partial(unzip, tempPath, tempFilePath),
125+
_.partial(move, unzippedFilePath, tempFilePath),
126+
_.partial(copyReplace, tempFilePath, chromedriverPath),
127+
],
128+
makeExecutable
129+
);
126130
}
127131
module.exports = downloadChromeDriver;

lib/chromedriver/index.js

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,11 @@
2929
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
3030
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
3131
*/
32+
3233
'use strict';
33-
var download = require('./download');
34-
var getLatestVersion = require('./version');
34+
35+
const download = require('./download');
36+
const getLatestVersion = require('./version');
3537

3638
function downloadChromeDriver(binPath, tempPath) {
3739
return function withCallback(callback) {
@@ -40,8 +42,17 @@ function downloadChromeDriver(binPath, tempPath) {
4042
return callback(error);
4143
}
4244
/* eslint no-console: 0 */
43-
console.log('[testium] grabbing selenium chromedriver %s', metadata.version);
44-
return download(binPath, tempPath, metadata.version, metadata.downloadUrl, callback);
45+
console.log(
46+
'[testium] grabbing selenium chromedriver %s',
47+
metadata.version
48+
);
49+
return download(
50+
binPath,
51+
tempPath,
52+
metadata.version,
53+
metadata.downloadUrl,
54+
callback
55+
);
4556
});
4657
};
4758
}

lib/chromedriver/version.js

Lines changed: 22 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -29,19 +29,22 @@
2929
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
3030
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
3131
*/
32+
3233
'use strict';
33-
var FALLBACK_CHROMEDRIVER_VERSION = '2.23';
3434

35-
var request = require('request');
35+
const FALLBACK_CHROMEDRIVER_VERSION = '2.23';
36+
37+
const request = require('request');
3638

3739
function getArchitecture() {
38-
var platform = process.platform;
40+
let platform = process.platform;
3941
if (platform !== 'linux' && platform !== 'darwin' && platform !== 'win32') {
4042
throw new Error(
41-
'Unsupported platform ' + platform + '. ' +
42-
'Only linux, darwin, and win32 are supported.');
43+
`Unsupported platform ${platform}. ` +
44+
`Only linux, darwin, and win32 are supported.`
45+
);
4346
}
44-
var bitness = process.arch.substr(1);
47+
let bitness = process.arch.substr(1);
4548
if (platform === 'darwin') {
4649
platform = 'mac';
4750
bitness = '64';
@@ -52,7 +55,7 @@ function getArchitecture() {
5255
}
5356
return {
5457
platform: platform,
55-
bitness: bitness
58+
bitness: bitness,
5659
};
5760
}
5861

@@ -63,7 +66,10 @@ function getLatestVersion(callback) {
6366
}
6467
return callback(null, body);
6568
}
66-
return request('https://chromedriver.storage.googleapis.com/LATEST_RELEASE', onBody);
69+
return request(
70+
'https://chromedriver.storage.googleapis.com/LATEST_RELEASE',
71+
onBody
72+
);
6773
}
6874

6975
function getLatestDownloadInfo(callback) {
@@ -72,21 +78,21 @@ function getLatestDownloadInfo(callback) {
7278
version = FALLBACK_CHROMEDRIVER_VERSION;
7379
/* eslint no-console: 0 */
7480
console.log(
75-
'[testium] Unable to determine latest version of selenium chromedriver; using %s', version);
81+
'[testium] Unable to determine latest version of selenium chromedriver; using %s',
82+
version
83+
);
7684
console.error(error.stack || error);
7785
} else {
7886
version = version.trim();
7987
}
80-
var arch = getArchitecture();
81-
var platform = arch.platform;
82-
var bitness = arch.bitness;
83-
var downloadUrl =
84-
'https://chromedriver.storage.googleapis.com/' + version +
85-
'/chromedriver_' + platform + bitness + '.zip';
88+
const arch = getArchitecture();
89+
const platform = arch.platform;
90+
const bitness = arch.bitness;
91+
const downloadUrl = `https://chromedriver.storage.googleapis.com/${version}/chromedriver_${platform}${bitness}.zip`;
8692

8793
return callback(null, {
8894
downloadUrl: downloadUrl,
89-
version: version
95+
version: version,
9096
});
9197
}
9298

lib/download.js

Lines changed: 21 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -29,39 +29,47 @@
2929
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
3030
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
3131
*/
32+
3233
'use strict';
33-
var fs = require('fs');
34-
var path = require('path');
3534

36-
var _ = require('lodash');
37-
var request = require('request');
35+
const fs = require('fs');
36+
const path = require('path');
37+
38+
const _ = require('lodash');
39+
const request = require('request');
3840

3941
function parseHashes(rawHash) {
4042
function parse(result, hash) {
41-
var parts = hash.trim().split('=');
42-
var key = parts[0];
43-
var value = parts.splice(1).join('=');
43+
const parts = hash.trim().split('=');
44+
const key = parts[0];
45+
const value = parts.splice(1).join('=');
4446
result[key] = value;
4547
return result;
4648
}
47-
var hashes = rawHash.split(',');
49+
const hashes = rawHash.split(',');
4850
return hashes.reduce(parse, {});
4951
}
5052

5153
function downloadWithMD5(url, destinationDir, fileName, callback) {
5254
function onResponse(err, response, body) {
5355
if (err) return callback(err);
5456
if (response.statusCode !== 200) {
55-
return callback(new Error(response.statusCode + ' - failed to download ' + url));
57+
return callback(
58+
new Error(`${response.statusCode} - failed to download ${url}`)
59+
);
5660
}
5761

58-
var rawHash = response.headers['x-goog-hash'];
62+
const rawHash = response.headers['x-goog-hash'];
5963
if (!rawHash) {
60-
return callback(new Error('Response did not contain a checksum: ' + url));
64+
return callback(new Error(`Response did not contain a checksum: ${url}`));
6165
}
6266

63-
var absoluteFile = path.join(destinationDir, fileName);
64-
return fs.writeFile(absoluteFile, body, _.partial(callback, _, parseHashes(rawHash).md5));
67+
const absoluteFile = path.join(destinationDir, fileName);
68+
return fs.writeFile(
69+
absoluteFile,
70+
body,
71+
_.partial(callback, _, parseHashes(rawHash).md5)
72+
);
6573
}
6674

6775
request(url, { gzip: true, encoding: null }, onResponse);

0 commit comments

Comments
 (0)