Skip to content

Commit

Permalink
🔀 Merge branch 'develop'
Browse files Browse the repository at this point in the history
* develop:
  ♻️ Change how the active PHP version is switched
  • Loading branch information
nicoverbruggen committed Feb 20, 2020
2 parents f62297e + cbf5526 commit b792f55
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 8 deletions.
8 changes: 4 additions & 4 deletions PHP Monitor.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -365,14 +365,14 @@
CODE_SIGN_IDENTITY = "-";
CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES;
CURRENT_PROJECT_VERSION = 16;
CURRENT_PROJECT_VERSION = 17;
DEVELOPMENT_TEAM = 8M54J5J787;
INFOPLIST_FILE = phpmon/Info.plist;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/../Frameworks",
);
MARKETING_VERSION = 1.6;
MARKETING_VERSION = 1.7;
PRODUCT_BUNDLE_IDENTIFIER = com.nicoverbruggen.phpmon;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 5.0;
Expand All @@ -387,14 +387,14 @@
CODE_SIGN_IDENTITY = "-";
CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES;
CURRENT_PROJECT_VERSION = 16;
CURRENT_PROJECT_VERSION = 17;
DEVELOPMENT_TEAM = 8M54J5J787;
INFOPLIST_FILE = phpmon/Info.plist;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/../Frameworks",
);
MARKETING_VERSION = 1.6;
MARKETING_VERSION = 1.7;
PRODUCT_BUNDLE_IDENTIFIER = com.nicoverbruggen.phpmon;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 5.0;
Expand Down
19 changes: 15 additions & 4 deletions phpmon/Classes/Commands/Actions.swift
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,25 @@ class Actions {

public static func switchToPhpVersion(version: String, availableVersions: [String]) {
availableVersions.forEach { (version) in
// Unlink the current version
Shell.user.run("brew unlink php@\(version)")
// Stop the services
if (version == Constants.LatestPhpVersion) {
Shell.user.run("sudo brew services stop php")
} else {
Shell.user.run("sudo brew services stop php@\(version)")
}
}
if (availableVersions.contains("7.4")) {
Shell.user.run("brew link [email protected]")
if (availableVersions.contains(Constants.LatestPhpVersion)) {
// Use the latest version as a default
Shell.user.run("brew link php@\(Constants.LatestPhpVersion) --overwrite --force")
if (version == Constants.LatestPhpVersion) {
Shell.user.run("valet use php")
// If said version was also requested, all we need to do is start the service
Shell.user.run("sudo brew services start php")
} else {
Shell.user.run("valet use php@\(version)")
// Otherwise, link the correct php version + start the correct service
Shell.user.run("brew link php@\(version) --overwrite --force")
Shell.user.run("sudo brew services start php@\(version)")
}
}
}
Expand Down

0 comments on commit b792f55

Please sign in to comment.