Skip to content

Commit

Permalink
Clean up PhpInvoker after decaffeinate
Browse files Browse the repository at this point in the history
References #460
  • Loading branch information
Gert-dev committed May 19, 2019
1 parent ddee0e2 commit bc94b2d
Showing 1 changed file with 14 additions and 22 deletions.
36 changes: 14 additions & 22 deletions lib/PhpInvoker.js
Original file line number Diff line number Diff line change
@@ -1,21 +1,17 @@
/* global atom */

/*
* decaffeinate suggestions:
* DS102: Remove unnecessary code created because of implicit returns
* DS207: Consider shorter variations of null checks
* Full docs: https://github.com/decaffeinate/decaffeinate/blob/master/docs/suggestions.md
*/
let PhpInvoker;
'use strict';

const os = require('os');
const child_process = require('child_process');

module.exports =

//#*
// Invokes PHP.
//#
(PhpInvoker = class PhpInvoker {
/**
* Invokes PHP.
*/
class PhpInvoker
{
/**
* Constructor.
*
Expand Down Expand Up @@ -85,11 +81,11 @@ module.exports =

// NOTE: Uncomment this to test failures
process.stdout.on('data', data => {
return console.debug('STDOUT', data.toString());
console.debug('STDOUT', data.toString());
});

process.stderr.on('data', data => {
return console.debug('STDERR', data.toString());
console.debug('STDERR', data.toString());
});

return process;
Expand All @@ -102,9 +98,9 @@ module.exports =
*/
getDockerRunParameters(dockerImage, additionalDockerRunParameters) {
const parameters = ['run', '--rm=true'];

const object = this.getPathsToMountInDockerContainer();
for (let src in object) {

for (const src in object) {
const dest = object[src];
parameters.push('-v');
parameters.push(src + ':' + dest);
Expand Down Expand Up @@ -161,10 +157,8 @@ module.exports =

const matches = path.match(/^([A-Z]+):(.+)$/);

// Path already normalized.
if (matches !== null) {
// On Windows, paths for Docker volumes are specified as
// /c/Path/To/Item.
// On Windows, paths for Docker volumes are specified as /c/Path/To/Item.
path = `/${matches[1].toLowerCase()}${matches[2]}`;
}

Expand All @@ -183,10 +177,8 @@ module.exports =

const matches = path.match(/^\/([a-z]+)\/(.+)$/);

// Path already denormalized.
if (matches !== null) {
// On Windows, paths for Docker volumes are specified as
// /c/Path/To/Item.
// On Windows, paths for Docker volumes are specified as /c/Path/To/Item.
path = matches[1].toUpperCase() + ':\\' + matches[2];
}

Expand Down Expand Up @@ -227,4 +219,4 @@ module.exports =

return this.denormalizeVolumePath(path);
}
});
};

0 comments on commit bc94b2d

Please sign in to comment.