mirror of
https://github.com/nicoverbruggen/phpmon.git
synced 2025-08-08 04:20:07 +02:00
👌 Code style fixes (empty line before class closes)
This commit is contained in:
@ -77,4 +77,5 @@ class AppDelegate: NSObject, NSApplicationDelegate, NSUserNotificationCenterDele
|
|||||||
) -> Bool {
|
) -> Bool {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -217,4 +217,5 @@ class Actions {
|
|||||||
.trimmingCharacters(in: .whitespacesAndNewlines)
|
.trimmingCharacters(in: .whitespacesAndNewlines)
|
||||||
.contains("YES")
|
.contains("YES")
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -124,4 +124,5 @@ class Startup {
|
|||||||
breaking ? failureCallback() : ()
|
breaking ? failureCallback() : ()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -7,11 +7,12 @@
|
|||||||
|
|
||||||
import Cocoa
|
import Cocoa
|
||||||
|
|
||||||
extension Date
|
extension Date {
|
||||||
{
|
|
||||||
func toString() -> String {
|
func toString() -> String {
|
||||||
let dateFormatter = DateFormatter()
|
let dateFormatter = DateFormatter()
|
||||||
dateFormatter.dateFormat = "yyyy-MM-dd HH:mm:ss"
|
dateFormatter.dateFormat = "yyyy-MM-dd HH:mm:ss"
|
||||||
return dateFormatter.string(from: self)
|
return dateFormatter.string(from: self)
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -33,4 +33,5 @@ extension String {
|
|||||||
let end = r.upperBound
|
let end = r.upperBound
|
||||||
return String(self[start ..< end])
|
return String(self[start ..< end])
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -7,17 +7,19 @@
|
|||||||
//
|
//
|
||||||
|
|
||||||
import Foundation
|
import Foundation
|
||||||
|
|
||||||
import Cocoa
|
import Cocoa
|
||||||
|
|
||||||
// Adapted from: https://stackoverflow.com/a/46268778
|
// Adapted from: https://stackoverflow.com/a/46268778
|
||||||
|
|
||||||
protocol XibLoadable {
|
protocol XibLoadable {
|
||||||
|
|
||||||
static var xibName: String? { get }
|
static var xibName: String? { get }
|
||||||
static func createFromXib(in bundle: Bundle) -> Self?
|
static func createFromXib(in bundle: Bundle) -> Self?
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
extension XibLoadable where Self: NSView {
|
extension XibLoadable where Self: NSView {
|
||||||
|
|
||||||
static var xibName: String? {
|
static var xibName: String? {
|
||||||
return String(describing: Self.self)
|
return String(describing: Self.self)
|
||||||
}
|
}
|
||||||
@ -30,4 +32,5 @@ extension XibLoadable where Self: NSView {
|
|||||||
let views = Array<Any>(results).filter { $0 is Self }
|
let views = Array<Any>(results).filter { $0 is Self }
|
||||||
return views.last as? Self
|
return views.last as? Self
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -8,6 +8,7 @@
|
|||||||
import Foundation
|
import Foundation
|
||||||
|
|
||||||
struct HomebrewPackage : Decodable {
|
struct HomebrewPackage : Decodable {
|
||||||
|
|
||||||
let name: String
|
let name: String
|
||||||
let full_name: String
|
let full_name: String
|
||||||
let aliases: [String]
|
let aliases: [String]
|
||||||
@ -15,4 +16,5 @@ struct HomebrewPackage : Decodable {
|
|||||||
public var version: String {
|
public var version: String {
|
||||||
return aliases.first!.replacingOccurrences(of: "php@", with: "")
|
return aliases.first!.replacingOccurrences(of: "php@", with: "")
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -10,6 +10,7 @@ import Foundation
|
|||||||
import Cocoa
|
import Cocoa
|
||||||
|
|
||||||
class HeaderView: NSView, XibLoadable {
|
class HeaderView: NSView, XibLoadable {
|
||||||
|
|
||||||
@IBOutlet weak var textField: NSTextField!
|
@IBOutlet weak var textField: NSTextField!
|
||||||
|
|
||||||
static func asMenuItem(text: String) -> NSMenuItem {
|
static func asMenuItem(text: String) -> NSMenuItem {
|
||||||
@ -20,4 +21,5 @@ class HeaderView: NSView, XibLoadable {
|
|||||||
item.target = self
|
item.target = self
|
||||||
return item
|
return item
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -10,6 +10,7 @@ import Foundation
|
|||||||
import Cocoa
|
import Cocoa
|
||||||
|
|
||||||
class StatsView: NSView, XibLoadable {
|
class StatsView: NSView, XibLoadable {
|
||||||
|
|
||||||
@IBOutlet weak var titleMemLimit: NSTextField!
|
@IBOutlet weak var titleMemLimit: NSTextField!
|
||||||
@IBOutlet weak var titleMaxPost: NSTextField!
|
@IBOutlet weak var titleMaxPost: NSTextField!
|
||||||
@IBOutlet weak var titleMaxUpload: NSTextField!
|
@IBOutlet weak var titleMaxUpload: NSTextField!
|
||||||
@ -31,4 +32,5 @@ class StatsView: NSView, XibLoadable {
|
|||||||
item.target = self
|
item.target = self
|
||||||
return item
|
return item
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -104,4 +104,5 @@ class PhpExtension {
|
|||||||
return PhpExtension($0, file: path.path)
|
return PhpExtension($0, file: path.path)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -169,4 +169,5 @@ class PhpInstallation {
|
|||||||
var upload_max_filesize = "???"
|
var upload_max_filesize = "???"
|
||||||
var post_max_size = "???"
|
var post_max_size = "???"
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -14,6 +14,7 @@ struct Keys {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class PrefsWC: NSWindowController {
|
class PrefsWC: NSWindowController {
|
||||||
|
|
||||||
override func windowDidLoad() {
|
override func windowDidLoad() {
|
||||||
super.windowDidLoad()
|
super.windowDidLoad()
|
||||||
}
|
}
|
||||||
|
@ -64,4 +64,5 @@ class Paths {
|
|||||||
public static var etcPath: String {
|
public static var etcPath: String {
|
||||||
return "\(shared.baseDir.rawValue)/etc"
|
return "\(shared.baseDir.rawValue)/etc"
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -21,7 +21,7 @@ class Shell {
|
|||||||
|
|
||||||
// MARK: - Singleton
|
// MARK: - Singleton
|
||||||
|
|
||||||
var shell = "/bin/sh"
|
var shell: String
|
||||||
|
|
||||||
init() {
|
init() {
|
||||||
// Determine if we're using macOS Catalina or newer (that support /bin/zsh as default shell)
|
// Determine if we're using macOS Catalina or newer (that support /bin/zsh as default shell)
|
||||||
@ -29,9 +29,14 @@ class Shell {
|
|||||||
.init(majorVersion: 10, minorVersion: 15, patchVersion: 0))
|
.init(majorVersion: 10, minorVersion: 15, patchVersion: 0))
|
||||||
|
|
||||||
// If macOS Mojave is being used, we'll default to /bin/bash
|
// If macOS Mojave is being used, we'll default to /bin/bash
|
||||||
shell = at_least_10_15 ? "/bin/sh" : "/bin/bash"
|
shell = at_least_10_15
|
||||||
print(at_least_10_15 ? "Detected recent macOS (> 10.15): defaulting to /bin/sh"
|
? "/bin/sh"
|
||||||
: "Detected older macOS (< 10.15): so defaulting to /bin/bash")
|
: "/bin/bash"
|
||||||
|
|
||||||
|
print(at_least_10_15
|
||||||
|
? "Detected recent macOS (> 10.15): defaulting to /bin/sh"
|
||||||
|
: "Detected older macOS (< 10.15): defaulting to /bin/bash"
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -78,4 +83,5 @@ class Shell {
|
|||||||
public static func fileExists(_ path: String) -> Bool {
|
public static func fileExists(_ path: String) -> Bool {
|
||||||
return Shell.pipe("if [ -f \(path) ]; then /bin/echo -n \"0\"; fi") == "0"
|
return Shell.pipe("if [ -f \(path) ]; then /bin/echo -n \"0\"; fi") == "0"
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user