forked from vanstee/Reflecticle
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Hack on a reflecticle menu bar app in macruby
- Loading branch information
vanstee
committed
Mar 27, 2012
1 parent
5bf2eba
commit 44f1d0d
Showing
10 changed files
with
763 additions
and
3,446 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7 changes: 7 additions & 0 deletions
7
Reflecticle.xcodeproj/project.xcworkspace/contents.xcworkspacedata
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Binary file added
BIN
+15.1 KB
...odeproj/project.xcworkspace/xcuserdata/vanstee.xcuserdatad/UserInterfaceState.xcuserstate
Binary file not shown.
57 changes: 57 additions & 0 deletions
57
Reflecticle.xcodeproj/xcuserdata/vanstee.xcuserdatad/xcschemes/Deployment.xcscheme
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<Scheme | ||
version = "1.3"> | ||
<BuildAction | ||
parallelizeBuildables = "YES" | ||
buildImplicitDependencies = "YES"> | ||
<BuildActionEntries> | ||
<BuildActionEntry | ||
buildForTesting = "YES" | ||
buildForRunning = "YES" | ||
buildForProfiling = "YES" | ||
buildForArchiving = "YES" | ||
buildForAnalyzing = "YES"> | ||
<BuildableReference | ||
BuildableIdentifier = "primary" | ||
BlueprintIdentifier = "103A10DB15215EF200C7E225" | ||
BuildableName = "Deployment" | ||
BlueprintName = "Deployment" | ||
ReferencedContainer = "container:Reflecticle.xcodeproj"> | ||
</BuildableReference> | ||
</BuildActionEntry> | ||
</BuildActionEntries> | ||
</BuildAction> | ||
<TestAction | ||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.GDB" | ||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.GDB" | ||
shouldUseLaunchSchemeArgsEnv = "YES" | ||
buildConfiguration = "Debug"> | ||
<Testables> | ||
</Testables> | ||
</TestAction> | ||
<LaunchAction | ||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.GDB" | ||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.GDB" | ||
launchStyle = "0" | ||
useCustomWorkingDirectory = "NO" | ||
buildConfiguration = "Debug" | ||
debugDocumentVersioning = "YES" | ||
allowLocationSimulation = "YES"> | ||
<AdditionalOptions> | ||
</AdditionalOptions> | ||
</LaunchAction> | ||
<ProfileAction | ||
shouldUseLaunchSchemeArgsEnv = "YES" | ||
savedToolIdentifier = "" | ||
useCustomWorkingDirectory = "NO" | ||
buildConfiguration = "Release" | ||
debugDocumentVersioning = "YES"> | ||
</ProfileAction> | ||
<AnalyzeAction | ||
buildConfiguration = "Debug"> | ||
</AnalyzeAction> | ||
<ArchiveAction | ||
buildConfiguration = "Release" | ||
revealArchiveInOrganizer = "YES"> | ||
</ArchiveAction> | ||
</Scheme> |
84 changes: 84 additions & 0 deletions
84
Reflecticle.xcodeproj/xcuserdata/vanstee.xcuserdatad/xcschemes/Reflecticle.xcscheme
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<Scheme | ||
version = "1.3"> | ||
<BuildAction | ||
parallelizeBuildables = "YES" | ||
buildImplicitDependencies = "YES"> | ||
<BuildActionEntries> | ||
<BuildActionEntry | ||
buildForTesting = "YES" | ||
buildForRunning = "YES" | ||
buildForProfiling = "YES" | ||
buildForArchiving = "YES" | ||
buildForAnalyzing = "YES"> | ||
<BuildableReference | ||
BuildableIdentifier = "primary" | ||
BlueprintIdentifier = "103A10D215215EF200C7E225" | ||
BuildableName = "Reflecticle.app" | ||
BlueprintName = "Reflecticle" | ||
ReferencedContainer = "container:Reflecticle.xcodeproj"> | ||
</BuildableReference> | ||
</BuildActionEntry> | ||
</BuildActionEntries> | ||
</BuildAction> | ||
<TestAction | ||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.GDB" | ||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.GDB" | ||
shouldUseLaunchSchemeArgsEnv = "YES" | ||
buildConfiguration = "Debug"> | ||
<Testables> | ||
</Testables> | ||
<MacroExpansion> | ||
<BuildableReference | ||
BuildableIdentifier = "primary" | ||
BlueprintIdentifier = "103A10D215215EF200C7E225" | ||
BuildableName = "Reflecticle.app" | ||
BlueprintName = "Reflecticle" | ||
ReferencedContainer = "container:Reflecticle.xcodeproj"> | ||
</BuildableReference> | ||
</MacroExpansion> | ||
</TestAction> | ||
<LaunchAction | ||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.GDB" | ||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.GDB" | ||
launchStyle = "0" | ||
useCustomWorkingDirectory = "NO" | ||
buildConfiguration = "Debug" | ||
debugDocumentVersioning = "YES" | ||
allowLocationSimulation = "YES"> | ||
<BuildableProductRunnable> | ||
<BuildableReference | ||
BuildableIdentifier = "primary" | ||
BlueprintIdentifier = "103A10D215215EF200C7E225" | ||
BuildableName = "Reflecticle.app" | ||
BlueprintName = "Reflecticle" | ||
ReferencedContainer = "container:Reflecticle.xcodeproj"> | ||
</BuildableReference> | ||
</BuildableProductRunnable> | ||
<AdditionalOptions> | ||
</AdditionalOptions> | ||
</LaunchAction> | ||
<ProfileAction | ||
shouldUseLaunchSchemeArgsEnv = "YES" | ||
savedToolIdentifier = "" | ||
useCustomWorkingDirectory = "NO" | ||
buildConfiguration = "Release" | ||
debugDocumentVersioning = "YES"> | ||
<BuildableProductRunnable> | ||
<BuildableReference | ||
BuildableIdentifier = "primary" | ||
BlueprintIdentifier = "103A10D215215EF200C7E225" | ||
BuildableName = "Reflecticle.app" | ||
BlueprintName = "Reflecticle" | ||
ReferencedContainer = "container:Reflecticle.xcodeproj"> | ||
</BuildableReference> | ||
</BuildableProductRunnable> | ||
</ProfileAction> | ||
<AnalyzeAction | ||
buildConfiguration = "Debug"> | ||
</AnalyzeAction> | ||
<ArchiveAction | ||
buildConfiguration = "Release" | ||
revealArchiveInOrganizer = "YES"> | ||
</ArchiveAction> | ||
</Scheme> |
32 changes: 32 additions & 0 deletions
32
Reflecticle.xcodeproj/xcuserdata/vanstee.xcuserdatad/xcschemes/xcschememanagement.plist
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | ||
<plist version="1.0"> | ||
<dict> | ||
<key>SchemeUserState</key> | ||
<dict> | ||
<key>Deployment.xcscheme</key> | ||
<dict> | ||
<key>orderHint</key> | ||
<integer>1</integer> | ||
</dict> | ||
<key>Reflecticle.xcscheme</key> | ||
<dict> | ||
<key>orderHint</key> | ||
<integer>0</integer> | ||
</dict> | ||
</dict> | ||
<key>SuppressBuildableAutocreation</key> | ||
<dict> | ||
<key>103A10D215215EF200C7E225</key> | ||
<dict> | ||
<key>primary</key> | ||
<true/> | ||
</dict> | ||
<key>103A10DB15215EF200C7E225</key> | ||
<dict> | ||
<key>primary</key> | ||
<true/> | ||
</dict> | ||
</dict> | ||
</dict> | ||
</plist> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,43 @@ | ||
# | ||
# AppDelegate.rb | ||
# Reflecticle | ||
# | ||
# Created by Patrick Van Stee on 3/26/12. | ||
# Copyright 2012 __MyCompanyName__. All rights reserved. | ||
# | ||
|
||
class AppDelegate | ||
attr_accessor :window | ||
def applicationDidFinishLaunching(a_notification) | ||
# Insert code here to initialize your application | ||
attr_accessor :window, :menu, :api_key, :projects, :project, :post, :menu_item_view | ||
|
||
def awakeFromNib | ||
@api_key.stringValue = NSUserDefaults.standardUserDefaults["api_key"] | ||
|
||
@status_bar = NSStatusBar.systemStatusBar.statusItemWithLength(NSVariableStatusItemLength) | ||
@status_bar.setMenu(@menu) | ||
@status_bar.setTitle("Reflecticle") | ||
@status_bar.setHighlightMode(true) | ||
|
||
@menu_item = NSMenuItem.new | ||
@menu_item.setView(@menu_item_view) | ||
@menu.insertItem(@menu_item, atIndex: 0) | ||
|
||
api_key = NSUserDefaults.standardUserDefaults["api_key"] | ||
unless api_key.empty? | ||
uri = URI.parse("http://www.reflecticle.com/api/projects.json?api_key=#{api_key}") | ||
@projects ||= Hash[JSON.parse(Net::HTTP.get_response(uri).body).map { |p| [p["id"], p["name"]] }] | ||
@project.removeAllItems | ||
@project.addItemsWithTitles(@projects.values) | ||
end | ||
end | ||
end | ||
|
||
def populate(sender) | ||
p @project.itemArray | ||
end | ||
|
||
def post(sender) | ||
api_key = NSUserDefaults.standardUserDefaults["api_key"] | ||
if !api_key.empty? && !@post.stringValue.empty? | ||
uri = URI.parse("http://www.reflecticle.com/api/activities/create.json?api_key=#{api_key}&project_id=1&description=#{@post.stringValue}") | ||
p Net::HTTP.get_response(uri) | ||
@post.stringValue = "" | ||
end | ||
end | ||
|
||
def save(sender) | ||
NSUserDefaults.standardUserDefaults["api_key"] = @api_key.stringValue | ||
NSUserDefaults.standardUserDefaults.synchronize | ||
@window.performClose(true) | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
class NSMenuItemWithTextField < NSMenuItem | ||
def setView(view) | ||
text_field = NSTextField.alloc.init | ||
view.addSubview(text_field) | ||
end | ||
end |
Oops, something went wrong.