I am writing a script to parse a binary file in ruby. According to the documentation on the file format, the integers are in little- endian format. When I take the script, read the appropriate part of the file, then 'unpack' with 'V' (little-endian), I don't get the right answer from the internal "Run script" command. I do get the right answer if I change to unpack with 'N'. However, if run from the command line against Apple Ruby (/usr/bin/ruby 1.8.2) or against Ruby compiled with DarwinPorts (/opt/local/bin/ruby 1.8.4), I get the appropriate result with 'V' (as I should).
This seems to be a bug to me, though I'm not sure I'm missing something here. Can someone either confirm this is a bug, or alternatively explain to me why things are behaving in this way.
-albert
This is a documented problem with the version of Ruby Apple supplied with Tiger. The other main problem with Apple's version of Ruby is its inability to support user extensions.
Dave.
On 13 Mar 2006, at 13:19, Albert Vernon Smith wrote:
I am writing a script to parse a binary file in ruby. According to the documentation on the file format, the integers are in little- endian format. When I take the script, read the appropriate part of the file, then 'unpack' with 'V' (little-endian), I don't get the right answer from the internal "Run script" command. I do get the right answer if I change to unpack with 'N'. However, if run from the command line against Apple Ruby (/usr/bin/ruby 1.8.2) or against Ruby compiled with DarwinPorts (/opt/local/bin/ruby 1.8.4), I get the appropriate result with 'V' (as I should).
This seems to be a bug to me, though I'm not sure I'm missing something here. Can someone either confirm this is a bug, or alternatively explain to me why things are behaving in this way.
-albert
For new threads USE THIS: textmate@lists.macromates.com (threading gets destroyed and the universe will collapse if you don't) http://lists.macromates.com/mailman/listinfo/textmate
Thanks for the info.
Is there a way to configure Textmate to point to another version of Ruby, such as the version I compiled from DarwinPorts?
-albert
On 13.3.2006, at 13:49, Dave Baldwin wrote:
This is a documented problem with the version of Ruby Apple supplied with Tiger. The other main problem with Apple's version of Ruby is its inability to support user extensions.
Dave.
On 13 Mar 2006, at 13:19, Albert Vernon Smith wrote:
I am writing a script to parse a binary file in ruby. According to the documentation on the file format, the integers are in little-endian format. When I take the script, read the appropriate part of the file, then 'unpack' with 'V' (little- endian), I don't get the right answer from the internal "Run script" command. I do get the right answer if I change to unpack with 'N'. However, if run from the command line against Apple Ruby (/usr/bin/ruby 1.8.2) or against Ruby compiled with DarwinPorts (/opt/local/bin/ruby 1.8.4), I get the appropriate result with 'V' (as I should).
This seems to be a bug to me, though I'm not sure I'm missing something here. Can someone either confirm this is a bug, or alternatively explain to me why things are behaving in this way.
-albert
On 13 Mar 2006, at 13:59, Albert Vernon Smith wrote:
Thanks for the info.
Is there a way to configure Textmate to point to another version of Ruby, such as the version I compiled from DarwinPorts?
Set up an environmental variable TM_RUBY to point to the version you want to use. See TextMate manual for details on this.
Alternatively include the directory holding the new ruby in your PATH before the /usr/bin where the Apple Ruby lives.
How you do this depends on which shell you are using. For tcsh add something similar to your .cshrc file in your home directory:
set path = (/opt/local/bin $path)
where opt/local/bin is where DarwinPorts has put Ruby (not sure if this is the correct place - do ls to check). You may need to restart TextMate for it to see this change.
Dave.
-albert
On 13.3.2006, at 13:49, Dave Baldwin wrote:
This is a documented problem with the version of Ruby Apple supplied with Tiger. The other main problem with Apple's version of Ruby is its inability to support user extensions.
Dave.
On 13 Mar 2006, at 13:19, Albert Vernon Smith wrote:
I am writing a script to parse a binary file in ruby. According to the documentation on the file format, the integers are in little-endian format. When I take the script, read the appropriate part of the file, then 'unpack' with 'V' (little- endian), I don't get the right answer from the internal "Run script" command. I do get the right answer if I change to unpack with 'N'. However, if run from the command line against Apple Ruby (/usr/bin/ruby 1.8.2) or against Ruby compiled with DarwinPorts (/opt/local/bin/ruby 1.8.4), I get the appropriate result with 'V' (as I should).
This seems to be a bug to me, though I'm not sure I'm missing something here. Can someone either confirm this is a bug, or alternatively explain to me why things are behaving in this way.
-albert
For new threads USE THIS: textmate@lists.macromates.com (threading gets destroyed and the universe will collapse if you don't) http://lists.macromates.com/mailman/listinfo/textmate
Thanks. My $PATH already had /opt/local/bin on it, before the Apple path. I got the right behavior by setting TM_RUBY.
Ty, -albert
On 13.3.2006, at 14:25, Dave Baldwin wrote:
On 13 Mar 2006, at 13:59, Albert Vernon Smith wrote:
Thanks for the info.
Is there a way to configure Textmate to point to another version of Ruby, such as the version I compiled from DarwinPorts?
Set up an environmental variable TM_RUBY to point to the version you want to use. See TextMate manual for details on this.
Alternatively include the directory holding the new ruby in your PATH before the /usr/bin where the Apple Ruby lives.
How you do this depends on which shell you are using. For tcsh add something similar to your .cshrc file in your home directory:
set path = (/opt/local/bin $path)
where opt/local/bin is where DarwinPorts has put Ruby (not sure if this is the correct place - do ls to check). You may need to restart TextMate for it to see this change.