[MacRuby] #859: rubygems load error when running script using evaluateFileAtPath:
#859: rubygems load error when running script using evaluateFileAtPath: ---------------------------+------------------------------------------------ Reporter: below@… | Owner: lsansonetti@… Type: defect | Status: new Priority: blocker | Milestone: Component: MacRuby | Keywords: ---------------------------+------------------------------------------------ I have a MacRuby script which, among other things, requires rubygems. It works very nice when I call it in the terminal (i.e. "macruby test.rb"), but when I try to execute it in a Cocoa App using [[MacRuby sharedRuntime] evaluateFileAtPath:path];, I get a LoadError exception: /Users/below/dev/build/Debug/(eval):1:in `<main>': no such file to load -- rubygems (LoadError) The issue is reproducible with this script, ControlTower must be present for this particular sample to work require 'rubygems' require 'control_tower' require 'rack/utils' server_options = { :port => 3001, :host => '0.0.0.0', :concurrent => false } app = Rack::Builder.new do map "/" do run Rack::File.new("/Users/below/Sites/") end end.to_app @s = ControlTower::Server.new(app, server_options) if @s puts 'Starting control tower webserver' @s.start else puts "ERROR: Couldnt build server" end -- Ticket URL: <http://www.macruby.org/trac/ticket/859> MacRuby <http://macruby.org/>
#859: rubygems load error when running script using evaluateFileAtPath: ---------------------------+------------------------------------------------ Reporter: below@… | Owner: lsansonetti@… Type: defect | Status: new Priority: blocker | Milestone: Component: MacRuby | Keywords: ---------------------------+------------------------------------------------ Comment(by lsansonetti@…): Reduction: {{{ $ cat t.m #import <MacRuby/MacRuby.h> int main(void) { [[MacRuby sharedRuntime] evaluateString:@"require 'rubygems'"]; return 0; } $ gcc t.m -o t -framework MacRuby -fobjc-gc -framework Foundation $ ./t 2010-08-19 19:57:36.092 t[6421:c03] *** Terminating app due to uncaught exception 'LoadError', reason: '/Users/lrz/src/macruby-trunk/(eval):1:in `<main>': no such file to load -- rubygems (LoadError) ' *** Call stack at first throw: ( 0 CoreFoundation 0x00007fff8198b136 __exceptionPreprocess + 198 1 libobjc.A.dylib 0x00007fff88b54772 objc_exception_throw + 45 2 libmacruby.dylib 0x000000010675e7e5 rb_vm_raise + 437 3 libmacruby.dylib 0x000000010664adb9 rb_exc_raise + 9 4 libmacruby.dylib 0x0000000106649884 rb_raise + 308 5 libmacruby.dylib 0x0000000106653abe rb_require_safe + 510 6 libmacruby.dylib 0x000000010674c24b rb_vm_dispatch + 6651 7 ??? 0x0000000107f97390 0x0 + 4428755856 8 ??? 0x0000000107f9706d 0x0 + 4428755053 9 libmacruby.dylib 0x0000000106758db8 rb_vm_run + 488 10 libmacruby.dylib 0x000000010675d6e1 rb_vm_run_under + 241 11 libmacruby.dylib 0x00000001067710bb rb_vm_debug_trap + 10379 12 t 0x000000010661beea main + 74 13 t 0x000000010661be94 start + 52 ) terminate called throwing an exceptionAbort trap: 6 }}} -- Ticket URL: <http://www.macruby.org/trac/ticket/859#comment:1> MacRuby <http://macruby.org/>
#859: rubygems load error when running script using evaluateFileAtPath: ---------------------------+------------------------------------------------ Reporter: below@… | Owner: lsansonetti@… Type: defect | Status: closed Priority: blocker | Milestone: MacRuby 0.7 Component: MacRuby | Resolution: fixed Keywords: | ---------------------------+------------------------------------------------ Changes (by lsansonetti@…): * status: new => closed * resolution: => fixed * milestone: => MacRuby 0.7 Comment: We forgot to initialize the load path in +[MacRuby sharedRuntime]. Should be fixed in r4435. -- Ticket URL: <http://www.macruby.org/trac/ticket/859#comment:2> MacRuby <http://macruby.org/>
participants (1)
-
MacRuby