mirror of
https://github.com/nicoverbruggen/phpmon.git
synced 2025-08-08 04:20:07 +02:00
Compare commits
15 Commits
Author | SHA1 | Date | |
---|---|---|---|
f62297ee3d | |||
2f017f6732 | |||
1c62a100af | |||
e176d6fa2d | |||
ea60626c47 | |||
69c3386088 | |||
3e898d435b | |||
a4dcd0cd3d | |||
bb382c0f74 | |||
c87c532d1c | |||
b26099369f | |||
90a8e7c336 | |||
398dad9d5e | |||
48d0878dfd | |||
4ba3415bf4 |
2
.gitignore
vendored
2
.gitignore
vendored
@ -1,2 +1,4 @@
|
|||||||
phpmon.xcodeproj/project.xcworkspace
|
phpmon.xcodeproj/project.xcworkspace
|
||||||
phpmon.xcodeproj/xcuserdata
|
phpmon.xcodeproj/xcuserdata
|
||||||
|
PHP Monitor.xcodeproj/project.xcworkspace
|
||||||
|
PHP Monitor.xcodeproj/xcuserdata
|
||||||
|
21
LICENSE
Normal file
21
LICENSE
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
MIT License
|
||||||
|
|
||||||
|
Copyright (c) 2019 Nico Verbruggen
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
in the Software without restriction, including without limitation the rights
|
||||||
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
copies of the Software, and to permit persons to whom the Software is
|
||||||
|
furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all
|
||||||
|
copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
SOFTWARE.
|
@ -8,26 +8,24 @@
|
|||||||
|
|
||||||
/* Begin PBXBuildFile section */
|
/* Begin PBXBuildFile section */
|
||||||
C41C1B3722B0097F00E7CF16 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = C41C1B3622B0097F00E7CF16 /* AppDelegate.swift */; };
|
C41C1B3722B0097F00E7CF16 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = C41C1B3622B0097F00E7CF16 /* AppDelegate.swift */; };
|
||||||
C41C1B3922B0097F00E7CF16 /* LogViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = C41C1B3822B0097F00E7CF16 /* LogViewController.swift */; };
|
|
||||||
C41C1B3B22B0098000E7CF16 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = C41C1B3A22B0098000E7CF16 /* Assets.xcassets */; };
|
C41C1B3B22B0098000E7CF16 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = C41C1B3A22B0098000E7CF16 /* Assets.xcassets */; };
|
||||||
C41C1B3E22B0098000E7CF16 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = C41C1B3C22B0098000E7CF16 /* Main.storyboard */; };
|
C41C1B3E22B0098000E7CF16 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = C41C1B3C22B0098000E7CF16 /* Main.storyboard */; };
|
||||||
C41C1B4722B009A400E7CF16 /* Shell.swift in Sources */ = {isa = PBXBuildFile; fileRef = C41C1B4622B009A400E7CF16 /* Shell.swift */; };
|
C41C1B4722B009A400E7CF16 /* Shell.swift in Sources */ = {isa = PBXBuildFile; fileRef = C41C1B4622B009A400E7CF16 /* Shell.swift */; };
|
||||||
C41C1B4922B00A9800E7CF16 /* MenuBarImageGenerator.swift in Sources */ = {isa = PBXBuildFile; fileRef = C41C1B4822B00A9800E7CF16 /* MenuBarImageGenerator.swift */; };
|
C41C1B4922B00A9800E7CF16 /* MenuBarImageGenerator.swift in Sources */ = {isa = PBXBuildFile; fileRef = C41C1B4822B00A9800E7CF16 /* MenuBarImageGenerator.swift */; };
|
||||||
C41C1B4B22B019FF00E7CF16 /* PhpVersion.swift in Sources */ = {isa = PBXBuildFile; fileRef = C41C1B4A22B019FF00E7CF16 /* PhpVersion.swift */; };
|
C41C1B4B22B019FF00E7CF16 /* PhpVersion.swift in Sources */ = {isa = PBXBuildFile; fileRef = C41C1B4A22B019FF00E7CF16 /* PhpVersion.swift */; };
|
||||||
C41C1B4D22B0215A00E7CF16 /* Actions.swift in Sources */ = {isa = PBXBuildFile; fileRef = C41C1B4C22B0215A00E7CF16 /* Actions.swift */; };
|
C41C1B4D22B0215A00E7CF16 /* Actions.swift in Sources */ = {isa = PBXBuildFile; fileRef = C41C1B4C22B0215A00E7CF16 /* Actions.swift */; };
|
||||||
|
C42295DD2358D02000E263B2 /* Command.swift in Sources */ = {isa = PBXBuildFile; fileRef = C42295DC2358D02000E263B2 /* Command.swift */; };
|
||||||
C476FF9822B0DD830098105B /* Alert.swift in Sources */ = {isa = PBXBuildFile; fileRef = C476FF9722B0DD830098105B /* Alert.swift */; };
|
C476FF9822B0DD830098105B /* Alert.swift in Sources */ = {isa = PBXBuildFile; fileRef = C476FF9722B0DD830098105B /* Alert.swift */; };
|
||||||
C4811D2422D70A4700B5F6B3 /* App.swift in Sources */ = {isa = PBXBuildFile; fileRef = C4811D2322D70A4700B5F6B3 /* App.swift */; };
|
C4811D2422D70A4700B5F6B3 /* App.swift in Sources */ = {isa = PBXBuildFile; fileRef = C4811D2322D70A4700B5F6B3 /* App.swift */; };
|
||||||
C4811D2A22D70F9A00B5F6B3 /* MainMenu.swift in Sources */ = {isa = PBXBuildFile; fileRef = C4811D2922D70F9A00B5F6B3 /* MainMenu.swift */; };
|
C4811D2A22D70F9A00B5F6B3 /* MainMenu.swift in Sources */ = {isa = PBXBuildFile; fileRef = C4811D2922D70F9A00B5F6B3 /* MainMenu.swift */; };
|
||||||
C4D8016622B1584700C6DA1B /* Startup.swift in Sources */ = {isa = PBXBuildFile; fileRef = C4D8016522B1584700C6DA1B /* Startup.swift */; };
|
C4D8016622B1584700C6DA1B /* Startup.swift in Sources */ = {isa = PBXBuildFile; fileRef = C4D8016522B1584700C6DA1B /* Startup.swift */; };
|
||||||
C4EE188422D3386B00E126E5 /* Constants.swift in Sources */ = {isa = PBXBuildFile; fileRef = C4EE188322D3386B00E126E5 /* Constants.swift */; };
|
C4EE188422D3386B00E126E5 /* Constants.swift in Sources */ = {isa = PBXBuildFile; fileRef = C4EE188322D3386B00E126E5 /* Constants.swift */; };
|
||||||
C4F8C0A422D4F12C002EFE61 /* DateExtension.swift in Sources */ = {isa = PBXBuildFile; fileRef = C4F8C0A322D4F12C002EFE61 /* DateExtension.swift */; };
|
C4F8C0A422D4F12C002EFE61 /* DateExtension.swift in Sources */ = {isa = PBXBuildFile; fileRef = C4F8C0A322D4F12C002EFE61 /* DateExtension.swift */; };
|
||||||
C4F8C0A622D4FA41002EFE61 /* README.md in Resources */ = {isa = PBXBuildFile; fileRef = C4F8C0A522D4FA41002EFE61 /* README.md */; };
|
|
||||||
/* End PBXBuildFile section */
|
/* End PBXBuildFile section */
|
||||||
|
|
||||||
/* Begin PBXFileReference section */
|
/* Begin PBXFileReference section */
|
||||||
C41C1B3322B0097F00E7CF16 /* phpmon.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = phpmon.app; sourceTree = BUILT_PRODUCTS_DIR; };
|
C41C1B3322B0097F00E7CF16 /* PHP Monitor.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "PHP Monitor.app"; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||||
C41C1B3622B0097F00E7CF16 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
|
C41C1B3622B0097F00E7CF16 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
|
||||||
C41C1B3822B0097F00E7CF16 /* LogViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LogViewController.swift; sourceTree = "<group>"; };
|
|
||||||
C41C1B3A22B0098000E7CF16 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
|
C41C1B3A22B0098000E7CF16 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
|
||||||
C41C1B3D22B0098000E7CF16 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = "<group>"; };
|
C41C1B3D22B0098000E7CF16 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = "<group>"; };
|
||||||
C41C1B3F22B0098000E7CF16 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
|
C41C1B3F22B0098000E7CF16 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
|
||||||
@ -36,6 +34,7 @@
|
|||||||
C41C1B4822B00A9800E7CF16 /* MenuBarImageGenerator.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MenuBarImageGenerator.swift; sourceTree = "<group>"; };
|
C41C1B4822B00A9800E7CF16 /* MenuBarImageGenerator.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MenuBarImageGenerator.swift; sourceTree = "<group>"; };
|
||||||
C41C1B4A22B019FF00E7CF16 /* PhpVersion.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PhpVersion.swift; sourceTree = "<group>"; };
|
C41C1B4A22B019FF00E7CF16 /* PhpVersion.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PhpVersion.swift; sourceTree = "<group>"; };
|
||||||
C41C1B4C22B0215A00E7CF16 /* Actions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Actions.swift; sourceTree = "<group>"; };
|
C41C1B4C22B0215A00E7CF16 /* Actions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Actions.swift; sourceTree = "<group>"; };
|
||||||
|
C42295DC2358D02000E263B2 /* Command.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Command.swift; sourceTree = "<group>"; };
|
||||||
C476FF9722B0DD830098105B /* Alert.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Alert.swift; sourceTree = "<group>"; };
|
C476FF9722B0DD830098105B /* Alert.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Alert.swift; sourceTree = "<group>"; };
|
||||||
C4811D2322D70A4700B5F6B3 /* App.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = App.swift; sourceTree = "<group>"; };
|
C4811D2322D70A4700B5F6B3 /* App.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = App.swift; sourceTree = "<group>"; };
|
||||||
C4811D2922D70F9A00B5F6B3 /* MainMenu.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MainMenu.swift; sourceTree = "<group>"; };
|
C4811D2922D70F9A00B5F6B3 /* MainMenu.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MainMenu.swift; sourceTree = "<group>"; };
|
||||||
@ -68,7 +67,7 @@
|
|||||||
C41C1B3422B0097F00E7CF16 /* Products */ = {
|
C41C1B3422B0097F00E7CF16 /* Products */ = {
|
||||||
isa = PBXGroup;
|
isa = PBXGroup;
|
||||||
children = (
|
children = (
|
||||||
C41C1B3322B0097F00E7CF16 /* phpmon.app */,
|
C41C1B3322B0097F00E7CF16 /* PHP Monitor.app */,
|
||||||
);
|
);
|
||||||
name = Products;
|
name = Products;
|
||||||
sourceTree = "<group>";
|
sourceTree = "<group>";
|
||||||
@ -102,7 +101,6 @@
|
|||||||
isa = PBXGroup;
|
isa = PBXGroup;
|
||||||
children = (
|
children = (
|
||||||
C41C1B3C22B0098000E7CF16 /* Main.storyboard */,
|
C41C1B3C22B0098000E7CF16 /* Main.storyboard */,
|
||||||
C41C1B3822B0097F00E7CF16 /* LogViewController.swift */,
|
|
||||||
);
|
);
|
||||||
path = "View Controllers";
|
path = "View Controllers";
|
||||||
sourceTree = "<group>";
|
sourceTree = "<group>";
|
||||||
@ -113,6 +111,7 @@
|
|||||||
C41C1B4622B009A400E7CF16 /* Shell.swift */,
|
C41C1B4622B009A400E7CF16 /* Shell.swift */,
|
||||||
C4811D2322D70A4700B5F6B3 /* App.swift */,
|
C4811D2322D70A4700B5F6B3 /* App.swift */,
|
||||||
C4811D2922D70F9A00B5F6B3 /* MainMenu.swift */,
|
C4811D2922D70F9A00B5F6B3 /* MainMenu.swift */,
|
||||||
|
C42295DC2358D02000E263B2 /* Command.swift */,
|
||||||
);
|
);
|
||||||
path = Singletons;
|
path = Singletons;
|
||||||
sourceTree = "<group>";
|
sourceTree = "<group>";
|
||||||
@ -147,9 +146,9 @@
|
|||||||
/* End PBXGroup section */
|
/* End PBXGroup section */
|
||||||
|
|
||||||
/* Begin PBXNativeTarget section */
|
/* Begin PBXNativeTarget section */
|
||||||
C41C1B3222B0097F00E7CF16 /* phpmon */ = {
|
C41C1B3222B0097F00E7CF16 /* PHP Monitor */ = {
|
||||||
isa = PBXNativeTarget;
|
isa = PBXNativeTarget;
|
||||||
buildConfigurationList = C41C1B4322B0098000E7CF16 /* Build configuration list for PBXNativeTarget "phpmon" */;
|
buildConfigurationList = C41C1B4322B0098000E7CF16 /* Build configuration list for PBXNativeTarget "PHP Monitor" */;
|
||||||
buildPhases = (
|
buildPhases = (
|
||||||
C41C1B2F22B0097F00E7CF16 /* Sources */,
|
C41C1B2F22B0097F00E7CF16 /* Sources */,
|
||||||
C41C1B3022B0097F00E7CF16 /* Frameworks */,
|
C41C1B3022B0097F00E7CF16 /* Frameworks */,
|
||||||
@ -159,9 +158,9 @@
|
|||||||
);
|
);
|
||||||
dependencies = (
|
dependencies = (
|
||||||
);
|
);
|
||||||
name = phpmon;
|
name = "PHP Monitor";
|
||||||
productName = phpmon;
|
productName = phpmon;
|
||||||
productReference = C41C1B3322B0097F00E7CF16 /* phpmon.app */;
|
productReference = C41C1B3322B0097F00E7CF16 /* PHP Monitor.app */;
|
||||||
productType = "com.apple.product-type.application";
|
productType = "com.apple.product-type.application";
|
||||||
};
|
};
|
||||||
/* End PBXNativeTarget section */
|
/* End PBXNativeTarget section */
|
||||||
@ -171,7 +170,7 @@
|
|||||||
isa = PBXProject;
|
isa = PBXProject;
|
||||||
attributes = {
|
attributes = {
|
||||||
LastSwiftUpdateCheck = 1020;
|
LastSwiftUpdateCheck = 1020;
|
||||||
LastUpgradeCheck = 1020;
|
LastUpgradeCheck = 1110;
|
||||||
ORGANIZATIONNAME = "Nico Verbruggen";
|
ORGANIZATIONNAME = "Nico Verbruggen";
|
||||||
TargetAttributes = {
|
TargetAttributes = {
|
||||||
C41C1B3222B0097F00E7CF16 = {
|
C41C1B3222B0097F00E7CF16 = {
|
||||||
@ -179,7 +178,7 @@
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
buildConfigurationList = C41C1B2E22B0097F00E7CF16 /* Build configuration list for PBXProject "phpmon" */;
|
buildConfigurationList = C41C1B2E22B0097F00E7CF16 /* Build configuration list for PBXProject "PHP Monitor" */;
|
||||||
compatibilityVersion = "Xcode 9.3";
|
compatibilityVersion = "Xcode 9.3";
|
||||||
developmentRegion = en;
|
developmentRegion = en;
|
||||||
hasScannedForEncodings = 0;
|
hasScannedForEncodings = 0;
|
||||||
@ -192,7 +191,7 @@
|
|||||||
projectDirPath = "";
|
projectDirPath = "";
|
||||||
projectRoot = "";
|
projectRoot = "";
|
||||||
targets = (
|
targets = (
|
||||||
C41C1B3222B0097F00E7CF16 /* phpmon */,
|
C41C1B3222B0097F00E7CF16 /* PHP Monitor */,
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
/* End PBXProject section */
|
/* End PBXProject section */
|
||||||
@ -202,7 +201,6 @@
|
|||||||
isa = PBXResourcesBuildPhase;
|
isa = PBXResourcesBuildPhase;
|
||||||
buildActionMask = 2147483647;
|
buildActionMask = 2147483647;
|
||||||
files = (
|
files = (
|
||||||
C4F8C0A622D4FA41002EFE61 /* README.md in Resources */,
|
|
||||||
C41C1B3B22B0098000E7CF16 /* Assets.xcassets in Resources */,
|
C41C1B3B22B0098000E7CF16 /* Assets.xcassets in Resources */,
|
||||||
C41C1B3E22B0098000E7CF16 /* Main.storyboard in Resources */,
|
C41C1B3E22B0098000E7CF16 /* Main.storyboard in Resources */,
|
||||||
);
|
);
|
||||||
@ -219,10 +217,10 @@
|
|||||||
C4F8C0A422D4F12C002EFE61 /* DateExtension.swift in Sources */,
|
C4F8C0A422D4F12C002EFE61 /* DateExtension.swift in Sources */,
|
||||||
C41C1B4722B009A400E7CF16 /* Shell.swift in Sources */,
|
C41C1B4722B009A400E7CF16 /* Shell.swift in Sources */,
|
||||||
C41C1B4D22B0215A00E7CF16 /* Actions.swift in Sources */,
|
C41C1B4D22B0215A00E7CF16 /* Actions.swift in Sources */,
|
||||||
|
C42295DD2358D02000E263B2 /* Command.swift in Sources */,
|
||||||
C4811D2422D70A4700B5F6B3 /* App.swift in Sources */,
|
C4811D2422D70A4700B5F6B3 /* App.swift in Sources */,
|
||||||
C41C1B4922B00A9800E7CF16 /* MenuBarImageGenerator.swift in Sources */,
|
C41C1B4922B00A9800E7CF16 /* MenuBarImageGenerator.swift in Sources */,
|
||||||
C4811D2A22D70F9A00B5F6B3 /* MainMenu.swift in Sources */,
|
C4811D2A22D70F9A00B5F6B3 /* MainMenu.swift in Sources */,
|
||||||
C41C1B3922B0097F00E7CF16 /* LogViewController.swift in Sources */,
|
|
||||||
C41C1B3722B0097F00E7CF16 /* AppDelegate.swift in Sources */,
|
C41C1B3722B0097F00E7CF16 /* AppDelegate.swift in Sources */,
|
||||||
C41C1B4B22B019FF00E7CF16 /* PhpVersion.swift in Sources */,
|
C41C1B4B22B019FF00E7CF16 /* PhpVersion.swift in Sources */,
|
||||||
C476FF9822B0DD830098105B /* Alert.swift in Sources */,
|
C476FF9822B0DD830098105B /* Alert.swift in Sources */,
|
||||||
@ -364,14 +362,17 @@
|
|||||||
buildSettings = {
|
buildSettings = {
|
||||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||||
CODE_SIGN_ENTITLEMENTS = phpmon/phpmon.entitlements;
|
CODE_SIGN_ENTITLEMENTS = phpmon/phpmon.entitlements;
|
||||||
|
CODE_SIGN_IDENTITY = "-";
|
||||||
CODE_SIGN_STYLE = Automatic;
|
CODE_SIGN_STYLE = Automatic;
|
||||||
COMBINE_HIDPI_IMAGES = YES;
|
COMBINE_HIDPI_IMAGES = YES;
|
||||||
|
CURRENT_PROJECT_VERSION = 16;
|
||||||
DEVELOPMENT_TEAM = 8M54J5J787;
|
DEVELOPMENT_TEAM = 8M54J5J787;
|
||||||
INFOPLIST_FILE = phpmon/Info.plist;
|
INFOPLIST_FILE = phpmon/Info.plist;
|
||||||
LD_RUNPATH_SEARCH_PATHS = (
|
LD_RUNPATH_SEARCH_PATHS = (
|
||||||
"$(inherited)",
|
"$(inherited)",
|
||||||
"@executable_path/../Frameworks",
|
"@executable_path/../Frameworks",
|
||||||
);
|
);
|
||||||
|
MARKETING_VERSION = 1.6;
|
||||||
PRODUCT_BUNDLE_IDENTIFIER = com.nicoverbruggen.phpmon;
|
PRODUCT_BUNDLE_IDENTIFIER = com.nicoverbruggen.phpmon;
|
||||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||||
SWIFT_VERSION = 5.0;
|
SWIFT_VERSION = 5.0;
|
||||||
@ -383,14 +384,17 @@
|
|||||||
buildSettings = {
|
buildSettings = {
|
||||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||||
CODE_SIGN_ENTITLEMENTS = phpmon/phpmon.entitlements;
|
CODE_SIGN_ENTITLEMENTS = phpmon/phpmon.entitlements;
|
||||||
|
CODE_SIGN_IDENTITY = "-";
|
||||||
CODE_SIGN_STYLE = Automatic;
|
CODE_SIGN_STYLE = Automatic;
|
||||||
COMBINE_HIDPI_IMAGES = YES;
|
COMBINE_HIDPI_IMAGES = YES;
|
||||||
|
CURRENT_PROJECT_VERSION = 16;
|
||||||
DEVELOPMENT_TEAM = 8M54J5J787;
|
DEVELOPMENT_TEAM = 8M54J5J787;
|
||||||
INFOPLIST_FILE = phpmon/Info.plist;
|
INFOPLIST_FILE = phpmon/Info.plist;
|
||||||
LD_RUNPATH_SEARCH_PATHS = (
|
LD_RUNPATH_SEARCH_PATHS = (
|
||||||
"$(inherited)",
|
"$(inherited)",
|
||||||
"@executable_path/../Frameworks",
|
"@executable_path/../Frameworks",
|
||||||
);
|
);
|
||||||
|
MARKETING_VERSION = 1.6;
|
||||||
PRODUCT_BUNDLE_IDENTIFIER = com.nicoverbruggen.phpmon;
|
PRODUCT_BUNDLE_IDENTIFIER = com.nicoverbruggen.phpmon;
|
||||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||||
SWIFT_VERSION = 5.0;
|
SWIFT_VERSION = 5.0;
|
||||||
@ -400,7 +404,7 @@
|
|||||||
/* End XCBuildConfiguration section */
|
/* End XCBuildConfiguration section */
|
||||||
|
|
||||||
/* Begin XCConfigurationList section */
|
/* Begin XCConfigurationList section */
|
||||||
C41C1B2E22B0097F00E7CF16 /* Build configuration list for PBXProject "phpmon" */ = {
|
C41C1B2E22B0097F00E7CF16 /* Build configuration list for PBXProject "PHP Monitor" */ = {
|
||||||
isa = XCConfigurationList;
|
isa = XCConfigurationList;
|
||||||
buildConfigurations = (
|
buildConfigurations = (
|
||||||
C41C1B4122B0098000E7CF16 /* Debug */,
|
C41C1B4122B0098000E7CF16 /* Debug */,
|
||||||
@ -409,7 +413,7 @@
|
|||||||
defaultConfigurationIsVisible = 0;
|
defaultConfigurationIsVisible = 0;
|
||||||
defaultConfigurationName = Release;
|
defaultConfigurationName = Release;
|
||||||
};
|
};
|
||||||
C41C1B4322B0098000E7CF16 /* Build configuration list for PBXNativeTarget "phpmon" */ = {
|
C41C1B4322B0098000E7CF16 /* Build configuration list for PBXNativeTarget "PHP Monitor" */ = {
|
||||||
isa = XCConfigurationList;
|
isa = XCConfigurationList;
|
||||||
buildConfigurations = (
|
buildConfigurations = (
|
||||||
C41C1B4422B0098000E7CF16 /* Debug */,
|
C41C1B4422B0098000E7CF16 /* Debug */,
|
50
README.md
50
README.md
@ -1,16 +1,26 @@
|
|||||||
# phpmon
|
# PHP Monitor
|
||||||
|
|
||||||
phpmon is a macOS utility that runs on your Mac and displays the active PHP version in your status bar.
|
PHP Monitor (or phpmon) is a macOS utility that runs on your Mac and displays the active PHP version in your status bar.
|
||||||
|
|
||||||
<img src="./docs/screenshot.png" width="278px" alt="phpmon screenshot"/>
|
<img src="./docs/screenshot.png" width="278px" alt="phpmon screenshot"/>
|
||||||
|
|
||||||
For me, it comes in handy when running multiple versions of PHP with Homebrew and you wish to be able to see at a glance which version is currently linked & active with Laravel Valet, and switch between versions.
|
For me, it comes in handy when running multiple versions of PHP with Homebrew and you wish to be able to see at a glance which version is currently linked & active with Laravel Valet, and switch between versions.
|
||||||
|
|
||||||
This version of phpmon was developed for:
|
## System requirements
|
||||||
|
|
||||||
* macOS Mojave (10.14)
|
**Minimal system requirements**
|
||||||
* PHP 7.x with Homebrew 2.x (with support for PHP 5.6 and PHP 7.0 [as well](https://github.com/eXolnet/homebrew-deprecated))
|
|
||||||
* Laravel Valet 2.2
|
* macOS 10.14 or higher
|
||||||
|
* PHP 7.4 installed via Homebrew
|
||||||
|
* Laravel Valet 2.3 or higher installed
|
||||||
|
|
||||||
|
**Recommended system**
|
||||||
|
|
||||||
|
* macOS 10.15 Catalina
|
||||||
|
* PHP 7.4 installed with Homebrew 2.2
|
||||||
|
- other versions of PHP are optional
|
||||||
|
- includes support for PHP 5.6 and PHP 7.0 [as well](https://github.com/eXolnet/homebrew-deprecated)
|
||||||
|
* Laravel Valet 2.5.x installed
|
||||||
|
|
||||||
## Why I built this
|
## Why I built this
|
||||||
|
|
||||||
@ -30,14 +40,14 @@ This utility will detect which PHP versions you have installed via Homebrew, and
|
|||||||
|
|
||||||
This means:
|
This means:
|
||||||
|
|
||||||
- You have at least the latest version of PHP installed (`php@7.3`)
|
- You have at least the latest version of PHP installed (`php@7.4`)
|
||||||
- You have installed Laravel Valet (`which valet` returns `/usr/local/bin/valet`)
|
- You have installed Laravel Valet (`which valet` returns `/usr/local/bin/valet`)
|
||||||
- You ran `valet trust`, which means Valet commands can be run without using sudo
|
- You ran `valet trust`, which means Valet commands can be run without using sudo
|
||||||
|
|
||||||
The utility runs the following commands:
|
The utility runs the following commands:
|
||||||
|
|
||||||
- Unlink all detected PHP versions
|
- Unlink all detected PHP versions
|
||||||
- Switch to PHP 7.3 (this is done in order to ensure that Valet works, even when attempting to use PHP 5.6)
|
- Switch to PHP 7.4 (this is done in order to ensure that Valet works, even when attempting to use PHP 5.6)
|
||||||
- Tell Valet to switch to a specific PHP version
|
- Tell Valet to switch to a specific PHP version
|
||||||
- Link the desired version of PHP
|
- Link the desired version of PHP
|
||||||
|
|
||||||
@ -46,3 +56,27 @@ The utility runs the following commands:
|
|||||||
If you want to know more about how this works, I recommend you check out the source code.
|
If you want to know more about how this works, I recommend you check out the source code.
|
||||||
|
|
||||||
This app isn't very complicated after all. In the end, this just (conveniently) executes some shell commands.
|
This app isn't very complicated after all. In the end, this just (conveniently) executes some shell commands.
|
||||||
|
|
||||||
|
## Troubleshooting
|
||||||
|
|
||||||
|
### Reasons for alerts at startup
|
||||||
|
|
||||||
|
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 7.4 is missing in `/usr/local/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`
|
||||||
|
|
||||||
|
Follow instructions as specified in the alert in order to resolve any issues.
|
||||||
|
|
||||||
|
### Still seeing another PHP version (from before switching versions)?
|
||||||
|
|
||||||
|
If you're still seeing an old version of PHP in your scripts — e.g. when running `phpinfo()` — I recommend you shut down the PHP service by running:
|
||||||
|
|
||||||
|
sudo brew services stop php
|
||||||
|
|
||||||
|
Please note that PHP Monitor will not be able to stop this service (it doesn't run as an administrator), so you'll need to handle this yourself.
|
||||||
|
|
||||||
|
You should only have to do this **once**, and then PHP Monitor should work as usual.
|
||||||
|
@ -1,7 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<Workspace
|
|
||||||
version = "1.0">
|
|
||||||
<FileRef
|
|
||||||
location = "self:phpmon.xcodeproj">
|
|
||||||
</FileRef>
|
|
||||||
</Workspace>
|
|
@ -1,8 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
|
||||||
<plist version="1.0">
|
|
||||||
<dict>
|
|
||||||
<key>IDEDidComputeMac32BitWarning</key>
|
|
||||||
<true/>
|
|
||||||
</dict>
|
|
||||||
</plist>
|
|
@ -1,6 +1,6 @@
|
|||||||
//
|
//
|
||||||
// AppDelegate.swift
|
// AppDelegate.swift
|
||||||
// phpmon
|
// PHP Monitor
|
||||||
//
|
//
|
||||||
// Created by Nico Verbruggen on 11/06/2019.
|
// Created by Nico Verbruggen on 11/06/2019.
|
||||||
// Copyright © 2019 Nico Verbruggen. All rights reserved.
|
// Copyright © 2019 Nico Verbruggen. All rights reserved.
|
||||||
@ -12,6 +12,7 @@ import Cocoa
|
|||||||
class AppDelegate: NSObject, NSApplicationDelegate {
|
class AppDelegate: NSObject, NSApplicationDelegate {
|
||||||
|
|
||||||
// MARK: - Variables
|
// MARK: - Variables
|
||||||
|
|
||||||
let sharedShell : Shell
|
let sharedShell : Shell
|
||||||
let state : App
|
let state : App
|
||||||
let menu : MainMenu
|
let menu : MainMenu
|
||||||
@ -32,7 +33,7 @@ class AppDelegate: NSObject, NSApplicationDelegate {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func applicationWillTerminate(_ aNotification: Notification) {
|
func applicationWillTerminate(_ aNotification: Notification) {
|
||||||
// Insert code here to tear down your application
|
self.state.windowController = nil
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
//
|
//
|
||||||
// Services.swift
|
// Services.swift
|
||||||
// phpmon
|
// PHP Monitor
|
||||||
//
|
//
|
||||||
// Created by Nico Verbruggen on 11/06/2019.
|
// Created by Nico Verbruggen on 11/06/2019.
|
||||||
// Copyright © 2019 Nico Verbruggen. All rights reserved.
|
// Copyright © 2019 Nico Verbruggen. All rights reserved.
|
||||||
@ -30,10 +30,10 @@ class Actions {
|
|||||||
availableVersions.forEach { (version) in
|
availableVersions.forEach { (version) in
|
||||||
Shell.user.run("brew unlink php@\(version)")
|
Shell.user.run("brew unlink php@\(version)")
|
||||||
}
|
}
|
||||||
if (availableVersions.contains("7.3")) {
|
if (availableVersions.contains("7.4")) {
|
||||||
Shell.user.run("brew link php@7.3")
|
Shell.user.run("brew link php@7.4")
|
||||||
if (version == Constants.LatestPhpVersion) {
|
if (version == Constants.LatestPhpVersion) {
|
||||||
Shell.user.run( "valet use php")
|
Shell.user.run("valet use php")
|
||||||
} else {
|
} else {
|
||||||
Shell.user.run("valet use php@\(version)")
|
Shell.user.run("valet use php@\(version)")
|
||||||
}
|
}
|
||||||
@ -42,6 +42,35 @@ class Actions {
|
|||||||
|
|
||||||
public static func openPhpConfigFolder(version: String) {
|
public static func openPhpConfigFolder(version: String) {
|
||||||
let files = [NSURL(fileURLWithPath: "/usr/local/etc/php/\(version)/php.ini")];
|
let files = [NSURL(fileURLWithPath: "/usr/local/etc/php/\(version)/php.ini")];
|
||||||
NSWorkspace.shared.activateFileViewerSelecting(files as [URL]);
|
NSWorkspace.shared.activateFileViewerSelecting(files as [URL])
|
||||||
|
}
|
||||||
|
|
||||||
|
public static func XdebugFound(_ version: String) -> Bool {
|
||||||
|
let command = """
|
||||||
|
grep -q 'zend_extension="xdebug.so"' /usr/local/etc/php/\(version)/php.ini; [ $? -eq 0 ] && echo "YES" || echo "NO"
|
||||||
|
"""
|
||||||
|
let output = Shell.user.pipe(command).trimmingCharacters(in: .whitespacesAndNewlines)
|
||||||
|
return (output == "YES")
|
||||||
|
}
|
||||||
|
|
||||||
|
public static func XdebugEnabled(_ version: String) -> Bool {
|
||||||
|
let command = """
|
||||||
|
grep -q '; zend_extension="xdebug.so"' /usr/local/etc/php/\(version)/php.ini; [ $? -eq 0 ] && echo "YES" || echo "NO"
|
||||||
|
"""
|
||||||
|
let output = Shell.user.pipe(command).trimmingCharacters(in: .whitespacesAndNewlines)
|
||||||
|
return (output == "NO")
|
||||||
|
}
|
||||||
|
|
||||||
|
public static func toggleXdebug() {
|
||||||
|
let version = App.shared.currentVersion?.short
|
||||||
|
var command = """
|
||||||
|
sed -i '' 's/; zend_extension="xdebug.so"/zend_extension="xdebug.so"/g' /usr/local/etc/php/\(version!)/php.ini
|
||||||
|
"""
|
||||||
|
if (self.XdebugEnabled(version!)) {
|
||||||
|
command = """
|
||||||
|
sed -i '' 's/zend_extension="xdebug.so"/; zend_extension="xdebug.so"/g' /usr/local/etc/php/\(version!)/php.ini
|
||||||
|
"""
|
||||||
|
}
|
||||||
|
Shell.user.run(command)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
//
|
//
|
||||||
// Environment.swift
|
// Environment.swift
|
||||||
// phpmon
|
// PHP Monitor
|
||||||
//
|
//
|
||||||
// Created by Nico Verbruggen on 12/06/2019.
|
// Created by Nico Verbruggen on 12/06/2019.
|
||||||
// Copyright © 2019 Nico Verbruggen. All rights reserved.
|
// Copyright © 2019 Nico Verbruggen. All rights reserved.
|
||||||
@ -19,9 +19,9 @@ class Startup {
|
|||||||
)
|
)
|
||||||
|
|
||||||
self.presentAlertOnMainThreadIf(
|
self.presentAlertOnMainThreadIf(
|
||||||
!Shell.user.pipe("ls /usr/local/opt | grep php@7.3").contains("php@7.3"),
|
!Shell.user.pipe("ls /usr/local/opt | grep php@7.4").contains("php@7.4"),
|
||||||
messageText: "PHP 7.3 is not correctly installed",
|
messageText: "PHP 7.4 is not correctly installed",
|
||||||
informativeText: "PHP 7.3 alias was not found in `/usr/local/opt`. The app will not work correctly until you resolve this issue."
|
informativeText: "PHP 7.4 alias was not found in `/usr/local/opt`. The app will not work correctly until you resolve this issue."
|
||||||
)
|
)
|
||||||
|
|
||||||
self.presentAlertOnMainThreadIf(
|
self.presentAlertOnMainThreadIf(
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
//
|
//
|
||||||
// Alert.swift
|
// Alert.swift
|
||||||
// phpmon
|
// PHP Monitor
|
||||||
//
|
//
|
||||||
// Created by Nico Verbruggen on 12/06/2019.
|
// Created by Nico Verbruggen on 12/06/2019.
|
||||||
// Copyright © 2019 Nico Verbruggen. All rights reserved.
|
// Copyright © 2019 Nico Verbruggen. All rights reserved.
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
//
|
//
|
||||||
// ImageGenerator.swift
|
// ImageGenerator.swift
|
||||||
// phpmon
|
// PHP Monitor
|
||||||
//
|
//
|
||||||
// Created by Nico Verbruggen on 11/06/2019.
|
// Created by Nico Verbruggen on 11/06/2019.
|
||||||
// Copyright © 2019 Nico Verbruggen. All rights reserved.
|
// Copyright © 2019 Nico Verbruggen. All rights reserved.
|
||||||
@ -39,7 +39,7 @@ class MenuBarImageGenerator {
|
|||||||
let imageRect = CGRect(x: 0, y: 0, width: image.size.width, height: image.size.height)
|
let imageRect = CGRect(x: 0, y: 0, width: image.size.width, height: image.size.height)
|
||||||
|
|
||||||
// Position the text inside the image rect
|
// Position the text inside the image rect
|
||||||
let textRect = CGRect(x: padding, y: 0, width: image.size.width, height: image.size.height)
|
let textRect = CGRect(x: padding, y: 0.5, width: image.size.width, height: image.size.height)
|
||||||
|
|
||||||
let targetImage: NSImage = NSImage(size: image.size)
|
let targetImage: NSImage = NSImage(size: image.size)
|
||||||
let rep: NSBitmapImageRep = NSBitmapImageRep(
|
let rep: NSBitmapImageRep = NSBitmapImageRep(
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
//
|
//
|
||||||
// PhpVersionExtractor.swift
|
// PhpVersionExtractor.swift
|
||||||
// phpmon
|
// PHP Monitor
|
||||||
//
|
//
|
||||||
// Created by Nico Verbruggen on 11/06/2019.
|
// Created by Nico Verbruggen on 11/06/2019.
|
||||||
// Copyright © 2019 Nico Verbruggen. All rights reserved.
|
// Copyright © 2019 Nico Verbruggen. All rights reserved.
|
||||||
@ -13,17 +13,25 @@ class PhpVersion {
|
|||||||
var short : String = "???"
|
var short : String = "???"
|
||||||
var long : String = "???"
|
var long : String = "???"
|
||||||
|
|
||||||
|
var xdebugFound: Bool = false
|
||||||
|
var xdebugEnabled : Bool = false
|
||||||
|
|
||||||
init() {
|
init() {
|
||||||
let version = Shell.user
|
let version = Command.execute(path: "/usr/local/bin/php", arguments: ["-r", "print phpversion();"])
|
||||||
// Get the version directly from PHP
|
|
||||||
.pipe("php -r 'print phpversion();'")
|
|
||||||
|
|
||||||
// That's the long version
|
// That's the long version
|
||||||
self.long = version
|
self.long = version
|
||||||
|
|
||||||
// Next up, let's strip away the minor version number
|
// Next up, let's strip away the minor version number
|
||||||
let segments = long.components(separatedBy: ".")
|
let segments = long.components(separatedBy: ".")
|
||||||
|
|
||||||
// Get the first two elements
|
// Get the first two elements
|
||||||
self.short = segments[0...1].joined(separator: ".")
|
self.short = segments[0...1].joined(separator: ".")
|
||||||
|
|
||||||
|
// Load xdebug support
|
||||||
|
self.xdebugFound = Actions.XdebugFound(self.short)
|
||||||
|
if (self.xdebugFound) {
|
||||||
|
self.xdebugEnabled = Actions.XdebugEnabled(self.short)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
//
|
//
|
||||||
// Constants.swift
|
// Constants.swift
|
||||||
// phpmon
|
// PHP Monitor
|
||||||
//
|
//
|
||||||
// Created by Nico Verbruggen on 08/07/2019.
|
// Created by Nico Verbruggen on 08/07/2019.
|
||||||
// Copyright © 2019 Nico Verbruggen. All rights reserved.
|
// Copyright © 2019 Nico Verbruggen. All rights reserved.
|
||||||
@ -14,13 +14,13 @@ class Constants {
|
|||||||
* The PHP versions supported by this application.
|
* The PHP versions supported by this application.
|
||||||
*/
|
*/
|
||||||
static let SupportedPhpVersions = [
|
static let SupportedPhpVersions = [
|
||||||
"5.6", "7.0", "7.1", "7.2", "7.3"
|
"5.6", "7.0", "7.1", "7.2", "7.3", "7.4"
|
||||||
]
|
]
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Which php version is aliased as `php` to brew?
|
Which php version is aliased as `php` to brew?
|
||||||
This is usually the latest PHP version.
|
This is usually the latest PHP version.
|
||||||
*/
|
*/
|
||||||
static let LatestPhpVersion = "7.3"
|
static let LatestPhpVersion = "7.4"
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
//
|
//
|
||||||
// Date.swift
|
// Date.swift
|
||||||
// phpmon
|
// PHP Monitor
|
||||||
//
|
//
|
||||||
// Created by Nico Verbruggen on 09/07/2019.
|
// Created by Nico Verbruggen on 09/07/2019.
|
||||||
// Copyright © 2019 Nico Verbruggen. All rights reserved.
|
// Copyright © 2019 Nico Verbruggen. All rights reserved.
|
||||||
|
@ -17,9 +17,9 @@
|
|||||||
<key>CFBundlePackageType</key>
|
<key>CFBundlePackageType</key>
|
||||||
<string>APPL</string>
|
<string>APPL</string>
|
||||||
<key>CFBundleShortVersionString</key>
|
<key>CFBundleShortVersionString</key>
|
||||||
<string>1.3</string>
|
<string>$(MARKETING_VERSION)</string>
|
||||||
<key>CFBundleVersion</key>
|
<key>CFBundleVersion</key>
|
||||||
<string>10</string>
|
<string>$(CURRENT_PROJECT_VERSION)</string>
|
||||||
<key>LSApplicationCategoryType</key>
|
<key>LSApplicationCategoryType</key>
|
||||||
<string>public.app-category.utilities</string>
|
<string>public.app-category.utilities</string>
|
||||||
<key>LSMinimumSystemVersion</key>
|
<key>LSMinimumSystemVersion</key>
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
//
|
//
|
||||||
// StateManager.swift
|
// StateManager.swift
|
||||||
// phpmon
|
// PHP Monitor
|
||||||
//
|
//
|
||||||
// Created by Nico Verbruggen on 11/07/2019.
|
// Created by Nico Verbruggen on 11/07/2019.
|
||||||
// Copyright © 2019 Nico Verbruggen. All rights reserved.
|
// Copyright © 2019 Nico Verbruggen. All rights reserved.
|
||||||
|
50
phpmon/Singletons/Command.swift
Normal file
50
phpmon/Singletons/Command.swift
Normal file
@ -0,0 +1,50 @@
|
|||||||
|
//
|
||||||
|
// Command.swift
|
||||||
|
// PHP Monitor
|
||||||
|
//
|
||||||
|
// Created by Nico Verbruggen on 17/10/2019.
|
||||||
|
// Copyright © 2019 Nico Verbruggen. All rights reserved.
|
||||||
|
//
|
||||||
|
|
||||||
|
import Cocoa
|
||||||
|
|
||||||
|
class Command {
|
||||||
|
|
||||||
|
public static func execute(path: String, arguments: [String]) -> String {
|
||||||
|
let task = Process()
|
||||||
|
task.launchPath = path
|
||||||
|
task.arguments = arguments
|
||||||
|
|
||||||
|
let pipe = Pipe()
|
||||||
|
task.standardOutput = pipe
|
||||||
|
task.launch()
|
||||||
|
|
||||||
|
let data = pipe.fileHandleForReading.readDataToEndOfFile()
|
||||||
|
let output: String = String.init(data: data, encoding: String.Encoding.utf8)!
|
||||||
|
return output;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static func experiment() {
|
||||||
|
/*
|
||||||
|
print("Running '/usr/local/bin/php -v' directly...")
|
||||||
|
print("========================================")
|
||||||
|
var start = DispatchTime.now()
|
||||||
|
print(Command.execute(path: "/usr/local/bin/php", arguments: ["-v"]))
|
||||||
|
var end = DispatchTime.now()
|
||||||
|
var nanoTime = end.uptimeNanoseconds - start.uptimeNanoseconds
|
||||||
|
var timeInterval = Double(nanoTime) / 1_000_000_000
|
||||||
|
print("Time to run command directly: \(timeInterval) seconds")
|
||||||
|
|
||||||
|
print("")
|
||||||
|
print("Running 'bash -> php -v'...")
|
||||||
|
print("========================================")
|
||||||
|
start = DispatchTime.now()
|
||||||
|
print(Shell.user.pipe("php -v"))
|
||||||
|
end = DispatchTime.now()
|
||||||
|
nanoTime = end.uptimeNanoseconds - start.uptimeNanoseconds
|
||||||
|
timeInterval = Double(nanoTime) / 1_000_000_000
|
||||||
|
print("Time to run command via bash: \(timeInterval) seconds")
|
||||||
|
*/
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -1,6 +1,6 @@
|
|||||||
//
|
//
|
||||||
// MainMenu.swift
|
// MainMenu.swift
|
||||||
// phpmon
|
// PHP Monitor
|
||||||
//
|
//
|
||||||
// Created by Nico Verbruggen on 11/07/2019.
|
// Created by Nico Verbruggen on 11/07/2019.
|
||||||
// Copyright © 2019 Nico Verbruggen. All rights reserved.
|
// Copyright © 2019 Nico Verbruggen. All rights reserved.
|
||||||
@ -63,15 +63,33 @@ class MainMenu: NSObject, NSWindowDelegate {
|
|||||||
menu.addItem(NSMenuItem.separator())
|
menu.addItem(NSMenuItem.separator())
|
||||||
}
|
}
|
||||||
if (App.shared.currentVersion != nil) {
|
if (App.shared.currentVersion != nil) {
|
||||||
menu.addItem(NSMenuItem(title: "PHP configuration file (php.ini)", action: #selector(self.openActiveConfigFolder), keyEquivalent: ""))
|
menu.addItem(NSMenuItem(title: "PHP configuration file (php.ini)", action: #selector(self.openActiveConfigFolder), keyEquivalent: "c"))
|
||||||
|
let xdebugFound = App.shared.currentVersion!.xdebugFound
|
||||||
|
if (xdebugFound) {
|
||||||
|
let xdebugOn = App.shared.currentVersion!.xdebugEnabled
|
||||||
|
let xdebugToggleMenuItem = NSMenuItem(
|
||||||
|
title: "Xdebug",
|
||||||
|
action: #selector(self.toggleXdebug), keyEquivalent: "x"
|
||||||
|
)
|
||||||
|
if (xdebugOn) {
|
||||||
|
xdebugToggleMenuItem.state = .on
|
||||||
|
}
|
||||||
|
menu.addItem(xdebugToggleMenuItem)
|
||||||
|
} else {
|
||||||
|
let disabledItem = NSMenuItem(
|
||||||
|
title: "xdebug.so missing",
|
||||||
|
action: nil, keyEquivalent: "x"
|
||||||
|
)
|
||||||
|
disabledItem.isEnabled = false
|
||||||
|
menu.addItem(disabledItem)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
menu.addItem(NSMenuItem(title: "View shell output", action: #selector(self.openOutput), keyEquivalent: ""))
|
|
||||||
menu.addItem(NSMenuItem.separator())
|
menu.addItem(NSMenuItem.separator())
|
||||||
menu.addItem(NSMenuItem(title: "About phpmon", action: #selector(self.openAbout), keyEquivalent: ""))
|
menu.addItem(NSMenuItem(title: "About PHP Monitor", action: #selector(self.openAbout), keyEquivalent: ""))
|
||||||
menu.items.forEach({ (item) in
|
menu.items.forEach({ (item) in
|
||||||
item.target = self
|
item.target = self
|
||||||
})
|
})
|
||||||
menu.addItem(NSMenuItem(title: "Quit phpmon", action: #selector(NSApplication.terminate(_:)), keyEquivalent: "q"))
|
menu.addItem(NSMenuItem(title: "Quit PHP Monitor", action: #selector(NSApplication.terminate(_:)), keyEquivalent: "q"))
|
||||||
DispatchQueue.main.async {
|
DispatchQueue.main.async {
|
||||||
self.statusItem.menu = menu
|
self.statusItem.menu = menu
|
||||||
}
|
}
|
||||||
@ -95,10 +113,6 @@ class MainMenu: NSObject, NSWindowDelegate {
|
|||||||
|
|
||||||
// MARK: - Callable via Obj-C (#selector)
|
// MARK: - Callable via Obj-C (#selector)
|
||||||
|
|
||||||
@objc func openOutput() {
|
|
||||||
LogViewController.show(delegate: self)
|
|
||||||
}
|
|
||||||
|
|
||||||
@objc func updatePhpVersionInStatusBar() {
|
@objc func updatePhpVersionInStatusBar() {
|
||||||
App.shared.currentVersion = PhpVersion()
|
App.shared.currentVersion = PhpVersion()
|
||||||
if (App.shared.busy) {
|
if (App.shared.busy) {
|
||||||
@ -147,6 +161,19 @@ class MainMenu: NSObject, NSWindowDelegate {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@objc public func toggleXdebug() {
|
||||||
|
DispatchQueue.global(qos: .userInitiated).async { [unowned self] in
|
||||||
|
DispatchQueue.main.async {
|
||||||
|
self.setStatusBar(image: NSImage(named: NSImage.Name("StatusBarIcon"))!)
|
||||||
|
}
|
||||||
|
Actions.toggleXdebug()
|
||||||
|
DispatchQueue.main.async {
|
||||||
|
self.updatePhpVersionInStatusBar()
|
||||||
|
self.update()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
func windowWillClose(_ notification: Notification) {
|
func windowWillClose(_ notification: Notification) {
|
||||||
App.shared.windowController = nil
|
App.shared.windowController = nil
|
||||||
Shell.user.delegate = nil
|
Shell.user.delegate = nil
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
//
|
//
|
||||||
// Shell.swift
|
// Shell.swift
|
||||||
// phpmon
|
// PHP Monitor
|
||||||
//
|
//
|
||||||
// Created by Nico Verbruggen on 11/06/2019.
|
// Created by Nico Verbruggen on 11/06/2019.
|
||||||
// Copyright © 2019 Nico Verbruggen. All rights reserved.
|
// Copyright © 2019 Nico Verbruggen. All rights reserved.
|
||||||
@ -60,11 +60,15 @@ class Shell {
|
|||||||
) as String
|
) as String
|
||||||
|
|
||||||
let historyItem = ShellHistoryItem(command: command, output: output)
|
let historyItem = ShellHistoryItem(command: command, output: output)
|
||||||
history.append(historyItem)
|
|
||||||
// Keep the last 100 items
|
|
||||||
history = history.suffix(100)
|
|
||||||
delegate?.didCompleteCommand(historyItem: historyItem)
|
|
||||||
|
|
||||||
|
DispatchQueue.global(qos: .userInitiated).async { [unowned self] in
|
||||||
|
self.history.append(historyItem)
|
||||||
|
// Keep the last 100 items
|
||||||
|
self.history = self.history.suffix(100)
|
||||||
|
}
|
||||||
|
|
||||||
|
delegate?.didCompleteCommand(historyItem: historyItem)
|
||||||
|
|
||||||
return output
|
return output
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,8 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<document type="com.apple.InterfaceBuilder3.Cocoa.Storyboard.XIB" version="3.0" toolsVersion="14490.70" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES">
|
<document type="com.apple.InterfaceBuilder3.Cocoa.Storyboard.XIB" version="3.0" toolsVersion="15702" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES">
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="14490.70"/>
|
<deployment identifier="macosx"/>
|
||||||
|
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="15702"/>
|
||||||
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
|
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
<scenes>
|
<scenes>
|
||||||
@ -11,18 +12,18 @@
|
|||||||
<application id="hnw-xV-0zn" sceneMemberID="viewController">
|
<application id="hnw-xV-0zn" sceneMemberID="viewController">
|
||||||
<menu key="mainMenu" title="Main Menu" systemMenu="main" id="AYu-sK-qS6">
|
<menu key="mainMenu" title="Main Menu" systemMenu="main" id="AYu-sK-qS6">
|
||||||
<items>
|
<items>
|
||||||
<menuItem title="phpmon" id="1Xt-HY-uBw">
|
<menuItem title="PHP Monitor" id="1Xt-HY-uBw">
|
||||||
<modifierMask key="keyEquivalentModifierMask"/>
|
<modifierMask key="keyEquivalentModifierMask"/>
|
||||||
<menu key="submenu" title="phpmon" systemMenu="apple" id="uQy-DD-JDr">
|
<menu key="submenu" title="PHP Monitor" systemMenu="apple" id="uQy-DD-JDr">
|
||||||
<items>
|
<items>
|
||||||
<menuItem title="About phpmon" id="5kV-Vb-QxS">
|
<menuItem title="About PHP Monitor" id="5kV-Vb-QxS">
|
||||||
<modifierMask key="keyEquivalentModifierMask"/>
|
<modifierMask key="keyEquivalentModifierMask"/>
|
||||||
<connections>
|
<connections>
|
||||||
<action selector="orderFrontStandardAboutPanel:" target="Ady-hI-5gd" id="Exp-CZ-Vem"/>
|
<action selector="orderFrontStandardAboutPanel:" target="Ady-hI-5gd" id="Exp-CZ-Vem"/>
|
||||||
</connections>
|
</connections>
|
||||||
</menuItem>
|
</menuItem>
|
||||||
<menuItem isSeparatorItem="YES" id="VOq-y0-SEH"/>
|
<menuItem isSeparatorItem="YES" id="VOq-y0-SEH"/>
|
||||||
<menuItem title="Quit phpmon" keyEquivalent="q" id="4sb-4s-VLi">
|
<menuItem title="Quit PHP Monitor" keyEquivalent="q" id="4sb-4s-VLi">
|
||||||
<connections>
|
<connections>
|
||||||
<action selector="terminate:" target="Ady-hI-5gd" id="Te7-pn-YzF"/>
|
<action selector="terminate:" target="Ady-hI-5gd" id="Te7-pn-YzF"/>
|
||||||
</connections>
|
</connections>
|
||||||
@ -34,7 +35,7 @@
|
|||||||
<modifierMask key="keyEquivalentModifierMask"/>
|
<modifierMask key="keyEquivalentModifierMask"/>
|
||||||
<menu key="submenu" title="Help" systemMenu="help" id="F2S-fz-NVQ">
|
<menu key="submenu" title="Help" systemMenu="help" id="F2S-fz-NVQ">
|
||||||
<items>
|
<items>
|
||||||
<menuItem title="phpmon Help" keyEquivalent="?" id="FKE-Sm-Kum">
|
<menuItem title="PHP Monitor Help" keyEquivalent="?" id="FKE-Sm-Kum">
|
||||||
<connections>
|
<connections>
|
||||||
<action selector="showHelp:" target="Ady-hI-5gd" id="y7X-2Q-9no"/>
|
<action selector="showHelp:" target="Ady-hI-5gd" id="y7X-2Q-9no"/>
|
||||||
</connections>
|
</connections>
|
||||||
@ -48,22 +49,22 @@
|
|||||||
<outlet property="delegate" destination="Voe-Tx-rLC" id="PrD-fu-P6m"/>
|
<outlet property="delegate" destination="Voe-Tx-rLC" id="PrD-fu-P6m"/>
|
||||||
</connections>
|
</connections>
|
||||||
</application>
|
</application>
|
||||||
<customObject id="Voe-Tx-rLC" customClass="AppDelegate" customModule="phpmon" customModuleProvider="target"/>
|
<customObject id="Voe-Tx-rLC" customClass="AppDelegate" customModule="PHP_Monitor" customModuleProvider="target"/>
|
||||||
<customObject id="YLy-65-1bz" customClass="NSFontManager"/>
|
<customObject id="YLy-65-1bz" customClass="NSFontManager"/>
|
||||||
<customObject id="Ady-hI-5gd" userLabel="First Responder" customClass="NSResponder" sceneMemberID="firstResponder"/>
|
<customObject id="Ady-hI-5gd" userLabel="First Responder" customClass="NSResponder" sceneMemberID="firstResponder"/>
|
||||||
</objects>
|
</objects>
|
||||||
<point key="canvasLocation" x="134" y="40"/>
|
<point key="canvasLocation" x="-343" y="-16"/>
|
||||||
</scene>
|
</scene>
|
||||||
<!--Log View Controller-->
|
<!--Log View Controller-->
|
||||||
<scene sceneID="hIz-AP-VOD">
|
<scene sceneID="hIz-AP-VOD">
|
||||||
<objects>
|
<objects>
|
||||||
<viewController storyboardIdentifier="logWindow" id="XfG-lQ-9wD" customClass="LogViewController" customModule="phpmon" customModuleProvider="target" sceneMemberID="viewController">
|
<viewController storyboardIdentifier="logWindow" id="XfG-lQ-9wD" customClass="LogViewController" customModule="PHP_Monitor" customModuleProvider="target" sceneMemberID="viewController">
|
||||||
<view key="view" identifier="main" id="m2S-Jp-Qdl">
|
<view key="view" identifier="main" id="m2S-Jp-Qdl">
|
||||||
<rect key="frame" x="0.0" y="0.0" width="662" height="475"/>
|
<rect key="frame" x="0.0" y="0.0" width="662" height="475"/>
|
||||||
<autoresizingMask key="autoresizingMask"/>
|
<autoresizingMask key="autoresizingMask"/>
|
||||||
<subviews>
|
<subviews>
|
||||||
<button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="ICa-gx-jgq">
|
<button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="ICa-gx-jgq">
|
||||||
<rect key="frame" x="573" y="8" width="75" height="32"/>
|
<rect key="frame" x="578" y="8" width="75" height="32"/>
|
||||||
<buttonCell key="cell" type="push" title="Close" bezelStyle="rounded" alignment="center" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="3md-FI-EWa">
|
<buttonCell key="cell" type="push" title="Close" bezelStyle="rounded" alignment="center" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="3md-FI-EWa">
|
||||||
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
|
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
|
||||||
<font key="font" metaFont="system"/>
|
<font key="font" metaFont="system"/>
|
||||||
@ -73,37 +74,38 @@
|
|||||||
</connections>
|
</connections>
|
||||||
</button>
|
</button>
|
||||||
<scrollView borderType="line" horizontalLineScroll="10" horizontalPageScroll="10" verticalLineScroll="10" verticalPageScroll="10" hasHorizontalScroller="NO" translatesAutoresizingMaskIntoConstraints="NO" id="vZy-5S-021">
|
<scrollView borderType="line" horizontalLineScroll="10" horizontalPageScroll="10" verticalLineScroll="10" verticalPageScroll="10" hasHorizontalScroller="NO" translatesAutoresizingMaskIntoConstraints="NO" id="vZy-5S-021">
|
||||||
<rect key="frame" x="20" y="46" width="622" height="409"/>
|
<rect key="frame" x="15" y="46" width="632" height="414"/>
|
||||||
<clipView key="contentView" drawsBackground="NO" copiesOnScroll="NO" id="s5L-AU-0fw">
|
<clipView key="contentView" drawsBackground="NO" copiesOnScroll="NO" id="s5L-AU-0fw">
|
||||||
<rect key="frame" x="1" y="1" width="620" height="407"/>
|
<rect key="frame" x="1" y="1" width="630" height="412"/>
|
||||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||||
<subviews>
|
<subviews>
|
||||||
<textView importsGraphics="NO" richText="NO" verticallyResizable="YES" smartInsertDelete="YES" id="tN6-Y9-1pA">
|
<textView importsGraphics="NO" richText="NO" verticallyResizable="YES" smartInsertDelete="YES" id="tN6-Y9-1pA">
|
||||||
<rect key="frame" x="0.0" y="0.0" width="620" height="407"/>
|
<rect key="frame" x="0.0" y="0.0" width="630" height="412"/>
|
||||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||||
<color key="textColor" name="textColor" catalog="System" colorSpace="catalog"/>
|
<color key="textColor" name="textColor" catalog="System" colorSpace="catalog"/>
|
||||||
<color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
|
<color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
|
||||||
<size key="minSize" width="620" height="407"/>
|
<size key="minSize" width="630" height="412"/>
|
||||||
<size key="maxSize" width="620" height="10000000"/>
|
<size key="maxSize" width="640" height="10000000"/>
|
||||||
<color key="insertionPointColor" name="textColor" catalog="System" colorSpace="catalog"/>
|
<color key="insertionPointColor" name="textColor" catalog="System" colorSpace="catalog"/>
|
||||||
</textView>
|
</textView>
|
||||||
</subviews>
|
</subviews>
|
||||||
|
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||||
</clipView>
|
</clipView>
|
||||||
<scroller key="horizontalScroller" hidden="YES" wantsLayer="YES" verticalHuggingPriority="750" horizontal="YES" id="Kho-JF-NZJ">
|
<scroller key="horizontalScroller" hidden="YES" wantsLayer="YES" verticalHuggingPriority="750" horizontal="YES" id="Kho-JF-NZJ">
|
||||||
<rect key="frame" x="-100" y="-100" width="240" height="16"/>
|
<rect key="frame" x="-100" y="-100" width="240" height="16"/>
|
||||||
<autoresizingMask key="autoresizingMask"/>
|
<autoresizingMask key="autoresizingMask"/>
|
||||||
</scroller>
|
</scroller>
|
||||||
<scroller key="verticalScroller" wantsLayer="YES" verticalHuggingPriority="750" horizontal="NO" id="qp7-7R-gTO">
|
<scroller key="verticalScroller" wantsLayer="YES" verticalHuggingPriority="750" horizontal="NO" id="qp7-7R-gTO">
|
||||||
<rect key="frame" x="605" y="1" width="16" height="407"/>
|
<rect key="frame" x="615" y="1" width="16" height="412"/>
|
||||||
<autoresizingMask key="autoresizingMask"/>
|
<autoresizingMask key="autoresizingMask"/>
|
||||||
</scroller>
|
</scroller>
|
||||||
</scrollView>
|
</scrollView>
|
||||||
</subviews>
|
</subviews>
|
||||||
<constraints>
|
<constraints>
|
||||||
<constraint firstItem="vZy-5S-021" firstAttribute="leading" secondItem="m2S-Jp-Qdl" secondAttribute="leading" constant="20" id="K0k-oE-r37"/>
|
<constraint firstItem="vZy-5S-021" firstAttribute="leading" secondItem="m2S-Jp-Qdl" secondAttribute="leading" constant="15" id="K0k-oE-r37"/>
|
||||||
<constraint firstAttribute="trailing" secondItem="ICa-gx-jgq" secondAttribute="trailing" constant="20" id="LFS-0E-Ibw"/>
|
<constraint firstAttribute="trailing" secondItem="ICa-gx-jgq" secondAttribute="trailing" constant="15" id="LFS-0E-Ibw"/>
|
||||||
<constraint firstItem="vZy-5S-021" firstAttribute="top" secondItem="m2S-Jp-Qdl" secondAttribute="top" constant="20" id="Nec-oI-CjE"/>
|
<constraint firstItem="vZy-5S-021" firstAttribute="top" secondItem="m2S-Jp-Qdl" secondAttribute="top" constant="15" id="Nec-oI-CjE"/>
|
||||||
<constraint firstAttribute="trailing" secondItem="vZy-5S-021" secondAttribute="trailing" constant="20" id="kBJ-O5-eYI"/>
|
<constraint firstAttribute="trailing" secondItem="vZy-5S-021" secondAttribute="trailing" constant="15" id="kBJ-O5-eYI"/>
|
||||||
<constraint firstAttribute="bottom" secondItem="ICa-gx-jgq" secondAttribute="bottom" constant="15" id="kYB-Fn-DSA"/>
|
<constraint firstAttribute="bottom" secondItem="ICa-gx-jgq" secondAttribute="bottom" constant="15" id="kYB-Fn-DSA"/>
|
||||||
<constraint firstItem="ICa-gx-jgq" firstAttribute="top" secondItem="vZy-5S-021" secondAttribute="bottom" constant="10" id="xdn-yU-LVb"/>
|
<constraint firstItem="ICa-gx-jgq" firstAttribute="top" secondItem="vZy-5S-021" secondAttribute="bottom" constant="10" id="xdn-yU-LVb"/>
|
||||||
</constraints>
|
</constraints>
|
||||||
|
@ -1,72 +0,0 @@
|
|||||||
//
|
|
||||||
// ViewController.swift
|
|
||||||
// phpmon
|
|
||||||
//
|
|
||||||
// Created by Nico Verbruggen on 11/06/2019.
|
|
||||||
// Copyright © 2019 Nico Verbruggen. All rights reserved.
|
|
||||||
//
|
|
||||||
|
|
||||||
import Cocoa
|
|
||||||
|
|
||||||
class LogViewController: NSViewController, ShellDelegate {
|
|
||||||
|
|
||||||
public static func show(delegate: NSWindowDelegate? = nil) {
|
|
||||||
if (App.shared.windowController == nil) {
|
|
||||||
let vc = NSStoryboard(name: "Main", bundle: nil).instantiateController(withIdentifier: "logWindow") as! LogViewController
|
|
||||||
Shell.user.delegate = vc
|
|
||||||
let window = NSWindow(contentViewController: vc)
|
|
||||||
window.title = "Terminal Output"
|
|
||||||
window.delegate = delegate
|
|
||||||
App.shared.windowController = NSWindowController(window: window)
|
|
||||||
}
|
|
||||||
App.shared.windowController!.showWindow(self)
|
|
||||||
NSApp.activate(ignoringOtherApps: true)
|
|
||||||
}
|
|
||||||
|
|
||||||
@IBOutlet var textView: NSTextView!
|
|
||||||
|
|
||||||
public func appendHistoryItem(_ historyItem: ShellHistoryItem) {
|
|
||||||
self.append(
|
|
||||||
"""
|
|
||||||
======
|
|
||||||
@ \(historyItem.date.toString())
|
|
||||||
------
|
|
||||||
$ \(historyItem.command)
|
|
||||||
------
|
|
||||||
> \(historyItem.output)
|
|
||||||
|
|
||||||
"""
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
public func append(_ text : String) {
|
|
||||||
self.textView.textStorage?.append(
|
|
||||||
NSAttributedString(
|
|
||||||
string: text,
|
|
||||||
attributes: [
|
|
||||||
NSAttributedString.Key.font: NSFont(name: "Menlo", size: 12.0)!
|
|
||||||
]
|
|
||||||
)
|
|
||||||
)
|
|
||||||
self.textView.scrollToEndOfDocument(nil)
|
|
||||||
}
|
|
||||||
|
|
||||||
override func viewDidLoad() {
|
|
||||||
self.textView.isEditable = false
|
|
||||||
for entry in Shell.user.history {
|
|
||||||
self.appendHistoryItem(entry)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func didCompleteCommand(historyItem: ShellHistoryItem) {
|
|
||||||
self.appendHistoryItem(historyItem)
|
|
||||||
}
|
|
||||||
|
|
||||||
@IBAction func pressed(_ sender: Any) {
|
|
||||||
self.view.window?.windowController?.close()
|
|
||||||
}
|
|
||||||
|
|
||||||
deinit {
|
|
||||||
print("VC deallocated")
|
|
||||||
}
|
|
||||||
}
|
|
Reference in New Issue
Block a user