[MacRuby-devel] Bug: NSValueTransformer receivers NSCFNumber, not fixnum

2009-02-12 Thread Brian Marick

Is this a bug? I don't see anything quite like it in Trac.

I have a binding to a button's state property. Here's the binding:

   @comboBox.bind 'enabled',
 toObject: @button,
 withKeyPath: 'state',
 options: {
 NSValueTransformerBindingOption =>
 OffStateMeansTrueTransformer.alloc.init
   }

At the point the binding is made, the state of the button is a fixnum 0.

The value transformer is immediately called to set the starting value.  
Here's the transformedValue code:


 def transformedValue(state)
   puts "state -> bool transforming #{state.inspect}"
# prints #
# state.intValue is 0

Because of this, I have to cast the state before making comparisons:

   case state.intValue
   when NSOffState then true
   when NSOnState then false
   else
 raise "The value to transform should be either NSOffState or  
NSOnState."

   end


If this is a bug, I'll write a testcase.

-
Brian Marick, independent consultant
Mostly on agile methods with a testing slant
www.exampler.com, www.exampler.com/blog, www.twitter.com/marick

___
MacRuby-devel mailing list
[email protected]
http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel


Re: [MacRuby-devel] helping out

2009-03-30 Thread Brian Marick
I'm going to start porting the _RubyCocoa_ demo app into MacRuby.  
What's the most useful (to you) branch to use?


On Mar 30, 2009, at 3:06 PM, Matt Aimonetti wrote:


Hey John,

I would happily spend some time on MacRuby, but I have no idea where  
to start.

Anyway I was wondering whether you could give me a quick run down on
how to start investigating learning and experimenting with the
experimental branch.

Don't start with the experimental branch, it's a work in progress  
and unless you work on a very specific area under the supervision of  
Laurent, I think you should wait a little bit.


I would like to start as simple as possible - but down the track one  
particular part that i would be interested in is tracing the  
dispatch from bridgesupport method to opengl function.


Once the experimental branch will have the cocoa integration I'm  
sure this is something we can help you working on. (and by 'we' I  
really mean: Laurent :p)


Speaking of which is it you that cannot make it? Pity if so - I was  
looking fwd to your talk as I have some very flaky code which  
interfaces with some traditional (ie non REST) webservices - I was  
hoping for some (yet more) tips ;-).


Unfortunately, there was a last minute change and I won't be able to  
make it to the conf. However, I'm still planning on preparing some  
documentation on integrating MacRuby apps with remote/local web  
applications. You mentioned non-REST webservices, what do you have  
to deal with? SOAP, XML-RPC, something else?


On a different note, I can think of a few things that you could do  
to help:
- work on MacRuby/HotCocoa examples, I know you already ported a lot  
of samples from various sources, but some original samples to show  
various technics would def. be helpful.

- write articles for the blog (I believe you already started)
- work on HotCocoa (add mappings, suggest new APIs, study a way to  
test hotcocoa code (hotcocoa itself as well as developer's code))

- port the major ruby C extensions to MacRuby (using C or obj-c)

I'll try to talk with Laurent and list the things he would like  
people to work on. Once we have a concrete list, maybe we can  
organize ourselves in pairs/small groups and start tackling these  
tasks.


- Matt



On Mon, Mar 30, 2009 at 12:42 PM, John Shea   
wrote:

Hi Matt,

you said:
> If you were thinking about helping out, be reassured, help is  
always welcome ;)


I would happily spend some time on MacRuby, but I have no idea where  
to start.

I downloaded the experimental branch - was not really sure to go from
there but tried running some simple ruby code with the miniruby
executable - it hung so I assume I was doing something wrong.

Anyway I was wondering whether you could give me a quick run down on
how to start investigating learning and experimenting with the
experimental branch. Any links would be helpful. I would like to start
as simple as possible - but down the track one particular part that i
would be interested in is tracing the dispatch from bridgesupport
method to opengl function.

I can't really spend much time until after the Amsterdam conference  
however.


Speaking of which is it you that cannot make it? Pity if so - I was
looking fwd to your talk as I have some very flakey code which
interfaces with some traditional (ie non REST) webservices - I was
hoping for some (yet more) tips ;-).

Cheers,
J
___
MacRuby-devel mailing list
[email protected]
http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel

___
MacRuby-devel mailing list
[email protected]
http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel


-
Brian Marick, independent consultant
Mostly on agile methods with a testing slant
www.exampler.com, www.exampler.com/blog, www.twitter.com/marick

___
MacRuby-devel mailing list
[email protected]
http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel


Re: [MacRuby-devel] Unit testing in Xcode

2009-04-07 Thread Brian Marick


On Apr 4, 2009, at 4:55 AM, John Shea wrote:

Brian Marick has a good chapter on testing in his "RubyCocoa,  
bringing some love. "  using standard ruby testing  
methodologies. You can get this as a pdf book (its not out in print  
yet)



Thanks. Note, though, that I don't test in Xcode. I don't even code in  
Xcode - I use Aquamacs emacs. So the testing I describe is plain old  
testing at the command line. It's the equivalent of Command-Tab and  
typing !! to the shell. (As an emacs user, of course, it's all done  
inside of emacs, so all I type is F4. I imagine a little AppleScript  
could make it one keystroke for non-emacs users.)


-
Brian Marick, independent consultant
Mostly on agile methods with a testing slant
www.exampler.com, www.exampler.com/blog, www.twitter.com/marick

___
MacRuby-devel mailing list
[email protected]
http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel


Re: [MacRuby-devel] Out parameters with MacRuby

2009-04-27 Thread Brian Marick


On Apr 26, 2009, at 12:09 PM, rebotfc wrote:


errorp = Pointer.new_with_type("@")

result = NSXMLDocument.alloc.initWithData(data,  
options:NSXMLDocumentValidate, error:errorp)


# access error
errorp[0]


So the RubyCocoa style of having by-reference arguments returned as  
extra return values is not included in MacRuby?



-----
Brian Marick, independent consultant
Mostly on agile methods with a testing slant
www.exampler.com, www.exampler.com/blog, www.twitter.com/marick

___
MacRuby-devel mailing list
[email protected]
http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel


Re: [MacRuby-devel] experimental branch: status update

2009-05-07 Thread Brian Marick


On May 4, 2009, at 5:35 PM, Laurent Sansonetti wrote:


We can pass more Cocoa examples thanks to that.



I've started translating the examples in /Developer/Examples into  
RubyCocoa & MacRuby. Is the MacRuby part redundant?


http://github.com/marick/cocoa-examples-translated/tree/master

-----
Brian Marick, independent consultant
Mostly on agile methods with a testing slant
www.exampler.com, www.exampler.com/blog, www.twitter.com/marick

___
MacRuby-devel mailing list
[email protected]
http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel


Re: [MacRuby-devel] experimental branch: status update

2009-05-07 Thread Brian Marick


On May 7, 2009, at 4:19 PM, Matt Aimonetti wrote:

On May 4, 2009, at 5:35 PM, Laurent Sansonetti wrote:

We can pass more Cocoa examples thanks to that.


I've started translating the examples in /Developer/Examples into  
RubyCocoa & MacRuby. Is the MacRuby part redundant?


http://github.com/marick/cocoa-examples-translated/tree/master


I meant that I don't want to translate /Developer/Examples examples to  
MacRuby if someone's already doing it.



-
Brian Marick, independent consultant
Mostly on agile methods with a testing slant
www.exampler.com, www.exampler.com/blog, www.twitter.com/marick

___
MacRuby-devel mailing list
[email protected]
http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel


Re: [MacRuby-devel] testing macruby/hotcocoa apps

2009-05-12 Thread Brian Marick
I think it's prudent to make UI testing as much like unit testing as  
possible. Tools and tests that poke at the GUI from "outside" are  
notoriously fragile. I gave a talk at Mountain West RubyConf on using  
TDD for user interfaces (using RubyCocoa, but the idea is the same for  
MacRuby).
<http://mwrc2009.confreaks.com/videos/13-mar-2009-17-00-test-driving-guis-with-rubycocoa-brian-marick-large.mp4 
>


This week, I'll be updating my tooling for MacRuby and starting to use  
it to reimplement the /Developer/Examples Objective-C samples.


(Shameless plug: There's a more detailed description of the testing  
approach in my RubyCocoa book: <http://pragprog.com/titles/bmrc/rubycocoa 
>.)


-
Brian Marick, independent consultant
Mostly on agile methods with a testing slant
www.exampler.com, www.exampler.com/blog, www.twitter.com/marick

___
MacRuby-devel mailing list
[email protected]
http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel


[MacRuby-devel] connect to udp socket: getaddrinfo: nodename nor servname provided, or not known (SocketError)

2009-12-11 Thread Brian Marick
I'm on Snow Leopard (10.6.2), using xmpp4r. I can connect to the jabber server 
fine using Apple's stock Ruby (1.8.7 (2008-08-11 patchlevel 72)) but not with 
MacRuby 0.5 (beta 2). When I try the same code with MacRuby, I get this:

core:in `connect:': getaddrinfo: nodename nor servname provided, or not known 
(SocketError)
from 
/Library/Frameworks/MacRuby.framework/Versions/0.5/usr/lib/ruby/1.9.0/resolv.rb:690:in
 `initialize:'

That line is from this code: 

  class ConnectedUDP < Requester # :nodoc:
def initialize(host, port=Port)
  super()
  @host = host
  @port = port
==>  @sock = UDPSocket.new(host.index(':') ? Socket::AF_INET6 : 
Socket::AF_INET)
  DNS.bind_random_port(@sock)
  @sock.connect(host, port)
  @sock.fcntl(Fcntl::F_SETFD, Fcntl::FD_CLOEXEC) if defined? 
Fcntl::F_SETFD
end

That code is the same as in 1.8.7 (though there are other differences in the 
file). 

I searched around and found references to the same error message coming from 
using drb on 10.5.3 stock ruby, but notice that my stock Ruby works. 

I'll do a little more digging. Does anyone have any ideas? Here's the code:

http://pastie.org/739072

-
Brian Marick, independent consultant
Mostly on agile methods with a testing slant
Author of /Programming Cocoa with Ruby/
www.exampler.com, www.exampler.com/blog, www.twitter.com/marick

___
MacRuby-devel mailing list
[email protected]
http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel


[MacRuby-devel] Cannot get standalone distribution to work with 0.5 or Apr 29 nightly

2010-05-02 Thread Brian Marick
I'm trying to get a standalone distribution working (one with the MacRuby 
framework embedded in the app). I've followed the instructions in the tutorial
http://www.macruby.com/documentation/tutorial.html
and also looked at the discussion in ticket 281, macruby-devel at 
http://bit.ly/dkKyXT, and carlo.log http://bit.ly/5SdxCq

At this point, the app does nothing but pop up "hello world" (using Cocoa 
directly rather than via hotcocoa). It fails with this message in the console:

no such file to load -- ubygems (LoadError)

ubygems.rb *is* present in the path that rb_main.rb sets, but the error happens 
before rb_main.rb is entered.

I've tried using install_name_tool in various ways, but it never changes 
anything.

Questions:

1. Is the LoadError caused by something else entirely?
2. Should I need to use install_name_tool with recent nightlies or is 
macruby_deploy all I should need?
3. Any ideas about how to make it work?

-
Brian Marick, independent consultant
Mostly on agile methods with a testing slant
Author of /Programming Cocoa with Ruby/
www.exampler.com, www.exampler.com/blog, www.twitter.com/marick

___
MacRuby-devel mailing list
[email protected]
http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel


Re: [MacRuby-devel] Cannot get standalone distribution to work with 0.5 or Apr 29 nightly

2010-05-02 Thread Brian Marick
Xcode.


On May 2, 2010, at 1:16 PM, Matt Aimonetti wrote:

> Are you trying to compile an Xcode or hotcocoa project?
> 
> - Matt
> 
> On Sun, May 2, 2010 at 11:10 AM, Brian Marick  wrote:
> I'm trying to get a standalone distribution working (one with the MacRuby 
> framework embedded in the app). I've followed the instructions in the tutorial
> http://www.macruby.com/documentation/tutorial.html
> and also looked at the discussion in ticket 281, macruby-devel at 
> http://bit.ly/dkKyXT, and carlo.log http://bit.ly/5SdxCq
> 
> At this point, the app does nothing but pop up "hello world" (using Cocoa 
> directly rather than via hotcocoa). It fails with this message in the console:
> 
>   no such file to load -- ubygems (LoadError)
> 
> ubygems.rb *is* present in the path that rb_main.rb sets, but the error 
> happens before rb_main.rb is entered.
> 
> I've tried using install_name_tool in various ways, but it never changes 
> anything.
> 
> Questions:
> 
> 1. Is the LoadError caused by something else entirely?
> 2. Should I need to use install_name_tool with recent nightlies or is 
> macruby_deploy all I should need?
> 3. Any ideas about how to make it work?
> 
> -
> Brian Marick, independent consultant
> Mostly on agile methods with a testing slant
> Author of /Programming Cocoa with Ruby/
> www.exampler.com, www.exampler.com/blog, www.twitter.com/marick
> 
> ___
> MacRuby-devel mailing list
> [email protected]
> http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
> 
> _______
> MacRuby-devel mailing list
> [email protected]
> http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel

-
Brian Marick, independent consultant
Mostly on agile methods with a testing slant
Author of /Programming Cocoa with Ruby/
www.exampler.com, www.exampler.com/blog, www.twitter.com/marick

___
MacRuby-devel mailing list
[email protected]
http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel


Re: [MacRuby-devel] Cannot get standalone distribution to work with 0.5 or Apr 29 nightly

2010-05-02 Thread Brian Marick
You are my hero. I set RUBYOPT in .MacOS/environment.plist long ago.

On May 2, 2010, at 3:18 PM, Laurent Sansonetti wrote:

> Hi Brian,
> 
> Would you have by any chance a RUBYOPT environment variable set to "-r 
> rubygems" in the default environment?
> 
> Laurent


-
Brian Marick, independent consultant
Mostly on agile methods with a testing slant
Author of /Programming Cocoa with Ruby/
www.exampler.com, www.exampler.com/blog, www.twitter.com/marick

___
MacRuby-devel mailing list
[email protected]
http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel


[MacRuby-devel] Kernel#caller doesn't show directories

2010-05-03 Thread Brian Marick
Suppose you have foo.rb:

  def __DIR__
caller[0]
raise 'death'
  end

  puts __DIR__

 
If you call that from, say, a directory two levels below it, you get this:

818 $ macruby ../../foo.rb
foo.rb:2:in `__DIR__': death (RuntimeError)
from foo.rb:6:in `'

In 1.8.6 (and I sure hope in stock 1.9), you get filenames with the relative 
directory:

819 $ ruby ../../foo.rb
../../foo.rb:3:in `__DIR__': death (RuntimeError)
from ../../foo.rb:6

I think that's important because there are tools (IDEs, my emacs hacks) that 
use the backtrace from a test to jump to the failing code. You can't do that 
unless you have the full pathname.

I will file a ticket if this is a real bug.


-
Brian Marick, independent consultant
Mostly on agile methods with a testing slant
Author of /Programming Cocoa with Ruby/
www.exampler.com, www.exampler.com/blog, www.twitter.com/marick

___
MacRuby-devel mailing list
[email protected]
http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel


Re: [MacRuby-devel] Kernel#caller doesn't show directories

2010-05-03 Thread Brian Marick
Oh, forgot to mention: Ramaze also uses (or used to) use the caller() result to 
find its root and would probably break too.


-
Brian Marick, independent consultant
Mostly on agile methods with a testing slant
Author of /Programming Cocoa with Ruby/
www.exampler.com, www.exampler.com/blog, www.twitter.com/marick

___
MacRuby-devel mailing list
[email protected]
http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel


[MacRuby-devel] files delivered in site_ruby

2010-05-03 Thread Brian Marick
MacRuby 0.7: There are files delivered in site_ruby:

bigdecimal/ openssl/ripper.rb
digest/ openssl.rb  universal-darwin10.0/
digest.rb   ripper/

Shouldn't they be in vendor_ruby? I can't run a program without site-specific 
files by stripping site_ruby out of the path. If I do, macruby crashes with an 
Abort trap (in 0.5, at least) when it tries to load gems. 

I know that macruby_deploy -embed copies site_ruby into the application, so 
this causes no real problem other than wasted space, so maybe it's not worth 
fixing. But it'll cause more problems when macruby ships with OSX and people 
stop embedding.

I'll file a ticket if needed.

-
Brian Marick, independent consultant
Mostly on agile methods with a testing slant
Author of /Programming Cocoa with Ruby/
www.exampler.com, www.exampler.com/blog, www.twitter.com/marick

___
MacRuby-devel mailing list
[email protected]
http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel


Re: [MacRuby-devel] Kernel#caller doesn't show directories

2010-05-03 Thread Brian Marick
I see that this works in 0.7. Sorry for the waste of bandwidth.

On May 3, 2010, at 11:27 AM, Brian Marick wrote:

> Suppose you have foo.rb:
> 
>  def __DIR__
>caller[0]
>raise 'death'
>  end
> 
>  puts __DIR__
> 
> 
> If you call that from, say, a directory two levels below it, you get this:
> 
> 818 $ macruby ../../foo.rb
> foo.rb:2:in `__DIR__': death (RuntimeError)
>   from foo.rb:6:in `'
> 
> In 1.8.6 (and I sure hope in stock 1.9), you get filenames with the relative 
> directory:
> 
> 819 $ ruby ../../foo.rb
> ../../foo.rb:3:in `__DIR__': death (RuntimeError)
>   from ../../foo.rb:6
> 
> I think that's important because there are tools (IDEs, my emacs hacks) that 
> use the backtrace from a test to jump to the failing code. You can't do that 
> unless you have the full pathname.
> 
> I will file a ticket if this is a real bug.
> 
> 
> -
> Brian Marick, independent consultant
> Mostly on agile methods with a testing slant
> Author of /Programming Cocoa with Ruby/
> www.exampler.com, www.exampler.com/blog, www.twitter.com/marick
> 
> ___
> MacRuby-devel mailing list
> [email protected]
> http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel



-
Brian Marick, independent consultant
Mostly on agile methods with a testing slant
Author of /Programming Cocoa with Ruby/
www.exampler.com, www.exampler.com/blog, www.twitter.com/marick

___
MacRuby-devel mailing list
[email protected]
http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel


Re: [MacRuby-devel] Kernel#caller doesn't show directories

2010-05-04 Thread Brian Marick
I couldn't reproduce it. Vanilla 1.8.6 is still slightly better in that it 
prints

from ../../foo.rb:6

whereas a recent 0.7 prints a full path:

from /Users/marick/src/clients/SES/Tests/preferences/../../foo.rb:6:in 
`' 



On May 3, 2010, at 4:46 PM, Laurent Sansonetti wrote:

> Hi Brian,
> 
> This looks like a bug. I don't know why it's fixed in 0.7 for you, because we 
> haven't changed a lot of things there. 
> 
> In any case, a trac ticket might be a good idea if you still reproduce the 
> problem. Note that backtraces in MacRuby are generated by walking through the 
> stack and sometimes some entries are missing. File/line numbering is 
> retrieved from DWARF metadata but sometimes it's incorrectly compiled. So, 
> bug reports are welcome :-)
> 
> Laurent
> 
> On May 3, 2010, at 1:12 PM, Brian Marick wrote:
> 
>> I see that this works in 0.7. Sorry for the waste of bandwidth.
>> 
>> On May 3, 2010, at 11:27 AM, Brian Marick wrote:
>> 
>>> Suppose you have foo.rb:
>>> 
>>> def __DIR__
>>>  caller[0]
>>>  raise 'death'
>>> end
>>> 
>>> puts __DIR__
>>> 
>>> 
>>> If you call that from, say, a directory two levels below it, you get this:
>>> 
>>> 818 $ macruby ../../foo.rb
>>> foo.rb:2:in `__DIR__': death (RuntimeError)
>>> from foo.rb:6:in `'
>>> 
>>> In 1.8.6 (and I sure hope in stock 1.9), you get filenames with the 
>>> relative directory:
>>> 
>>> 819 $ ruby ../../foo.rb
>>> ../../foo.rb:3:in `__DIR__': death (RuntimeError)
>>> from ../../foo.rb:6
>>> 
>>> I think that's important because there are tools (IDEs, my emacs hacks) 
>>> that use the backtrace from a test to jump to the failing code. You can't 
>>> do that unless you have the full pathname.
>>> 
>>> I will file a ticket if this is a real bug.
>>> 
>>> 
>>> -
>>> Brian Marick, independent consultant
>>> Mostly on agile methods with a testing slant
>>> Author of /Programming Cocoa with Ruby/
>>> www.exampler.com, www.exampler.com/blog, www.twitter.com/marick
>>> 
>>> ___
>>> MacRuby-devel mailing list
>>> [email protected]
>>> http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
>> 
>> 
>> 
>> -
>> Brian Marick, independent consultant
>> Mostly on agile methods with a testing slant
>> Author of /Programming Cocoa with Ruby/
>> www.exampler.com, www.exampler.com/blog, www.twitter.com/marick
>> 
>> ___
>> MacRuby-devel mailing list
>> [email protected]
>> http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
> 
> ___
> MacRuby-devel mailing list
> [email protected]
> http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel



-
Brian Marick, independent consultant
Mostly on agile methods with a testing slant
Author of /Programming Cocoa with Ruby/
www.exampler.com, www.exampler.com/blog, www.twitter.com/marick

___
MacRuby-devel mailing list
[email protected]
http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel


[MacRuby-devel] Mocking package for 0.5+?

2010-05-04 Thread Brian Marick
I've been looking for a combination of unit testing and mocking packages for 
macruby. (The mocking is the real problem.) If anyone does TDD with mocks: what 
do you use?

-
Brian Marick, independent consultant
Mostly on agile methods with a testing slant
Author of /Programming Cocoa with Ruby/
www.exampler.com, www.exampler.com/blog, www.twitter.com/marick

___
MacRuby-devel mailing list
[email protected]
http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel


Re: [MacRuby-devel] Mocking package for 0.5+?

2010-05-04 Thread Brian Marick
Thanks to James Mead, I now know that at least simple examples work with 0.6 
and these gems:

mocha-macruby (0.9.8.20100129120100)
test-unit (2.0.7)

On May 4, 2010, at 10:58 AM, Brian Marick wrote:

> I've been looking for a combination of unit testing and mocking packages for 
> macruby. (The mocking is the real problem.) If anyone does TDD with mocks: 
> what do you use?
> 
> -
> Brian Marick, independent consultant
> Mostly on agile methods with a testing slant
> Author of /Programming Cocoa with Ruby/
> www.exampler.com, www.exampler.com/blog, www.twitter.com/marick
> 
> ___
> MacRuby-devel mailing list
> [email protected]
> http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel

-
Brian Marick, independent consultant
Mostly on agile methods with a testing slant
Author of /Programming Cocoa with Ruby/
www.exampler.com, www.exampler.com/blog, www.twitter.com/marick

___
MacRuby-devel mailing list
[email protected]
http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel


Re: [MacRuby-devel] MacRuby and Shoulda

2010-05-04 Thread Brian Marick
That's a known issue, I think: https://www.macruby.org/trac/ticket/336

I ran into several problems trying to use both miniunit and the built-in 
version of test/unit (mostly about integration with mocking packages). I'm now 
using the testunit gem: test-unit-2.0.7

It's too bad shoulda doesn't work. It's a nice test-unit add-on.

On May 4, 2010, at 11:59 AM, Mike Taylor wrote:

> 
> Has anyone had any luck using Thoughtbot's Shoulda gem with MacRuby for 
> testing?
> 
> I'm getting errors like this:
> 
> 1) Error:
> test: My factorial method should return 1 when passed 0.(TC_Test):
> NoMethodError: undefined method `test: My factorial method should return 1 
> when passed 0.' for #
> 
> I'm fairly new to both Ruby and MacRuby. I'm not sure if the problem is due 
> to MiniTest replacing Test::Unit in Ruby 1.9. Or, if it is a MacRuby issue.
> 
> Here's my simple test file that works in ruby 1.8:
> 
> require 'rubygems' 
> gem 'thoughtbot-shoulda' 
> require 'shoulda'
> require 'test/unit'
> 
> def fact(x) 
>   return 1 if x == 0
>   return (1..x).inject(:*)
> end
> 
> class TC_Test < Test::Unit::TestCase
>   context "My factorial method" do
> should "return 1 when passed 0" do
>   assert_equal 1, fact(0)
> end
> should "return 1 when passed 1" do
>   assert_equal 1, fact(1)
> end
> should "return 6 when passed 3" do
>   assert_equal 6, fact(3)
> end
>   end
> end
> 
> I'll keep on digging, but if anyone has any insight, I'd appreciate it!
> 
> /\/\ike
> 
> ___
> MacRuby-devel mailing list
> [email protected]
> http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel



-
Brian Marick, independent consultant
Mostly on agile methods with a testing slant
Author of /Programming Cocoa with Ruby/
www.exampler.com, www.exampler.com/blog, www.twitter.com/marick

___
MacRuby-devel mailing list
[email protected]
http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel


[MacRuby-devel] installing tmail

2010-05-12 Thread Brian Marick
I'm trying to install tmail in macruby 0.6. While building the native 
extensions, I get the following. Ideas?


Building native extensions.  This could take a while...
ERROR:  Error installing tmail:
make failed:

["/Library/Frameworks/MacRuby.framework/Versions/0.6/usr/bin/macruby 
extconf.rb", "creating Makefile\n", "make", "/usr/bin/gcc -I. 
-I/Library/Frameworks/MacRuby.framework/Versions/0.6/usr/include/ruby-1.9.0/universal-darwin10.0
 
-I/Library/Frameworks/MacRuby.framework/Versions/0.6/usr/include/ruby-1.9.0/ruby/backward
 -I/Library/Frameworks/MacRuby.framework/Versions/0.6/usr/include/ruby-1.9.0 
-I.  -fno-common -fexceptions -fno-common -pipe -O3 -g -Wall -Wno-parentheses 
-D_FILE_OFFSET_BITS=64 -arch i386 -arch x86_64 -o tmailscanner.o -c 
tmailscanner.c\ntmailscanner.c:32:16: error: re.h: No such file or 
directory\ntmailscanner.c: In function 'mails_s_new':\ntmailscanner.c:93: 
warning: assignment discards qualifiers from pointer target 
type\ntmailscanner.c: In function 'skip_japanese_string':\ntmailscanner.c:218: 
warning: implicit declaration of function 'ismbchar'\ntmailscanner.c:219: 
warning: implicit declaration of function 'mbclen'\ntmailscanner.c: In function 
'digit_p':\ntmai
 lscanner.c:410: warning: assignment discards qualifiers from pointer target 
type\ntmailscanner.c: In function 'atomsym':\ntmailscanner.c:430: warning: 
initialization discards qualifiers from pointer target 
type\ntmailscanner.c:32:16: error: re.h: No such file or 
directory\ntmailscanner.c: In function 'mails_s_new':\ntmailscanner.c:93: 
warning: assignment discards qualifiers from pointer target 
type\ntmailscanner.c: In function 'skip_japanese_string':\ntmailscanner.c:218: 
warning: implicit declaration of function 'ismbchar'\ntmailscanner.c:219: 
warning: implicit declaration of function 'mbclen'\ntmailscanner.c: In function 
'digit_p':\ntmailscanner.c:410: warning: assignment discards qualifiers from 
pointer target type\ntmailscanner.c: In function 
'atomsym':\ntmailscanner.c:430: warning: initialization discards qualifiers 
from pointer target type\nlipo: can't open input file: /var/tmp//ccheFt8w.out 
(No such file or directory)\nmake: *** [tmailscanner.o] Error 1\n"]


-
Brian Marick, independent consultant
Mostly on agile methods with a testing slant
Author of /Programming Cocoa with Ruby/
www.exampler.com, www.exampler.com/blog, www.twitter.com/marick

___
MacRuby-devel mailing list
[email protected]
http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel


Re: [MacRuby-devel] installing tmail

2010-05-12 Thread Brian Marick
Sorry - I posted that too fast. Ignore it. I'll do more digging.

-
Brian Marick, independent consultant
Mostly on agile methods with a testing slant
Author of /Programming Cocoa with Ruby/
www.exampler.com, www.exampler.com/blog, www.twitter.com/marick

___
MacRuby-devel mailing list
[email protected]
http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel


[MacRuby-devel] HAVE_RUBY_VM_H and nkf.bundle (was: installing tmail)

2010-05-12 Thread Brian Marick
The problem with installing TMail are lines like this in tmailscanner.c

#ifdef HAVE_RUBY_VM_H
#include "ruby/re.h"
#include "ruby/encoding.h"
#else
#include "re.h"
#endif

I suspect "HAVE_RUBY_VM_H" is being used as a synonym for "on 1.9". It's 
defined once in the 1.9 source I have, never used. It's not defined in either 
1.8.7 or MacRuby.

Is there a more correct way to say "compiling against 1.9"? I don't see 
anything obvious in the include files, other than parsing it out of paths.

(Is there a correct way to say "compiling against MacRuby?")

=

Hacking around that gets tmailscanner.c to compile, but tmail also requires 
'nkf.bundle', which exists in 1.8 but not in MacRuby. I might try to compile 
the version out of 1.9, but this pile of yak hair is getting pretty deep, 
considering I just want to parse RFC822 headers.

-
Brian Marick, independent consultant
Mostly on agile methods with a testing slant
Author of /Programming Cocoa with Ruby/
www.exampler.com, www.exampler.com/blog, www.twitter.com/marick

___
MacRuby-devel mailing list
[email protected]
http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel


Re: [MacRuby-devel] HAVE_RUBY_VM_H and nkf.bundle (was: installing tmail)

2010-05-12 Thread Brian Marick
Well, loading a compiled NKF library leads to this:

dyld: lazy symbol binding failed: Symbol not found: _rb_enc_find_index
  Referenced from: /Users/marick/src/clients/SES/Lib/nkf.bundle
  Expected in: flat namespace

dyld: Symbol not found: _rb_enc_find_index
  Referenced from: /Users/marick/src/clients/SES/Lib/nkf.bundle
  Expected in: flat namespace

Compilation looked like this:

/usr/bin/gcc -I. 
-I/Library/Frameworks/MacRuby.framework/Versions/0.6/usr/include/ruby-1.9.0/universal-darwin10.0
 
-I/Library/Frameworks/MacRuby.framework/Versions/0.6/usr/include/ruby-1.9.0/ruby/backward
 -I/Library/Frameworks/MacRuby.framework/Versions/0.6/usr/include/ruby-1.9.0 
-I.  -fno-common -fexceptions -fno-common -pipe -O3 -g -Wall -Wno-parentheses 
-arch i386 -arch x86_64 -o nkf.o -c nkf.c
/usr/bin/gcc -dynamic -bundle -undefined suppress -flat_namespace -arch i386 
-arch x86_64 -o nkf.bundle nkf.o -L. 
-L/Library/Frameworks/MacRuby.framework/Versions/0.6/usr/lib   -arch i386 -arch 
x86_64  -lmacruby   


It's been 15-some years since I last used a C compiler in anger, so I'm out of 
my depth.


-----
Brian Marick, independent consultant
Mostly on agile methods with a testing slant
Author of /Programming Cocoa with Ruby/
www.exampler.com, www.exampler.com/blog, www.twitter.com/marick

___
MacRuby-devel mailing list
[email protected]
http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel


Re: [MacRuby-devel] HAVE_RUBY_VM_H and nkf.bundle (was: installing tmail)

2010-05-12 Thread Brian Marick

On May 12, 2010, at 2:42 PM, Laurent Sansonetti wrote:
> In the meantime, I'm afraid you will have to hack the tmail sources to avoid 
> using nkf (or create a fake nkf.rb file and put it in the path).

I switched to trying mail-2.2.0, but it runs into problems with various pieces 
of active_support. 

# require 'active_support/dependencies'
#  include ActiveSupport::CoreExtensions::String::OutputSafety

#  include ActiveSupport::CoreExtensions::Range::IncludeRange
#  include ActiveSupport::CoreExtensions::Range::BlocklessStep


I notice active_support didn't make it into 0.6. Is it a priority for 0.7?


-
Brian Marick, independent consultant
Mostly on agile methods with a testing slant
Author of /Programming Cocoa with Ruby/
www.exampler.com, www.exampler.com/blog, www.twitter.com/marick

___
MacRuby-devel mailing list
[email protected]
http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel