mirror of
https://github.com/shivammathur/setup-php.git
synced 2024-11-22 20:01:06 +07:00
Rename resolveVersion to readPHPversion
This commit is contained in:
parent
6bf279d08a
commit
035ef490b9
@ -10,7 +10,7 @@ jest.mock('../src/install', () => ({
|
|||||||
.mockImplementation(async (os: string): Promise<string> => {
|
.mockImplementation(async (os: string): Promise<string> => {
|
||||||
const filename = os + (await utils.scriptExtension(os));
|
const filename = os + (await utils.scriptExtension(os));
|
||||||
const version: string = await utils.parseVersion(
|
const version: string = await utils.parseVersion(
|
||||||
await utils.resolveVersion()
|
await utils.readPHPVersion()
|
||||||
);
|
);
|
||||||
const ini_file: string = await utils.parseIniFile(
|
const ini_file: string = await utils.parseIniFile(
|
||||||
await utils.getInput('ini-file', false)
|
await utils.getInput('ini-file', false)
|
||||||
|
@ -263,11 +263,11 @@ describe('Utils tests', () => {
|
|||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('checking resolveVersion', async () => {
|
it('checking readPHPVersion', async () => {
|
||||||
expect(await utils.resolveVersion()).toBe('latest');
|
expect(await utils.readPHPVersion()).toBe('latest');
|
||||||
|
|
||||||
process.env['php-version-file'] = '.phpenv-version';
|
process.env['php-version-file'] = '.phpenv-version';
|
||||||
await expect(utils.resolveVersion()).rejects.toThrow(
|
await expect(utils.readPHPVersion()).rejects.toThrow(
|
||||||
"Could not find '.phpenv-version' file."
|
"Could not find '.phpenv-version' file."
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -277,10 +277,10 @@ describe('Utils tests', () => {
|
|||||||
existsSync.mockReturnValue(true);
|
existsSync.mockReturnValue(true);
|
||||||
readFileSync.mockReturnValue('8.1');
|
readFileSync.mockReturnValue('8.1');
|
||||||
|
|
||||||
expect(await utils.resolveVersion()).toBe('8.1');
|
expect(await utils.readPHPVersion()).toBe('8.1');
|
||||||
|
|
||||||
process.env['php-version'] = '8.2';
|
process.env['php-version'] = '8.2';
|
||||||
expect(await utils.resolveVersion()).toBe('8.2');
|
expect(await utils.readPHPVersion()).toBe('8.2');
|
||||||
|
|
||||||
existsSync.mockClear();
|
existsSync.mockClear();
|
||||||
readFileSync.mockClear();
|
readFileSync.mockClear();
|
||||||
|
8
dist/index.js
vendored
8
dist/index.js
vendored
@ -557,7 +557,7 @@ async function getScript(os) {
|
|||||||
const ini_values_csv = await utils.getInput('ini-values', false);
|
const ini_values_csv = await utils.getInput('ini-values', false);
|
||||||
const coverage_driver = await utils.getInput('coverage', false);
|
const coverage_driver = await utils.getInput('coverage', false);
|
||||||
const tools_csv = await utils.getInput('tools', false);
|
const tools_csv = await utils.getInput('tools', false);
|
||||||
const version = await utils.parseVersion(await utils.resolveVersion());
|
const version = await utils.parseVersion(await utils.readPHPVersion());
|
||||||
const ini_file = await utils.parseIniFile(await utils.getInput('ini-file', false));
|
const ini_file = await utils.parseIniFile(await utils.getInput('ini-file', false));
|
||||||
let script = await utils.joins('.', script_path, version, ini_file);
|
let script = await utils.joins('.', script_path, version, ini_file);
|
||||||
if (extension_csv) {
|
if (extension_csv) {
|
||||||
@ -1036,7 +1036,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|||||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||||
};
|
};
|
||||||
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||||||
exports.setVariable = exports.resolveVersion = exports.parseExtensionSource = exports.customPackage = exports.scriptTool = exports.scriptExtension = exports.joins = exports.getCommand = exports.getUnsupportedLog = exports.suppressOutput = exports.getExtensionPrefix = exports.CSVArray = exports.extensionArray = exports.addLog = exports.stepLog = exports.log = exports.color = exports.asyncForEach = exports.parseIniFile = exports.parseVersion = exports.getManifestURL = exports.getInput = exports.readEnv = void 0;
|
exports.setVariable = exports.readPHPVersion = exports.parseExtensionSource = exports.customPackage = exports.scriptTool = exports.scriptExtension = exports.joins = exports.getCommand = exports.getUnsupportedLog = exports.suppressOutput = exports.getExtensionPrefix = exports.CSVArray = exports.extensionArray = exports.addLog = exports.stepLog = exports.log = exports.color = exports.asyncForEach = exports.parseIniFile = exports.parseVersion = exports.getManifestURL = exports.getInput = exports.readEnv = void 0;
|
||||||
const fs_1 = __importDefault(__nccwpck_require__(7147));
|
const fs_1 = __importDefault(__nccwpck_require__(7147));
|
||||||
const path = __importStar(__nccwpck_require__(1017));
|
const path = __importStar(__nccwpck_require__(1017));
|
||||||
const core = __importStar(__nccwpck_require__(2186));
|
const core = __importStar(__nccwpck_require__(2186));
|
||||||
@ -1282,7 +1282,7 @@ async function parseExtensionSource(extension, prefix) {
|
|||||||
return await joins('\nadd_extension_from_source', ...matches.splice(1, matches.length), prefix);
|
return await joins('\nadd_extension_from_source', ...matches.splice(1, matches.length), prefix);
|
||||||
}
|
}
|
||||||
exports.parseExtensionSource = parseExtensionSource;
|
exports.parseExtensionSource = parseExtensionSource;
|
||||||
async function resolveVersion() {
|
async function readPHPVersion() {
|
||||||
const version = await getInput('php-version', false);
|
const version = await getInput('php-version', false);
|
||||||
if (version) {
|
if (version) {
|
||||||
return version;
|
return version;
|
||||||
@ -1296,7 +1296,7 @@ async function resolveVersion() {
|
|||||||
}
|
}
|
||||||
return 'latest';
|
return 'latest';
|
||||||
}
|
}
|
||||||
exports.resolveVersion = resolveVersion;
|
exports.readPHPVersion = readPHPVersion;
|
||||||
async function setVariable(variable, command, os) {
|
async function setVariable(variable, command, os) {
|
||||||
switch (os) {
|
switch (os) {
|
||||||
case 'win32':
|
case 'win32':
|
||||||
|
@ -24,7 +24,7 @@ export async function getScript(os: string): Promise<string> {
|
|||||||
const coverage_driver: string = await utils.getInput('coverage', false);
|
const coverage_driver: string = await utils.getInput('coverage', false);
|
||||||
const tools_csv: string = await utils.getInput('tools', false);
|
const tools_csv: string = await utils.getInput('tools', false);
|
||||||
const version: string = await utils.parseVersion(
|
const version: string = await utils.parseVersion(
|
||||||
await utils.resolveVersion()
|
await utils.readPHPVersion()
|
||||||
);
|
);
|
||||||
const ini_file: string = await utils.parseIniFile(
|
const ini_file: string = await utils.parseIniFile(
|
||||||
await utils.getInput('ini-file', false)
|
await utils.getInput('ini-file', false)
|
||||||
|
@ -425,9 +425,9 @@ export async function parseExtensionSource(
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Resolve php version from input or file
|
* Read php version from input or file
|
||||||
*/
|
*/
|
||||||
export async function resolveVersion(): Promise<string> {
|
export async function readPHPVersion(): Promise<string> {
|
||||||
const version = await getInput('php-version', false);
|
const version = await getInput('php-version', false);
|
||||||
if (version) {
|
if (version) {
|
||||||
return version;
|
return version;
|
||||||
|
Loading…
Reference in New Issue
Block a user