| Total Complexity | 3 |
| Total Lines | 36 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | import PackageManager from '../client/packageManager' |
||
| 5 | |||
| 6 | |||
| 7 | export default class OS { |
||
| 8 | private static instance: OS; |
||
| 9 | |||
| 10 | operatingSystem: string |
||
| 11 | packageManager: PackageManager |
||
| 12 | serviceCtl: ServiceCtl |
||
| 13 | services: null |
||
| 14 | usrLocalDir: string |
||
| 15 | |||
| 16 | private constructor() { |
||
| 17 | switch (`${process.platform}_${process.arch}`) { |
||
| 18 | case 'darwin_arm64': |
||
| 19 | this.operatingSystem = 'darwin_arm64' |
||
| 20 | this.packageManager = Homebrew.getInstance() |
||
| 21 | this.serviceCtl = BrewServices.getInstance() |
||
| 22 | this.services = null |
||
| 23 | this.usrLocalDir = '/opt/homebrew' |
||
| 24 | break |
||
| 25 | default: // darwin x64 |
||
| 26 | this.operatingSystem = 'darwin_x64' |
||
| 27 | this.packageManager = Homebrew.getInstance() |
||
| 28 | this.serviceCtl = BrewServices.getInstance() |
||
| 29 | this.services = null |
||
| 30 | this.usrLocalDir = '/usr/local' |
||
| 31 | break |
||
| 32 | } |
||
| 33 | } |
||
| 34 | |||
| 35 | public static getInstance(): OS { |
||
| 36 | if (!OS.instance) { |
||
| 37 | OS.instance = new OS() |
||
| 38 | } |
||
| 39 | |||
| 40 | return OS.instance |
||
| 41 | } |
||
| 43 |