diff --git a/src/Kube-Solo.xcodeproj/project.pbxproj b/src/Kube-Solo.xcodeproj/project.pbxproj index 4fce8b7..d8e4cdf 100644 --- a/src/Kube-Solo.xcodeproj/project.pbxproj +++ b/src/Kube-Solo.xcodeproj/project.pbxproj @@ -248,11 +248,12 @@ isa = PBXProject; attributes = { LastSwiftUpdateCheck = 0730; - LastUpgradeCheck = 0710; + LastUpgradeCheck = 0800; ORGANIZATIONNAME = "Rimantas Mocevicius"; TargetAttributes = { 01E2853918A6C4E300BC630D = { DevelopmentTeam = 5LVLAZJPH7; + LastSwiftMigration = 0800; SystemCapabilities = { com.apple.Sandbox = { enabled = 0; @@ -383,14 +384,19 @@ CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; CLANG_WARN_EMPTY_BODY = YES; CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; CLANG_WARN_INT_CONVERSION = YES; CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNREACHABLE_CODE = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; COPY_PHASE_STRIP = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; ENABLE_TESTABILITY = YES; GCC_C_LANGUAGE_STANDARD = gnu99; GCC_DYNAMIC_NO_PIC = NO; GCC_ENABLE_OBJC_EXCEPTIONS = YES; + GCC_NO_COMMON_BLOCKS = YES; GCC_OPTIMIZATION_LEVEL = 0; GCC_PREPROCESSOR_DEFINITIONS = ( "DEBUG=1", @@ -421,14 +427,19 @@ CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; CLANG_WARN_EMPTY_BODY = YES; CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; CLANG_WARN_INT_CONVERSION = YES; CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNREACHABLE_CODE = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; COPY_PHASE_STRIP = YES; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; ENABLE_NS_ASSERTIONS = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; GCC_C_LANGUAGE_STANDARD = gnu99; GCC_ENABLE_OBJC_EXCEPTIONS = YES; + GCC_NO_COMMON_BLOCKS = YES; GCC_WARN_64_TO_32_BIT_CONVERSION = YES; GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; GCC_WARN_UNDECLARED_SELECTOR = YES; @@ -437,6 +448,7 @@ GCC_WARN_UNUSED_VARIABLE = YES; MACOSX_DEPLOYMENT_TARGET = 10.10; SDKROOT = macosx; + SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; }; name = Release; }; @@ -447,6 +459,7 @@ CLANG_ENABLE_OBJC_ARC = YES; "CODE_SIGN_IDENTITY[sdk=macosx*]" = "Mac Developer"; COMBINE_HIDPI_IMAGES = YES; + DEVELOPMENT_TEAM = 5LVLAZJPH7; GCC_PRECOMPILE_PREFIX_HEADER = YES; GCC_PREFIX_HEADER = "Kube-Solo/Kube-Solo-Prefix.pch"; INFOPLIST_FILE = "Kube-Solo/Kube-Solo-Info.plist"; @@ -461,6 +474,7 @@ PROVISIONING_PROFILE = ""; SWIFT_OBJC_BRIDGING_HEADER = "Kube-Solo/Kube-Solo-Bridging-Header.h"; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + SWIFT_VERSION = 3.0; WRAPPER_EXTENSION = app; }; name = Debug; @@ -472,6 +486,7 @@ CLANG_ENABLE_OBJC_ARC = YES; "CODE_SIGN_IDENTITY[sdk=macosx*]" = "Mac Developer"; COMBINE_HIDPI_IMAGES = YES; + DEVELOPMENT_TEAM = 5LVLAZJPH7; GCC_PRECOMPILE_PREFIX_HEADER = YES; GCC_PREFIX_HEADER = "Kube-Solo/Kube-Solo-Prefix.pch"; INFOPLIST_FILE = "Kube-Solo/Kube-Solo-Info.plist"; @@ -485,6 +500,7 @@ PRODUCT_NAME = "Kube-Solo"; PROVISIONING_PROFILE = ""; SWIFT_OBJC_BRIDGING_HEADER = "Kube-Solo/Kube-Solo-Bridging-Header.h"; + SWIFT_VERSION = 3.0; WRAPPER_EXTENSION = app; }; name = Release; diff --git a/src/Kube-Solo.xcodeproj/project.xcworkspace/xcuserdata/rmocevicius.xcuserdatad/UserInterfaceState.xcuserstate b/src/Kube-Solo.xcodeproj/project.xcworkspace/xcuserdata/rmocevicius.xcuserdatad/UserInterfaceState.xcuserstate index 324a794..7b39ef1 100644 Binary files a/src/Kube-Solo.xcodeproj/project.xcworkspace/xcuserdata/rmocevicius.xcuserdatad/UserInterfaceState.xcuserstate and b/src/Kube-Solo.xcodeproj/project.xcworkspace/xcuserdata/rmocevicius.xcuserdatad/UserInterfaceState.xcuserstate differ diff --git a/src/Kube-Solo.xcodeproj/xcuserdata/rmocevicius.xcuserdatad/xcschemes/Kube-Solo.xcscheme b/src/Kube-Solo.xcodeproj/xcuserdata/rmocevicius.xcuserdatad/xcschemes/Kube-Solo.xcscheme index 036faeb..85f0e1d 100644 --- a/src/Kube-Solo.xcodeproj/xcuserdata/rmocevicius.xcuserdatad/xcschemes/Kube-Solo.xcscheme +++ b/src/Kube-Solo.xcodeproj/xcuserdata/rmocevicius.xcuserdatad/xcschemes/Kube-Solo.xcscheme @@ -1,6 +1,6 @@ CFBundlePackageType APPL CFBundleShortVersionString - 0.9.2 + 0.9.3 CFBundleSignature ???? CFBundleVersion - 257 + 295 LSApplicationCategoryType public.app-category.utilities LSMinimumSystemVersion diff --git a/src/Kube-Solo/Notifications.swift b/src/Kube-Solo/Notifications.swift index ac57b24..8ab66be 100644 --- a/src/Kube-Solo/Notifications.swift +++ b/src/Kube-Solo/Notifications.swift @@ -10,12 +10,12 @@ import Foundation import Cocoa // notifications -func userNotificationCenter(center: NSUserNotificationCenter, shouldPresentNotification notification: NSUserNotification) -> Bool { +func userNotificationCenter(_ center: NSUserNotificationCenter, shouldPresentNotification notification: NSUserNotification) -> Bool { return true } -func displayWithMessage(mText: String, infoText: String) { +func displayWithMessage(_ mText: String, infoText: String) { let alert: NSAlert = NSAlert() // alert.alertStyle = NSInformationalAlertStyle // alert.icon = NSImage(named: "coreos-wordmark-vert-color") diff --git a/src/Kube-Solo/RunShellApps.swift b/src/Kube-Solo/RunShellApps.swift index bc10a44..6dc6183 100644 --- a/src/Kube-Solo/RunShellApps.swift +++ b/src/Kube-Solo/RunShellApps.swift @@ -11,9 +11,9 @@ import Cocoa // run script -func runScript(scriptName: String, arguments: String) { - let task: NSTask = NSTask() - let launchPath = NSBundle.mainBundle().resourcePath! + "/" + scriptName +func runScript(_ scriptName: String, arguments: String) { + let task: Process = Process() + let launchPath = Bundle.main.resourcePath! + "/" + scriptName task.launchPath = launchPath task.arguments = [arguments] task.launch() @@ -22,27 +22,27 @@ func runScript(scriptName: String, arguments: String) { // run an app -func runApp(appName: String, arguments: String) { +func runApp(_ appName: String, arguments: String) { // lunch an external App - NSWorkspace.sharedWorkspace().openFile(arguments, withApplication: appName) + NSWorkspace.shared().openFile(arguments, withApplication: appName) } // shell commands to run -func shell(launchPath: String, arguments: [String]) -> String +func shell(_ launchPath: String, arguments: [String]) -> String { - let task = NSTask() + let task = Process() task.launchPath = launchPath task.arguments = arguments - let pipe = NSPipe() + let pipe = Pipe() task.standardOutput = pipe task.launch() let data = pipe.fileHandleForReading.readDataToEndOfFile() - let output = String(data: data, encoding: NSUTF8StringEncoding)! + let output = String(data: data, encoding: String.Encoding.utf8)! if output.characters.count > 0 { - return output.substringToIndex(output.endIndex.advancedBy(-1)) + return output.substring(to: output.characters.index(output.endIndex, offsetBy: -1)) } return output } diff --git a/src/Kube-Solo/Updates.swift b/src/Kube-Solo/Updates.swift index 7d6c1c1..a8cd65f 100644 --- a/src/Kube-Solo/Updates.swift +++ b/src/Kube-Solo/Updates.swift @@ -12,9 +12,9 @@ import Cocoa // to be used from obj-c @objc class Updates: NSObject { - func checkAppVersionGithub(showPopUp:String?=nil) { + func checkAppVersionGithub(_ showPopUp:String?=nil) { // get latest github version - let script = NSBundle.mainBundle().resourcePath! + "/check_app_version_github.command" + let script = Bundle.main.resourcePath! + "/check_app_version_github.command" let latest_app_version = shell(script, arguments: []) print("latest app version: " + latest_app_version) // @@ -24,7 +24,7 @@ import Cocoa } // get installed App version - let installed_app_version = NSBundle.mainBundle().objectForInfoDictionaryKey("CFBundleShortVersionString")as? String + let installed_app_version = Bundle.main.object(forInfoDictionaryKey: "CFBundleShortVersionString")as? String print("installed app version: " + installed_app_version!) if (latest_app_version == "v" + installed_app_version!){ @@ -40,24 +40,33 @@ import Cocoa } else { NSLog("App has the update!!!") - // show alert message - let mText: String = NSLocalizedString("AppUpdateMessage", comment: "") - let infoText: String = NSLocalizedString("AppUpdatenformativeText", comment: "") - displayWithMessage(mText, infoText: infoText) - - // open kube-solo.app releases URL - let url: String = ["https://github.com/TheNewNormal/kube-solo-osx/releases"].componentsJoinedByString("") - NSWorkspace.sharedWorkspace().openURL(NSURL(string: url)!) + // show popup on the screen + let alert: NSAlert = NSAlert() + alert.messageText = NSLocalizedString("AppUpdateMessage", comment: "") + alert.informativeText = NSLocalizedString("AppUpdatenformativeText", comment: "") + alert.alertStyle = NSAlertStyle.warning + alert.addButton(withTitle: "OK") + alert.addButton(withTitle: "Cancel") + if alert.runModal() == NSAlertFirstButtonReturn { + // if OK clicked + // open kube-solo.app releases URL in default browser + let url: String = NSLocalizedString("AppReleaseURL", comment: "") + NSWorkspace.shared().open(URL(string: url)!) + } + else { + // Cancel was pressed + NSLog("App update was canceled !!!") + } } } // testing function which returns string - func sayHello(name: String) -> String { + func sayHello(_ name: String) -> String { let nameForGreeting = name.characters.count == 0 ? "World" : name; let greeting = "Hello " + nameForGreeting + "!"; return greeting; } -} \ No newline at end of file +} diff --git a/src/Kube-Solo/en.lproj/Localizable.strings b/src/Kube-Solo/en.lproj/Localizable.strings index eb046e8..59c8af6 100644 --- a/src/Kube-Solo/en.lproj/Localizable.strings +++ b/src/Kube-Solo/en.lproj/Localizable.strings @@ -28,8 +28,6 @@ "ISOImageWillBeUpdatedNotificationMessage" = "CoreOS ISO image will be updated"; "ReleaseChannelChangeNotificationMessage" = "CoreOS release channel change"; "VMRAMChangeNotificationMessage" = "VM RAM size change"; -"NFSChangeNotificationMessage" = "NFS settings change"; -"SudoPasswordChangeNotificationMessage" = "sudo password change"; "SSHShellWillOpenNotificationMessage" = "VM ssh shell will be opened"; "ShellWillOpenNotificationMessage" = "macOS shell will be opened"; "ConsoleWillOpenNotificationMessage" = "VM's console will be opened"; @@ -58,3 +56,8 @@ "AppUpdatenformativeText" = "The download link will be opened in your browser ..."; "NoAppUpdateMessage" = "Kube-Solo for macOS"; "NoAppUpdatenformativeText" = "You are-up-to-date !!!"; + +// URL + +"AppReleaseURL" = "https://github.com/TheNewNormal/kube-solo-osx/releases"; + diff --git a/src/first-init.command b/src/first-init.command index 8754ed4..934fa44 100755 --- a/src/first-init.command +++ b/src/first-init.command @@ -46,7 +46,7 @@ echo "Checking internet availablity on VM..." check_internet_from_vm # download latest version of deis and helm clients -download_osx_clients +###download_osx_clients # echo " " @@ -102,10 +102,9 @@ echo " " # install_k8s_add_ons +# download latest version of deis, helmc and helm clients # install Helm Tiller -echo " " -echo "Installing Helm Tiller..." -~/kube-solo/bin/helm init +download_osx_clients # docker daemon export DOCKER_HOST=tcp://$vm_ip:2375