Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat: Rephrase for a more relaxed notification style, see #42 #43

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/copy_corectl_blobs.command
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,5 @@ res_folder=$1
mkdir ~/bin > /dev/null 2>&1

# copy blobs
echo "Copying files ..."
echo "Copying files"
cp -f "${res_folder}"/* ~/bin/
28 changes: 14 additions & 14 deletions src/corectl/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ class AppDelegate: NSObject, NSApplicationDelegate {
else {
//
let alert: NSAlert = NSAlert()
alert.messageText = "Restarting Corectld server will halt all your running VMs !!!"
alert.messageText = "Restarting Corectld server will halt all your running VMs."
alert.informativeText = "Are you sure you want to do that?"
alert.alertStyle = NSAlertStyle.warning
alert.addButton(withTitle: "OK")
Expand All @@ -85,7 +85,7 @@ class AppDelegate: NSObject, NSApplicationDelegate {
// send a notification on to the screen
let notification: NSUserNotification = NSUserNotification()
notification.title = "Corectl"
notification.informativeText = "Updates for Corectl App will be checked"
notification.informativeText = "Updates for Corectl App will be checked"
NSUserNotificationCenter.default.deliver(notification)

// run check function
Expand All @@ -97,7 +97,7 @@ class AppDelegate: NSObject, NSApplicationDelegate {
// send a notification on to the screen
let notification: NSUserNotification = NSUserNotification()
notification.title = "Corectl"
notification.informativeText = "Updates for Corectl tools will be checked"
notification.informativeText = "Updates for Corectl tools will be checked"
NSUserNotificationCenter.default.deliver(notification)

// run check function
Expand All @@ -111,7 +111,7 @@ class AppDelegate: NSObject, NSApplicationDelegate {
// send a notification on to the screen
let notification: NSUserNotification = NSUserNotification()
notification.title = "Corectl"
notification.informativeText = "CoreOS Alpha ISO image will be updated"
notification.informativeText = "CoreOS Alpha ISO image will be updated"
NSUserNotificationCenter.default.deliver(notification)

// run the script
Expand All @@ -122,7 +122,7 @@ class AppDelegate: NSObject, NSApplicationDelegate {
// send a notification on to the screen
let notification: NSUserNotification = NSUserNotification()
notification.title = "Corectl"
notification.informativeText = "CoreOS Beta ISO image will be updated"
notification.informativeText = "CoreOS Beta ISO image will be updated"
NSUserNotificationCenter.default.deliver(notification)

// run the script
Expand All @@ -133,7 +133,7 @@ class AppDelegate: NSObject, NSApplicationDelegate {
// send a notification on to the screen
let notification: NSUserNotification = NSUserNotification()
notification.title = "Corectl"
notification.informativeText = "CoreOS Stable ISO image will be updated"
notification.informativeText = "CoreOS Stable ISO image will be updated"
NSUserNotificationCenter.default.deliver(notification)

// run the script
Expand All @@ -146,7 +146,7 @@ class AppDelegate: NSObject, NSApplicationDelegate {
@IBAction func About(_ sender: NSMenuItem) {
let version = Bundle.main.object(forInfoDictionaryKey: "CFBundleShortVersionString")as? String
let mText: String = "Corectl for macOS v" + version!
let infoText: String = "It is a simple wrapper around the \"corectld\" server, allows to have a control via the Status Bar App !!!"
let infoText: String = "A simple wrapper around the \"corectld\" server. Allows to have control your server via the Status Bar App."
displayWithMessage(mText, infoText: infoText)
}

Expand All @@ -155,7 +155,7 @@ class AppDelegate: NSObject, NSApplicationDelegate {
@IBAction func Quit(_ sender: NSMenuItem) {
//
let alert: NSAlert = NSAlert()
alert.messageText = "Quitting App will halt all your running VMs !!!"
alert.messageText = "Quitting the Corectl App will halt all your running VMs."
alert.informativeText = "Are you sure you want to close the App?"
alert.alertStyle = NSAlertStyle.warning
alert.addButton(withTitle: "OK")
Expand All @@ -164,7 +164,7 @@ class AppDelegate: NSObject, NSApplicationDelegate {
// if OK clicked
// send a notification on to the screen
let notification: NSUserNotification = NSUserNotification()
notification.title = "Quitting Corectl App"
notification.title = "Quitting Corectl App"
NSUserNotificationCenter.default.deliver(notification)

// stop corectld server
Expand Down Expand Up @@ -230,8 +230,8 @@ class AppDelegate: NSObject, NSApplicationDelegate {
// check resourcePath and exit the App if it runs from the dmg
if resoucesPathFromApp.isEqual(dmgPath) {
// show alert message
let mText: String = "\("Corectl App cannot be started from DMG !!!")"
let infoText: String = "Please copy App to your Applications folder ..."
let mText: String = "\("Corectl App cannot be started from DMG.")"
let infoText: String = "Please copy the App to your Applications folder."
displayWithMessage(mText, infoText: infoText)
// exiting App
NSApplication.shared().terminate(self)
Expand All @@ -249,11 +249,11 @@ class AppDelegate: NSObject, NSApplicationDelegate {
//
if (status == "yes"){
let menuItem : NSStatusItem = statusItem
menuItem.menu?.item(withTag: 1)?.title = "Server is running"
menuItem.menu?.item(withTag: 1)?.title = "Server status: Running"
}
else {
let menuItem : NSStatusItem = statusItem
menuItem.menu?.item(withTag: 1)?.title = "Server is Off"
menuItem.menu?.item(withTag: 1)?.title = "Server status: Off"
}
}

Expand Down Expand Up @@ -282,7 +282,7 @@ class AppDelegate: NSObject, NSApplicationDelegate {
else {
// update menu item
let menuItem : NSStatusItem = statusItem
menuItem.menu?.item(withTag: 10)?.title = " Active VMs: 0"
menuItem.menu?.item(withTag: 10)?.title = "No Active VMs"
}
}

Expand Down
20 changes: 10 additions & 10 deletions src/corectl/ServerControl.swift
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ func ServerStart() {

// send an alert about the user password
let mText: String = "Corectl for macOS"
let infoText: String = "You will be asked to type your \"user\" password, needed to start \"corectld\" server !!!"
let infoText: String = "You will be asked to type your \"user\" password to start the \"Corectld\" server."
displayWithMessage(mText, infoText: infoText)

//
Expand All @@ -38,14 +38,14 @@ func ServerStart() {
//
if (status == "no"){
let menuItem : NSStatusItem = statusItem
menuItem.menu?.item(withTag: 1)?.title = "Server is Off"
menuItem.menu?.item(withTag: 1)?.title = "Server status: Off"
// display the error message
let mText: String = "Corectl for macOS"
let infoText: String = "Cannot start the \"corectld server\" !!!"
let infoText: String = "Can not start the \"Corectl server\"."
displayWithMessage(mText, infoText: infoText)
}
else {
menuItem.menu?.item(withTag: 1)?.title = "Server is running"
menuItem.menu?.item(withTag: 1)?.title = "Server status: Running"
menuItem.menu?.item(withTag: 1)?.state = NSOnState
//
let script = Bundle.main.resourcePath! + "/check_corectld_version.command"
Expand All @@ -63,7 +63,7 @@ func ServerStop() {
let menuItem : NSStatusItem = statusItem

// show notification on to screen
//notifyUserWithTitle("Corectl App", text: "All running VMs will be stopped !!!")
//notifyUserWithTitle("Corectl App", text: "All running VMs will be stopped.")

// stop corectld server
let task = Process()
Expand All @@ -73,7 +73,7 @@ func ServerStop() {
task.waitUntilExit()

//
menuItem.menu?.item(withTag: 1)?.title = "Server is off"
menuItem.menu?.item(withTag: 1)?.title = "Server status: Off"
menuItem.menu?.item(withTag: 1)?.state = NSOffState
}

Expand All @@ -84,22 +84,22 @@ func RestartServer() {
let menuItem : NSStatusItem = statusItem

// send a notification on to the screen
print("Restarting corectld server")
print("Restarting Corectl server")
let notification: NSUserNotification = NSUserNotification()
notification.title = "Restarting corectld server"
NSUserNotificationCenter.default.deliver(notification)

// stop corectld server
menuItem.menu?.item(withTag: 1)?.title = "Server is stopping"
menuItem.menu?.item(withTag: 1)?.title = "Server is stopping"
ServerStop()

// start corectld server
menuItem.menu?.item(withTag: 1)?.title = "Server is starting"
menuItem.menu?.item(withTag: 1)?.title = "Server is starting"
ServerStart()

//
menuItem.menu?.item(withTag: 3)?.title = "Check for App updates"
menuItem.menu?.item(withTag: 4)?.title = "Check for corectl updates"
menuItem.menu?.item(withTag: 4)?.title = "Check for Corectl updates"
}


Expand Down
20 changes: 10 additions & 10 deletions src/corectl/Updates.swift
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ func check_for_corectl_app_github(_ showPopUp:String?=nil, runViaUpdateMenu:Stri
//
let script = Bundle.main.resourcePath! + "/check_corectl_app_version.command"
let latest_app_version = shell(script, arguments: [])
print("latest app version: " + latest_app_version)
print("Latest app version: " + latest_app_version)
//
if (latest_app_version == "" ) {
NSLog("Cannot check latest version on Github, must be API limit was reached or other Github tecnnical issues !!!")
NSLog("We can not check the latest version on Github. There was either an API limit reached, or Github has technical issues.")
return
}
//
Expand All @@ -30,7 +30,7 @@ func check_for_corectl_app_github(_ showPopUp:String?=nil, runViaUpdateMenu:Stri
// then show popup on the screeen
if (runViaUpdateMenu == "yes") {
let mText: String = "Corectl App for macOS"
let infoText: String = "You are up-to-date ..."
let infoText: String = "You are up-to-date!"
displayWithMessage(mText, infoText: infoText)
}
else {
Expand All @@ -47,15 +47,15 @@ func check_for_corectl_app_github(_ showPopUp:String?=nil, runViaUpdateMenu:Stri
}
else {
let menuItem : NSStatusItem = statusItem
menuItem.menu?.item(withTag: 3)?.title = "Download App updates..."
menuItem.menu?.item(withTag: 3)?.title = "Download App updates"
}
}
}
// download corectl.app updates
func download_corectl_app_github() {
// show popup on the screen
let alert: NSAlert = NSAlert()
alert.messageText = "There is a new version of Corectl App available !!!"
alert.messageText = "There is a new version of the Corectl App available"
alert.informativeText = "Open download URL in your browser?"
alert.alertStyle = NSAlertStyle.warning
alert.addButton(withTitle: "OK")
Expand Down Expand Up @@ -89,7 +89,7 @@ func check_for_corectl_blobs_github(_ showPopUp:String?=nil, runViaUpdateMenu:St
}
else {
let menuItem : NSStatusItem = statusItem
menuItem.menu?.item(withTag: 4)?.title = "Download corectl updates..."
menuItem.menu?.item(withTag: 4)?.title = "Downloading Corectl updates"
}
}
else {
Expand All @@ -100,15 +100,15 @@ func check_for_corectl_blobs_github(_ showPopUp:String?=nil, runViaUpdateMenu:St
}
else {
let menuItem : NSStatusItem = statusItem
menuItem.menu?.item(withTag: 4)?.title = "Check for corectl updates"
menuItem.menu?.item(withTag: 4)?.title = "Check for Corectl updates"
}
}
}

// download corectl blobs
func download_corectl_blobs_github(_ runViaUpdateMenu:String?=nil) {
let alert: NSAlert = NSAlert()
alert.messageText = "There is a new version of Corectld server available !!!"
alert.messageText = "There is a new version of the Corectld server available"
alert.informativeText = "Do you want to download it?"
alert.alertStyle = NSAlertStyle.warning
alert.addButton(withTitle: "OK")
Expand All @@ -129,12 +129,12 @@ func download_corectl_blobs_github(_ runViaUpdateMenu:String?=nil) {
// }
// restore menu item
// let menuItem : NSStatusItem = statusItem
// menuItem.menu?.itemWithTag(4)?.title = "Check for corectl updates"
// menuItem.menu?.itemWithTag(4)?.title = "Check for Corectl updates"
// }
}
else {
let menuItem : NSStatusItem = statusItem
menuItem.menu?.item(withTag: 4)?.title = "Download corectl updates..."
menuItem.menu?.item(withTag: 4)?.title = "Downloading Corectl updates"
}
}

Expand Down
8 changes: 4 additions & 4 deletions src/fetch_latest_iso_stable.command
Original file line number Diff line number Diff line change
Expand Up @@ -9,21 +9,21 @@ source "${DIR}"/functions.sh
CHANNEL=stable

echo " "
echo "Fetching lastest CoreOS $CHANNEL channel ISO ..."
echo "Fetching lastest CoreOS $CHANNEL channel ISO"
echo " "
#
~/bin/corectl pull --channel="$CHANNEL" 2>&1 | tee ~/.coreos/tmp/check_channel
CHECK_CHANNEL=$(cat ~/.coreos/tmp/check_channel | grep "downloading" | awk '{print $2}')
#
if [[ "$CHECK_CHANNEL" == "downloading" ]]; then
echo " "
echo "You need to reload your VMs to use the lastest version !!! "
echo "You will need to reload your VMs to use the lastest version."
rm -f ~/.coreos/tmp/check_channel
else
echo "You have the latest ISO already ..."
echo "You already have the latest CoreOS ISO."
fi

echo " "
pause 'Press [Enter] key to continue...'
pause 'Please press [Enter] to continue.'

exit 0
2 changes: 1 addition & 1 deletion src/get_go_binaries/corectl_download_latest.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ chmod +x *

cd $current_folder
# copy blobs
echo "Copying files ..."
echo "Copying files"
cp -f bin/* ../bin

#
Expand Down
2 changes: 1 addition & 1 deletion src/start_docker_registry.command
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@ kill $(ps aux | grep "[r]egistry serve config.yml" | awk {'print $2'}) >/dev/nul
sleep 1

# start registry
echo "Starting Docker Registry v2 on 192.168.64.1:5000 ..."
echo "Starting Docker Registry v2 on 192.168.64.1:5000"
cd ~/.coreos/registry
nohup "${res_folder}"/registry/registry serve config.yml >/dev/null 2>&1 &
13 changes: 7 additions & 6 deletions src/update_corectl_blobs.command
Original file line number Diff line number Diff line change
Expand Up @@ -20,37 +20,38 @@ rm -f corectl.tar.gz
chmod +x *

# copy blobs
echo "Copying files to ~/bin ..."
echo "Copying files to ~/bin "
cp -f * ~/bin/ > /dev/null 2>&1

#
cd ~/
rm -fr ~/tmp/corectl > /dev/null 2>&1

#
echo "Download has finished !!!"
echo "The download has finished."
echo " "

# check if corectld is running
CHECK_SERVER_STATUS=$(~/bin/corectld status 2>&1 | grep "Uptime:")

if [[ "$CHECK_SERVER_STATUS" == "" ]]; then
# corectld is not running
echo "Corectld is updated to latest version ..."
echo "Corectld is updated to latest version."
else
# check for active VMs
vms=$(~/bin/corectld status | grep "Active VMs:" | awk '{print $3}')
if [[ "$vms" -ne "0" ]]; then
# active VMs
echo "You need to restart 'corectld' server via menu, but Halt all your VMs first, as you have $vms running !!! "
echo "You have $vms VMs running. Please stop them."
echo "Then restart the 'corectld' server via the menu."
else
# no vms
echo "You need to restart 'corectld' server via menu !!! "
echo "Please restart the 'corectld' server via the menu."
fi
fi

echo " "
pause 'Press [Enter] key to continue...'
pause 'Please press [Enter] to continue.'

exit 0

Expand Down