# Preview of ironruby-rack gem

**URL:** <https://www.ruby-forum.com/t/preview-of-ironruby-rack-gem/191028>\
**Category:** IronRuby\
**Created:** [July 3, 2010, 12:10am UTC](https://www.ruby-forum.com/t/preview-of-ironruby-rack-gem/191028 "2010-07-03T00:10:47Z")\
**Posts on this page:** 16\
**Page:** 1

<div class="post-metadata">

**Author:** ![jsoho](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/8baadc/32.png) [@jsoho](https://www.ruby-forum.com/u/jsoho)\
**Post date:** [July 3, 2010, 12:10am UTC](https://www.ruby-forum.com/t/preview-of-ironruby-rack-gem/191028/1 "2010-07-03T00:10:47Z")

</div>

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.NET](http://ASP.NET)[http://www.asp.net/](http://www.asp.net/)and deploying to  
IIS [http://www.iis.net/](http://www.iis.net/) on Windows.

_INSTALL_

First you’ll need IronRuby 1.0 for .NET  
4.0[http://ironruby.codeplex.com/releases/view/25901](http://ironruby.codeplex.com/releases/view/25901)installed:  
[http://ironruby.codeplex.com/releases/view/25901#DownloadId=116524](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](http://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](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](http://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](http://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](http://ASP.NET):

D:\demo\>rack2aspnet . sinatra

rack2aspnet copied IronRuby.Rack, Cassini, and your local copy of  
IronRuby  
to the “bin” directory, a [config.ru](http://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](http://config.ru)
- log
- web.config

Because it’s been ASP.NET-ified, it can run on any [ASP.NET](http://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](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](http://github.com/jschementi/ironruby/tree/master/Hosts/IronRuby.Rack)

Enjoy,  
~Jimmy

---

<div class="post-metadata">

**Author:** ![jsoho](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/8baadc/32.png) [@jsoho](https://www.ruby-forum.com/u/jsoho)\
**Post date:** [July 6, 2010, 10:17pm UTC](https://www.ruby-forum.com/t/preview-of-ironruby-rack-gem/191028/2 "2010-07-06T22:17:38Z")

</div>

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](http://github.com/rack/rack/issues/issue/32)  
(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](http://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](http://config.ru))?

Will continue working with this, thanks again!

Best Regards,  
Kevin R.

---

<div class="post-metadata">

**Author:** ![jsoho](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/8baadc/32.png) [@jsoho](https://www.ruby-forum.com/u/jsoho)\
**Post date:** [July 7, 2010, 5:48am UTC](https://www.ruby-forum.com/t/preview-of-ironruby-rack-gem/191028/3 "2010-07-07T05:48:58Z")

</div>

* * *

Ironruby-core mailing list  
removed\_email\_address@domain.invalid  
[http://rubyforge.org/mailman/listinfo/ironruby-core](http://rubyforge.org/mailman/listinfo/ironruby-core)

---

<div class="post-metadata">

**Author:** ![jsoho](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/8baadc/32.png) [@jsoho](https://www.ruby-forum.com/u/jsoho)\
**Post date:** [July 7, 2010, 6:02am UTC](https://www.ruby-forum.com/t/preview-of-ironruby-rack-gem/191028/4 "2010-07-07T06:02:25Z")

</div>

From: removed\_email\_address@domain.invalid  
[[mailto:removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)] On Behalf Of Kevin  
Radcliffe  
Sent: Tuesday, July 06, 2010 1:11 PM  
To: removed\_email\_address@domain.invalid  
Subject: Re: [Ironruby-core] Preview of ironruby-rack gem

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

I hit this, too. If nothing else, just don’t put a default app in the  
[config.ru](http://config.ru) at all and let the developer add it. I know you only add the  
[config.ru](http://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

---

<div class="post-metadata">

**Author:** ![jsoho](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/8baadc/32.png) [@jsoho](https://www.ruby-forum.com/u/jsoho)\
**Post date:** [July 7, 2010, 7:15pm UTC](https://www.ruby-forum.com/t/preview-of-ironruby-rack-gem/191028/5 "2010-07-07T19:15:13Z")

</div>

* * *

Ironruby-core mailing list  
removed\_email\_address@domain.invalid  
[http://rubyforge.org/mailman/listinfo/ironruby-core](http://rubyforge.org/mailman/listinfo/ironruby-core)

---

<div class="post-metadata">

**Author:** ![jsoho](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/8baadc/32.png) [@jsoho](https://www.ruby-forum.com/u/jsoho)\
**Post date:** [July 20, 2010, 6:44pm UTC](https://www.ruby-forum.com/t/preview-of-ironruby-rack-gem/191028/6 "2010-07-20T18:44:14Z")

</div>

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](http://IronShay.com) | Twitter: [http://twitter.com/ironshay](http://twitter.com/ironshay)

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

---

<div class="post-metadata">

**Author:** ![jsoho](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/8baadc/32.png) [@jsoho](https://www.ruby-forum.com/u/jsoho)\
**Post date:** [August 1, 2010, 3:56am UTC](https://www.ruby-forum.com/t/preview-of-ironruby-rack-gem/191028/7 "2010-08-01T03:56:12Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![jsoho](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/8baadc/32.png) [@jsoho](https://www.ruby-forum.com/u/jsoho)\
**Post date:** [July 7, 2010, 11:26pm UTC](https://www.ruby-forum.com/t/preview-of-ironruby-rack-gem/191028/8 "2010-07-07T23:26:21Z")

</div>

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):

> <https://gist.github.com/kradcliffe/467279>

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.

---

<div class="post-metadata">

**Author:** ![jsoho](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/8baadc/32.png) [@jsoho](https://www.ruby-forum.com/u/jsoho)\
**Post date:** [August 19, 2010, 3:33pm UTC](https://www.ruby-forum.com/t/preview-of-ironruby-rack-gem/191028/9 "2010-08-19T15:33:09Z")

</div>

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](http://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

---

<div class="post-metadata">

**Author:** ![jsoho](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/8baadc/32.png) [@jsoho](https://www.ruby-forum.com/u/jsoho)\
**Post date:** [December 6, 2010, 8:38am UTC](https://www.ruby-forum.com/t/preview-of-ironruby-rack-gem/191028/10 "2010-12-06T08:38:37Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![jsoho](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/8baadc/32.png) [@jsoho](https://www.ruby-forum.com/u/jsoho)\
**Post date:** [February 18, 2011, 3:07pm UTC](https://www.ruby-forum.com/t/preview-of-ironruby-rack-gem/191028/11 "2011-02-18T15:07:00Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![jsoho](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/8baadc/32.png) [@jsoho](https://www.ruby-forum.com/u/jsoho)\
**Post date:** [November 2, 2010, 2:11pm UTC](https://www.ruby-forum.com/t/preview-of-ironruby-rack-gem/191028/12 "2010-11-02T14:11:24Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![jsoho](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/8baadc/32.png) [@jsoho](https://www.ruby-forum.com/u/jsoho)\
**Post date:** [April 23, 2011, 8:10pm UTC](https://www.ruby-forum.com/t/preview-of-ironruby-rack-gem/191028/13 "2011-04-23T20:10:37Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![jsoho](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/8baadc/32.png) [@jsoho](https://www.ruby-forum.com/u/jsoho)\
**Post date:** [April 24, 2011, 6:19am UTC](https://www.ruby-forum.com/t/preview-of-ironruby-rack-gem/191028/14 "2011-04-24T06:19:37Z")

</div>

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:

> **[rack/test at master · leahneukirchen/rack](https://github.com/leahneukirchen/rack/tree/master/test)**
>
> master/test

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

> **[main/Hosts/IronRuby.Rack/ironruby-rack/test at master · IronLanguages/main](https://github.com/IronLanguages/main/tree/master/Hosts/IronRuby.Rack/ironruby-rack/test)**
>
> master/Hosts/IronRuby.Rack/ironruby-rack/test

(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.

---

<div class="post-metadata">

**Author:** ![jsoho](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/8baadc/32.png) [@jsoho](https://www.ruby-forum.com/u/jsoho)\
**Post date:** [April 24, 2011, 3:18pm UTC](https://www.ruby-forum.com/t/preview-of-ironruby-rack-gem/191028/15 "2011-04-24T15:18:21Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![jsoho](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/8baadc/32.png) [@jsoho](https://www.ruby-forum.com/u/jsoho)\
**Post date:** [April 23, 2011, 9:45pm UTC](https://www.ruby-forum.com/t/preview-of-ironruby-rack-gem/191028/16 "2011-04-23T21:45:38Z")

</div>

On Sat, Apr 23, 2011 at 2:10 PM, Eduardo B.  
[removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) 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:

> **[main/Hosts/IronRuby.Rack at master · IronLanguages/main](https://github.com/IronLanguages/main/tree/master/Hosts/IronRuby.Rack)**
>
> master/Hosts/IronRuby.Rack

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
