From 1617a193c0a71742e4094c591d15cfd8e29527a8 Mon Sep 17 00:00:00 2001
From: Rhys Arkins <rhys@arkins.net>
Date: Fri, 10 Jan 2020 16:39:15 +0100
Subject: [PATCH] refactor: move util/exec to own folder (#5125)

Also moves related docker and env files
---
 lib/manager/bundler/artifacts.ts                      | 2 +-
 lib/manager/cargo/artifacts.ts                        | 2 +-
 lib/manager/composer/artifacts.ts                     | 2 +-
 lib/manager/gomod/artifacts.ts                        | 2 +-
 lib/manager/npm/post-update/index.ts                  | 2 +-
 lib/manager/pipenv/artifacts.ts                       | 2 +-
 lib/manager/poetry/artifacts.ts                       | 2 +-
 lib/util/{ => exec}/docker/index.ts                   | 0
 lib/util/{env/basicVars.ts => exec/env/basic-vars.ts} | 0
 lib/util/{ => exec}/env/index.ts                      | 2 +-
 lib/util/{exec.ts => exec/index.ts}                   | 2 +-
 test/manager/bundler/artifacts.spec.ts                | 4 ++--
 test/manager/cargo/artifacts.spec.ts                  | 4 ++--
 test/manager/composer/artifacts.spec.ts               | 4 ++--
 test/manager/gomod/artifacts.spec.ts                  | 4 ++--
 test/manager/gradle/index.spec.ts                     | 4 ++--
 test/manager/mix/artifacts.spec.ts                    | 4 ++--
 test/manager/pip_setup/extract.spec.ts                | 4 ++--
 test/manager/pip_setup/index.spec.ts                  | 4 ++--
 test/manager/pipenv/artifacts.spec.ts                 | 4 ++--
 test/manager/poetry/artifacts.spec.ts                 | 4 ++--
 test/util/env.spec.ts                                 | 2 +-
 test/workers/branch/lock-files/lerna.spec.ts          | 4 ++--
 test/workers/branch/lock-files/npm.spec.ts            | 4 ++--
 test/workers/branch/lock-files/pnpm.spec.ts           | 4 ++--
 test/workers/branch/lock-files/yarn.spec.ts           | 4 ++--
 26 files changed, 38 insertions(+), 38 deletions(-)
 rename lib/util/{ => exec}/docker/index.ts (100%)
 rename lib/util/{env/basicVars.ts => exec/env/basic-vars.ts} (100%)
 rename lib/util/{ => exec}/env/index.ts (90%)
 rename lib/util/{exec.ts => exec/index.ts} (96%)

diff --git a/lib/manager/bundler/artifacts.ts b/lib/manager/bundler/artifacts.ts
index 993fda2e1f..3997a8a7cb 100644
--- a/lib/manager/bundler/artifacts.ts
+++ b/lib/manager/bundler/artifacts.ts
@@ -1,7 +1,7 @@
 import { outputFile, readFile } from 'fs-extra';
 import { join, dirname } from 'upath';
 import { exec } from '../../util/exec';
-import { getChildProcessEnv } from '../../util/env';
+import { getChildProcessEnv } from '../../util/exec/env';
 import { logger } from '../../logger';
 import { getPkgReleases } from '../../datasource/docker';
 import {
diff --git a/lib/manager/cargo/artifacts.ts b/lib/manager/cargo/artifacts.ts
index 38df465487..c617f626ea 100644
--- a/lib/manager/cargo/artifacts.ts
+++ b/lib/manager/cargo/artifacts.ts
@@ -2,7 +2,7 @@ import { join } from 'upath';
 import { hrtime } from 'process';
 import { outputFile, readFile } from 'fs-extra';
 import { exec } from '../../util/exec';
-import { getChildProcessEnv } from '../../util/env';
+import { getChildProcessEnv } from '../../util/exec/env';
 import { logger } from '../../logger';
 import { UpdateArtifactsConfig, UpdateArtifactsResult } from '../common';
 import { platform } from '../../platform';
diff --git a/lib/manager/composer/artifacts.ts b/lib/manager/composer/artifacts.ts
index 7d28900b89..a1242ab12b 100644
--- a/lib/manager/composer/artifacts.ts
+++ b/lib/manager/composer/artifacts.ts
@@ -6,7 +6,7 @@ import { exec } from '../../util/exec';
 import { UpdateArtifactsConfig, UpdateArtifactsResult } from '../common';
 import { logger } from '../../logger';
 import * as hostRules from '../../util/host-rules';
-import { getChildProcessEnv } from '../../util/env';
+import { getChildProcessEnv } from '../../util/exec/env';
 import { platform } from '../../platform';
 
 export async function updateArtifacts(
diff --git a/lib/manager/gomod/artifacts.ts b/lib/manager/gomod/artifacts.ts
index b437619d76..74b4cbdc3b 100644
--- a/lib/manager/gomod/artifacts.ts
+++ b/lib/manager/gomod/artifacts.ts
@@ -2,7 +2,7 @@ import { ensureDir, outputFile, readFile } from 'fs-extra';
 import { join, dirname } from 'upath';
 import { exec } from '../../util/exec';
 import { find } from '../../util/host-rules';
-import { getChildProcessEnv } from '../../util/env';
+import { getChildProcessEnv } from '../../util/exec/env';
 import { logger } from '../../logger';
 import { UpdateArtifactsConfig, UpdateArtifactsResult } from '../common';
 import { platform } from '../../platform';
diff --git a/lib/manager/npm/post-update/index.ts b/lib/manager/npm/post-update/index.ts
index 23c54cfe06..0a615c2e71 100644
--- a/lib/manager/npm/post-update/index.ts
+++ b/lib/manager/npm/post-update/index.ts
@@ -8,7 +8,7 @@ import * as lerna from './lerna';
 import * as yarn from './yarn';
 import * as pnpm from './pnpm';
 import * as hostRules from '../../../util/host-rules';
-import { getChildProcessEnv } from '../../../util/env';
+import { getChildProcessEnv } from '../../../util/exec/env';
 import { PostUpdateConfig, PackageFile, Upgrade } from '../../common';
 import { platform } from '../../../platform';
 
diff --git a/lib/manager/pipenv/artifacts.ts b/lib/manager/pipenv/artifacts.ts
index 4e47dcf891..7f50dd03fc 100644
--- a/lib/manager/pipenv/artifacts.ts
+++ b/lib/manager/pipenv/artifacts.ts
@@ -1,7 +1,7 @@
 import { ensureDir, outputFile, readFile } from 'fs-extra';
 import { join, dirname } from 'upath';
 import { exec } from '../../util/exec';
-import { getChildProcessEnv } from '../../util/env';
+import { getChildProcessEnv } from '../../util/exec/env';
 import { logger } from '../../logger';
 import { UpdateArtifactsResult, UpdateArtifactsConfig } from '../common';
 import { platform } from '../../platform';
diff --git a/lib/manager/poetry/artifacts.ts b/lib/manager/poetry/artifacts.ts
index 1f72bf370e..a1fa62e732 100644
--- a/lib/manager/poetry/artifacts.ts
+++ b/lib/manager/poetry/artifacts.ts
@@ -2,7 +2,7 @@ import { parse, join } from 'upath';
 import { hrtime } from 'process';
 import { outputFile, readFile } from 'fs-extra';
 import { exec } from '../../util/exec';
-import { getChildProcessEnv } from '../../util/env';
+import { getChildProcessEnv } from '../../util/exec/env';
 import { logger } from '../../logger';
 import { UpdateArtifactsConfig, UpdateArtifactsResult } from '../common';
 import { platform } from '../../platform';
diff --git a/lib/util/docker/index.ts b/lib/util/exec/docker/index.ts
similarity index 100%
rename from lib/util/docker/index.ts
rename to lib/util/exec/docker/index.ts
diff --git a/lib/util/env/basicVars.ts b/lib/util/exec/env/basic-vars.ts
similarity index 100%
rename from lib/util/env/basicVars.ts
rename to lib/util/exec/env/basic-vars.ts
diff --git a/lib/util/env/index.ts b/lib/util/exec/env/index.ts
similarity index 90%
rename from lib/util/env/index.ts
rename to lib/util/exec/env/index.ts
index ad3f79a127..ced002b711 100644
--- a/lib/util/env/index.ts
+++ b/lib/util/exec/env/index.ts
@@ -1,4 +1,4 @@
-import { basicEnvVars } from './basicVars';
+import { basicEnvVars } from './basic-vars';
 
 export function getChildProcessEnv(
   customEnvVars: string[] = []
diff --git a/lib/util/exec.ts b/lib/util/exec/index.ts
similarity index 96%
rename from lib/util/exec.ts
rename to lib/util/exec/index.ts
index 83c46238c6..3ff5caa921 100644
--- a/lib/util/exec.ts
+++ b/lib/util/exec/index.ts
@@ -5,7 +5,7 @@ import {
 } from 'child_process';
 import { dockerCmd, DockerOptions } from './docker';
 import { getChildProcessEnv } from './env';
-import { basicEnvVars } from './env/basicVars';
+import { basicEnvVars } from './env/basic-vars';
 
 const pExec: (
   cmd: string,
diff --git a/test/manager/bundler/artifacts.spec.ts b/test/manager/bundler/artifacts.spec.ts
index e837b43eee..238c86ab57 100644
--- a/test/manager/bundler/artifacts.spec.ts
+++ b/test/manager/bundler/artifacts.spec.ts
@@ -6,7 +6,7 @@ import { platform as _platform } from '../../../lib/platform';
 import * as _datasource from '../../../lib/datasource/docker';
 import { mocked } from '../../util';
 import { envMock, mockExecAll } from '../../execUtil';
-import * as _env from '../../../lib/util/env';
+import * as _env from '../../../lib/util/exec/env';
 
 const fs: jest.Mocked<typeof _fs> = _fs as any;
 const exec: jest.Mock<typeof _exec> = _exec as any;
@@ -16,7 +16,7 @@ const datasource = mocked(_datasource);
 
 jest.mock('fs-extra');
 jest.mock('child_process');
-jest.mock('../../../lib/util/env');
+jest.mock('../../../lib/util/exec/env');
 jest.mock('../../../lib/platform');
 jest.mock('../../../lib/datasource/docker');
 
diff --git a/test/manager/cargo/artifacts.spec.ts b/test/manager/cargo/artifacts.spec.ts
index 771f753910..9dfcf3360c 100644
--- a/test/manager/cargo/artifacts.spec.ts
+++ b/test/manager/cargo/artifacts.spec.ts
@@ -4,11 +4,11 @@ import * as cargo from '../../../lib/manager/cargo/artifacts';
 import { platform as _platform } from '../../../lib/platform';
 import { mocked } from '../../util';
 import { envMock, mockExecAll } from '../../execUtil';
-import * as _env from '../../../lib/util/env';
+import * as _env from '../../../lib/util/exec/env';
 
 jest.mock('fs-extra');
 jest.mock('child_process');
-jest.mock('../../../lib/util/env');
+jest.mock('../../../lib/util/exec/env');
 
 const fs: jest.Mocked<typeof _fs> = _fs as any;
 const exec: jest.Mock<typeof _exec> = _exec as any;
diff --git a/test/manager/composer/artifacts.spec.ts b/test/manager/composer/artifacts.spec.ts
index 3ca597276e..34956116bf 100644
--- a/test/manager/composer/artifacts.spec.ts
+++ b/test/manager/composer/artifacts.spec.ts
@@ -5,11 +5,11 @@ import { platform as _platform } from '../../../lib/platform';
 import { mocked } from '../../util';
 import { StatusResult } from '../../../lib/platform/git/storage';
 import { envMock, mockExecAll } from '../../execUtil';
-import * as _env from '../../../lib/util/env';
+import * as _env from '../../../lib/util/exec/env';
 
 jest.mock('fs-extra');
 jest.mock('child_process');
-jest.mock('../../../lib/util/env');
+jest.mock('../../../lib/util/exec/env');
 jest.mock('../../../lib/util/host-rules');
 
 const hostRules = require('../../../lib/util/host-rules');
diff --git a/test/manager/gomod/artifacts.spec.ts b/test/manager/gomod/artifacts.spec.ts
index 175218065d..566265e512 100644
--- a/test/manager/gomod/artifacts.spec.ts
+++ b/test/manager/gomod/artifacts.spec.ts
@@ -5,11 +5,11 @@ import { platform as _platform } from '../../../lib/platform';
 import { mocked } from '../../util';
 import { StatusResult } from '../../../lib/platform/git/storage';
 import { envMock, mockExecAll } from '../../execUtil';
-import * as _env from '../../../lib/util/env';
+import * as _env from '../../../lib/util/exec/env';
 
 jest.mock('fs-extra');
 jest.mock('child_process');
-jest.mock('../../../lib/util/env');
+jest.mock('../../../lib/util/exec/env');
 jest.mock('../../../lib/util/host-rules');
 
 const hostRules = require('../../../lib/util/host-rules');
diff --git a/test/manager/gradle/index.spec.ts b/test/manager/gradle/index.spec.ts
index 1d3c3530f0..702e1bb15f 100644
--- a/test/manager/gradle/index.spec.ts
+++ b/test/manager/gradle/index.spec.ts
@@ -5,12 +5,12 @@ import { exec as _exec } from 'child_process';
 import * as manager from '../../../lib/manager/gradle';
 import { platform as _platform, Platform } from '../../../lib/platform';
 import { envMock, mockExecAll } from '../../execUtil';
-import * as _env from '../../../lib/util/env';
+import * as _env from '../../../lib/util/exec/env';
 import { mocked } from '../../util';
 
 jest.mock('fs-extra');
 jest.mock('child_process');
-jest.mock('../../../lib/util/env');
+jest.mock('../../../lib/util/exec/env');
 
 const platform: jest.Mocked<Platform> = _platform as any;
 const fs: jest.Mocked<typeof _fs> = _fs as any;
diff --git a/test/manager/mix/artifacts.spec.ts b/test/manager/mix/artifacts.spec.ts
index 14777855de..8ee79763e8 100644
--- a/test/manager/mix/artifacts.spec.ts
+++ b/test/manager/mix/artifacts.spec.ts
@@ -4,7 +4,7 @@ import { platform as _platform } from '../../../lib/platform';
 import { updateArtifacts } from '../../../lib/manager/mix';
 import { mocked } from '../../util';
 import { envMock, mockExecAll } from '../../execUtil';
-import * as _env from '../../../lib/util/env';
+import * as _env from '../../../lib/util/exec/env';
 
 const fs: jest.Mocked<typeof _fs> = _fs as any;
 const exec: jest.Mock<typeof _exec> = _exec as any;
@@ -14,7 +14,7 @@ const env = mocked(_env);
 jest.mock('fs-extra');
 jest.mock('child_process');
 jest.mock('../../../lib/platform');
-jest.mock('../../../lib/util/env');
+jest.mock('../../../lib/util/exec/env');
 
 const config = {
   localDir: '/tmp/github/some/repo',
diff --git a/test/manager/pip_setup/extract.spec.ts b/test/manager/pip_setup/extract.spec.ts
index 6547943420..3c9ce423cb 100644
--- a/test/manager/pip_setup/extract.spec.ts
+++ b/test/manager/pip_setup/extract.spec.ts
@@ -7,14 +7,14 @@ import {
   pythonVersions,
 } from '../../../lib/manager/pip_setup/extract';
 import { envMock, mockExecSequence } from '../../execUtil';
-import * as _env from '../../../lib/util/env';
+import * as _env from '../../../lib/util/exec/env';
 import { mocked } from '../../util';
 
 const exec: jest.Mock<typeof _exec> = _exec as any;
 const env = mocked(_env);
 
 jest.mock('child_process');
-jest.mock('../../../lib/util/env');
+jest.mock('../../../lib/util/exec/env');
 
 describe('lib/manager/pip_setup/extract', () => {
   beforeEach(() => {
diff --git a/test/manager/pip_setup/index.spec.ts b/test/manager/pip_setup/index.spec.ts
index cad815bb9d..aedb081e69 100644
--- a/test/manager/pip_setup/index.spec.ts
+++ b/test/manager/pip_setup/index.spec.ts
@@ -8,7 +8,7 @@ import {
   mockExecAll,
   mockExecSequence,
 } from '../../execUtil';
-import * as _env from '../../../lib/util/env';
+import * as _env from '../../../lib/util/exec/env';
 import { mocked } from '../../util';
 
 const packageFile = 'test/manager/pip_setup/_fixtures/setup.py';
@@ -25,7 +25,7 @@ const exec: jest.Mock<typeof _exec> = _exec as any;
 const env = mocked(_env);
 
 jest.mock('child_process');
-jest.mock('../../../lib/util/env');
+jest.mock('../../../lib/util/exec/env');
 
 const pythonVersionCallResults = [
   { stdout: '', stderr: 'Python 2.7.17\\n' },
diff --git a/test/manager/pipenv/artifacts.spec.ts b/test/manager/pipenv/artifacts.spec.ts
index 29ffcc6522..44ede4824b 100644
--- a/test/manager/pipenv/artifacts.spec.ts
+++ b/test/manager/pipenv/artifacts.spec.ts
@@ -5,11 +5,11 @@ import { platform as _platform } from '../../../lib/platform';
 import { mocked } from '../../util';
 import { StatusResult } from '../../../lib/platform/git/storage';
 import { envMock, mockExecAll } from '../../execUtil';
-import * as _env from '../../../lib/util/env';
+import * as _env from '../../../lib/util/exec/env';
 
 jest.mock('fs-extra');
 jest.mock('child_process');
-jest.mock('../../../lib/util/env');
+jest.mock('../../../lib/util/exec/env');
 jest.mock('../../../lib/util/host-rules');
 
 const fs: jest.Mocked<typeof _fs> = _fs as any;
diff --git a/test/manager/poetry/artifacts.spec.ts b/test/manager/poetry/artifacts.spec.ts
index f1d9448fa8..5ad9d3a09d 100644
--- a/test/manager/poetry/artifacts.spec.ts
+++ b/test/manager/poetry/artifacts.spec.ts
@@ -4,11 +4,11 @@ import { updateArtifacts } from '../../../lib/manager/poetry/artifacts';
 import { platform as _platform } from '../../../lib/platform';
 import { mocked } from '../../util';
 import { envMock, mockExecAll } from '../../execUtil';
-import * as _env from '../../../lib/util/env';
+import * as _env from '../../../lib/util/exec/env';
 
 jest.mock('fs-extra');
 jest.mock('child_process');
-jest.mock('../../../lib/util/env');
+jest.mock('../../../lib/util/exec/env');
 
 const fs: jest.Mocked<typeof _fs> = _fs as any;
 const exec: jest.Mock<typeof _exec> = _exec as any;
diff --git a/test/util/env.spec.ts b/test/util/env.spec.ts
index d80ae19672..c8e057c96f 100644
--- a/test/util/env.spec.ts
+++ b/test/util/env.spec.ts
@@ -1,4 +1,4 @@
-import { getChildProcessEnv } from '../../lib/util/env';
+import { getChildProcessEnv } from '../../lib/util/exec/env';
 
 describe('getChildProcess environment when trustlevel set to low', () => {
   const envVars = ['HTTP_PROXY', 'HTTPS_PROXY', 'NO_PROXY', 'HOME', 'PATH'];
diff --git a/test/workers/branch/lock-files/lerna.spec.ts b/test/workers/branch/lock-files/lerna.spec.ts
index d2ae02326a..26b2b1c87c 100644
--- a/test/workers/branch/lock-files/lerna.spec.ts
+++ b/test/workers/branch/lock-files/lerna.spec.ts
@@ -3,10 +3,10 @@ import * as _lernaHelper from '../../../../lib/manager/npm/post-update/lerna';
 import { platform as _platform } from '../../../../lib/platform';
 import { mocked } from '../../../util';
 import { envMock, mockExecAll } from '../../../execUtil';
-import * as _env from '../../../../lib/util/env';
+import * as _env from '../../../../lib/util/exec/env';
 
 jest.mock('child_process');
-jest.mock('../../../../lib/util/env');
+jest.mock('../../../../lib/util/exec/env');
 
 const exec: jest.Mock<typeof _exec> = _exec as any;
 const env = mocked(_env);
diff --git a/test/workers/branch/lock-files/npm.spec.ts b/test/workers/branch/lock-files/npm.spec.ts
index 11a5d943ae..48b7cbb50c 100644
--- a/test/workers/branch/lock-files/npm.spec.ts
+++ b/test/workers/branch/lock-files/npm.spec.ts
@@ -5,11 +5,11 @@ import { exec as _exec } from 'child_process';
 import * as npmHelper from '../../../../lib/manager/npm/post-update/npm';
 import { mocked } from '../../../util';
 import { envMock, mockExecAll } from '../../../execUtil';
-import * as _env from '../../../../lib/util/env';
+import * as _env from '../../../../lib/util/exec/env';
 
 jest.mock('fs-extra');
 jest.mock('child_process');
-jest.mock('../../../../lib/util/env');
+jest.mock('../../../../lib/util/exec/env');
 jest.mock('get-installed-path');
 
 getInstalledPath.mockImplementation(() => null);
diff --git a/test/workers/branch/lock-files/pnpm.spec.ts b/test/workers/branch/lock-files/pnpm.spec.ts
index 79e3d923c2..5e8eab5ff8 100644
--- a/test/workers/branch/lock-files/pnpm.spec.ts
+++ b/test/workers/branch/lock-files/pnpm.spec.ts
@@ -4,11 +4,11 @@ import { exec as _exec } from 'child_process';
 import { mocked } from '../../../util';
 import * as _pnpmHelper from '../../../../lib/manager/npm/post-update/pnpm';
 import { envMock, mockExecAll } from '../../../execUtil';
-import * as _env from '../../../../lib/util/env';
+import * as _env from '../../../../lib/util/exec/env';
 
 jest.mock('fs-extra');
 jest.mock('child_process');
-jest.mock('../../../../lib/util/env');
+jest.mock('../../../../lib/util/exec/env');
 jest.mock('get-installed-path');
 
 getInstalledPath.mockImplementation(() => null);
diff --git a/test/workers/branch/lock-files/yarn.spec.ts b/test/workers/branch/lock-files/yarn.spec.ts
index 99bbb9ffe0..ba074452d8 100644
--- a/test/workers/branch/lock-files/yarn.spec.ts
+++ b/test/workers/branch/lock-files/yarn.spec.ts
@@ -4,11 +4,11 @@ import { exec as _exec } from 'child_process';
 import * as _yarnHelper from '../../../../lib/manager/npm/post-update/yarn';
 import { mocked } from '../../../util';
 import { ExecSnapshots, envMock, mockExecAll } from '../../../execUtil';
-import * as _env from '../../../../lib/util/env';
+import * as _env from '../../../../lib/util/exec/env';
 
 jest.mock('fs-extra');
 jest.mock('child_process');
-jest.mock('../../../../lib/util/env');
+jest.mock('../../../../lib/util/exec/env');
 jest.mock('get-installed-path');
 
 getInstalledPath.mockImplementation(() => null);
-- 
GitLab