refactor: move util/exec to own folder (#5125)

Also moves related docker and env files
This commit is contained in:
Rhys Arkins 2020-01-10 16:39:15 +01:00 committed by GitHub
parent 5fd6361c56
commit 1617a193c0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
26 changed files with 38 additions and 38 deletions

View file

@ -1,7 +1,7 @@
import { outputFile, readFile } from 'fs-extra'; import { outputFile, readFile } from 'fs-extra';
import { join, dirname } from 'upath'; import { join, dirname } from 'upath';
import { exec } from '../../util/exec'; import { exec } from '../../util/exec';
import { getChildProcessEnv } from '../../util/env'; import { getChildProcessEnv } from '../../util/exec/env';
import { logger } from '../../logger'; import { logger } from '../../logger';
import { getPkgReleases } from '../../datasource/docker'; import { getPkgReleases } from '../../datasource/docker';
import { import {

View file

@ -2,7 +2,7 @@ import { join } from 'upath';
import { hrtime } from 'process'; import { hrtime } from 'process';
import { outputFile, readFile } from 'fs-extra'; import { outputFile, readFile } from 'fs-extra';
import { exec } from '../../util/exec'; import { exec } from '../../util/exec';
import { getChildProcessEnv } from '../../util/env'; import { getChildProcessEnv } from '../../util/exec/env';
import { logger } from '../../logger'; import { logger } from '../../logger';
import { UpdateArtifactsConfig, UpdateArtifactsResult } from '../common'; import { UpdateArtifactsConfig, UpdateArtifactsResult } from '../common';
import { platform } from '../../platform'; import { platform } from '../../platform';

View file

@ -6,7 +6,7 @@ import { exec } from '../../util/exec';
import { UpdateArtifactsConfig, UpdateArtifactsResult } from '../common'; import { UpdateArtifactsConfig, UpdateArtifactsResult } from '../common';
import { logger } from '../../logger'; import { logger } from '../../logger';
import * as hostRules from '../../util/host-rules'; import * as hostRules from '../../util/host-rules';
import { getChildProcessEnv } from '../../util/env'; import { getChildProcessEnv } from '../../util/exec/env';
import { platform } from '../../platform'; import { platform } from '../../platform';
export async function updateArtifacts( export async function updateArtifacts(

View file

@ -2,7 +2,7 @@ import { ensureDir, outputFile, readFile } from 'fs-extra';
import { join, dirname } from 'upath'; import { join, dirname } from 'upath';
import { exec } from '../../util/exec'; import { exec } from '../../util/exec';
import { find } from '../../util/host-rules'; import { find } from '../../util/host-rules';
import { getChildProcessEnv } from '../../util/env'; import { getChildProcessEnv } from '../../util/exec/env';
import { logger } from '../../logger'; import { logger } from '../../logger';
import { UpdateArtifactsConfig, UpdateArtifactsResult } from '../common'; import { UpdateArtifactsConfig, UpdateArtifactsResult } from '../common';
import { platform } from '../../platform'; import { platform } from '../../platform';

View file

@ -8,7 +8,7 @@ import * as lerna from './lerna';
import * as yarn from './yarn'; import * as yarn from './yarn';
import * as pnpm from './pnpm'; import * as pnpm from './pnpm';
import * as hostRules from '../../../util/host-rules'; 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 { PostUpdateConfig, PackageFile, Upgrade } from '../../common';
import { platform } from '../../../platform'; import { platform } from '../../../platform';

View file

@ -1,7 +1,7 @@
import { ensureDir, outputFile, readFile } from 'fs-extra'; import { ensureDir, outputFile, readFile } from 'fs-extra';
import { join, dirname } from 'upath'; import { join, dirname } from 'upath';
import { exec } from '../../util/exec'; import { exec } from '../../util/exec';
import { getChildProcessEnv } from '../../util/env'; import { getChildProcessEnv } from '../../util/exec/env';
import { logger } from '../../logger'; import { logger } from '../../logger';
import { UpdateArtifactsResult, UpdateArtifactsConfig } from '../common'; import { UpdateArtifactsResult, UpdateArtifactsConfig } from '../common';
import { platform } from '../../platform'; import { platform } from '../../platform';

View file

@ -2,7 +2,7 @@ import { parse, join } from 'upath';
import { hrtime } from 'process'; import { hrtime } from 'process';
import { outputFile, readFile } from 'fs-extra'; import { outputFile, readFile } from 'fs-extra';
import { exec } from '../../util/exec'; import { exec } from '../../util/exec';
import { getChildProcessEnv } from '../../util/env'; import { getChildProcessEnv } from '../../util/exec/env';
import { logger } from '../../logger'; import { logger } from '../../logger';
import { UpdateArtifactsConfig, UpdateArtifactsResult } from '../common'; import { UpdateArtifactsConfig, UpdateArtifactsResult } from '../common';
import { platform } from '../../platform'; import { platform } from '../../platform';

View file

@ -1,4 +1,4 @@
import { basicEnvVars } from './basicVars'; import { basicEnvVars } from './basic-vars';
export function getChildProcessEnv( export function getChildProcessEnv(
customEnvVars: string[] = [] customEnvVars: string[] = []

View file

@ -5,7 +5,7 @@ import {
} from 'child_process'; } from 'child_process';
import { dockerCmd, DockerOptions } from './docker'; import { dockerCmd, DockerOptions } from './docker';
import { getChildProcessEnv } from './env'; import { getChildProcessEnv } from './env';
import { basicEnvVars } from './env/basicVars'; import { basicEnvVars } from './env/basic-vars';
const pExec: ( const pExec: (
cmd: string, cmd: string,

View file

@ -6,7 +6,7 @@ import { platform as _platform } from '../../../lib/platform';
import * as _datasource from '../../../lib/datasource/docker'; import * as _datasource from '../../../lib/datasource/docker';
import { mocked } from '../../util'; import { mocked } from '../../util';
import { envMock, mockExecAll } from '../../execUtil'; 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 fs: jest.Mocked<typeof _fs> = _fs as any;
const exec: jest.Mock<typeof _exec> = _exec 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('fs-extra');
jest.mock('child_process'); jest.mock('child_process');
jest.mock('../../../lib/util/env'); jest.mock('../../../lib/util/exec/env');
jest.mock('../../../lib/platform'); jest.mock('../../../lib/platform');
jest.mock('../../../lib/datasource/docker'); jest.mock('../../../lib/datasource/docker');

View file

@ -4,11 +4,11 @@ import * as cargo from '../../../lib/manager/cargo/artifacts';
import { platform as _platform } from '../../../lib/platform'; import { platform as _platform } from '../../../lib/platform';
import { mocked } from '../../util'; import { mocked } from '../../util';
import { envMock, mockExecAll } from '../../execUtil'; 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('fs-extra');
jest.mock('child_process'); 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 fs: jest.Mocked<typeof _fs> = _fs as any;
const exec: jest.Mock<typeof _exec> = _exec as any; const exec: jest.Mock<typeof _exec> = _exec as any;

View file

@ -5,11 +5,11 @@ import { platform as _platform } from '../../../lib/platform';
import { mocked } from '../../util'; import { mocked } from '../../util';
import { StatusResult } from '../../../lib/platform/git/storage'; import { StatusResult } from '../../../lib/platform/git/storage';
import { envMock, mockExecAll } from '../../execUtil'; 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('fs-extra');
jest.mock('child_process'); jest.mock('child_process');
jest.mock('../../../lib/util/env'); jest.mock('../../../lib/util/exec/env');
jest.mock('../../../lib/util/host-rules'); jest.mock('../../../lib/util/host-rules');
const hostRules = require('../../../lib/util/host-rules'); const hostRules = require('../../../lib/util/host-rules');

View file

@ -5,11 +5,11 @@ import { platform as _platform } from '../../../lib/platform';
import { mocked } from '../../util'; import { mocked } from '../../util';
import { StatusResult } from '../../../lib/platform/git/storage'; import { StatusResult } from '../../../lib/platform/git/storage';
import { envMock, mockExecAll } from '../../execUtil'; 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('fs-extra');
jest.mock('child_process'); jest.mock('child_process');
jest.mock('../../../lib/util/env'); jest.mock('../../../lib/util/exec/env');
jest.mock('../../../lib/util/host-rules'); jest.mock('../../../lib/util/host-rules');
const hostRules = require('../../../lib/util/host-rules'); const hostRules = require('../../../lib/util/host-rules');

View file

@ -5,12 +5,12 @@ import { exec as _exec } from 'child_process';
import * as manager from '../../../lib/manager/gradle'; import * as manager from '../../../lib/manager/gradle';
import { platform as _platform, Platform } from '../../../lib/platform'; import { platform as _platform, Platform } from '../../../lib/platform';
import { envMock, mockExecAll } from '../../execUtil'; import { envMock, mockExecAll } from '../../execUtil';
import * as _env from '../../../lib/util/env'; import * as _env from '../../../lib/util/exec/env';
import { mocked } from '../../util'; import { mocked } from '../../util';
jest.mock('fs-extra'); jest.mock('fs-extra');
jest.mock('child_process'); jest.mock('child_process');
jest.mock('../../../lib/util/env'); jest.mock('../../../lib/util/exec/env');
const platform: jest.Mocked<Platform> = _platform as any; const platform: jest.Mocked<Platform> = _platform as any;
const fs: jest.Mocked<typeof _fs> = _fs as any; const fs: jest.Mocked<typeof _fs> = _fs as any;

View file

@ -4,7 +4,7 @@ import { platform as _platform } from '../../../lib/platform';
import { updateArtifacts } from '../../../lib/manager/mix'; import { updateArtifacts } from '../../../lib/manager/mix';
import { mocked } from '../../util'; import { mocked } from '../../util';
import { envMock, mockExecAll } from '../../execUtil'; 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 fs: jest.Mocked<typeof _fs> = _fs as any;
const exec: jest.Mock<typeof _exec> = _exec 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('fs-extra');
jest.mock('child_process'); jest.mock('child_process');
jest.mock('../../../lib/platform'); jest.mock('../../../lib/platform');
jest.mock('../../../lib/util/env'); jest.mock('../../../lib/util/exec/env');
const config = { const config = {
localDir: '/tmp/github/some/repo', localDir: '/tmp/github/some/repo',

View file

@ -7,14 +7,14 @@ import {
pythonVersions, pythonVersions,
} from '../../../lib/manager/pip_setup/extract'; } from '../../../lib/manager/pip_setup/extract';
import { envMock, mockExecSequence } from '../../execUtil'; import { envMock, mockExecSequence } from '../../execUtil';
import * as _env from '../../../lib/util/env'; import * as _env from '../../../lib/util/exec/env';
import { mocked } from '../../util'; import { mocked } from '../../util';
const exec: jest.Mock<typeof _exec> = _exec as any; const exec: jest.Mock<typeof _exec> = _exec as any;
const env = mocked(_env); const env = mocked(_env);
jest.mock('child_process'); jest.mock('child_process');
jest.mock('../../../lib/util/env'); jest.mock('../../../lib/util/exec/env');
describe('lib/manager/pip_setup/extract', () => { describe('lib/manager/pip_setup/extract', () => {
beforeEach(() => { beforeEach(() => {

View file

@ -8,7 +8,7 @@ import {
mockExecAll, mockExecAll,
mockExecSequence, mockExecSequence,
} from '../../execUtil'; } from '../../execUtil';
import * as _env from '../../../lib/util/env'; import * as _env from '../../../lib/util/exec/env';
import { mocked } from '../../util'; import { mocked } from '../../util';
const packageFile = 'test/manager/pip_setup/_fixtures/setup.py'; 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); const env = mocked(_env);
jest.mock('child_process'); jest.mock('child_process');
jest.mock('../../../lib/util/env'); jest.mock('../../../lib/util/exec/env');
const pythonVersionCallResults = [ const pythonVersionCallResults = [
{ stdout: '', stderr: 'Python 2.7.17\\n' }, { stdout: '', stderr: 'Python 2.7.17\\n' },

View file

@ -5,11 +5,11 @@ import { platform as _platform } from '../../../lib/platform';
import { mocked } from '../../util'; import { mocked } from '../../util';
import { StatusResult } from '../../../lib/platform/git/storage'; import { StatusResult } from '../../../lib/platform/git/storage';
import { envMock, mockExecAll } from '../../execUtil'; 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('fs-extra');
jest.mock('child_process'); jest.mock('child_process');
jest.mock('../../../lib/util/env'); jest.mock('../../../lib/util/exec/env');
jest.mock('../../../lib/util/host-rules'); jest.mock('../../../lib/util/host-rules');
const fs: jest.Mocked<typeof _fs> = _fs as any; const fs: jest.Mocked<typeof _fs> = _fs as any;

View file

@ -4,11 +4,11 @@ import { updateArtifacts } from '../../../lib/manager/poetry/artifacts';
import { platform as _platform } from '../../../lib/platform'; import { platform as _platform } from '../../../lib/platform';
import { mocked } from '../../util'; import { mocked } from '../../util';
import { envMock, mockExecAll } from '../../execUtil'; 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('fs-extra');
jest.mock('child_process'); 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 fs: jest.Mocked<typeof _fs> = _fs as any;
const exec: jest.Mock<typeof _exec> = _exec as any; const exec: jest.Mock<typeof _exec> = _exec as any;

View file

@ -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', () => { describe('getChildProcess environment when trustlevel set to low', () => {
const envVars = ['HTTP_PROXY', 'HTTPS_PROXY', 'NO_PROXY', 'HOME', 'PATH']; const envVars = ['HTTP_PROXY', 'HTTPS_PROXY', 'NO_PROXY', 'HOME', 'PATH'];

View file

@ -3,10 +3,10 @@ import * as _lernaHelper from '../../../../lib/manager/npm/post-update/lerna';
import { platform as _platform } from '../../../../lib/platform'; import { platform as _platform } from '../../../../lib/platform';
import { mocked } from '../../../util'; import { mocked } from '../../../util';
import { envMock, mockExecAll } from '../../../execUtil'; 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('child_process');
jest.mock('../../../../lib/util/env'); jest.mock('../../../../lib/util/exec/env');
const exec: jest.Mock<typeof _exec> = _exec as any; const exec: jest.Mock<typeof _exec> = _exec as any;
const env = mocked(_env); const env = mocked(_env);

View file

@ -5,11 +5,11 @@ import { exec as _exec } from 'child_process';
import * as npmHelper from '../../../../lib/manager/npm/post-update/npm'; import * as npmHelper from '../../../../lib/manager/npm/post-update/npm';
import { mocked } from '../../../util'; import { mocked } from '../../../util';
import { envMock, mockExecAll } from '../../../execUtil'; 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('fs-extra');
jest.mock('child_process'); jest.mock('child_process');
jest.mock('../../../../lib/util/env'); jest.mock('../../../../lib/util/exec/env');
jest.mock('get-installed-path'); jest.mock('get-installed-path');
getInstalledPath.mockImplementation(() => null); getInstalledPath.mockImplementation(() => null);

View file

@ -4,11 +4,11 @@ import { exec as _exec } from 'child_process';
import { mocked } from '../../../util'; import { mocked } from '../../../util';
import * as _pnpmHelper from '../../../../lib/manager/npm/post-update/pnpm'; import * as _pnpmHelper from '../../../../lib/manager/npm/post-update/pnpm';
import { envMock, mockExecAll } from '../../../execUtil'; 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('fs-extra');
jest.mock('child_process'); jest.mock('child_process');
jest.mock('../../../../lib/util/env'); jest.mock('../../../../lib/util/exec/env');
jest.mock('get-installed-path'); jest.mock('get-installed-path');
getInstalledPath.mockImplementation(() => null); getInstalledPath.mockImplementation(() => null);

View file

@ -4,11 +4,11 @@ import { exec as _exec } from 'child_process';
import * as _yarnHelper from '../../../../lib/manager/npm/post-update/yarn'; import * as _yarnHelper from '../../../../lib/manager/npm/post-update/yarn';
import { mocked } from '../../../util'; import { mocked } from '../../../util';
import { ExecSnapshots, envMock, mockExecAll } from '../../../execUtil'; 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('fs-extra');
jest.mock('child_process'); jest.mock('child_process');
jest.mock('../../../../lib/util/env'); jest.mock('../../../../lib/util/exec/env');
jest.mock('get-installed-path'); jest.mock('get-installed-path');
getInstalledPath.mockImplementation(() => null); getInstalledPath.mockImplementation(() => null);