Trying to duplicate Phil Haack's example

Using rev 113, I tried to duplicate Phil H.'s blog post (here
My First IronRuby Unit Test Spec For ASP.NET MVC | You’ve Been Haacked)

I downloaded Rspec 1.1.4

and ran the exact code from the blog; setting the path on the first
‘require’ to point to where I extracted RSpect

require File.dirname(FILE) +
‘/…/…/Libraries/rspec-1.1.4/spec/spec_helper’

The error I get is:

IronRuby.Libraries:0:in require': Type 'IronRuby, Version=1.0.0.0, Culture=neut ral, PublicKeyToken=31bf3856ad364e35, Ruby.Runtime.RubyContext' is missing or ca nnot be loaded. (Microsoft::Scripting::Runtime::MissingTypeException) from :0:in Initialize##1

When I comment out the entire file, and just include the first
‘require’ I still get this error; so I assume the problem is in
loading that RSpect spec_helper file?

Anyone else run into this?


Greg A.

http://www.pghcodingdojo.org
http://www.insomnia-consulting.org/monologue

What happens if you try to require an empty .rb file in the startup
directory? Same error, or success?

Is this not the old SIGNED problem?
Pete

I don’t know. Revision 113 has the SIGNED symbol set in a number of
projects.

When I was having this problem last week the Ruby.Console was able to
load
up and run code. It was only when you require a file that it popped up
exactly this error.

[I haven’t looked but I suspect that Ruby.Console is able to load up IronRuby.dll without doing the strong named assembly lookup.]

Pete

I don’t think he would have gotten that far if it were.
Ruby.Runtime.RubyContext is in IronRuby.dll, which has to be loaded in
order to do anything at all.

Offhand, I’d say that versioning is the most likely source of the
problem, perhaps related to changes in file names. Make sure that
there’s no copy of rbx.exe or Ruby.dll someplace where they might cause
trouble, as these have been replaced by ir.exe and IronRuby.dll. And
after deletion, do the equivalent of a “rebuild all” for good measure.

This is definitely a problem with the SIGNED conditional compilation
symbol.
I can reproduce it by checking out a clean copy of r113 and building via
Visual Studio 2008.

At least two of the project files in the solution have the SIGNED symbol
set
in their Debug configuration. Some projects have an ExternalDebug
configuration which is supposed not to have this set but the whole lot
appears to be in a bit of a mess at the moment.

The thing to do is go through each project and remove any traces of
SIGNED.

If you build this revision with rake compile you don’t get the SIGNED
problem because the rake task does not use the .csproj files to build
the
assemblies. What you do get in that case, though, is a corrupt ir.cmd
file.
The output from rake compile is ir.cmd instead of ir.exe. Just rename
the
file to ir.exe and all is well.

Finally, I did have some problems requiring the MVC assemblies. I
downloaded the most recent ones (Preview 3) but the
System.Web.Abstractions
and System.Web.Routing had 0.0.0.0 for their version number. I couldn’t
get
IronRuby to require them from the GAC.

What I found was that if you move them into the local folder and require
them without their full name then all works fine. Here is my mvc.rb
script
and output (note my mvc.rb file is in trunk\tests\ironruby\specs) …

require File.dirname(FILE) + ‘/spec_helper’
require ‘System.Web.Routing’
require ‘System.Web.Mvc’
require ‘System.Web.Abstractions’

describe “Route#<<” do

it “can create RouteCollection which is empty” do
rc = System::Web::Routing::RouteCollection.new
rc.count.should == 0
end

it “can add route to RouteCollection” do
rc = System::Web::Routing::RouteCollection.new
r = System::Web::Routing::Route.new “”, nil
rc.add “route-name”, r

rc.count.should == 1

end

end

D:\dev\ruby\ironruby\mvc\tests\ironruby\Specs>…\build\debug\ir
mvc.rb

Route#<<

  • can create RouteCollection which is empty
  • can add route to RouteCollection

2 examples, 0 failures

Hope that helps.
Pete

Ignoring the MVC requires, and just trying to require rspec, I get

c:\Libraries\IronRuby\trunk\src\IronRuby.Libraries\Builtins\kernelops.cs:300:in
require': no such file to load -- stringio (LoadError) from :0:in Initialize##3
from
c:\Libraries\IronRuby\trunk\src\IronRuby.Libraries\Builtins\kernelo
ps.cs:300:in require' from :0:in Initialize##1

Seems like the paths are correct, so I’m not sure why I’m getting
this…

On Sun, Jun 8, 2008 at 5:36 PM, Greg A. [email protected] wrote:


Greg A.

http://www.pghcodingdojo.org
http://www.insomnia-consulting.org/monologue

There should be a “stringio.rb” in the Libs directory. It has a single
line which reads:
load_assembly ‘IronRuby.Libraries’, ‘Ruby.StandardLibrary.StringIO’
Either “Libs” needs to be in your Ruby path, or you’ll need to copy this
.rb file (and probably the other .rb files in Libs) someplace where it
can be found.

When I used the output from rake compile, I didn’t those errors.

My attempt at duplicating Phil’s blog still didn’t work, but I haven’t
tried all of Peter’s suggestions yet.


Greg A.

http://www.pghcodingdojo.org
http://www.insomnia-consulting.org/monologue

For the record the Rakefile is fixed on the internal side, but I didn’t
want to venture screwing up either repository by trying a push without
John being around. When I get into the office, I’ll ask John to make
sure I don’t screw stuff up and I’ll push out a changeset that will
include the new Rakefile (compiling to ir.exe) and a svn version of
ir.cmd and irvars.bat.

JD


From: [email protected]
[[email protected]] On Behalf Of Peter Bacon D.
[[email protected]]
Sent: Sunday, June 08, 2008 2:04 PM
To: [email protected]; [email protected]
Subject: Re: [Ironruby-core] Trying to duplicate Phil H.'s example

This is definitely a problem with the SIGNED conditional compilation
symbol.
I can reproduce it by checking out a clean copy of r113 and building via
Visual Studio 2008.

At least two of the project files in the solution have the SIGNED symbol
set
in their Debug configuration. Some projects have an ExternalDebug
configuration which is supposed not to have this set but the whole lot
appears to be in a bit of a mess at the moment.

The thing to do is go through each project and remove any traces of
SIGNED.

If you build this revision with rake compile you don’t get the SIGNED
problem because the rake task does not use the .csproj files to build
the
assemblies. What you do get in that case, though, is a corrupt ir.cmd
file.
The output from rake compile is ir.cmd instead of ir.exe. Just rename
the
file to ir.exe and all is well.

Finally, I did have some problems requiring the MVC assemblies. I
downloaded the most recent ones (Preview 3) but the
System.Web.Abstractions
and System.Web.Routing had 0.0.0.0 for their version number. I couldn’t
get
IronRuby to require them from the GAC.

What I found was that if you move them into the local folder and require
them without their full name then all works fine. Here is my mvc.rb
script
and output (note my mvc.rb file is in trunk\tests\ironruby\specs) …

require File.dirname(FILE) + ‘/spec_helper’
require ‘System.Web.Routing’
require ‘System.Web.Mvc’
require ‘System.Web.Abstractions’

describe “Route#<<” do

it “can create RouteCollection which is empty” do
rc = System::Web::Routing::RouteCollection.new
rc.count.should == 0
end

it “can add route to RouteCollection” do
rc = System::Web::Routing::RouteCollection.new
r = System::Web::Routing::Route.new “”, nil
rc.add “route-name”, r

rc.count.should == 1

end

end

D:\dev\ruby\ironruby\mvc\tests\ironruby\Specs>…\build\debug\ir
mvc.rb

Route#<<

  • can create RouteCollection which is empty
  • can add route to RouteCollection

2 examples, 0 failures

Hope that helps.
Pete

Hi Greg,
I think you would be better off using the version of rspec included with
IronRuby at the moment rather than the one you downloaded from RSpec.

My results yesterday were from requiring the spec_helper.rb contained
within
the trunk\tests\ironruby\specs folder.

I tried downloading RSpec 1.1.4, requiring spec_helper.rb in there and I
get
the same error as you.

Pete

Ah, thank you!

I didn’t realize there was a version of rspec included.

I didn’t get to do anymore work yesterday, but should be able to get
back and try that later this morning.

On Mon, Jun 9, 2008 at 1:57 AM, Peter Bacon D.
[email protected] wrote:

Pete

http://www.insomnia-consulting.org/monologue
Ironruby-core mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/ironruby-core


Greg A.

http://www.pghcodingdojo.org
http://www.insomnia-consulting.org/monologue