1
0
mirror of https://github.com/nicoverbruggen/phpmon.git synced 2025-08-08 04:20:07 +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: 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` - The PHP binary is not located in `/usr/local/bin/php` (or `/opt/homebrew/bin/php`)
- PHP is missing in `/usr/local/opt` - PHP is missing in `/usr/local/opt` (or `/opt/homebrew/opt`)
- Laravel Valet is missing in `/usr/local/bin/valet` - Laravel Valet is missing in `/usr/local/bin/valet`
- Brew has not been added to sudoers in `/private/etc/sudoers.d/brew` - 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` - Valet has not been added to sudoers in `/private/etc/sudoers.d/valet`

View File

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