fredag, november 03, 2006

JRuby versus Camping: Round 2

As undoubtedly some of you have discovered while trying, JRuby doesn't run Camping anymore. The culprit is a small feature in Ruby that we don't support yet. For some reason this feature is the preferred idiom for option parsing and Camping 1.5 introduced it, which means that Camping 1.5 will fail miserably in JRuby right now. There are more or less two ways around it, though. The first one is easy; just use a Camping version that is
opts.on("-p", "--port NUM", "Port for web server (defaults to #{conf.port})")
{ |conf.port| }
To fix this particular instance, just change it into this:
opts.on("-p", "--port NUM", "Port for web server (defaults to #{conf.port})")
{ |v| conf.port=v }
Not much of a difference, really. On all places where assignment to a non-obvious node is done in the manner above, just replace it with a regular assignment, and Camping will run.

Now, we are planning on fixing this syntax, but there is much development going down right now, and this change requires some changes in the parser, which is always interesting. But it will be there.

3 kommentarer:

Anonym sa...

I believe matz is removing this behavior from future versions of ruby, as it is actually an accidental side effect rather than a feature added on purpose.

Ola Bini sa...

Yes, that's true. He is removing it in the next version. But that's a year from now. And during that year, Camping will not run. I will not have it that way! =)

Anonym sa...

FREE Business Advertising Tips The Most Powerful Internet Classified Advertising Methods On The Web! "TOP" Rated Money Making Website! A Must See!!!