Strange ruby script behavior

software development


I have a ruby script that executes some mysql queries and resizes and renames jpg images. This script works completely fine on my personal development mahchine. It successfully executes the queries and transforms the images appropriately.

My machine is running ruby 1.8.4 and the script “requires” rio, RMagick, rubygems, and mysql.

I note that we are running ruby 1.8.2 here on dreamhost. I followed the directions on the wiki with regard to installing my own gems without compiling my own version of rubygems.

On dreamhost, I see that the script doesn’t complete appropriately. In fact, the script won’t get to the third puts in the code snippet below:

[code snipped from method]
puts " 0ap_file_name: " + ap_file_name
puts " 1ap_file_name: " + ap_file_name
temp = ap_file_name.length - 2
ap_file_name = ap_file_name[0,temp]
puts " 2ap_file_name: " + ap_file_name

[code snipped]

To me, it is behaving like I have pointer errors in a C program except I’m doing nothing that low level and don’t even know if that level of granulity and control is even possible in a ruby program!

I would appreciate any insight or pointers (Ha!).



The problem turned out to be the rubygem that I had installed in my user directory. Also, I’ve had many problems with my code due to the fact that dreamhost isn’t running ruby 1.8.4 or the lastest gems. Anyone know when this is expected to change?