mirror of
https://github.com/shivammathur/setup-php.git
synced 2024-11-25 13:03:04 +07:00
Use Homebrew for PHP 7.4 on macOS
This commit is contained in:
parent
5a081357b4
commit
2f951ef5cd
@ -60,10 +60,6 @@ describe('Utils tests', () => {
|
||||
});
|
||||
|
||||
it('checking readScripts', async () => {
|
||||
const rc: string = fs.readFileSync(
|
||||
path.join(__dirname, '../src/scripts/7.4.sh'),
|
||||
'utf8'
|
||||
);
|
||||
const darwin: string = fs.readFileSync(
|
||||
path.join(__dirname, '../src/scripts/darwin.sh'),
|
||||
'utf8'
|
||||
@ -76,15 +72,12 @@ describe('Utils tests', () => {
|
||||
path.join(__dirname, '../src/scripts/win32.ps1'),
|
||||
'utf8'
|
||||
);
|
||||
expect(await utils.readScript('darwin.sh', '7.4', 'darwin')).toBe(rc);
|
||||
expect(await utils.readScript('darwin.sh', '7.4', 'darwin')).toBe(darwin);
|
||||
expect(await utils.readScript('darwin.sh', '7.3', 'darwin')).toBe(darwin);
|
||||
expect(await utils.readScript('linux.sh', '7.4', 'linux')).toBe(linux);
|
||||
expect(await utils.readScript('linux.sh', '7.3', 'linux')).toBe(linux);
|
||||
expect(await utils.readScript('win32.ps1', '7.4', 'win32')).toBe(win32);
|
||||
expect(await utils.readScript('win32.ps1', '7.3', 'win32')).toBe(win32);
|
||||
expect(await utils.readScript('fedora.sh', '7.3', 'fedora')).toContain(
|
||||
'Platform fedora is not supported'
|
||||
);
|
||||
});
|
||||
|
||||
it('checking writeScripts', async () => {
|
||||
|
14
dist/index.js
vendored
14
dist/index.js
vendored
@ -810,19 +810,7 @@ exports.addLog = addLog;
|
||||
*/
|
||||
function readScript(filename, version, os_version) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
switch (os_version) {
|
||||
case 'darwin':
|
||||
switch (version) {
|
||||
case '7.4':
|
||||
return fs.readFileSync(path.join(__dirname, '../src/scripts/7.4.sh'), 'utf8');
|
||||
}
|
||||
return fs.readFileSync(path.join(__dirname, '../src/scripts/' + filename), 'utf8');
|
||||
case 'linux':
|
||||
case 'win32':
|
||||
return fs.readFileSync(path.join(__dirname, '../src/scripts/' + filename), 'utf8');
|
||||
default:
|
||||
return yield log('Platform ' + os_version + ' is not supported', os_version, 'error');
|
||||
}
|
||||
return fs.readFileSync(path.join(__dirname, '../src/scripts/' + filename), 'utf8');
|
||||
});
|
||||
}
|
||||
exports.readScript = readScript;
|
||||
|
@ -17,12 +17,15 @@ add_log() {
|
||||
fi
|
||||
}
|
||||
|
||||
step_log "Setup PHP and Composer"
|
||||
version=$1
|
||||
export HOMEBREW_NO_INSTALL_CLEANUP=TRUE
|
||||
if [ "$1" = "5.6" ] || [ "$1" = "7.0" ]; then
|
||||
brew tap exolnet/homebrew-deprecated >/dev/null 2>&1
|
||||
fi
|
||||
step_log "Setup PHP and Composer"
|
||||
if [ "$1" = "7.4" ]; then
|
||||
brew update >/dev/null 2>&1
|
||||
fi
|
||||
brew install php@"$1" composer >/dev/null 2>&1
|
||||
brew link --force --overwrite php@"$1" >/dev/null 2>&1
|
||||
ini_file=$(php -d "date.timezone=UTC" --ini | grep "Loaded Configuration" | sed -e "s|.*:s*||" | sed "s/ //g")
|
||||
|
30
src/utils.ts
30
src/utils.ts
@ -173,32 +173,10 @@ export async function readScript(
|
||||
version: string,
|
||||
os_version: string
|
||||
): Promise<string> {
|
||||
switch (os_version) {
|
||||
case 'darwin':
|
||||
switch (version) {
|
||||
case '7.4':
|
||||
return fs.readFileSync(
|
||||
path.join(__dirname, '../src/scripts/7.4.sh'),
|
||||
'utf8'
|
||||
);
|
||||
}
|
||||
return fs.readFileSync(
|
||||
path.join(__dirname, '../src/scripts/' + filename),
|
||||
'utf8'
|
||||
);
|
||||
case 'linux':
|
||||
case 'win32':
|
||||
return fs.readFileSync(
|
||||
path.join(__dirname, '../src/scripts/' + filename),
|
||||
'utf8'
|
||||
);
|
||||
default:
|
||||
return await log(
|
||||
'Platform ' + os_version + ' is not supported',
|
||||
os_version,
|
||||
'error'
|
||||
);
|
||||
}
|
||||
return fs.readFileSync(
|
||||
path.join(__dirname, '../src/scripts/' + filename),
|
||||
'utf8'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user