I've been just trying out RubyCocoa, and I am having problems running some of the examples from within TextMate. The "Run Script" command doesn't seem to work properly, for instance with the "HelloWorld.rb" example.
Has anyone dealt with this?
Haris
On Jun 21, 2006, at 9:43 PM, Charilaos Skiadas wrote:
I've been just trying out RubyCocoa, and I am having problems running some of the examples from within TextMate. The "Run Script" command doesn't seem to work properly, for instance with the "HelloWorld.rb" example.
The 'if $0 == __FILE__' idiom doesn't seem to be working with RubyMate. In HelloWorld.rb, replace "$0 == __FILE__" with "1".
Chris
On Jun 21, 2006, at 11:12 PM, Chris Thomas wrote:
On Jun 21, 2006, at 9:43 PM, Charilaos Skiadas wrote:
I've been just trying out RubyCocoa, and I am having problems running some of the examples from within TextMate. The "Run Script" command doesn't seem to work properly, for instance with the "HelloWorld.rb" example.
The 'if $0 == __FILE__' idiom doesn't seem to be working with RubyMate. In HelloWorld.rb, replace "$0 == __FILE__" with "1".
Works like a charm. Thanks!
RubyMate is a dangerous place for me to wade through, so I've been avoiding it, but is there no way to fix this there? Is the problem that $0 points to the wrong thing or __FILE__ ? Can't they be changed before the code from the program loads?
Chris
Haris
On Jun 21, 2006, at 11:33 PM, Charilaos Skiadas wrote:
RubyMate is a dangerous place for me to wade through, so I've been avoiding it, but is there no way to fix this there? Is the problem that $0 points to the wrong thing or __FILE__ ? Can't they be changed before the code from the program loads?
Yes, I can patch this. If Allan's OK with it, I will do it. (I've been burned by the same behavior.)
James Edward Gray II
On Jun 22, 2006, at 8:53 AM, James Edward Gray II wrote:
On Jun 21, 2006, at 11:33 PM, Charilaos Skiadas wrote:
RubyMate is a dangerous place for me to wade through, so I've been avoiding it, but is there no way to fix this there? Is the problem that $0 points to the wrong thing or __FILE__ ? Can't they be changed before the code from the program loads?
Yes, I can patch this. If Allan's OK with it, I will do it. (I've been burned by the same behavior.)
This is fixed now.
James Edward Gray II
On Jun 22, 2006, at 3:30 PM, James Edward Gray II wrote:
This is fixed now.
Hm, now I am getting:
/usr/lib/ruby/site_ruby/1.8/powerpc-darwin8.0/rubycocoa.bundle: [BUG] Bus Error ruby 1.8.2 (2004-12-25) [powerpc-darwin8.0]
when I run HelloWorld.rb from the RubyCocoa examples. The same thing from the command line runs beautifully. Any thoughts?
James Edward Gray II
Haris
On Jun 22, 2006, at 3:35 PM, Charilaos Skiadas wrote:
On Jun 22, 2006, at 3:30 PM, James Edward Gray II wrote:
This is fixed now.
Hm, now I am getting:
/usr/lib/ruby/site_ruby/1.8/powerpc-darwin8.0/rubycocoa.bundle: [BUG] Bus Error ruby 1.8.2 (2004-12-25) [powerpc-darwin8.0]
when I run HelloWorld.rb from the RubyCocoa examples. The same thing from the command line runs beautifully. Any thoughts?
Hmm, that error is being thrown inside rubycocoa. I wonder if it doesn't like my hack to $0/$PROGRAM_NAME. If you comment out all the rubycocoa lines, including the require, the error goes away, right?
James Edward Gray II
On Jun 22, 2006, at 3:51 PM, James Edward Gray II wrote:
Hmm, that error is being thrown inside rubycocoa. I wonder if it doesn't like my hack to $0/$PROGRAM_NAME. If you comment out all the rubycocoa lines, including the require, the error goes away, right?
Indeed it goes away. The mere presence of the require is enough to generate the error.
James Edward Gray II
Haris
On Jun 22, 2006, at 3:58 PM, Charilaos Skiadas wrote:
On Jun 22, 2006, at 3:51 PM, James Edward Gray II wrote:
Hmm, that error is being thrown inside rubycocoa. I wonder if it doesn't like my hack to $0/$PROGRAM_NAME. If you comment out all the rubycocoa lines, including the require, the error goes away, right?
Indeed it goes away. The mere presence of the require is enough to generate the error.
Doesn't RubyCocoa require a hacked version of Ruby? I'm wondering if we are running the right binary.
James Edward Gray II
On Jun 22, 2006, at 4:12 PM, James Edward Gray II wrote:
On Jun 22, 2006, at 3:58 PM, Charilaos Skiadas wrote:
On Jun 22, 2006, at 3:51 PM, James Edward Gray II wrote:
Hmm, that error is being thrown inside rubycocoa. I wonder if it doesn't like my hack to $0/$PROGRAM_NAME. If you comment out all the rubycocoa lines, including the require, the error goes away, right?
Indeed it goes away. The mere presence of the require is enough to generate the error.
Doesn't RubyCocoa require a hacked version of Ruby? I'm wondering if we are running the right binary.
Well, it runs fine from the command line, so it is compatible with my version of Ruby, the one coming with 10.4 by default. I installed RubyCocoa through the .dmg installer here: http://prdownloads.sourceforge.net/rubycocoa/RubyCocoa-0.4.2- tiger.dmg?download as per the instructions on: http://rubycocoa.sourceforge.net/doc/getting.en.html Running: ruby 1.8.2 (2004-12-25) [powerpc-darwin8.0]
So I did not do any compiling at all. And it does run just fine from the command line.
James Edward Gray II
Haris
So I did not do any compiling at all. And it does run just fine from the command line.
FWIW, it works here with the latest RubyMate, but I'm using Ruby 1.8.4_2 from DarwinPorts and I built rubycocoa from the latest CVS source.
Disable Word Wrap RubyMate r3762 running Ruby v1.8.4.
~/Code/rubycocoa/sample/HelloWorld.rb
just wait...<NSWindow: 0x1129480>Hello, World! Hello again, World! Program exited normally.
Chris
On 23/6/2006, at 3:10, Chris Thomas wrote:
So I did not do any compiling at all. And it does run just fine from the command line.
FWIW, it works here with the latest RubyMate, but I'm using Ruby 1.8.4_2 from DarwinPorts and I built rubycocoa from the latest CVS source.
Turns out the problem is that when assigning to $0/$PROGRAM_NAME Ruby will put that as argv[0] and put NULL in the rest of the slots -- this is done so that ‘ps’ etc. will show the new name in the process listing.
Unfortunately some of the code involved in loading cocoaruby does strcmp etc. on argv values, and thus the crash.
Haris found a thread on ruby-talk which discussed the problem, and it may have been worked around for 1.8.4.
An ambitious remaking of RubyMate is now in progress, so we can supply the proper script name… :)