diff --git a/.travis.yml b/.travis.yml index 80a91820..1c8e9de2 100644 --- a/.travis.yml +++ b/.travis.yml @@ -34,7 +34,7 @@ before_install: install: - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then - pip install codespell; + pip install codespell==1.9.2; npm install -g bower; brew install afsctool; brew install jq; diff --git a/appveyor.yml b/appveyor.yml index 2022e76b..acbd4171 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -32,7 +32,7 @@ install: - set PATH=C:\Program Files (x86)\NSIS;%PATH% - set PATH=C:\MinGW\bin;%PATH% - set PATH=C:\MinGW\msys\1.0\bin;%PATH% - - pip install codespell + - pip install codespell==1.9.2 - make info - make electron-develop diff --git a/lib/child-writer/writer-proxy.js b/lib/child-writer/writer-proxy.js index 63fec58e..b30da743 100644 --- a/lib/child-writer/writer-proxy.js +++ b/lib/child-writer/writer-proxy.js @@ -18,6 +18,7 @@ const Bluebird = require('bluebird'); const childProcess = require('child_process'); +const commandJoin = require('command-join'); const isElevated = Bluebird.promisify(require('is-elevated')); const ipc = require('node-ipc'); const _ = require('lodash'); @@ -141,9 +142,7 @@ return isElevated().then((elevated) => { return commandPrefix.concat(process.argv); }); - const command = _.join(_.map(commandArguments, (argument) => { - return `"${argument.replace(/(")/g, '\\$1')}"`; - }), ' '); + const command = commandJoin(commandArguments); // For debugging purposes console.log(`Running: ${command}`); diff --git a/lib/gui/models/supported-formats.js b/lib/gui/models/supported-formats.js index eb92b0c6..4bdcce95 100644 --- a/lib/gui/models/supported-formats.js +++ b/lib/gui/models/supported-formats.js @@ -115,7 +115,7 @@ SupportedFormats.service('SupportedFormatsModel', function() { * } */ this.isSupportedImage = (imagePath) => { - const extension = _.replace(path.extname(imagePath), '.', '').toLowerCase(); + const extension = _.toLower(_.replace(path.extname(imagePath), '.', '')); if (_.some([ _.includes(this.getNonCompressedExtensions(), extension), diff --git a/lib/gui/modules/analytics.js b/lib/gui/modules/analytics.js index 75057217..a0072f7f 100644 --- a/lib/gui/modules/analytics.js +++ b/lib/gui/modules/analytics.js @@ -59,7 +59,7 @@ const analytics = angular.module(MODULE_NAME, [ * } */ 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 diff --git a/lib/image-stream/archive.js b/lib/image-stream/archive.js index a91038a4..6a141cc8 100644 --- a/lib/image-stream/archive.js +++ b/lib/image-stream/archive.js @@ -172,7 +172,7 @@ exports.extractImage = (archive, hooks) => { return hooks.getEntries(archive).then((entries) => { 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); }); diff --git a/npm-shrinkwrap.json b/npm-shrinkwrap.json index a95289e1..d88486de 100644 --- a/npm-shrinkwrap.json +++ b/npm-shrinkwrap.json @@ -213,6 +213,11 @@ "from": "columnify@>=1.5.1 <2.0.0", "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": { "version": "2.1.0", "from": "commander@>=2.1.0 <2.2.0", diff --git a/package.json b/package.json index 3ed71fa8..352ef9e8 100644 --- a/package.json +++ b/package.json @@ -74,6 +74,7 @@ "bluebird": "^3.0.5", "bootstrap-sass": "^3.3.5", "chalk": "^1.1.3", + "command-join": "^2.0.0", "deep-map-keys": "^1.2.0", "drivelist": "^5.0.16", "electron-is-running-in-asar": "^1.0.0", diff --git a/scripts/build/docker/Dockerfile-i686 b/scripts/build/docker/Dockerfile-i686 index adbfdd14..57e47975 100644 --- a/scripts/build/docker/Dockerfile-i686 +++ b/scripts/build/docker/Dockerfile-i686 @@ -29,4 +29,4 @@ RUN npm config set spin=false RUN npm install -g bower asar electron-installer-debian # Python -RUN pip install codespell +RUN pip install codespell==1.9.2 diff --git a/scripts/build/docker/Dockerfile-x86_64 b/scripts/build/docker/Dockerfile-x86_64 index c4ff35b3..84d285ec 100644 --- a/scripts/build/docker/Dockerfile-x86_64 +++ b/scripts/build/docker/Dockerfile-x86_64 @@ -29,4 +29,4 @@ RUN npm config set spin=false RUN npm install -g bower asar electron-installer-debian # Python -RUN pip install codespell +RUN pip install codespell==1.9.2 diff --git a/scripts/build/docker/Dockerfile.template b/scripts/build/docker/Dockerfile.template index 38d51c9d..a14e46eb 100644 --- a/scripts/build/docker/Dockerfile.template +++ b/scripts/build/docker/Dockerfile.template @@ -29,4 +29,4 @@ RUN npm config set spin=false RUN npm install -g bower asar electron-installer-debian # Python -RUN pip install codespell +RUN pip install codespell==1.9.2 diff --git a/tests/gui/components/svg-icon.spec.js b/tests/gui/components/svg-icon.spec.js index fbd706ad..2e198424 100644 --- a/tests/gui/components/svg-icon.spec.js +++ b/tests/gui/components/svg-icon.spec.js @@ -1,6 +1,7 @@ 'use strict'; const m = require('mochainon'); +const _ = require('lodash'); const fs = require('fs'); const path = require('path'); const angular = require('angular'); @@ -33,9 +34,9 @@ describe('Browser: SVGIcon', function() { it('should inline the svg contents in the element', function() { 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' - }).split(/\r?\n/); + }), /\r?\n/); // Injecting XML as HTML causes the XML header to be commented out. // Modify here to ease assertions later on. diff --git a/tests/gui/models/supported-formats.spec.js b/tests/gui/models/supported-formats.spec.js index 57e99dc5..89865643 100644 --- a/tests/gui/models/supported-formats.spec.js +++ b/tests/gui/models/supported-formats.spec.js @@ -80,7 +80,7 @@ describe('Browser: SupportedFormats', function() { it('should ignore casing when determining extension validity', function() { const nonCompressedExtension = _.first(SupportedFormatsModel.getNonCompressedExtensions()); - const imagePath = `/path/to/foo.${nonCompressedExtension.toUpperCase()}`; + const imagePath = `/path/to/foo.${_.toUpper(nonCompressedExtension)}`; const isSupported = SupportedFormatsModel.isSupportedImage(imagePath); m.chai.expect(isSupported).to.be.true; }); diff --git a/tests/shared/utils.spec.js b/tests/shared/utils.spec.js index 234dd03b..0ce52d6d 100644 --- a/tests/shared/utils.spec.js +++ b/tests/shared/utils.spec.js @@ -125,7 +125,7 @@ describe('Shared: Utils', function() { }); - describe('hideAbsolutePathsInObject()', function() { + describe('.hideAbsolutePathsInObject()', function() { it('should return undefined if given undefined', function() { m.chai.expect(utils.hideAbsolutePathsInObject(undefined)).to.be.undefined;