1
0
mirror of https://github.com/nicoverbruggen/phpmon.git synced 2025-08-07 12:00:09 +02:00

♻️ Cleanup, updated README (#20)

This commit is contained in:
2021-01-01 23:05:16 +01:00
parent 4ea11c5f59
commit 5825e8d0b0
2 changed files with 13 additions and 19 deletions

View File

@ -75,8 +75,8 @@ This app isn't very complicated after all. In the end, this just (conveniently)
PHP Monitor performs some integrity checks to ensure a good experience when using the app. You'll get a message telling you that PHP Monitor won't work correctly in the following scenarios:
- The PHP binary is not located in `/usr/local/bin/php`
- PHP is missing in `/usr/local/opt`
- The PHP binary is not located in `/usr/local/bin/php` (or `/opt/homebrew/bin/php`)
- PHP is missing in `/usr/local/opt` (or `/opt/homebrew/opt`)
- Laravel Valet is missing in `/usr/local/bin/valet`
- Brew has not been added to sudoers in `/private/etc/sudoers.d/brew`
- Valet has not been added to sudoers in `/private/etc/sudoers.d/valet`

View File

@ -9,8 +9,8 @@
import Foundation
enum HomebrewDir: String {
case opt = "/opt/homebrew/bin"
case usr = "/usr/local/bin"
case opt = "/opt/homebrew"
case usr = "/usr/local"
}
class Paths {
@ -19,8 +19,8 @@ class Paths {
var baseDir : HomebrewDir
init() {
let optBrewFound = Shell.fileExists("\(HomebrewDir.opt.rawValue)/brew")
let usrBrewFound = Shell.fileExists("\(HomebrewDir.usr.rawValue)/brew")
let optBrewFound = Shell.fileExists("\(HomebrewDir.opt.rawValue)/bin/brew")
let usrBrewFound = Shell.fileExists("\(HomebrewDir.usr.rawValue)/bin/brew")
if (optBrewFound) {
// This is usually the case with Homebrew installed on Apple Silicon
@ -38,6 +38,8 @@ class Paths {
print("Homebrew directory: \(self.baseDir)")
}
// - MARK: Binaries
public static func brew() -> String {
return "\(self.binPath())/brew"
}
@ -46,26 +48,18 @@ class Paths {
return "\(self.binPath())/php"
}
// - MARK: Paths
public static func binPath() -> String {
return self.shared.baseDir.rawValue
return "\(self.shared.baseDir.rawValue)/bin"
}
public static func optPath() -> String {
switch self.shared.baseDir {
case .opt:
return "/opt/homebrew/opt"
case .usr:
return "/usr/local/opt"
}
return "\(self.shared.baseDir.rawValue)/opt"
}
public static func etcPath() -> String {
switch self.shared.baseDir {
case .opt:
return "/opt/homebrew/etc"
case .usr:
return "/usr/local/etc"
}
return "\(self.shared.baseDir.rawValue)/etc"
}
}