Re: [MacRuby-devel] command line cocoa framework

2010-09-22 Thread Clay Bridges
 I wrote my piece in nu, but I'd love some other submissions, in case
 macrake had support for building frameworks, or if somebody had a rake
 file to do it.

Rakefile sorted. That was fast.
___
MacRuby-devel mailing list
MacRuby-devel@lists.macosforge.org
http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel


Re: [MacRuby-devel] Debugging API... standalone? documented? where?

2010-09-18 Thread Clay Bridges
 Note that this API is to control the MacRuby debugger.

My mistake, I thought MacRuby was using some debugger-fu that would be
more generally applicable.

Thanks

Clay
___
MacRuby-devel mailing list
MacRuby-devel@lists.macosforge.org
http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel


[MacRuby-devel] Debugging API... standalone? documented? where?

2010-09-17 Thread Clay Bridges
Like some of you, I keep tabs on MacRuby and nu. I showed the nu guys
this quote from the 0.6 release:

An interesting feature of the debugger is that it has been abstracted
into a simple Objective-C API, of which macrubyd is just one client.
In the future we might see other clients. [1]

Tim Burks (created nu) wrote back:

 Can you point out a link to the simple Objective-C API that Laurent
 mentioned? Do we have to pull it from the MacRuby source?

What's the story?

Thanks

Clay
___
MacRuby-devel mailing list
MacRuby-devel@lists.macosforge.org
http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel


[MacRuby-devel] rescue NSException?

2009-09-09 Thread Clay Bridges
Does MacRuby 0.5 rescue Objective-C NSExceptions? e.g.

begin
  # call to Objective C dynlib here, raises NSException
rescue
  # should this get called?
end

Thanks

Clay
___
MacRuby-devel mailing list
MacRuby-devel@lists.macosforge.org
http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel


Re: [MacRuby-devel] rescue NSException?

2009-09-09 Thread Clay Bridges
If it matters, I'm on SL.

cb
___
MacRuby-devel mailing list
MacRuby-devel@lists.macosforge.org
http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel


[MacRuby-devel] bundle or dylib

2009-09-01 Thread Clay Bridges
Hi gang,

I was checking out the potential changes to the website, particularly
create-an-objective-c-bundle.txt, and that inspired me to ask a
longstanding question. I know very little about this stuff, but from
what I could discern, it looks like MacRuby is loading what are
technically dylibs, and not proper bundles. Is this true, or am I just
whack again?

Thanks

Clay
___
MacRuby-devel mailing list
MacRuby-devel@lists.macosforge.org
http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel


Re: [MacRuby-devel] forwardingTargetForSelector vs. MacRuby 0.4

2009-08-21 Thread Clay Bridges
 (Sorry for the late reply.)

Ditto.

 Did you try using the old methodSignatureForSelector: and
 -forwardInvocation: technique?

Thanks for the suggestion, but no. I'm using MacRuby to test my ObjC
classes, and the design decisions on the ObjC side are made othogonal
to MacRuby considerations. Put another way, for me, the workarounds
should be on the MacRuby side.

I actually found some interesting stuff while trying to create a
workaround, but I'll post that in another thread. Two follow-up
questions:

* Do I need to file a bug, etc.? Let me know what I can do to help.

* The probably-too-frequent question: Any idea if this will be fixed in 0.5?

Thanks

Clay Bridges
___
MacRuby-devel mailing list
MacRuby-devel@lists.macosforge.org
http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel


[MacRuby-devel] Monkey patching Objective-C classes

2009-08-21 Thread Clay Bridges
I'm using MacRuby to test some of my ObjC classes. I was wondering if
there was a canonical way to monkey patch these classes.

Consider, the following where Cell is an ObjC class:

irb(main):001:0 Cell.object_id
= 4387749088
irb(main):002:0 class Cell
irb(main):003:1   def whee
irb(main):004:2 p 'whee'
irb(main):005:2   end
irb(main):006:1 end
= nil
irb(main):007:0 Cell.object_id
= 4388625216

I would expect the object_id to stay the same, e.g. using pure MacRuby:

irb(main):010:0 class Bar
irb(main):011:1 end
= nil
irb(main):012:0 Bar.object_id
= 4298834304
irb(main):013:0 class Bar
irb(main):014:1   def drink
irb(main):015:2 p 'tasty!'
irb(main):016:2   end
irb(main):017:1 end
= nil
irb(main):018:0  Bar.object_id
= 4298834304

Thanks

Clay Bridges
___
MacRuby-devel mailing list
MacRuby-devel@lists.macosforge.org
http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel


Re: [MacRuby-devel] Monkey patching Objective-C classes

2009-08-21 Thread Clay Bridges
Forgive my caveman-programmer terminology, but it seems to overwrite
the class symbol. Extending Laurent's example (kind of):

gort:~ clay$ macruby -e p NSPredicate.object_id; p
NSPredicate.methods(false,true); class NSPredicate; def hey;end; end;
p NSPredicate.object_id; p NSPredicate.methods(false,true)

140735077844512
[:predicateWithValue, :predicateWithFormat:arguments:,
:predicateWithFormat, :predicateWithFormat:argumentArray:,
:newStringFrom:usingUnicodeTransforms:, :initialize]
4298735808
[:__new__, :new, :alloc]

gort:~ clay$ macruby --version
MacRuby version 0.4 (ruby 1.9.1) [universal-darwin9.5, x86_64]

If it's fixed, it still might be worth a unit test. ;)

Clay
___
MacRuby-devel mailing list
MacRuby-devel@lists.macosforge.org
http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel


[MacRuby-devel] macruby-bundle-example

2009-08-15 Thread Clay Bridges
Hi all,

When I was first figuring out how to call my ObjC classes from MacRuby, I
greatly benefited from Pieter de Bie's excellent minimal, xcode-free example
of this, macruby-bundle-example. I spiffed it up a bit.  Here's the github
link: http://github.com/diffengr/macruby-bundle-example.

It might be helpful to link to this or its like in future tutorials on this
subject.

Cheers,

Clay
___
MacRuby-devel mailing list
MacRuby-devel@lists.macosforge.org
http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel


[MacRuby-devel] How to use custom C struct's?

2009-08-05 Thread Clay Bridges
Hi all,

I'm writing an iPhone app. I made the audacious step of trying to test
my ObjC model classes using MacRuby. I create and load a dynlib
(bundle) of these classes. So far, so good.

However, I have a C struct that I use all over the place:

struct MapPoint {
  int row;
  int col;
};
typedef struct MapPoint MapPoint;

Obviously, when I have a method that returns that type, MacRuby
doesn't like it. That is,

# ruby
my_objc_object.mapPoint

gives this error:

RuntimeError: unrecognized octype `{MapPoint=ii}'

The google didn't yield much guidance on this. Before I started a
deep-dive on the MacRuby source, and/or the standard ruby way to
handle this sort of thing, I thought I would ask a couple of
questions:

1) Any easy advice?

2) Is this different in MacRuby than in ruby proper?

3) Any pointers into the MacRuby source that might help me?

Thanks,

Clay Bridges
___
MacRuby-devel mailing list
MacRuby-devel@lists.macosforge.org
http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel


Re: [MacRuby-devel] How to use custom C struct's?

2009-08-05 Thread Clay Bridges
 Yes, use RubyCocoa

I'm afraid I'm already hooked. ;)

If it comes down to it, I've already put a testing-only category wrapper
around one method, e.g.

#import Cell.h

@interface Cell (TestUtil)

@property (readonly) NSArray* mapPointAsArray;

@end

@implementation Cell (TestUtil)

@dynamic mapPointAsArray;

// this method is simply for ruby-side testing
- (NSArray*) mapPointAsArray {
NSMutableArray* nsma = [[NSMutableArray alloc] initWithCapacity:2];
[nsma addObject:[NSNumber numberWithInt:mapPoint.row]];
[nsma addObject:[NSNumber numberWithInt:mapPoint.col]];
return [nsma autorelease];
}

@end

Not too much work to do it for the others. Of course, one could argue what
I'm really testing here, but the craftsman in me says it's OK.

Clay
___
MacRuby-devel mailing list
MacRuby-devel@lists.macosforge.org
http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel


Re: [MacRuby-devel] How to use custom C struct's?

2009-08-05 Thread Clay Bridges
Thank you, Laurent. That was *incredibly* helpful and kind of you, and
worked perfectly. Being able to add MapPoint#to_a and MapPoint[row,col]
methods was the oh, ruby, you *are* magic moment of it all.

I was going to try to pay it back by putting it up on a wiki, but Jordan
beat me to it. I LOL'd when I saw my lowly MapPoint had made it to the big
time. You go, struct!

Seriously, gang, as a first contact with the MacRuby community, I couldn't
be more impressed.

Thanks,

Clay
___
MacRuby-devel mailing list
MacRuby-devel@lists.macosforge.org
http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel