mirror of
https://github.com/nicoverbruggen/phpmon.git
synced 2025-08-08 04:20:07 +02:00
♻️ Refactoring, version bump for M1 support (#20)
This commit is contained in:
@ -423,7 +423,7 @@
|
|||||||
CODE_SIGN_IDENTITY = "Apple Development";
|
CODE_SIGN_IDENTITY = "Apple Development";
|
||||||
CODE_SIGN_STYLE = Automatic;
|
CODE_SIGN_STYLE = Automatic;
|
||||||
COMBINE_HIDPI_IMAGES = YES;
|
COMBINE_HIDPI_IMAGES = YES;
|
||||||
CURRENT_PROJECT_VERSION = 26;
|
CURRENT_PROJECT_VERSION = 28;
|
||||||
DEVELOPMENT_TEAM = 8M54J5J787;
|
DEVELOPMENT_TEAM = 8M54J5J787;
|
||||||
ENABLE_HARDENED_RUNTIME = YES;
|
ENABLE_HARDENED_RUNTIME = YES;
|
||||||
INFOPLIST_FILE = phpmon/Info.plist;
|
INFOPLIST_FILE = phpmon/Info.plist;
|
||||||
@ -431,7 +431,7 @@
|
|||||||
"$(inherited)",
|
"$(inherited)",
|
||||||
"@executable_path/../Frameworks",
|
"@executable_path/../Frameworks",
|
||||||
);
|
);
|
||||||
MARKETING_VERSION = 2.5;
|
MARKETING_VERSION = 2.6;
|
||||||
PRODUCT_BUNDLE_IDENTIFIER = com.nicoverbruggen.phpmon;
|
PRODUCT_BUNDLE_IDENTIFIER = com.nicoverbruggen.phpmon;
|
||||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||||
PROVISIONING_PROFILE_SPECIFIER = "";
|
PROVISIONING_PROFILE_SPECIFIER = "";
|
||||||
@ -447,7 +447,7 @@
|
|||||||
CODE_SIGN_IDENTITY = "Apple Development";
|
CODE_SIGN_IDENTITY = "Apple Development";
|
||||||
CODE_SIGN_STYLE = Automatic;
|
CODE_SIGN_STYLE = Automatic;
|
||||||
COMBINE_HIDPI_IMAGES = YES;
|
COMBINE_HIDPI_IMAGES = YES;
|
||||||
CURRENT_PROJECT_VERSION = 26;
|
CURRENT_PROJECT_VERSION = 28;
|
||||||
DEVELOPMENT_TEAM = 8M54J5J787;
|
DEVELOPMENT_TEAM = 8M54J5J787;
|
||||||
ENABLE_HARDENED_RUNTIME = YES;
|
ENABLE_HARDENED_RUNTIME = YES;
|
||||||
INFOPLIST_FILE = phpmon/Info.plist;
|
INFOPLIST_FILE = phpmon/Info.plist;
|
||||||
@ -455,7 +455,7 @@
|
|||||||
"$(inherited)",
|
"$(inherited)",
|
||||||
"@executable_path/../Frameworks",
|
"@executable_path/../Frameworks",
|
||||||
);
|
);
|
||||||
MARKETING_VERSION = 2.5;
|
MARKETING_VERSION = 2.6;
|
||||||
PRODUCT_BUNDLE_IDENTIFIER = com.nicoverbruggen.phpmon;
|
PRODUCT_BUNDLE_IDENTIFIER = com.nicoverbruggen.phpmon;
|
||||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||||
PROVISIONING_PROFILE_SPECIFIER = "";
|
PROVISIONING_PROFILE_SPECIFIER = "";
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
|
|
||||||
import Foundation
|
import Foundation
|
||||||
|
|
||||||
enum HomebrewDirectory: String {
|
enum HomebrewDir: String {
|
||||||
case opt = "/opt/homebrew/bin"
|
case opt = "/opt/homebrew/bin"
|
||||||
case usr = "/usr/local/bin"
|
case usr = "/usr/local/bin"
|
||||||
}
|
}
|
||||||
@ -16,24 +16,26 @@ enum HomebrewDirectory: String {
|
|||||||
class Paths {
|
class Paths {
|
||||||
|
|
||||||
static let shared = Paths()
|
static let shared = Paths()
|
||||||
var baseDirectory : HomebrewDirectory
|
var baseDir : HomebrewDir
|
||||||
|
|
||||||
init() {
|
init() {
|
||||||
let optBrewFound = Shell.fileExists("\(HomebrewDirectory.opt.rawValue)/brew")
|
let optBrewFound = Shell.fileExists("\(HomebrewDir.opt.rawValue)/brew")
|
||||||
let usrBrewFound = Shell.fileExists("\(HomebrewDirectory.usr.rawValue)/brew")
|
let usrBrewFound = Shell.fileExists("\(HomebrewDir.usr.rawValue)/brew")
|
||||||
|
|
||||||
if (optBrewFound) {
|
if (optBrewFound) {
|
||||||
self.baseDirectory = .opt
|
// This is usually the case with Homebrew installed on Apple Silicon
|
||||||
|
self.baseDir = .opt
|
||||||
} else if (usrBrewFound) {
|
} else if (usrBrewFound) {
|
||||||
self.baseDirectory = .usr
|
// This is usually the case with Homebrew installed on Intel (or Rosetta 2)
|
||||||
|
self.baseDir = .usr
|
||||||
} else {
|
} else {
|
||||||
// Falling back to Intel
|
// Falling back to default "legacy" Homebrew location (for Intel)
|
||||||
print("Seems like we couldn't determine the architecture.")
|
print("Seems like we couldn't determine the Homebrew directory.")
|
||||||
print("This usually means we're in trouble... (no Homebrew?)")
|
print("This usually means we're in trouble... (no Homebrew?)")
|
||||||
self.baseDirectory = .usr
|
self.baseDir = .usr
|
||||||
}
|
}
|
||||||
|
|
||||||
print("Homebrew directory: \(self.baseDirectory)")
|
print("Homebrew directory: \(self.baseDir)")
|
||||||
}
|
}
|
||||||
|
|
||||||
public static func brew() -> String {
|
public static func brew() -> String {
|
||||||
@ -45,11 +47,11 @@ class Paths {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static func binPath() -> String {
|
public static func binPath() -> String {
|
||||||
return self.shared.baseDirectory.rawValue
|
return self.shared.baseDir.rawValue
|
||||||
}
|
}
|
||||||
|
|
||||||
public static func optPath() -> String {
|
public static func optPath() -> String {
|
||||||
switch self.shared.baseDirectory {
|
switch self.shared.baseDir {
|
||||||
case .opt:
|
case .opt:
|
||||||
return "/opt/homebrew/opt"
|
return "/opt/homebrew/opt"
|
||||||
case .usr:
|
case .usr:
|
||||||
@ -58,7 +60,7 @@ class Paths {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static func etcPath() -> String {
|
public static func etcPath() -> String {
|
||||||
switch self.shared.baseDirectory {
|
switch self.shared.baseDir {
|
||||||
case .opt:
|
case .opt:
|
||||||
return "/opt/homebrew/etc"
|
return "/opt/homebrew/etc"
|
||||||
case .usr:
|
case .usr:
|
||||||
|
@ -47,9 +47,12 @@ class Shell {
|
|||||||
)!
|
)!
|
||||||
}
|
}
|
||||||
|
|
||||||
public static func fileExists(_ filePath: String) -> Bool {
|
/**
|
||||||
|
Checks if a file exists at the provided path.
|
||||||
|
*/
|
||||||
|
public static func fileExists(_ path: String) -> Bool {
|
||||||
return Shell.user.pipe(
|
return Shell.user.pipe(
|
||||||
"if [ -f \(filePath) ]; then echo \"Y\"; fi"
|
"if [ -f \(path) ]; then echo \"PHP_Y_FE\"; fi"
|
||||||
).contains("Y")
|
).contains("PHP_Y_FE")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user