Skip to content

Commit e0757ab

Browse files
committed
Refactor installer to reduce pattern duplication
Signed-off-by: Jason Frey <fryguy9@gmail.com>
1 parent af0be76 commit e0757ab

11 files changed

Lines changed: 319 additions & 292 deletions

File tree

dist/index.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/index.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/install-linux.js

Lines changed: 0 additions & 84 deletions
This file was deleted.

src/install-macos.js

Lines changed: 0 additions & 64 deletions
This file was deleted.

src/install-util.js

Lines changed: 0 additions & 64 deletions
This file was deleted.

src/install-windows.js

Lines changed: 0 additions & 72 deletions
This file was deleted.

src/install.js

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,25 @@
11
import * as core from '@actions/core'
22
import * as exec from '@actions/exec'
33
import * as io from '@actions/io'
4-
import { installLinux } from './install-linux.js'
5-
import { installMacOS } from './install-macos.js'
6-
import { installWindows } from './install-windows.js'
4+
import { LinuxInstaller } from './installer/linux.js'
5+
import { MacOSInstaller } from './installer/macos.js'
6+
import { WindowsInstaller } from './installer/windows.js'
77

88
async function install() {
99
core.startGroup('Installing IBM Cloud CLI')
1010
const cliPath = await io.which("ibmcloud")
1111
if (cliPath) {
1212
core.info("IBM Cloud CLI is already installed.")
1313
} else {
14+
let installer
1415
if (process.platform == 'win32') {
15-
await installWindows()
16+
installer = new WindowsInstaller()
1617
} else if (process.platform == 'darwin') {
17-
await installMacOS()
18+
installer = new MacOSInstaller()
1819
} else {
19-
await installLinux()
20+
installer = new LinuxInstaller()
2021
}
22+
await installer.install()
2123
}
2224
core.endGroup()
2325
}

0 commit comments

Comments
 (0)