Skip to content

Commit 1bfcdd5

Browse files
🐛 Fixes #3: Bad Gateway caused by valet use
Note: The terminal output work-in-progress is currently disabled in this particular commit.
1 parent 78702ae commit 1bfcdd5

File tree

5 files changed

+39
-3
lines changed

5 files changed

+39
-3
lines changed

phpmon.xcodeproj/project.pbxproj

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
C41C1B4D22B0215A00E7CF16 /* Services.swift in Sources */ = {isa = PBXBuildFile; fileRef = C41C1B4C22B0215A00E7CF16 /* Services.swift */; };
1818
C476FF9822B0DD830098105B /* Alert.swift in Sources */ = {isa = PBXBuildFile; fileRef = C476FF9722B0DD830098105B /* Alert.swift */; };
1919
C4D8016622B1584700C6DA1B /* BootChecks.swift in Sources */ = {isa = PBXBuildFile; fileRef = C4D8016522B1584700C6DA1B /* BootChecks.swift */; };
20+
C4EE188422D3386B00E126E5 /* Constants.swift in Sources */ = {isa = PBXBuildFile; fileRef = C4EE188322D3386B00E126E5 /* Constants.swift */; };
2021
/* End PBXBuildFile section */
2122

2223
/* Begin PBXFileReference section */
@@ -33,6 +34,7 @@
3334
C41C1B4C22B0215A00E7CF16 /* Services.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Services.swift; sourceTree = "<group>"; };
3435
C476FF9722B0DD830098105B /* Alert.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Alert.swift; sourceTree = "<group>"; };
3536
C4D8016522B1584700C6DA1B /* BootChecks.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BootChecks.swift; sourceTree = "<group>"; };
37+
C4EE188322D3386B00E126E5 /* Constants.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Constants.swift; sourceTree = "<group>"; };
3638
/* End PBXFileReference section */
3739

3840
/* Begin PBXFrameworksBuildPhase section */
@@ -65,6 +67,7 @@
6567
C41C1B3522B0097F00E7CF16 /* phpmon */ = {
6668
isa = PBXGroup;
6769
children = (
70+
C4EE188322D3386B00E126E5 /* Constants.swift */,
6871
C41E181722CB61EB0072CF09 /* Classes */,
6972
C41E181622CB61890072CF09 /* Startup */,
7073
C41E181522CB614C0072CF09 /* Terminal */,
@@ -199,6 +202,7 @@
199202
C41C1B3722B0097F00E7CF16 /* AppDelegate.swift in Sources */,
200203
C41C1B4B22B019FF00E7CF16 /* PhpVersion.swift in Sources */,
201204
C476FF9822B0DD830098105B /* Alert.swift in Sources */,
205+
C4EE188422D3386B00E126E5 /* Constants.swift in Sources */,
202206
);
203207
runOnlyForDeploymentPostprocessing = 0;
204208
};

phpmon/AppDelegate.swift

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ class AppDelegate: NSObject, NSApplicationDelegate {
7373
// Actions
7474
menu.addItem(NSMenuItem.separator())
7575
menu.addItem(NSMenuItem(title: "Open php.ini in Finder", action: #selector(self.openActiveConfigFolder), keyEquivalent: ""))
76+
// OPTIONAL
7677
// menu.addItem(NSMenuItem(title: "Restart PHP \(self.version!.short) service", action: #selector(self.restartPhp), keyEquivalent: ""))
7778
}
7879
menu.addItem(NSMenuItem.separator())
@@ -92,7 +93,8 @@ class AppDelegate: NSObject, NSApplicationDelegate {
9293
menu.addItem(NSMenuItem(title: "Switching PHP versions...", action: nil, keyEquivalent: ""))
9394
menu.addItem(NSMenuItem.separator())
9495
}
95-
menu.addItem(NSMenuItem(title: "View terminal output...", action: #selector(self.openOutput), keyEquivalent: ""))
96+
// TODO: Enable when implementation is complete
97+
// menu.addItem(NSMenuItem(title: "View terminal output", action: #selector(self.openOutput), keyEquivalent: ""))
9698
menu.addItem(NSMenuItem(title: "About phpmon", action: #selector(self.openAbout), keyEquivalent: ""))
9799
menu.addItem(NSMenuItem(title: "Quit phpmon", action: #selector(NSApplication.terminate(_:)), keyEquivalent: "q"))
98100
DispatchQueue.main.async {

phpmon/Constants.swift

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
//
2+
// Constants.swift
3+
// phpmon
4+
//
5+
// Created by Nico Verbruggen on 08/07/2019.
6+
// Copyright © 2019 Nico Verbruggen. All rights reserved.
7+
//
8+
9+
import Cocoa
10+
11+
class Constants {
12+
13+
/**
14+
* The PHP versions supported by this application.
15+
*/
16+
static let SupportedPhpVersions = [
17+
"5.6", "7.0", "7.1", "7.2", "7.3"
18+
]
19+
20+
/**
21+
Which php version is aliased as `php` to brew?
22+
This is usually the latest PHP version.
23+
*/
24+
static let LatestPhpVersion = "7.3"
25+
26+
}

phpmon/Info.plist

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
<key>CFBundlePackageType</key>
1818
<string>APPL</string>
1919
<key>CFBundleShortVersionString</key>
20-
<string>1.1</string>
20+
<string>1.2</string>
2121
<key>CFBundleVersion</key>
2222
<string>10</string>
2323
<key>LSApplicationCategoryType</key>

phpmon/Terminal/Services.swift

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,11 @@ class Services {
4141
}
4242
if (availableVersions.contains("7.3")) {
4343
_ = Shell.execute(command: "brew link [email protected]")
44-
_ = Shell.execute(command: "valet use php@\(version)")
44+
if (version == Constants.LatestPhpVersion) {
45+
_ = Shell.execute(command: "valet use php")
46+
} else {
47+
_ = Shell.execute(command: "valet use php@\(version)")
48+
}
4549
}
4650
}
4751

0 commit comments

Comments
 (0)