Skip to content

Commit

Permalink
v0.0.6
Browse files Browse the repository at this point in the history
  • Loading branch information
rimusz committed Jun 29, 2016
1 parent 64ab303 commit 114935a
Show file tree
Hide file tree
Showing 11 changed files with 294 additions and 3 deletions.
44 changes: 44 additions & 0 deletions src/corectl.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,26 @@
objects = {

/* Begin PBXBuildFile section */
136605381D23CCB200D497A0 /* fetch_latest_iso_alpha.command in Resources */ = {isa = PBXBuildFile; fileRef = 136605361D23CCB200D497A0 /* fetch_latest_iso_alpha.command */; };
136605391D23CCB200D497A0 /* functions.sh in Resources */ = {isa = PBXBuildFile; fileRef = 136605371D23CCB200D497A0 /* functions.sh */; };
1366053B1D23D6AD00D497A0 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1366053A1D23D6AD00D497A0 /* Foundation.framework */; };
1366053D1D23D6B800D497A0 /* AppKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1366053C1D23D6B800D497A0 /* AppKit.framework */; };
1366053F1D23D6C700D497A0 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1366053E1D23D6C700D497A0 /* Cocoa.framework */; };
136605431D23E85800D497A0 /* fetch_latest_iso_beta.command in Resources */ = {isa = PBXBuildFile; fileRef = 136605411D23E85800D497A0 /* fetch_latest_iso_beta.command */; };
136605441D23E85800D497A0 /* fetch_latest_iso_stable.command in Resources */ = {isa = PBXBuildFile; fileRef = 136605421D23E85800D497A0 /* fetch_latest_iso_stable.command */; };
13CAFC2A1D2272B000E57ED4 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 13CAFC291D2272B000E57ED4 /* AppDelegate.swift */; };
13CAFC2C1D2272B000E57ED4 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 13CAFC2B1D2272B000E57ED4 /* Assets.xcassets */; };
13CAFC2F1D2272B000E57ED4 /* MainMenu.xib in Resources */ = {isa = PBXBuildFile; fileRef = 13CAFC2D1D2272B000E57ED4 /* MainMenu.xib */; };
/* End PBXBuildFile section */

/* Begin PBXFileReference section */
136605361D23CCB200D497A0 /* fetch_latest_iso_alpha.command */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; path = fetch_latest_iso_alpha.command; sourceTree = "<group>"; };
136605371D23CCB200D497A0 /* functions.sh */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; path = functions.sh; sourceTree = "<group>"; };
1366053A1D23D6AD00D497A0 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; };
1366053C1D23D6B800D497A0 /* AppKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AppKit.framework; path = System/Library/Frameworks/AppKit.framework; sourceTree = SDKROOT; };
1366053E1D23D6C700D497A0 /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = System/Library/Frameworks/Cocoa.framework; sourceTree = SDKROOT; };
136605411D23E85800D497A0 /* fetch_latest_iso_beta.command */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; path = fetch_latest_iso_beta.command; sourceTree = "<group>"; };
136605421D23E85800D497A0 /* fetch_latest_iso_stable.command */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; path = fetch_latest_iso_stable.command; sourceTree = "<group>"; };
13CAFC261D2272B000E57ED4 /* corectl.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = corectl.app; sourceTree = BUILT_PRODUCTS_DIR; };
13CAFC291D2272B000E57ED4 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
13CAFC2B1D2272B000E57ED4 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
Expand All @@ -25,16 +39,42 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
1366053F1D23D6C700D497A0 /* Cocoa.framework in Frameworks */,
1366053D1D23D6B800D497A0 /* AppKit.framework in Frameworks */,
1366053B1D23D6AD00D497A0 /* Foundation.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXFrameworksBuildPhase section */

/* Begin PBXGroup section */
136605351D23CC9A00D497A0 /* scripts */ = {
isa = PBXGroup;
children = (
136605361D23CCB200D497A0 /* fetch_latest_iso_alpha.command */,
136605411D23E85800D497A0 /* fetch_latest_iso_beta.command */,
136605421D23E85800D497A0 /* fetch_latest_iso_stable.command */,
136605371D23CCB200D497A0 /* functions.sh */,
);
name = scripts;
sourceTree = "<group>";
};
136605401D23D6F600D497A0 /* Frameworks */ = {
isa = PBXGroup;
children = (
1366053E1D23D6C700D497A0 /* Cocoa.framework */,
1366053C1D23D6B800D497A0 /* AppKit.framework */,
1366053A1D23D6AD00D497A0 /* Foundation.framework */,
);
name = Frameworks;
sourceTree = "<group>";
};
13CAFC1D1D2272B000E57ED4 = {
isa = PBXGroup;
children = (
13CAFC281D2272B000E57ED4 /* corectl */,
136605351D23CC9A00D497A0 /* scripts */,
136605401D23D6F600D497A0 /* Frameworks */,
13CAFC271D2272B000E57ED4 /* Products */,
);
sourceTree = "<group>";
Expand Down Expand Up @@ -117,8 +157,12 @@
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
136605441D23E85800D497A0 /* fetch_latest_iso_stable.command in Resources */,
13CAFC2C1D2272B000E57ED4 /* Assets.xcassets in Resources */,
13CAFC2F1D2272B000E57ED4 /* MainMenu.xib in Resources */,
136605391D23CCB200D497A0 /* functions.sh in Resources */,
136605381D23CCB200D497A0 /* fetch_latest_iso_alpha.command in Resources */,
136605431D23E85800D497A0 /* fetch_latest_iso_beta.command in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<Bucket
type = "1"
version = "2.0">
</Bucket>
93 changes: 93 additions & 0 deletions src/corectl/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
//

import Cocoa
import Foundation

@NSApplicationMain
class AppDelegate: NSObject, NSApplicationDelegate {
Expand Down Expand Up @@ -78,13 +79,105 @@ class AppDelegate: NSObject, NSApplicationDelegate {
ServerStart()
}


// fetch latest ISOs

@IBAction func fetchLatestISOAlpha(sender: NSMenuItem) {

// send a notification on to the screen
let notification: NSUserNotification = NSUserNotification()
notification.title = "Corectl"
notification.informativeText = "CoreOS Alpha ISO image will be updated"
NSUserNotificationCenter.defaultUserNotificationCenter().deliverNotification(notification)

// run the script
runTerminal(NSBundle.mainBundle().resourcePath! + "/fetch_latest_iso_alpha.command")

}


@IBAction func fetchLatestISOBeta(sender: NSMenuItem) {
// send a notification on to the screen
let notification: NSUserNotification = NSUserNotification()
notification.title = "Corectl"
notification.informativeText = "CoreOS Beta ISO image will be updated"
NSUserNotificationCenter.defaultUserNotificationCenter().deliverNotification(notification)

// run the script
runTerminal(NSBundle.mainBundle().resourcePath! + "/fetch_latest_iso_beta.command")
}


@IBAction func fetchLatestISOStable(sender: NSMenuItem) {
// send a notification on to the screen
let notification: NSUserNotification = NSUserNotification()
notification.title = "Corectl"
notification.informativeText = "CoreOS Stable ISO image will be updated"
NSUserNotificationCenter.defaultUserNotificationCenter().deliverNotification(notification)

// run the script
runTerminal(NSBundle.mainBundle().resourcePath! + "/fetch_latest_iso_stable.command")
}
//


@IBAction func Quit(sender: NSMenuItem) {
// send a notification on to the screen
let notification: NSUserNotification = NSUserNotification()
notification.title = "Quitting Corectl App"
NSUserNotificationCenter.defaultUserNotificationCenter().deliverNotification(notification)

// stop corectld server
ServerStop()

// exit App
exit(0)
}


// helping functions

func runScript(scriptName: String, arguments: String) {
let task: NSTask = NSTask()
task.launchPath = "\(NSBundle.mainBundle().pathForResource(scriptName, ofType: "command")!)"
task.arguments = [arguments]
task.launch()
task.waitUntilExit()
}


func runTerminal(arguments: String) {
let fileManager = NSFileManager.defaultManager()
// Check if file exists, given its path
if fileManager.fileExistsAtPath("/Applications/iTerm.app") {
// lunch iTerm App
NSWorkspace.sharedWorkspace().openFile(arguments, withApplication: "iTerm")
} else {
// lunch Terminal App
NSWorkspace.sharedWorkspace().openFile(arguments, withApplication: "Terminal")
}
}


func runApp(appName: String, arguments: String) {
// lunch an external App
NSWorkspace.sharedWorkspace().openFile(arguments, withApplication: appName)
}

// notifications
func userNotificationCenter(center: NSUserNotificationCenter, shouldPresentNotification notification: NSUserNotification) -> Bool {
return true
}


func displayWithMessage(mText: String, infoText: String) {
let alert: NSAlert = NSAlert()
// alert.alertStyle = NSInformationalAlertStyle
// alert.icon = NSImage(named: "coreos-wordmark-vert-color")
alert.messageText = mText
alert.informativeText = infoText
alert.runModal()
}

}

35 changes: 34 additions & 1 deletion src/corectl/Base.lproj/MainMenu.xib
Original file line number Diff line number Diff line change
Expand Up @@ -683,7 +683,40 @@
</connections>
</menuItem>
<menuItem isSeparatorItem="YES" id="7F0-f8-uD9"/>
<menuItem title="Quit" tag="3" alternate="YES" id="Nfe-LP-eNg">
<menuItem title="Check for updates" id="G6m-bG-AHV">
<modifierMask key="keyEquivalentModifierMask"/>
</menuItem>
<menuItem title="Fetch latest CoreOS ISO" id="cxS-wy-CSq">
<modifierMask key="keyEquivalentModifierMask"/>
<menu key="submenu" title="Fetch latest CoreOS ISO" id="WjL-bi-BbT">
<items>
<menuItem title="Alpha" id="0SQ-P4-rTq">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="fetchLatestISOAlpha:" target="Voe-Tx-rLC" id="DCJ-Zh-pW9"/>
</connections>
</menuItem>
<menuItem title="Beta" id="KEW-NR-3cp">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="fetchLatestISOBeta:" target="Voe-Tx-rLC" id="3sE-Lg-VcR"/>
</connections>
</menuItem>
<menuItem title="Stable" id="gJK-EZ-iV0">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="fetchLatestISOStable:" target="Voe-Tx-rLC" id="xjn-If-zaL"/>
</connections>
</menuItem>
</items>
</menu>
</menuItem>
<menuItem isSeparatorItem="YES" id="6MD-ne-tfW"/>
<menuItem title="Preferences" id="jv0-Md-oMt">
<modifierMask key="keyEquivalentModifierMask"/>
</menuItem>
<menuItem isSeparatorItem="YES" id="gfq-fY-qL1"/>
<menuItem title="Quit Corectl" tag="3" alternate="YES" id="Nfe-LP-eNg">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="Quit:" target="Voe-Tx-rLC" id="1hY-bR-e5f"/>
Expand Down
4 changes: 2 additions & 2 deletions src/corectl/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>0.0.5</string>
<string>0.0.6</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>25</string>
<string>27</string>
<key>LSMinimumSystemVersion</key>
<string>$(MACOSX_DEPLOYMENT_TARGET)</string>
<key>LSUIElement</key>
Expand Down
25 changes: 25 additions & 0 deletions src/fetch_latest_iso_alpha.command
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#!/bin/bash

# fetch latest iso
#
DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
source "${DIR}"/functions.sh

# set channel
CHANNEL=alpha

echo " "
echo "Fetching lastest CoreOS $CHANNEL channel ISO ..."
echo " "
#
/usr/local/sbin/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 !!! "
rm -f ~/.coreos/tmp/check_channel
fi

echo " "
pause 'Press [Enter] key to continue...'
25 changes: 25 additions & 0 deletions src/fetch_latest_iso_beta.command
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#!/bin/bash

# fetch latest iso
#
DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
source "${DIR}"/functions.sh

# set channel
CHANNEL=beta

echo " "
echo "Fetching lastest CoreOS $CHANNEL channel ISO ..."
echo " "
#
/usr/local/sbin/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 !!! "
rm -f ~/.coreos/tmp/check_channel
fi

echo " "
pause 'Press [Enter] key to continue...'
25 changes: 25 additions & 0 deletions src/fetch_latest_iso_stable.command
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#!/bin/bash

# fetch latest iso
#
DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
source "${DIR}"/functions.sh

# set channel
CHANNEL=stable

echo " "
echo "Fetching lastest CoreOS $CHANNEL channel ISO ..."
echo " "
#
/usr/local/sbin/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 !!! "
rm -f ~/.coreos/tmp/check_channel
fi

echo " "
pause 'Press [Enter] key to continue...'
16 changes: 16 additions & 0 deletions src/functions.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/bin/bash

# shared functions library

DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )


function pause(){
read -p "$*"
}






25 changes: 25 additions & 0 deletions src/install_iterm.command
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#!/bin/bash

# fetch latest iso
#
DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
source "${DIR}"/functions.sh

# set channel
CHANNEL=stable

echo " "
echo "Fetching lastest CoreOS $CHANNEL channel ISO ..."
echo " "
#
/usr/local/sbin/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 !!! "
rm -f ~/.coreos/tmp/check_channel
fi

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

0 comments on commit 114935a

Please sign in to comment.