1
0
mirror of https://github.com/nicoverbruggen/phpmon.git synced 2025-08-07 20:10:08 +02:00

🚛 Move around files

This commit is contained in:
2022-09-21 21:06:11 +02:00
parent 90a69338f7
commit 39769d815f
6 changed files with 104 additions and 51 deletions

View File

@ -7,8 +7,8 @@
objects = { objects = {
/* Begin PBXBuildFile section */ /* Begin PBXBuildFile section */
03E36FE728D9219000636F7F /* NewShell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 03E36FE628D9219000636F7F /* NewShell.swift */; }; 03E36FE728D9219000636F7F /* NxtShell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 03E36FE628D9219000636F7F /* NxtShell.swift */; };
03E36FE828D9219000636F7F /* NewShell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 03E36FE628D9219000636F7F /* NewShell.swift */; }; 03E36FE828D9219000636F7F /* NxtShell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 03E36FE628D9219000636F7F /* NxtShell.swift */; };
5420395926135DC100FB00FA /* PrefsVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5420395826135DC100FB00FA /* PrefsVC.swift */; }; 5420395926135DC100FB00FA /* PrefsVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5420395826135DC100FB00FA /* PrefsVC.swift */; };
5420395F2613607600FB00FA /* Preferences.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5420395E2613607600FB00FA /* Preferences.swift */; }; 5420395F2613607600FB00FA /* Preferences.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5420395E2613607600FB00FA /* Preferences.swift */; };
5489625828312FAD004F647A /* CreatedFromFile.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5489625728312FAD004F647A /* CreatedFromFile.swift */; }; 5489625828312FAD004F647A /* CreatedFromFile.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5489625728312FAD004F647A /* CreatedFromFile.swift */; };
@ -148,6 +148,12 @@
C46E206D28299B3800D909D6 /* AppUpdateChecker.swift in Sources */ = {isa = PBXBuildFile; fileRef = C46E206C28299B3800D909D6 /* AppUpdateChecker.swift */; }; C46E206D28299B3800D909D6 /* AppUpdateChecker.swift in Sources */ = {isa = PBXBuildFile; fileRef = C46E206C28299B3800D909D6 /* AppUpdateChecker.swift */; };
C46E206E28299B3800D909D6 /* AppUpdateChecker.swift in Sources */ = {isa = PBXBuildFile; fileRef = C46E206C28299B3800D909D6 /* AppUpdateChecker.swift */; }; C46E206E28299B3800D909D6 /* AppUpdateChecker.swift in Sources */ = {isa = PBXBuildFile; fileRef = C46E206C28299B3800D909D6 /* AppUpdateChecker.swift */; };
C46E20702829D27F00D909D6 /* AppUpdaterCheckTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = C46E206F2829D27F00D909D6 /* AppUpdaterCheckTest.swift */; }; C46E20702829D27F00D909D6 /* AppUpdaterCheckTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = C46E206F2829D27F00D909D6 /* AppUpdaterCheckTest.swift */; };
C46EBC4428DB95F0007ACC74 /* Shellable.swift in Sources */ = {isa = PBXBuildFile; fileRef = C46EBC4328DB95F0007ACC74 /* Shellable.swift */; };
C46EBC4528DB95F0007ACC74 /* Shellable.swift in Sources */ = {isa = PBXBuildFile; fileRef = C46EBC4328DB95F0007ACC74 /* Shellable.swift */; };
C46EBC4728DB9644007ACC74 /* SystemShell.swift in Sources */ = {isa = PBXBuildFile; fileRef = C46EBC4628DB9644007ACC74 /* SystemShell.swift */; };
C46EBC4828DB9644007ACC74 /* SystemShell.swift in Sources */ = {isa = PBXBuildFile; fileRef = C46EBC4628DB9644007ACC74 /* SystemShell.swift */; };
C46EBC4A28DB966A007ACC74 /* TestableShell.swift in Sources */ = {isa = PBXBuildFile; fileRef = C46EBC4928DB966A007ACC74 /* TestableShell.swift */; };
C46EBC4B28DB966A007ACC74 /* TestableShell.swift in Sources */ = {isa = PBXBuildFile; fileRef = C46EBC4928DB966A007ACC74 /* TestableShell.swift */; };
C46FA23F246C358E00944F05 /* StringExtension.swift in Sources */ = {isa = PBXBuildFile; fileRef = C46FA23E246C358E00944F05 /* StringExtension.swift */; }; C46FA23F246C358E00944F05 /* StringExtension.swift in Sources */ = {isa = PBXBuildFile; fileRef = C46FA23E246C358E00944F05 /* StringExtension.swift */; };
C46FA9882822EFDC00D78807 /* PhpConfigurationFile.swift in Sources */ = {isa = PBXBuildFile; fileRef = C46FA9872822EFDC00D78807 /* PhpConfigurationFile.swift */; }; C46FA9882822EFDC00D78807 /* PhpConfigurationFile.swift in Sources */ = {isa = PBXBuildFile; fileRef = C46FA9872822EFDC00D78807 /* PhpConfigurationFile.swift */; };
C46FA9892822EFDC00D78807 /* PhpConfigurationFile.swift in Sources */ = {isa = PBXBuildFile; fileRef = C46FA9872822EFDC00D78807 /* PhpConfigurationFile.swift */; }; C46FA9892822EFDC00D78807 /* PhpConfigurationFile.swift in Sources */ = {isa = PBXBuildFile; fileRef = C46FA9872822EFDC00D78807 /* PhpConfigurationFile.swift */; };
@ -325,7 +331,7 @@
/* End PBXContainerItemProxy section */ /* End PBXContainerItemProxy section */
/* Begin PBXFileReference section */ /* Begin PBXFileReference section */
03E36FE628D9219000636F7F /* NewShell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NewShell.swift; sourceTree = "<group>"; }; 03E36FE628D9219000636F7F /* NxtShell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NxtShell.swift; sourceTree = "<group>"; };
5420395826135DC100FB00FA /* PrefsVC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PrefsVC.swift; sourceTree = "<group>"; }; 5420395826135DC100FB00FA /* PrefsVC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PrefsVC.swift; sourceTree = "<group>"; };
5420395E2613607600FB00FA /* Preferences.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Preferences.swift; sourceTree = "<group>"; }; 5420395E2613607600FB00FA /* Preferences.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Preferences.swift; sourceTree = "<group>"; };
5489625728312FAD004F647A /* CreatedFromFile.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CreatedFromFile.swift; sourceTree = "<group>"; }; 5489625728312FAD004F647A /* CreatedFromFile.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CreatedFromFile.swift; sourceTree = "<group>"; };
@ -418,6 +424,9 @@
C464ADB1275A87CA003FCD53 /* DomainListCellProtocol.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DomainListCellProtocol.swift; sourceTree = "<group>"; }; C464ADB1275A87CA003FCD53 /* DomainListCellProtocol.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DomainListCellProtocol.swift; sourceTree = "<group>"; };
C46E206C28299B3800D909D6 /* AppUpdateChecker.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppUpdateChecker.swift; sourceTree = "<group>"; }; C46E206C28299B3800D909D6 /* AppUpdateChecker.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppUpdateChecker.swift; sourceTree = "<group>"; };
C46E206F2829D27F00D909D6 /* AppUpdaterCheckTest.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppUpdaterCheckTest.swift; sourceTree = "<group>"; }; C46E206F2829D27F00D909D6 /* AppUpdaterCheckTest.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppUpdaterCheckTest.swift; sourceTree = "<group>"; };
C46EBC4328DB95F0007ACC74 /* Shellable.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Shellable.swift; sourceTree = "<group>"; };
C46EBC4628DB9644007ACC74 /* SystemShell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SystemShell.swift; sourceTree = "<group>"; };
C46EBC4928DB966A007ACC74 /* TestableShell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TestableShell.swift; sourceTree = "<group>"; };
C46FA23E246C358E00944F05 /* StringExtension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = StringExtension.swift; sourceTree = "<group>"; }; C46FA23E246C358E00944F05 /* StringExtension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = StringExtension.swift; sourceTree = "<group>"; };
C46FA9872822EFDC00D78807 /* PhpConfigurationFile.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PhpConfigurationFile.swift; sourceTree = "<group>"; }; C46FA9872822EFDC00D78807 /* PhpConfigurationFile.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PhpConfigurationFile.swift; sourceTree = "<group>"; };
C46FA98A2822F08F00D78807 /* PhpConfigurationTest.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PhpConfigurationTest.swift; sourceTree = "<group>"; }; C46FA98A2822F08F00D78807 /* PhpConfigurationTest.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PhpConfigurationTest.swift; sourceTree = "<group>"; };
@ -652,17 +661,16 @@
C4C1019A27C65C6F001FACC2 /* Process.swift */, C4C1019A27C65C6F001FACC2 /* Process.swift */,
C40C7F2F27722E8D00DDDCDC /* Logger.swift */, C40C7F2F27722E8D00DDDCDC /* Logger.swift */,
C417DC73277614690015E6EE /* Helpers.swift */, C417DC73277614690015E6EE /* Helpers.swift */,
03E36FE628D9219000636F7F /* NewShell.swift */,
); );
path = Core; path = Core;
sourceTree = "<group>"; sourceTree = "<group>";
}; };
C413E43328DA3E8F00AE33C7 /* Concord */ = { C413E43328DA3E8F00AE33C7 /* Next */ = {
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
C413E43428DA3EB100AE33C7 /* ShellTest.swift */, C413E43428DA3EB100AE33C7 /* ShellTest.swift */,
); );
path = Concord; path = Next;
sourceTree = "<group>"; sourceTree = "<group>";
}; };
C41C1B2A22B0097F00E7CF16 = { C41C1B2A22B0097F00E7CF16 = {
@ -693,6 +701,7 @@
C41C1B3522B0097F00E7CF16 /* phpmon */ = { C41C1B3522B0097F00E7CF16 /* phpmon */ = {
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
C46EBC3F28DB9550007ACC74 /* Next */,
C4B5853A2770FE2500DA4FBE /* Common */, C4B5853A2770FE2500DA4FBE /* Common */,
C41E181722CB61EB0072CF09 /* Domain */, C41E181722CB61EB0072CF09 /* Domain */,
54D9E0BE27E4F5C0003B9AD9 /* Vendor */, 54D9E0BE27E4F5C0003B9AD9 /* Vendor */,
@ -863,6 +872,17 @@
path = DomainList; path = DomainList;
sourceTree = "<group>"; sourceTree = "<group>";
}; };
C46EBC3F28DB9550007ACC74 /* Next */ = {
isa = PBXGroup;
children = (
03E36FE628D9219000636F7F /* NxtShell.swift */,
C46EBC4628DB9644007ACC74 /* SystemShell.swift */,
C46EBC4928DB966A007ACC74 /* TestableShell.swift */,
C46EBC4328DB95F0007ACC74 /* Shellable.swift */,
);
path = Next;
sourceTree = "<group>";
};
C47331A0247093AC009A0597 /* Menu */ = { C47331A0247093AC009A0597 /* Menu */ = {
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
@ -1150,7 +1170,7 @@
C4F7807A25D7F84B000DBC97 /* phpmon-tests */ = { C4F7807A25D7F84B000DBC97 /* phpmon-tests */ = {
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
C413E43328DA3E8F00AE33C7 /* Concord */, C413E43328DA3E8F00AE33C7 /* Next */,
C4F7807D25D7F84B000DBC97 /* Info.plist */, C4F7807D25D7F84B000DBC97 /* Info.plist */,
C43A8A1925D9CD1000591B77 /* Utility.swift */, C43A8A1925D9CD1000591B77 /* Utility.swift */,
C40C7F1C27720E1400DDDCDC /* Test Files */, C40C7F1C27720E1400DDDCDC /* Test Files */,
@ -1376,6 +1396,7 @@
C4AC51FC27E27F47008528CA /* DomainListKindCell.swift in Sources */, C4AC51FC27E27F47008528CA /* DomainListKindCell.swift in Sources */,
C4CDA893288F1A71007CE25F /* Keys.swift in Sources */, C4CDA893288F1A71007CE25F /* Keys.swift in Sources */,
C4F361612836BFD9003598CC /* MainMenu+Actions.swift in Sources */, C4F361612836BFD9003598CC /* MainMenu+Actions.swift in Sources */,
C46EBC4A28DB966A007ACC74 /* TestableShell.swift in Sources */,
C44C198D276E3A1C0072762D /* TerminalProgressWindowController.swift in Sources */, C44C198D276E3A1C0072762D /* TerminalProgressWindowController.swift in Sources */,
54D9E0B827E4F51E003B9AD9 /* KeyCombo.swift in Sources */, 54D9E0B827E4F51E003B9AD9 /* KeyCombo.swift in Sources */,
C4C0E8E727F88B41002D32A9 /* ProxyScanner.swift in Sources */, C4C0E8E727F88B41002D32A9 /* ProxyScanner.swift in Sources */,
@ -1386,6 +1407,7 @@
C415937F27A1B54F00D2E1B7 /* PhpFrameworks.swift in Sources */, C415937F27A1B54F00D2E1B7 /* PhpFrameworks.swift in Sources */,
C4811D2422D70A4700B5F6B3 /* App.swift in Sources */, C4811D2422D70A4700B5F6B3 /* App.swift in Sources */,
C495F5AF28A42E080087F70A /* EnvironmentCheck.swift in Sources */, C495F5AF28A42E080087F70A /* EnvironmentCheck.swift in Sources */,
C46EBC4428DB95F0007ACC74 /* Shellable.swift in Sources */,
C41C1B4922B00A9800E7CF16 /* MenuBarImageGenerator.swift in Sources */, C41C1B4922B00A9800E7CF16 /* MenuBarImageGenerator.swift in Sources */,
C4F30B03278E16BA00755FCE /* HomebrewService.swift in Sources */, C4F30B03278E16BA00755FCE /* HomebrewService.swift in Sources */,
54D9E0B427E4F51E003B9AD9 /* Key.swift in Sources */, 54D9E0B427E4F51E003B9AD9 /* Key.swift in Sources */,
@ -1402,9 +1424,10 @@
C41CA5ED2774F8EE00A2C80E /* DomainListVC+Actions.swift in Sources */, C41CA5ED2774F8EE00A2C80E /* DomainListVC+Actions.swift in Sources */,
C46E206D28299B3800D909D6 /* AppUpdateChecker.swift in Sources */, C46E206D28299B3800D909D6 /* AppUpdateChecker.swift in Sources */,
C412E5FC25700D5300A1FB67 /* HomebrewPackage.swift in Sources */, C412E5FC25700D5300A1FB67 /* HomebrewPackage.swift in Sources */,
03E36FE728D9219000636F7F /* NewShell.swift in Sources */, 03E36FE728D9219000636F7F /* NxtShell.swift in Sources */,
C4D9ADBF277610E1007277F4 /* PhpSwitcher.swift in Sources */, C4D9ADBF277610E1007277F4 /* PhpSwitcher.swift in Sources */,
C45E76142854A65300B4FE0C /* ServicesManager.swift in Sources */, C45E76142854A65300B4FE0C /* ServicesManager.swift in Sources */,
C46EBC4728DB9644007ACC74 /* SystemShell.swift in Sources */,
C4068CAA27B0890D00544CD5 /* MenuBarIcons.swift in Sources */, C4068CAA27B0890D00544CD5 /* MenuBarIcons.swift in Sources */,
C44264C02850BD2A007400F1 /* VersionPopoverView.swift in Sources */, C44264C02850BD2A007400F1 /* VersionPopoverView.swift in Sources */,
C4C8E81B276F54E5003AC782 /* PhpConfigWatcher.swift in Sources */, C4C8E81B276F54E5003AC782 /* PhpConfigWatcher.swift in Sources */,
@ -1475,6 +1498,7 @@
C413E43528DA3EB100AE33C7 /* ShellTest.swift in Sources */, C413E43528DA3EB100AE33C7 /* ShellTest.swift in Sources */,
C4205A7F27F4D21800191A39 /* ValetProxy.swift in Sources */, C4205A7F27F4D21800191A39 /* ValetProxy.swift in Sources */,
C42F26742805B4B400938AC7 /* DomainListable.swift in Sources */, C42F26742805B4B400938AC7 /* DomainListable.swift in Sources */,
C46EBC4528DB95F0007ACC74 /* Shellable.swift in Sources */,
C4F780C425D80B75000DBC97 /* MainMenu.swift in Sources */, C4F780C425D80B75000DBC97 /* MainMenu.swift in Sources */,
54FCFD2B276C8AA4004CE748 /* CheckboxPreferenceView.swift in Sources */, 54FCFD2B276C8AA4004CE748 /* CheckboxPreferenceView.swift in Sources */,
C415D3B82770F294005EF286 /* Actions.swift in Sources */, C415D3B82770F294005EF286 /* Actions.swift in Sources */,
@ -1554,7 +1578,7 @@
C4B97B7C275CF20A003F3378 /* App+GlobalHotkey.swift in Sources */, C4B97B7C275CF20A003F3378 /* App+GlobalHotkey.swift in Sources */,
5489625928313231004F647A /* CreatedFromFile.swift in Sources */, 5489625928313231004F647A /* CreatedFromFile.swift in Sources */,
54D9E0B327E4F51E003B9AD9 /* HotKeysController.swift in Sources */, 54D9E0B327E4F51E003B9AD9 /* HotKeysController.swift in Sources */,
03E36FE828D9219000636F7F /* NewShell.swift in Sources */, 03E36FE828D9219000636F7F /* NxtShell.swift in Sources */,
C4B97B79275CF1B5003F3378 /* App+ActivationPolicy.swift in Sources */, C4B97B79275CF1B5003F3378 /* App+ActivationPolicy.swift in Sources */,
C4CE3BBB27B324230086CA49 /* MainMenu+Switcher.swift in Sources */, C4CE3BBB27B324230086CA49 /* MainMenu+Switcher.swift in Sources */,
C46E20702829D27F00D909D6 /* AppUpdaterCheckTest.swift in Sources */, C46E20702829D27F00D909D6 /* AppUpdaterCheckTest.swift in Sources */,
@ -1589,6 +1613,7 @@
C4F780B725D80B5D000DBC97 /* App.swift in Sources */, C4F780B725D80B5D000DBC97 /* App.swift in Sources */,
C4927F0C27B2DFC200C55AFD /* Errors.swift in Sources */, C4927F0C27B2DFC200C55AFD /* Errors.swift in Sources */,
C485707628BF455100539B36 /* SectionHeaderView.swift in Sources */, C485707628BF455100539B36 /* SectionHeaderView.swift in Sources */,
C46EBC4828DB9644007ACC74 /* SystemShell.swift in Sources */,
C4E4404727C56F4700D225E1 /* ValetSite.swift in Sources */, C4E4404727C56F4700D225E1 /* ValetSite.swift in Sources */,
C44CCD4A27AFF3BC00CE40E5 /* MainMenu+Async.swift in Sources */, C44CCD4A27AFF3BC00CE40E5 /* MainMenu+Async.swift in Sources */,
C449B4F327EE7FC600C47E8A /* DomainListTypeCell.swift in Sources */, C449B4F327EE7FC600C47E8A /* DomainListTypeCell.swift in Sources */,
@ -1609,6 +1634,7 @@
C40C7F1F2772136000DDDCDC /* PhpEnv.swift in Sources */, C40C7F1F2772136000DDDCDC /* PhpEnv.swift in Sources */,
C464ADB0275A7A6A003FCD53 /* DomainListVC.swift in Sources */, C464ADB0275A7A6A003FCD53 /* DomainListVC.swift in Sources */,
C43A8A1A25D9CD1000591B77 /* Utility.swift in Sources */, C43A8A1A25D9CD1000591B77 /* Utility.swift in Sources */,
C46EBC4B28DB966A007ACC74 /* TestableShell.swift in Sources */,
C418898A275FE8CB001EF227 /* Filesystem.swift in Sources */, C418898A275FE8CB001EF227 /* Filesystem.swift in Sources */,
C40FE73B282ABB2E00A302C2 /* AppVersionTest.swift in Sources */, C40FE73B282ABB2E00A302C2 /* AppVersionTest.swift in Sources */,
C4F780C625D80B75000DBC97 /* XibLoadable.swift in Sources */, C4F780C625D80B75000DBC97 /* XibLoadable.swift in Sources */,

View File

@ -10,9 +10,9 @@ import XCTest
class ShellTest: XCTestCase { class ShellTest: XCTestCase {
func test_default_shell_is_system_shell() { func test_default_shell_is_system_shell() {
XCTAssertTrue(NewShell.shared is SystemShell) XCTAssertTrue(NxtShell.shared is SystemShell)
XCTAssertTrue(NewShell.shared.syncPipe("php -v") XCTAssertTrue(NxtShell.shared.syncPipe("php -v")
.contains("Copyright (c) The PHP Group")) .contains("Copyright (c) The PHP Group"))
} }
@ -25,12 +25,12 @@ class ShellTest: XCTestCase {
with Xdebug v3.1.4, Copyright (c) 2002-2022, by Derick Rethans with Xdebug v3.1.4, Copyright (c) 2002-2022, by Derick Rethans
""" """
NewShell.useTestable([ NxtShell.useTestable([
"php -v": expectedPhpOutput "php -v": expectedPhpOutput
]) ])
XCTAssertTrue(NewShell.shared is TestableShell) XCTAssertTrue(NxtShell.shared is TestableShell)
XCTAssertEqual(expectedPhpOutput, NewShell.shared.syncPipe("php -v")) XCTAssertEqual(expectedPhpOutput, NxtShell.shared.syncPipe("php -v"))
} }
} }

View File

@ -0,0 +1,23 @@
//
// Shell.swift
// PHP Monitor
//
// Created by Nico Verbruggen on 20/09/2022.
// Copyright © 2022 Nico Verbruggen. All rights reserved.
//
import Foundation
class NxtShell {
static var shared: Shellable = SystemShell()
/// Uses a testable shell with predefined responses. You specify the terminal's output.
public static func useTestable(_ expectations: [String: String]) {
Self.shared = TestableShell(expectations: expectations)
}
/// Reverts back to the system shell. You do not need to call this, only after using `useTestable()`.
public static func useSystem() {
Self.shared = SystemShell()
}
}

View File

@ -0,0 +1,14 @@
//
// Shellable.swift
// PHP Monitor
//
// Created by Nico Verbruggen on 21/09/2022.
// Copyright © 2022 Nico Verbruggen. All rights reserved.
//
import Foundation
protocol Shellable {
func syncPipe(_ command: String) -> String
func pipe(_ command: String) async -> String
}

View File

@ -1,32 +1,13 @@
// //
// NewShell.swift // SystemShell.swift
// PHP Monitor // PHP Monitor
// //
// Created by Nico Verbruggen on 20/09/2022. // Created by Nico Verbruggen on 21/09/2022.
// Copyright © 2022 Nico Verbruggen. All rights reserved. // Copyright © 2022 Nico Verbruggen. All rights reserved.
// //
import Foundation import Foundation
class NewShell {
static var shared: Shellable = SystemShell()
/// Uses a testable shell with predefined responses. You specify the terminal's output.
public static func useTestable(_ expectations: [String: String]) {
Self.shared = TestableShell(expectations: expectations)
}
/// Reverts back to the system shell. You do not need to call this, only after using `useTestable()`.
public static func useSystem() {
Self.shared = SystemShell()
}
}
protocol Shellable {
func syncPipe(_ command: String) -> String
func pipe(_ command: String) async -> String
}
class SystemShell: Shellable { class SystemShell: Shellable {
public var launchPath: String = "/bin/sh" public var launchPath: String = "/bin/sh"
@ -69,19 +50,3 @@ class SystemShell: Shellable {
return "" return ""
} }
} }
class TestableShell: Shellable {
init(expectations: [String: String]) {
self.expectations = expectations
}
var expectations: [String: String] = [:]
func pipe(_ command: String) async -> String {
return expectations[command] ?? ""
}
func syncPipe(_ command: String) -> String {
return expectations[command] ?? ""
}
}

View File

@ -0,0 +1,25 @@
//
// TestableShell.swift
// PHP Monitor
//
// Created by Nico Verbruggen on 21/09/2022.
// Copyright © 2022 Nico Verbruggen. All rights reserved.
//
import Foundation
class TestableShell: Shellable {
init(expectations: [String: String]) {
self.expectations = expectations
}
var expectations: [String: String] = [:]
func pipe(_ command: String) async -> String {
return expectations[command] ?? ""
}
func syncPipe(_ command: String) -> String {
return expectations[command] ?? ""
}
}