Skip to content
This repository has been archived by the owner on Nov 9, 2017. It is now read-only.

Commit

Permalink
Merge pull request #130 from TheNewNormal/v0.9.3
Browse files Browse the repository at this point in the history
v0.9.3
  • Loading branch information
rimusz authored Sep 12, 2016
2 parents 8253a39 + 71b3a4a commit 3c9c63d
Show file tree
Hide file tree
Showing 10 changed files with 70 additions and 43 deletions.
18 changes: 17 additions & 1 deletion src/Kube-Solo.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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;
Expand All @@ -437,6 +448,7 @@
GCC_WARN_UNUSED_VARIABLE = YES;
MACOSX_DEPLOYMENT_TARGET = 10.10;
SDKROOT = macosx;
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
};
name = Release;
};
Expand All @@ -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";
Expand All @@ -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;
Expand All @@ -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";
Expand All @@ -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;
Expand Down
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0710"
LastUpgradeVersion = "0800"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
16 changes: 8 additions & 8 deletions src/Kube-Solo/Helpers.swift
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import Cocoa
// check if app runs from dmg
func check_for_dmg() {
// get the App's main bundle path
let resoucesPathFromApp = NSBundle.mainBundle().resourcePath!
let resoucesPathFromApp = Bundle.main.resourcePath!
NSLog("applicationDirectory: '%@'", resoucesPathFromApp)
//
let dmgPath: String = "/Volumes/Kube-Solo/Kube-Solo.app/Contents/Resources"
Expand All @@ -36,7 +36,7 @@ import Cocoa

func check_for_corectl_app() {

if !NSWorkspace.sharedWorkspace().launchApplication("/Applications/corectl.app") {
if !NSWorkspace.shared().launchApplication("/Applications/corectl.app") {
NSLog("corectl failed to launch")

// show alert message
Expand All @@ -45,15 +45,15 @@ import Cocoa
displayWithMessage(mText, infoText: infoText)

// open corectl.app releases URL
let url: String = ["https://github.com/TheNewNormal/corectl.app/releases"].componentsJoinedByString("")
NSWorkspace.sharedWorkspace().openURL(NSURL(string: url)!)
let url: String = "https://github.com/TheNewNormal/corectl.app/releases"
NSWorkspace.shared().open(URL(string: url)!)

// show quitting App message
// self.notifyUserWithTitle(NSLocalizedString("QuittingNotificationTitle"), text: nil)
let notification: NSUserNotification = NSUserNotification()
notification.title = "Kube-Solo"
notification.informativeText = NSLocalizedString("QuittingNotificationTitle", comment: "")
NSUserNotificationCenter.defaultUserNotificationCenter().deliverNotification(notification)
NSUserNotificationCenter.default.deliver(notification)

// exiting App
exit(0)
Expand All @@ -72,8 +72,8 @@ import Cocoa
// bundled helper app is Apple's recommended approach, but that
// has a lot of configuration overhead to get right.
func addToLoginItems() {
NSTask.launchedTaskWithLaunchPath(
"/usr/bin/osascript",
Process.launchedProcess(
launchPath: "/usr/bin/osascript",
arguments: [
"-e",
"tell application \"System Events\" to make login item at end with properties {path:\"/Applications/Kube-Solo.app\", hidden:false, name:\"Kube-Solo\"}"
Expand All @@ -83,4 +83,4 @@ import Cocoa


// end of class Helpers
}
}
4 changes: 2 additions & 2 deletions src/Kube-Solo/Kube-Solo-Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>0.9.2</string>
<string>0.9.3</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>257</string>
<string>295</string>
<key>LSApplicationCategoryType</key>
<string>public.app-category.utilities</string>
<key>LSMinimumSystemVersion</key>
Expand Down
4 changes: 2 additions & 2 deletions src/Kube-Solo/Notifications.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
20 changes: 10 additions & 10 deletions src/Kube-Solo/RunShellApps.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand All @@ -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
}
Expand Down
35 changes: 22 additions & 13 deletions src/Kube-Solo/Updates.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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)
//
Expand All @@ -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!){
Expand All @@ -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;
}

}
}
7 changes: 5 additions & 2 deletions src/Kube-Solo/en.lproj/Localizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down Expand Up @@ -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";

7 changes: 3 additions & 4 deletions src/first-init.command
Original file line number Diff line number Diff line change
Expand Up @@ -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 " "
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 3c9c63d

Please sign in to comment.