Preview of ironruby-rack gem

All,

I’d like your feedback and testing of a early-but-near-to-beta-quality
build
of IronRuby.Rack, packaged in a RubyGem with some very simple scripts to
configure rack-based applications for running on
ASP.NEThttp://www.asp.net/and deploying to
IIS http://www.iis.net/ on Windows.

INSTALL

First you’ll need IronRuby 1.0 for .NET
4.0http://ironruby.codeplex.com/releases/view/25901installed:
http://ironruby.codeplex.com/releases/view/25901#DownloadId=116524

Since it’s a for-the-mailing-list-only preview, I am not publishing it
to
rubygems.org until I’ve gotten enough of your feedback that it’s ready,
so
you’ll have to first download the gem from:
http://jimmy.schementi.com/downloads/ironruby-rack-0.0.9-universal-dotnet.gem

And then install it with your IronRuby installation:
D:>igem install path\to\ironruby-rack-0.0.9-universal-dotnet.gem

This gem packages up the following components:

  • IronRuby.Rack.dll: integration between Rack and ASP.NET
  • Cassini.exe: a open-source development-time web server
  • rack2aspnet <app_path> [rails|sinatra]: takes a Rack application
    and
    enables it to run on ASP.NET
  • deploy2iis <app_name> <app_path>: takes a Rack-enabled
    ASP.NETapplication and deploys it to the IIS web server.

USAGE

Lets take a tiny Sinatra app and deploy it to IIS. Given this app:

D:>cd demo

D:>more app.rb
require ‘rubygems’
require ‘sinatra’

get ‘/’ do
‘hi’
end

Run rack2aspnet to set it up for running on ASP.NET:

D:\demo>rack2aspnet . sinatra

rack2aspnet copied IronRuby.Rack, Cassini, and your local copy of
IronRuby
to the “bin” directory, a config.ru for sinatra (if not present
already),
and a web.config all pre-configured to point at your local IronRuby
installation:

  • bin\Cassini.exe
  • bin\ir.exe
  • bin\ir.exe.config
  • bin\IronRuby.dll
  • bin\IronRuby.Libraries.dll
  • bin\IronRuby.Libraries.Yaml.dll
  • bin\IronRuby.Rack.dll
  • bin\Microsoft.Dynamic.dll
  • bin\Microsoft.Scripting.dll
  • config.ru
  • log
  • web.config

Because it’s been ASP.NET-ified, it can run on any ASP.NET web-server;
this
gem includes Cassini.exe:

D:\demo>bin\Cassini.exe D:\demo 9202 /

Now this app can be deployed to an IIS web server with deploy2iis:

D:\demo>deploy2iis myapp d:\demo
Gives IIS_IUSRS FullControl to d:\demo
myapp has been created successfully.
myapp has been configured successfully.
IIS Restarted

Note: you’ll still have to give IIS_IUSRS read-only access to your
IronRuby
installation; the script will enable this in the future.

You can now navigate to the Sinatra app at http://localhost/myapp, which
will be running on IIS.

FEEDBACK

For now, just reply to the list with any major issues you find. Feel
free to
try it with your own apps too, but make sure they run OK on IronRuby
first.

If you find some bugs and what to take a stab at fixing them yourself,
you
can find the source code here:
http://github.com/jschementi/ironruby/tree/master/Hosts/IronRuby.Rack

Enjoy,
~Jimmy

Jimmy,
This is great! Thanks for your work.

I’ve run into a few issues so far:

  1. not IronRuby.Rack’s fault, but the latest rack (1.2.1) breaks the
    minimal
    test app above due to this issue:
    rack 1.2.1/sinatra 1.0 crash on windows · Issue #32 · rack/rack · GitHub
    (I had to apply the patch mentioned via that link to get things
    working
    w/ rack 1.2.1)

  2. Is there any way you can detect if sintra is not already installed
    when
    running: rack2aspnet . sinatra
    I did not have the gem installed, and so I received an error when
    browsing to the app via cassini
    If possible, it would be cool to warn the user that sinatra (or
    rails)
    is not installed when running rack2aspnet

  3. Very minor - I created the app.rb like above, and then ran
    rack2aspnet.
    At first, I was a little confused why my app.rb wasn’t used at all,
    and
    instead, some default text from the config.ru was used instead.
    Is it possible to detect if app.rb already exists, and use it by
    default if so (from the config.ru)?

Will continue working with this, thanks again!

Best Regards,
Kevin R.


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

From: [email protected]
[mailto:[email protected]] On Behalf Of Kevin
Radcliffe
Sent: Tuesday, July 06, 2010 1:11 PM
To: [email protected]
Subject: Re: [Ironruby-core] Preview of ironruby-rack gem

  1. Very minor - I created the app.rb like above, and then ran
    rack2aspnet.

    At first, I was a little confused why my app.rb wasn’t used at all,
    and
    instead, some default text from the config.ru was used instead.

    Is it possible to detect if app.rb already exists, and use it by
    default if so (from the config.ru)?

I hit this, too. If nothing else, just don’t put a default app in the
config.ru at all and let the developer add it. I know you only add the
config.ru if it doesn’t already exist. I suppose it’s a toss up as to
whether to show a default message or leave it blank. I can go either
way,
but I kinda lean toward blank.

Ryan


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

Hi,

I’m checking out the new IronRuby.Rack utils with a small web
application
(not the sample one) I have here.
The first problems I had were related to version problems since the
project
had been created using version 1.0.0.0 (and I’m using 1.1). Small fixes
for
the references in the project made this problem go away.

Another problem was that the virtual directory on the IIS server was
created
using the default application pool, which uses .NET 2. Since I’m using
the
.NET 4 version I had to change the application pool.

Last problem, which I couldn’t figure out yet is that now I get the next
error:

unknown: No coercion operator is defined between types ‘System.String’
and ‘IronRuby.Builtins.MutableString’. (TypeError)

I took a look at the log and it seems like the problem is somewhere in
this
method:

    private object Rackup() {
        Utils.Log("=> Loading Rack application");
        var fullPath = Path.Combine(_appRoot, "config.ru");
        if (File.Exists(fullPath)) {
            return IronRubyEngine.ExecuteMethod<RubyArray>(
                IronRubyEngine.Execute("Rack::Builder"),
                "parse_file", 

MutableString.CreateAscii(fullPath))[0];
}
return null;
}

Any ideas?

Thanks!
Shay.

Shay F. | Microsoft Visual C#/IronRuby MVP | Author of IronRuby
Unleashed
Blog: http://IronShay.com | Twitter: http://twitter.com/ironshay

On Wed, Jul 7, 2010 at 11:20 PM, Kevin R.

Jimmy,

What’s the status with some of the issues identified so far? Also, have
you
made it easier to switch between 1.0 and 1.1?

Cheers,

Ryan R.

Jimmy,

As mentioned before, it appears (at least on my own Windows 7 x64
system)
that add_acl (in lib\rack\deploy\iis.rb) was not giving FullControl
rights
to IIS_IUSRS as expected.
This results in the “cannot read configuration file” that Ryan reported
above.

I was able to get the system to give appropriate rights to IIS_IUSRS but
in
a very strange way:

I had to give it 2 FileSystemAccessRules, one simpler one and the full
one
(that you already had in iis.rb)
If I give it one or the other but not BOTH, it will add IIS_IUSRS as a
user
of the app directory, but will NOT give it any permissions at all.

Here’s the gist with my minor edits (in case it is helpful).
(again, this is from lib\rack\deploy\iis.rb):

Unfortunately, I’m not really sure WHY this is the case.
It seems strange to be required to essentially add 2 rules that appear
to do
the same thing.

Best Regards,
Kevin R.

First, thank you for doing what you’re doing. The sooner we can develop
Rails 3 apps in IronRuby and deploy them to IIS without pain, the
better! Especially since the pain level can be a deciding factor in
whether to use Rails or ASP.NET MVC 2.

That said, I’ve followed the instructions above. I have a Rails 2.3.5
app with Rack 1.0.1 that runs fine under webrick.

rack2aspnet did what you suggested it would do.
deploy2iis told me I needed Administrator privileges. Closed command
window, reopened with administrator privileges. Ran again, did what you
suggested it would do.

In browser, I get error screen:

Error: undefined method `parse_file’ for Rack::Builder:Class

unknown: undefined method `parse_file’ for Rack::Builder:Class
(NoMethodError)

Search paths

C:/workspace/jkt
C:/IronRuby/lib/IronRuby
C:/IronRuby/lib/ruby/1.8
C:/IronRuby/lib/ironruby/gems/1.8/gems/rack-1.0.1/bin
C:/IronRuby/lib/ironruby/gems/1.8/gems/rack-1.0.1/lib
C:/IronRuby/lib/ruby/site_ruby/1.8
.

Gem paths

C:/IronRuby/lib/ironruby/gems/1.8

belstaff jackets
http://www.belstaffjacketsoutlet.com/Belstaff-Man/
men belstaff jackets
http://www.belstaffjacketsoutlet.com/Belstaff-Man/
belstaff sale
http://www.belstaffjacketsoutlet.com/Belstaff-Man/
belstaff bags
http://www.belstaffjacketsoutlet.com/Belstaff-Bag/
belstaff bag
http://www.belstaffjacketsoutlet.com/Belstaff-Bag/
belstaff 554
http://www.belstaffjacketsoutlet.com/Belstaff-Bag/
women belstaff jackets
http://ww.belstaffjacketsoutlet.com/Belstaff-Women/
belstaff jackets
http://www.belstaffjacketsoutlet.com/Belstaff-Icon-Jackets/
Belstaff Icon Jackets
http://www.belstaffjacketsoutlet.com/Belstaff-Icon-Jackets/
belstaff boots
http://www.belstaffjacketsoutlet.com/Belstaff-Shoes/
belstaff
http://www.belstaffjacketsoutlet.com/Belstaff-Women/

Hi all,

IronRuby 1.1.2 is really working good…

I was trying to see what is the status of this project,
it seems to be no longer in the original path in github.

Is there any news-updates on that?
Is there any way to contribute to the project?

Regards

Eduardo

Eduardo B. wrote in post #958706:

Hi all,

First, thank you for all the effort put in this project.

Is there any news on this particular project (ironruby-rack gem), going
forward with the release 1.1.1?

Eduardo

Hi all,

First, thank you for all the effort put in this project.

Is there any news on this particular project (ironruby-rack gem), going
forward with the release 1.1.1?

Eduardo

Eduardo B. wrote in post #982472:
Hi all,

IronRuby 1.1.2 is working really good in production for wpf
applications.
Do you know the status of the IronRuby-Rack project?

Is there any way to contribute?

Eduardo

I may also be interested in contributing to move IronRuby.Rack toward
rack-1.2.0 compatibility.

I would imagine (but this could be totally wrong) that we would want to
move
more tests over from:

Would this be a good approach?
Where would be a good place for them, here?

(Or pehaps a subdirectory off of that)

If it isn’t a good approach, what would be a better way to move toward
1.2.0
compatibility?
Thanks!

Best Regards,
Kevin R.

There are two important parts to testing IronRuby-Rack:

First, we need to make sure IronRuby can run rack 1.2. This will be a
subset of the tests as rack has tests for mongrel and thin, which we
won’t be able to run, but the webrick test is fair game. The rack tests
are checked into external/languages/ruby/tests, as we used to run rack
tests against IronRuby in CI. So just updating those tests and running
them should be all that’s required, and well see what bugs come out of
that.

Second we need to actually test IronRuby-Rack: given a HttpRequest it
creates a valid rack request, runs the request, and then takes the rack
response and makes into a HttpResponse. We should thoroughly make sure
that’s unit tested, and the only way to do that is write the tests; the
rack tests won’t really help. Currently there are some unit tests and a
test similar to rack’s webrick test that use Cassini instead. For
starters in testing the HttpRequest portion, we could give it a
HttpRequest and run rack-lint to make sure it doesn’t fuck anything up.
But ideally we’ll probably need tests exercising the entire rack spec.

~Jimmy

On Sat, Apr 23, 2011 at 2:10 PM, Eduardo B.
[email protected] wrote:

IronRuby 1.1.2 is working really good in production for wpf
applications.
Do you know the status of the IronRuby-Rack project?

Not much going on. Should at least make sure it’s rack-1.2.0 compatible.

Is there any way to contribute?

If you want to submit patches, source is here:

If you want to contribute blog-posts, tutorials, or documentation,
send it to the mailing list and we’ll figure out where best to put it.

~Jimmy