Re: [Ironruby-core] Assistance Needed Running IronRuby.Rack.Example
On Tue, Jun 23, 2009 at 4:40 PM, Jimmy Schementi 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 # 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 # 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 #] 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. ___ Ironruby-core mailing list Ironruby-core@rubyforge.org http://rubyforge.org/mailman/listinfo/ironruby-core
[Ironruby-core] Assistance Needed Running IronRuby.Rack.Example
Could I get some assistance in running rack on IronRuby? I am just trying out: http://github.com/jschementi/ironruby/tree/master/Merlin/Main/Hosts/IronRuby.Rack from RailsConf, not the latest one from the IronRuby tree. Everything has built successfully and I had to modify Web.config to point to my MRI 1.8 installation directory but this is as far as I can get. I have tried both igem install rack and gem install rack but I still receive this message. Running on IIS7 under Windows Vista 64bit. I do not have any release versions of IronRuby installed on this machine. I did not have a IIS_IUSER to assign permissions to but I did try assigning read/execute permissions to the IIS_IUSRS group with no change. Assuming I can get this to work, could I also get some instructions on how to run Sinatra on top of this? Error: Gem::LoadError c:/progra~2/ruby/lib/ruby/site_ruby/1.8/rubygems.rb:826:in `report_activate_error': Could not find RubyGem rack (= 1.0.0) (Gem::LoadError) from c:/progra~2/ruby/lib/ruby/site_ruby/1.8/rubygems.rb:260:in `activate' from c:/progra~2/ruby/lib/ruby/site_ruby/1.8/rubygems.rb:67:in `gem' from :0 from C:\src\Merlin\Main\Hosts\IronRuby.Rack\RubyEngine.cs:43:in `Execute' from C:\src\Merlin\Main\Hosts\IronRuby.Rack\RubyEngine.cs:39:in `Execute' from C:\src\Merlin\Main\Hosts\IronRuby.Rack\RubyEngine.cs:31:in `Require' from C:\src\Merlin\Main\Hosts\IronRuby.Rack\Application.cs:49:in `InitRack' from C:\src\Merlin\Main\Hosts\IronRuby.Rack\Application.cs:28:in `.ctor' from C:\src\Merlin\Main\Hosts\IronRuby.Rack\HttpHandlerFactory.cs:41:in `GetHandler' from System.Web:0:in `System.Web.HttpApplication.IExecutionStep.Execute' from System.Web:0:in `ExecuteStep' from System.Web:0:in `ResumeSteps' from System.Web:0:in `BeginProcessRequestNotification' from System.Web:0:in `ProcessRequestNotificationPrivate' from System.Web:0:in `ProcessRequestNotificationHelper' from System.Web:0:in `ProcessRequestNotification' from System.Web:0:in `ProcessRequestNotificationHelper' from System.Web:0:in `ProcessRequestNotification' Search paths C:/src/Merlin/Main/Hosts/IronRuby.Rack/IronRuby.Rack.Example C:/src/Merlin/Main/Languages/Ruby/Libs c:/progra~2/ruby/lib/ruby/site_ruby/1.8 c:/progra~2/ruby/lib/ruby/site_ruby c:/progra~2/ruby/lib/ruby/1.8 . ___ Ironruby-core mailing list Ironruby-core@rubyforge.org http://rubyforge.org/mailman/listinfo/ironruby-core
Re: [Ironruby-core] IronRuby for GIMP
On Thu, Oct 30, 2008 at 10:12 AM, Curt Hagenlocher <[EMAIL PROTECTED]> wrote: > Finally, we're shortly going to change the naming policy for overrides of CLS > virtual methods. When this happens, you'll need to define > ProcedureEnumerator with the "rubified" method names: move_next, reset and > current. I still do not like this decision. Any chance there could be a flag we could set to get back to using the normal .NET naming? ___ Ironruby-core mailing list Ironruby-core@rubyforge.org http://rubyforge.org/mailman/listinfo/ironruby-core
Re: [Ironruby-core] Unicode Source Files
On Sun, Oct 26, 2008 at 3:17 PM, Jim Deville <[EMAIL PROTECTED]> wrote: > > If you are able to solve this with an extension method, then it looks likely > that any VS integration work for IRb will take care of that. As it is, I use > GVim for most of my Ruby coding these days. :) I use ViEmu for the best of both worlds. :) ___ Ironruby-core mailing list Ironruby-core@rubyforge.org http://rubyforge.org/mailman/listinfo/ironruby-core
Re: [Ironruby-core] Unicode Source Files
Here is the extension method I am using if anyone else is interested: public static object ExecuteUnicodeFile( this ScriptRuntime rt, string filename ) { string rbCode; // OpenText will strip the BOM and keep the Unicode intact using( var rdr = File.OpenText( filename ) ) { rbCode = rdr.ReadToEnd(); } return IronRuby.Ruby.GetEngine( rt ).Execute( rbCode ); } It works great for using Japanese in strings in Ruby with IronRuby and WPF. ___ Ironruby-core mailing list Ironruby-core@rubyforge.org http://rubyforge.org/mailman/listinfo/ironruby-core
Re: [Ironruby-core] Unicode Source Files
Why so rigorous? I understand the need to maintain compatibility but this effectively eliminates Visual Studio as an editor for .rb files, without some kind of clunky build mechanism. I guess I will just use an extension method to get around the behavior for the time being. >From the things I have read about Ruby and UTF-8, it seems more like it is just extremely broken, rather than extremely tricky. I still cannot even get pure Ruby stuff in Windows to work properly with UTF-8, like when using the Shoes toolkit for example. On Sun, Oct 26, 2008 at 11:52 AM, Curt Hagenlocher <[EMAIL PROTECTED]> wrote: > We do this for compatibility with Ruby 1.8.6, though as you can see, we don't > have the error message quite right: > > PS F:\> C:\ruby\bin\ruby.exe x.rb > x.rb:1: Invalid char `\377' in expression > x.rb:1: Invalid char `\376' in expression > > :) > > I believe you'll need to save as UTF-8 and then manually strip the BOM in > order to use Unicode source files -- hopefully Tomas will tell me if I'm > wrong. > > Source encoding for Ruby is extremely tricky, and (from what I can tell) > hasn't even yet been finalized for 1.9.x. We will eventually support > whatever the Ruby standards are. ___ Ironruby-core mailing list Ironruby-core@rubyforge.org http://rubyforge.org/mailman/listinfo/ironruby-core
[Ironruby-core] Unicode Source Files
Is the DLR going to be fixed so that it properly supports Unicode source files or is this an issue with IronRuby? If you attempt to create a new Code File with Visual Studio 2008 and call it test.rb and then execute it with: ScriptRuntime runtime = IronRuby.Ruby.CreateRuntime(); runtime.ExecuteFile( "test.rb" ); it blows up on the Unicode byte-order marker with: Unhandled Exception: Microsoft.Scripting.SyntaxErrorException: Invalid character 'ï' in expression at Microsoft.Scripting.ErrorSink.Add(SourceUnit source, String message, SourceSpan span, Int32 errorCode, Severity severity) in C:\Users\ted\Desktop\IronRuby\src\Microsoft.Scripting\ErrorSink.cs:line 34 at Microsoft.Scripting.ErrorCounter.Add(SourceUnit source, String message, SourceSpan span, Int32 errorCode, Severity severity) in C:\Users\ted\Desktop\IronRuby\src\Microsoft.Scripting\ErrorSink.cs:line 92 at IronRuby.Compiler.Tokenizer.Report(String message, Int32 errorCode, SourceSpan location, Severity severity) in C:\Users\ted\Desktop\IronRuby\src\ironruby\Compiler\Parser\Tokenizer.cs:line 430 at IronRuby.Compiler.Tokenizer.ReportError(ErrorInfo info, Object[] args) in C:\Users\ted\Desktop\IronRuby\src\ironruby\Compiler\Parser\Tokenizer.cs:line 442 at IronRuby.Compiler.Tokenizer.Tokenize(Boolean whitespaceSeen, Boolean cmdState) in C:\Users\ted\Desktop\IronRuby\src\ironruby\Compiler\Parser\Tokenizer.cs:line 966 at IronRuby.Compiler.Tokenizer.Tokenize() in C:\Users\ted\Desktop\IronRuby\src\ironruby\Compiler\Parser\Tokenizer.cs:line 739 at IronRuby.Compiler.Tokenizer.GetNextToken() in C:\Users\ted\Desktop\IronRuby\src\ironruby\Compiler\Parser\Tokenizer.cs:line 711 at IronRuby.Compiler.Parser.GetNextToken() in C:\Users\ted\Desktop\IronRuby\src\ironruby\Compiler\Parser\Parser.cs:line 99 at IronRuby.Compiler.ShiftReduceParser`2.Parse() in C:\Users\ted\Desktop\IronRuby\src\ironruby\Compiler\Parser\GPPG.cs:line 310 at IronRuby.Compiler.Parser.Parse(SourceUnit sourceUnit, RubyCompilerOptions options, ErrorSink errorSink) in C:\Users\ted\Desktop\IronRuby\src\ironruby\Compiler\Parser\Parser.cs:line 158 at IronRuby.Runtime.RubyContext.ParseSourceCode(SourceUnit sourceUnit, RubyCompilerOptions options, ErrorSink errorSink) in C:\Users\ted\Desktop\IronRuby\src\ironruby\Runtime\RubyContext.cs:line 203 at IronRuby.Runtime.RubyContext.CompileSourceCode(SourceUnit sourceUnit, CompilerOptions options, ErrorSink errorSink) in C:\Users\ted\Desktop\IronRuby\src\ironruby\Runtime\RubyContext.cs:line 179 at Microsoft.Scripting.SourceUnit.Compile(CompilerOptions options, ErrorSink errorSink) in C:\Users\ted\Desktop\IronRuby\src\Microsoft.Scripting\SourceUnit.cs:line 215 at Microsoft.Scripting.SourceUnit.Execute(Scope scope, ErrorSink errorSink) in C:\Users\ted\Desktop\IronRuby\src\Microsoft.Scripting\SourceUnit.cs:line 225 at Microsoft.Scripting.Hosting.ScriptSource.Execute(ScriptScope scope) in C:\Users\ted\Desktop\IronRuby\src\Microsoft.Scripting\Hosting\ScriptSource.cs:line 129 at Microsoft.Scripting.Hosting.ScriptEngine.ExecuteFile(String path, ScriptScope scope) in C:\Users\ted\Desktop\IronRuby\src\Microsoft.Scripting\Hosting\ScriptEngine.cs:line 159 at Microsoft.Scripting.Hosting.ScriptEngine.ExecuteFile(String path) in C:\Users\ted\Desktop\IronRuby\src\Microsoft.Scripting\Hosting\ScriptEngine.cs:line 148 at Microsoft.Scripting.Hosting.ScriptRuntime.ExecuteFile(String path) in C:\Users\ted\Desktop\IronRuby\src\Microsoft.Scripting\Hosting\ScriptRuntime.cs:line 257 at HostingDLRConsole.Program.Main(String[] args) in C:\Users\ted\Documents\Visual Studio 2008\Projects\Books\IronRuby in Action\HostingDLRConsole\HostingDLRConsole\Program.cs:line 14 Press any key to continue . . . I know I can fix this by using the Advanced Save Options but the DLR spec talks about Unicode support, so I assume this means that ScriptRuntime.ExecuteFile() should also support Unicode source files. ___ Ironruby-core mailing list Ironruby-core@rubyforge.org http://rubyforge.org/mailman/listinfo/ironruby-core
Re: [Ironruby-core] Overriding CLS Virtuals
On Sun, Oct 26, 2008 at 12:20 AM, Curt Hagenlocher <[EMAIL PROTECTED]> wrote: > > However, virtual calls from a C# application back into IronRuby are a > different matter, due Ruby's dynamic nature. Here there is both a > performance cost and a semantic cost for performing multiple lookups. The > performance cost results from the fact that we have to check for two > different symbol names on every CLS call to this method before we can > identify that we need to delegate to the base class implementation. (To be > fair, this, too could be cached, albeit with slightly greater difficulty.) > The semantic cost is based in the confusion resulting when methods with both > names are defined on the class. Should we call method "dispose" or method > "Dispose"? or both? This is a tough one, glad I do not have to make the call. Pitfalls and trouble every way I try to think of it and type a response. :) My gut tells me that capitalization matters, regardless of The Ruby Way, when it comes to .NET. If you want to write a new Dispose, def Dispose. > Finally, as you're probably aware by now, capitalization in Ruby is not > simply a matter of convention. In many cases, the parser actually treats > identifiers which start with a capital letter differently than it does > identifiers that start lower case. Now it turns out that method names are > one of the places where Ruby doesn't draw this distinction, but I'd guess > that many Ruby programmers look at any identifier starting with a capital > letter and think "that's a constant". But given the following: def Foo "Bar" end Foo() what Ruby programmer would look at Foo and still think it is a constant? Of course, if I would have made it lowercase, the parentheses would not be necessary. My point is that the parentheses tell the reader that it is not a constant, but a method. Is there a situation where Foo could appear legally, as defined above, without parentheses and be confused for a constant? ___ Ironruby-core mailing list Ironruby-core@rubyforge.org http://rubyforge.org/mailman/listinfo/ironruby-core
Re: [Ironruby-core] Overriding CLS Virtuals
On Sat, Oct 25, 2008 at 6:59 PM, Orion Edwards <[EMAIL PROTECTED]> wrote: > While none of the languages will stop you from using any conventions you > like, it's MUCH easier to learn to put your ego aside, and go with the > conventions. I agree, however, the DLR adds a twist to the formula. > The simple fact is, you're going to be reading loads of sourcecode written > by others in the form of examples and so forth, and if you get annoyed every > time you see stuff you 'hate' - well you're going to be having a pretty > unhappy time. I do not get annoyed if I am reading or programming in a single language. I do like to keep things simple though. If I am working in .NET, I am going to keep a single, consistent style convention for my source code. I am not going to maintain two different conventions just because I am using Ruby in half of my app and C# in the other. Even if it were pure Ruby in IronRuby, I would use .NET guidelines because I am almost certain to be using the .NET libraries in IronRuby. In this case and in my opinion, the framework determines the convention, not the languages used. One of the main reasons why I am interested in IronRuby is because it will give me access to WPF. GUIs with Ruby in Windows, I have learned, is a pretty painful and overall annoying experience compared to C# and WPF. I do have a particular dislike for the underscore key because of its placement on the keyboard as well. ___ Ironruby-core mailing list Ironruby-core@rubyforge.org http://rubyforge.org/mailman/listinfo/ironruby-core
Re: [Ironruby-core] Overriding CLS Virtuals
On Fri, Oct 24, 2008 at 7:54 PM, Curt Hagenlocher <[EMAIL PROTECTED]> wrote: > We're thinking now that we're going to go with the mangled version of the > name instead of the originally cased-version. "Dispose" just doesn't look > Rubyish enough. Any objections? My opinion does not count for much but I love Ruby openness and hate the naming conventions. I much prefer camel case and .NET guidelines for naming than underscore and lowercase hell. I am just getting started with Ruby and have no intention of following the naming conventions if I can avoid it. IronRuby and .NET are my platform of choice for the future, even in its immature state. ___ Ironruby-core mailing list Ironruby-core@rubyforge.org http://rubyforge.org/mailman/listinfo/ironruby-core
Re: [Ironruby-core] IronRuby Compiles Broken?
On Thu, Oct 23, 2008 at 11:49 AM, Ivan Porto Carrero <[EMAIL PROTECTED]> wrote: > I got the same errors yesterday. I could build it using visual studio > though. > Mine was on vista 32-bit in both powershell and command Wow, I sure was overlooking the obvious. I have been fighting this since the weekend, trying to figure out what was wrong. I was reading your book and have been trying to build with your instructions in the first chapter and I totally missed the solution file. ___ Ironruby-core mailing list Ironruby-core@rubyforge.org http://rubyforge.org/mailman/listinfo/ironruby-core
[Ironruby-core] IronRuby Compiles Broken?
Is the IronRuby tree currently broken for compiles? I have tried everything I can think of to get it to build and I just get: Setting environment for using Microsoft Visual Studio 2008 x86 tools. c:\Users\ted\Desktop\IronRuby>rake compile (in c:/Users/ted/Desktop/IronRuby) Read in 17 resources from "c:\users\ted\desktop\ironruby\src\microsoft.scripting \math\MathResources.resx" Writing resource file... Done. The command line is too long. rake aborted! Command failed with status (1): [csc /out:"c:\users\ted\desktop\ironruby\bu...] c:/Users/ted/Desktop/IronRuby/rakefile:284 (See full trace by running task with --trace) c:\Users\ted\Desktop\IronRuby> I am running on Vista Ultimate 64bit with Visual Studio 2008 Professional. I have tried both the 32bit and 64bit command line shortcuts and I just cannot get past "The command line is too long." I cannot even figure out which command line is too long. I have tried on two different machines(both Vista Ultimate 64bit) with the same results. ___ Ironruby-core mailing list Ironruby-core@rubyforge.org http://rubyforge.org/mailman/listinfo/ironruby-core