[Ironruby-core] Assistance Needed Running IronRuby.Rack.Example

Ted Milker tmilker at gmail.com
Wed Jun 24 08:57:51 EDT 2009


On Tue, Jun 23, 2009 at 4:40 PM, Jimmy
Schementi<Jimmy.Schementi at microsoft.com> wrote:
>    // HACK Load gems from default MRI installation. This shouldn't be needed.
>    Environment.SetEnvironmentVariable("GEM_PATH", @"C:\ruby\lib\ruby\gems\1.8");
>
> I'm being pretty evil here and setting GEM_PATH over your head. This line should be set to "c:\progra~2\ruby\lib\ruby\gems\1.8" for you if you want to use MRI's gems, or the path to rubygems that IronRuby sets up (do a "echo %GEM_PATH% from Dev.bat to get that value). A simple recompile should make things work again.

Yep, that did it.  I just updated the path to reflect my MRI install
and it is working now. I am sure this has been covered on the list and
I am just forgetting, but igem is just a way to manage a separate set
of installed gems, correct? There is nothing special about the gems it
retrieves vs. the ones from an MRI install?

Now, on to what I really wanted to do, run Sinatra.  I tried a simple
Hello World but I get a YSOD about an undefined method 'call'.  I
modified config.ru to require my new .rb file and tried both:

require 'rubygems'
require 'sinatra'

class App
    get '/' do
        'Hello world!'
    end
end

and after commenting out App.new in config.ru:

require 'rubygems'
require 'sinatra'

get '/' do
    'Hello world!'
end

but they both give a similar stack trace:

Server Error in '/IronRuby.Rack.Example' Application.

undefined method `call' for #<App:0x0000536>

Description: An unhandled exception occurred during the execution of
the current web request. Please review the stack trace for more
information about the error and where it originated in the code.

Exception Details: System.MissingMethodException: undefined method
`call' for #<App:0x0000536>

Source Error:


Line 458:        public static object MethodMissing(RubyContext/*!*/
context, object/*!*/ self, SymbolId symbol, [NotNull]params
object[]/*!*/ args) {
Line 459:            string name = SymbolTable.IdToString(symbol);
Line 460:            throw RubyExceptions.CreateMethodMissing(context,
self, name);
Line 461:        }
Line 462:

Source File: C:\src\Merlin\Main\Languages\Ruby\Libraries.LCA_RESTRICTED\Builtins\KernelOps.cs
   Line: 460

Stack Trace:


[MissingMethodException: undefined method `call' for #<App:0x0000536>]
   IronRuby.Builtins.KernelOps.MethodMissing(RubyContext context,
Object self, SymbolId symbol, Object[] args) in
C:\src\Merlin\Main\Languages\Ruby\Libraries.LCA_RESTRICTED\Builtins\KernelOps.cs:460
   CallSite.Target(Closure , CallSite , Object , Object ) +317
   System.Dynamic.UpdateDelegates.UpdateAndExecute2(CallSite site, T0
arg0, T1 arg1) in
C:\src\ndp\fx\src\Core\Microsoft\Scripting\Actions\UpdateDelegates.Generated.cs:384
   Microsoft.Scripting.Runtime.DynamicOperations.InvokeMember(Object
obj, String memberName, Boolean ignoreCase, Object[] parameters) in
C:\src\Merlin\Main\Runtime\Microsoft.Scripting\Runtime\DynamicOperations.cs:118
   Microsoft.Scripting.Runtime.DynamicOperations.InvokeMember(Object
obj, String memberName, Object[] parameters) in
C:\src\Merlin\Main\Runtime\Microsoft.Scripting\Runtime\DynamicOperations.cs:101
   Microsoft.Scripting.Hosting.ObjectOperations.InvokeMember(Object
obj, String memberName, Object[] parameters) in
C:\src\Merlin\Main\Runtime\Microsoft.Scripting\Hosting\ObjectOperations.cs:85
   IronRuby.Rack.RubyEngine.ExecuteMethod(Object instance, String
methodName, Object[] args) in
C:\src\Merlin\Main\Hosts\IronRuby.Rack\RubyEngine.cs:48
   IronRuby.Rack.Application.Call(IDictionary`2 env) in
C:\src\Merlin\Main\Hosts\IronRuby.Rack\Application.cs:38
   IronRuby.Rack.Handler.IIS.Handle(Request request, Response
response) in C:\src\Merlin\Main\Hosts\IronRuby.Rack\IIS.cs:238
   IronRuby.Rack.HttpHandler.ProcessRequest(HttpContext context) in
C:\src\Merlin\Main\Hosts\IronRuby.Rack\HttpHandler.cs:46
   System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
+599
   System.Web.HttpApplication.ExecuteStep(IExecutionStep step,
Boolean& completedSynchronously) +171

Version Information: Microsoft .NET Framework Version:2.0.50727.3074;
ASP.NET Version:2.0.50727.3074

The only difference is whether the the undefined method is for App or
nil:NilClass.


More information about the Ironruby-core mailing list