[MacRuby-devel] "framework" method gotcha

Christian Niles christian at nerdyc.com
Sat Mar 12 22:54:41 PST 2011


Cool. I've compiled MacRuby from source and discovered a test for the 'framework' method in test-macruby/cases/framework_test.rb. 

What's the best way to run the tests in this directory? It doesn't seem to be run by `rake spec` and I couldn't find another task that seemed to run these.

On Mar 12, 2011, at 8:35 PM, Matt Aimonetti wrote:

> Hi Christian,
> 
> As long as performance isn't affected, I think that making #framework smarter shouldn't be a problem. 
> 
> - Matt
> 
> Sent from my iPhone
> 
> On Mar 12, 2011, at 17:19, Christian Niles <christian at nerdyc.com> wrote:
> 
>> Hey All,
>> 
>> I just spent a few hours banging my head against a gotcha with the `framework` method -- if there happens to be a file or directory in the current directory with the name of the framework, the method fails:
>> 
>> $ touch Cocoa
>> $ macruby -e 'framework "Cocoa"'
>> -e:1:in `<main>': framework at path `Cocoa' cannot be located (RuntimeError)
>> 
>> $ rm Cocoa; mkdir Cocoa
>> $ macruby -e 'framework "Cocoa"'
>> -e:1:in `<main>': framework at path `Cocoa' cannot be loaded: Error Domain=NSCocoaErrorDomain Code=4 UserInfo=0x200241e20 "The bundle “Cocoa” couldn’t be loaded because its executable couldn’t be located."
>> 
>> I ran into this while trying to setup unit testing for a Cocoa framework I'm writing. XCode 4 automatically creates a directory for each target you create. Thus, when I tried to load my framework, it saw my project target directory and thought it had found the framework.
>> 
>> I think the `framework` method should be updated to avoid this gotcha. Currently, it just tests for existence of a file or directory. I'm happy to start working on a patch, but wanted to ask if there's any possible reason the `framework` method is this naïve?
>> 
>> christian.
>> _______________________________________________
>> MacRuby-devel mailing list
>> MacRuby-devel at lists.macosforge.org
>> http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
> _______________________________________________
> MacRuby-devel mailing list
> MacRuby-devel at lists.macosforge.org
> http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel



More information about the MacRuby-devel mailing list