chore: get the CI tests working again (#1182)

* chore: get the CI tests working again
 * an updated eslint-plugin-lodash was creating extra linter errors where we
   were using built-in String methods instead of the lodash equivalents
 * an updated codespell package now installs with a different executable-name
   (no .py extension), and now supports multiple dictionaries
 * while I was at it I replaced the messy double-quoting-string logic with the
   command-join module

Changelog-type: patch

* chore: downgrade codespell to 1.9.2 because the latest version has issues running on Windows
(we'll hopefully be able to revert this commit when codespell works again properly!)
This commit is contained in:
Andrew Scheller 2017-03-15 20:32:25 +00:00 committed by Juan Cruz Viotti
parent 66c0cb6e17
commit c9702c3a6d
14 changed files with 21 additions and 15 deletions

View File

@ -34,7 +34,7 @@ before_install:
install: install:
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then
pip install codespell; pip install codespell==1.9.2;
npm install -g bower; npm install -g bower;
brew install afsctool; brew install afsctool;
brew install jq; brew install jq;

View File

@ -32,7 +32,7 @@ install:
- set PATH=C:\Program Files (x86)\NSIS;%PATH% - set PATH=C:\Program Files (x86)\NSIS;%PATH%
- set PATH=C:\MinGW\bin;%PATH% - set PATH=C:\MinGW\bin;%PATH%
- set PATH=C:\MinGW\msys\1.0\bin;%PATH% - set PATH=C:\MinGW\msys\1.0\bin;%PATH%
- pip install codespell - pip install codespell==1.9.2
- make info - make info
- make electron-develop - make electron-develop

View File

@ -18,6 +18,7 @@
const Bluebird = require('bluebird'); const Bluebird = require('bluebird');
const childProcess = require('child_process'); const childProcess = require('child_process');
const commandJoin = require('command-join');
const isElevated = Bluebird.promisify(require('is-elevated')); const isElevated = Bluebird.promisify(require('is-elevated'));
const ipc = require('node-ipc'); const ipc = require('node-ipc');
const _ = require('lodash'); const _ = require('lodash');
@ -141,9 +142,7 @@ return isElevated().then((elevated) => {
return commandPrefix.concat(process.argv); return commandPrefix.concat(process.argv);
}); });
const command = _.join(_.map(commandArguments, (argument) => { const command = commandJoin(commandArguments);
return `"${argument.replace(/(")/g, '\\$1')}"`;
}), ' ');
// For debugging purposes // For debugging purposes
console.log(`Running: ${command}`); console.log(`Running: ${command}`);

View File

@ -115,7 +115,7 @@ SupportedFormats.service('SupportedFormatsModel', function() {
* } * }
*/ */
this.isSupportedImage = (imagePath) => { this.isSupportedImage = (imagePath) => {
const extension = _.replace(path.extname(imagePath), '.', '').toLowerCase(); const extension = _.toLower(_.replace(path.extname(imagePath), '.', ''));
if (_.some([ if (_.some([
_.includes(this.getNonCompressedExtensions(), extension), _.includes(this.getNonCompressedExtensions(), extension),

View File

@ -59,7 +59,7 @@ const analytics = angular.module(MODULE_NAME, [
* } * }
*/ */
const getHostArchitecture = () => { const getHostArchitecture = () => {
return _.includes([ 'ia32', 'x64' ], process.arch) ? arch().replace('x86', 'ia32') : process.arch; return _.includes([ 'ia32', 'x64' ], process.arch) ? _.replace(arch(), 'x86', 'ia32') : process.arch;
}; };
// Mixpanel integration // Mixpanel integration

View File

@ -172,7 +172,7 @@ exports.extractImage = (archive, hooks) => {
return hooks.getEntries(archive).then((entries) => { return hooks.getEntries(archive).then((entries) => {
const imageEntries = _.filter(entries, (entry) => { const imageEntries = _.filter(entries, (entry) => {
const extension = _.replace(path.extname(entry.name), '.', '').toLowerCase(); const extension = _.toLower(_.replace(path.extname(entry.name), '.', ''));
return _.includes(IMAGE_EXTENSIONS, extension); return _.includes(IMAGE_EXTENSIONS, extension);
}); });

5
npm-shrinkwrap.json generated
View File

@ -213,6 +213,11 @@
"from": "columnify@>=1.5.1 <2.0.0", "from": "columnify@>=1.5.1 <2.0.0",
"resolved": "https://registry.npmjs.org/columnify/-/columnify-1.5.4.tgz" "resolved": "https://registry.npmjs.org/columnify/-/columnify-1.5.4.tgz"
}, },
"command-join": {
"version": "2.0.0",
"from": "command-join@latest",
"resolved": "https://registry.npmjs.org/command-join/-/command-join-2.0.0.tgz"
},
"commander": { "commander": {
"version": "2.1.0", "version": "2.1.0",
"from": "commander@>=2.1.0 <2.2.0", "from": "commander@>=2.1.0 <2.2.0",

View File

@ -74,6 +74,7 @@
"bluebird": "^3.0.5", "bluebird": "^3.0.5",
"bootstrap-sass": "^3.3.5", "bootstrap-sass": "^3.3.5",
"chalk": "^1.1.3", "chalk": "^1.1.3",
"command-join": "^2.0.0",
"deep-map-keys": "^1.2.0", "deep-map-keys": "^1.2.0",
"drivelist": "^5.0.16", "drivelist": "^5.0.16",
"electron-is-running-in-asar": "^1.0.0", "electron-is-running-in-asar": "^1.0.0",

View File

@ -29,4 +29,4 @@ RUN npm config set spin=false
RUN npm install -g bower asar electron-installer-debian RUN npm install -g bower asar electron-installer-debian
# Python # Python
RUN pip install codespell RUN pip install codespell==1.9.2

View File

@ -29,4 +29,4 @@ RUN npm config set spin=false
RUN npm install -g bower asar electron-installer-debian RUN npm install -g bower asar electron-installer-debian
# Python # Python
RUN pip install codespell RUN pip install codespell==1.9.2

View File

@ -29,4 +29,4 @@ RUN npm config set spin=false
RUN npm install -g bower asar electron-installer-debian RUN npm install -g bower asar electron-installer-debian
# Python # Python
RUN pip install codespell RUN pip install codespell==1.9.2

View File

@ -1,6 +1,7 @@
'use strict'; 'use strict';
const m = require('mochainon'); const m = require('mochainon');
const _ = require('lodash');
const fs = require('fs'); const fs = require('fs');
const path = require('path'); const path = require('path');
const angular = require('angular'); const angular = require('angular');
@ -33,9 +34,9 @@ describe('Browser: SVGIcon', function() {
it('should inline the svg contents in the element', function() { it('should inline the svg contents in the element', function() {
const icon = '../../../../../lib/gui/assets/etcher.svg'; const icon = '../../../../../lib/gui/assets/etcher.svg';
let iconContents = fs.readFileSync(path.join(__dirname, '../../../lib/gui/assets/etcher.svg'), { let iconContents = _.split(fs.readFileSync(path.join(__dirname, '../../../lib/gui/assets/etcher.svg'), {
encoding: 'utf8' encoding: 'utf8'
}).split(/\r?\n/); }), /\r?\n/);
// Injecting XML as HTML causes the XML header to be commented out. // Injecting XML as HTML causes the XML header to be commented out.
// Modify here to ease assertions later on. // Modify here to ease assertions later on.

View File

@ -80,7 +80,7 @@ describe('Browser: SupportedFormats', function() {
it('should ignore casing when determining extension validity', function() { it('should ignore casing when determining extension validity', function() {
const nonCompressedExtension = _.first(SupportedFormatsModel.getNonCompressedExtensions()); const nonCompressedExtension = _.first(SupportedFormatsModel.getNonCompressedExtensions());
const imagePath = `/path/to/foo.${nonCompressedExtension.toUpperCase()}`; const imagePath = `/path/to/foo.${_.toUpper(nonCompressedExtension)}`;
const isSupported = SupportedFormatsModel.isSupportedImage(imagePath); const isSupported = SupportedFormatsModel.isSupportedImage(imagePath);
m.chai.expect(isSupported).to.be.true; m.chai.expect(isSupported).to.be.true;
}); });

View File

@ -125,7 +125,7 @@ describe('Shared: Utils', function() {
}); });
describe('hideAbsolutePathsInObject()', function() { describe('.hideAbsolutePathsInObject()', function() {
it('should return undefined if given undefined', function() { it('should return undefined if given undefined', function() {
m.chai.expect(utils.hideAbsolutePathsInObject(undefined)).to.be.undefined; m.chai.expect(utils.hideAbsolutePathsInObject(undefined)).to.be.undefined;