2009-10-27
Unit Testing Applications in Cocoa
0 comments
chanson.livejournal.com/tag/unit+testing is a wonderful resource for getting unit tests up and running in cocoa (esp under the debugger). One of the comments was a gem and I pulled it out and fixed it up to work a bit better... This converts your project to run your application's unit tests under gdb. I can't get it to work under XCode's script menu, but it should work fine under the system wide script menu.
(*
To debug the unit tests, in the "General" tab of the executable info window, the "Working Directory" must be set to "Build Products directory"
Modify the testFrameworkPath for your system
*)
set testFrameworkPath to "/Developer/Library/Frameworks/SenTestingKit.framework"
tell application "Xcode"
tell project of active project document
set projectName to name
set executablePath to "$(BUILT_PRODUCTS_DIR)/" & projectName & ".app/Contents/MacOS/" & projectName
tell executable name
make new launch argument with properties {name:"-SenTest All", active:true}
make new environment variable with properties {name:"DYLD_FALLBACK_FRAMEWORK_PATH", value:"$(DEVELOPER_LIBRARY_DIR)/Frameworks", active:true}
make new environment variable with properties {name:"XCInjectBundleInto", value:(projectName & ".app/Contents/MacOS/" & projectName), active:true}
make new environment variable with properties {name:"XCInjectBundle", value:"Unit Tests.octest", active:true}
make new environment variable with properties {name:"DYLD_INSERT_LIBRARIES", value:"$(DEVELOPER_LIBRARY_DIR)/PrivateFrameworks/DevToolsBundleInjection.framework/DevToolsBundleInjection", active:true}
end tell
set unitTestTemplate to target template "Cocoa/Unit Test Bundle"
make new target at end of targets with data unitTestTemplate with properties {name:"Unit Tests"}
tell root group
make new group with properties {name:"Test Cases"} at beginning of groups
end tell
tell group "Linked Frameworks"
set testFrameworkFile to make new file reference with properties {full path:testFrameworkPath, name:"SenTestingKit.framework"}
end tell
add testFrameworkFile to (get link binary with libraries phase of target "Unit Tests")
set value of build setting "BUNDLE_LOADER" of build configuration "Debug" of target "Unit Tests" to executablePath
set value of build setting "TEST_HOST" of build configuration "Debug" of target "Unit Tests" to "$(BUNDLE_LOADER)"
set active target to target "Unit Tests"
end tell
end tell
activate application "Xcode"
tell application "System Events"
tell process "Xcode"
tell outline 1 of scroll area 1 of splitter group 1 of group 1 of window 1
tell (first row whose value of text field 1 of group 1 = "Targets")
set targetGroupDisclosureTriangle to UI element 1 of group 1
if value of targetGroupDisclosureTriangle = 0 then
perform action "AXPress" of targetGroupDisclosureTriangle
end if
end tell
select (first row whose value of text field 1 of group 1 = "Unit Tests")
end tell
perform action "AXPress" of menu item "Get Info" of menu 1 of menu bar item "File" of menu bar 1
tell window "Target “Unit Tests” Info"
click radio button "General" of tab group 1
perform action "AXPress" of button 1 of splitter group 1 of tab group 1
tell sheet 1
select (first row of outline 1 of scroll area 1 whose value of text field 1 = projectName)
click button "Add Target"
end tell
click button 1
end tell
end tell
end tell
2009-10-16
osx_keychain version 1.0.0 has been released!
0 comments
Provides API and a command line tool to Access the OS X Keychain. The
command line tool isn't actually useful (use security
instead), but
demonstrates the usage quite well.
Changes:
1.0.0 / 2009-10-16
1 major enhancement
- Birthday!
rubyforge.org/projects/seattlerb
2009-10-11
omnifocus version 1.3.0 has been released!
0 comments
Synchronizes bug tracking systems to omnifocus.
Changes:
1.3.0 / 2009-10-10
1 minor enhancement:
- Added ability to re-open tasks. (aja)
rubyforge.org/projects/seattlerb
2009-09-21
rubyforge version 2.0.0 has been released!
0 comments
A script which automates a limited set of rubyforge operations.
- Run 'rubyforge help' for complete usage.
- Setup: For first time users AND upgrades to 0.4.0:
- rubyforge setup (deletes your username and password, so run sparingly!)
- edit ~/.rubyforge/user-config.yml
- rubyforge config
- For all rubyforge upgrades, run 'rubyforge config' to ensure you have latest.
Changes:
2.0.0 / 2009-09-21
Modified to use RubyForge REST API rather than scraping HTML.
codeforpeople.rubyforge.org/rubyforge/
- rubyforge.org/projects/codeforpeople/
2009-09-14
rubyforge version 1.0.5 has been released!
0 comments
A script which automates a limited set of rubyforge operations.
- Run 'rubyforge help' for complete usage.
- Setup: For first time users AND upgrades to 0.4.0:
- rubyforge setup (deletes your username and password, so run sparingly!)
- edit ~/.rubyforge/user-config.yml
- rubyforge config
- For all rubyforge upgrades, run 'rubyforge config' to ensure you have latest.
- Don't forget to login! logging in will store a cookie in your .rubyforge directory which expires after a time. always run the login command before any operation that requires authentication, such as uploading a package.
Changes:
1.0.5 / 2009-09-15
- Added experimental script to sync RF trackers with release names.
- Fixed that damned processor_id bug. (hinegardner)
- The century usually doesn't change across runs. Refactor.
Fix use of Time.utc if args.size < 10, tho seems unnecessary.
codeforpeople.rubyforge.org/rubyforge/
- rubyforge.org/projects/codeforpeople/
2009-09-10
10 Principles of Good Design
0 comments
(Picked this up at work yesterday. Good stuff.)
10 Principles of Good Design
- Good design is innovative.
- Good design makes a product useful.
- Good design is aesthetic.
- Good design helps us to understand a product.
- Good design is unobtrusive.
- Good design is honest.
- Good design is durable.
- Good design is consequent to the last detail.
- Good design is concerned with the environment.
- Good design is as little design as possible.
From Dieter Rams, the design force behind Braun in the 60s.
Rams’s motto:
"Weniger, aber besser."
("Less, but better.")
2009-09-06
Ruby Hitsquad's Newest Members
0 comments
Kevin Bullock has recently released both vlad-hg and vlad-merb gems.
John Barnette released the vlad-git gem.
They're all available under the hitsquad's project on rubyforge.
2009-09-03
wilson
0 comments
Tee hee. I think this is your best gem name evar. [...] Wilson is very metal. Wilson strikes more fear in to my heart than you do!
-- Aaron Patterson
2009-08-29
Why I Hate Yacc
0 comments
call_args2: arg_value tCOMMA args opt_block_arg
| arg_value tCOMMA block_arg
| arg_value tCOMMA tSTAR arg_value opt_block_arg
| arg_value tCOMMA args tCOMMA tSTAR arg_value opt_block_arg
| assocs opt_block_arg
| assocs tCOMMA tSTAR arg_value opt_block_arg
| arg_value tCOMMA assocs opt_block_arg
| arg_value tCOMMA args tCOMMA assocs opt_block_arg
| arg_value tCOMMA assocs tCOMMA tSTAR arg_value opt_block_arg
| arg_value tCOMMA args tCOMMA assocs tCOMMA tSTAR arg_value opt_block_arg
| tSTAR arg_value opt_block_arg
| block_arg
2009-08-24
GEM_PATH, rubygems, and you
0 comments
On OSX, I have GEM_PATH
set in my environment to stop using (or even seeing) apple installed gems which inevitably grow stale. I do that via:
export GEM_PATH=`gem env home`
This works pretty well, except for gem clean
which always bitches about rails and libxml-ruby and a bunch of other crap I don't care about. I couldn't figure out why gem list
was fine but gem clean
was seeing stuff it shouldn't be able to see.
I figgered it out!
See, apple added a bunch of extra safeguards to the default sudo
configuration:
# Defaults specification
Defaults env_reset
Defaults env_keep += "BLOCKSIZE"
# ...
Defaults env_keep += "EDITOR VISUAL"
This is actually pretty cool when you think about it. Your environment is clean(er)ly scrubbed whenever you're acting as root. So, to fix this, you run sudo visudo
and add this to the env_keep
section:
# Added by ryand:
Defaults env_keep += "GEM_PATH GEM_HOME"