Forums RubyCocoa

 
Gravatar-new_small Leroy Campbell 2 posts

I saw Dr. Nic’s corrections for the counting web app source code, but I’m having trouble getting it to work. I’m getting a load error at line 43 of sandbox.rb (rubygems is not found). I’ve tried requiring RubyGems earlier in the code, but I still can’t get the app to start. Any ideas?

 
Gravatar-new_small Leroy Campbell 2 posts

Just a bit of additional info: if I require rubygems at the beginning of the module, I get this error (line 47):

uninitialized constant Sandbox::APPLE_GEM_HOME (NameError)

I’m running OS X 10.5.3 if that helps.

 
Generic-user-small Rune Botten 1 post

Probably not related, but:

I have an error at line 29:
mymac:~/RubyCocoa/code/counting-webapp me$ ruby start.rb
../sandbox.rb:29:in `install_pristine_load_path’: uninitialized constant Sandbox::RbConfig (NameError) from ../sandbox.rb:29:in `delete_if’ from ../sandbox.rb:29:in `install_pristine_load_path’ from ../sandbox.rb:36:in `adjust_load_path’ from ../sandbox.rb:55 from start.rb:10:in `require’ from start.rb:10

If I require ‘rbconfig’ in the start of the module, all is good.

 
England-small_small Brian Marick 27 posts

Hmm… there’s a configuration problem here. I think the sandboxing came after beta 1 of the book was cut. That means the code is out of sync with the book describing it, and the code snapshot might have come in the middle of my fiddling to get the sandboxing right.

I will investigate.

 
England-small_small Brian Marick 27 posts

I should have said “there may be a configuration problem here”.

 
England-small_small Brian Marick 27 posts

Try this version

I didn’t do anything specific to fix the problem, but maybe it will provide more clues. Run the test suite, please.

 
P1000949_small peter schröder 3 posts

i got the following error:

./sandbox.rb:36:in `require': no such file to load -- rubygems (LoadError) <br />from ./sandbox.rb:36:in `adjust_gem_path' <br />from ./sandbox.rb:50 <br />from sandbox-tests.rb:3:in `require' <br />from sandbox-tests.rb:3

i think the root of the error was a self compiled ruby version on my mac. i removed all the home-brewn stuff and reinstallted ruby using finks apt-get. after updating gems everything worked as expected.

 
England-small_small Brian Marick 27 posts

Perhaps it was an older version of Ruby, one that didn’t have Rubygems included in the distribution?

 
P1000949_small peter schröder 3 posts

i dont think so. i tried it with selfcompiled version 1.8.6 of ruby, guided by this tutorial:
http://hivelogic.com/articles/2007/02/ruby-rails-mongrel-mysql-osx

 
P1000949_small peter schröder 3 posts

i am still having problems with code that uses require within class-methods.

in these cases i had to pull up the require statement to file-level or up to requiring class.

 
England-small_small Brian Marick 27 posts

Is the problem running code out of the code distribution? If so, what code? If not, can you send me the code that breaks when you require, plus the fixed code? I’m at marick@exampler.com

11 posts, 4 voices