July 4, 2008 at 6:52 pm
· Filed under Anime, Ruby, Ruby on Rails
I’m currently working on a Rails application. It has some non-trivial business rules, so I ended up writing test methods along the lines of:
-
def test_a_message_with_a_password_protected_channel_as_recipient_will_be_delivered_to_a_users_mailbox_if_that_user_is_subscribed_to_said_channel
Okaaaay….. This is what I think of that method name:

Nice boat!
Other than the mental-psychological stress as well as an unexplainable impending feeling of doom that such a long method name brings forth in our minds, one have to ask oneself whether it is morally justified to unintentionally punish whomever will ever read this code by presenting them with such a NICE BOAT, even if said person deserves it.
As much as I love RSpec, it doesn’t feel totally appropriate to use it, because then everything must start with “it”. Unfortunately not all rules in my application can be described with sentences that start with “it”. Rails edge has a solution though. You can define test methods in a declarative style ala RSpec, like this:
-
test "an anime should be invalid if any of its characters are invalid" do
-
# Your usual test code here.
-
end
After staring at my test cases for the 2^32th time in a futile attempt to understand what the test method names are actually trying to tell me, I gave up and decided that it’s time to dig up a series that I’ve been trying to finish for the past 3 months. Surely only this will save me from going completely insane.

The face of un-insanity (?)
There Chu Yeow, I did what you asked me to do.

Baka baka baka! ….or maybe not.
Anyway, under the hood, the test method translates that block to:
-
def test_an_anime_should_be_invalid_if_any_of_its_characters_are_invalid
That’s nice. But it could be nicer. I don’t want to upgrade to Edge so I decided to copy & paste the ‘test’ method from ActiveSupport edge - it’s only 6 lines. And yesterday I found out that it’s apparently possible for method names to contain arbitrary binary data, except “\0″. So you can do this:
-
Object.send(:define_method, "omg\1wtf\n!@$%^&*()") do
-
"abc"
-
end
-
Object.new.send("omg\1wtf\n!@$%^&*()") # => "abc"
Cool! So this means we can have RSpec-style test method names even when using Test::Unit.
So I modified the test method a little bit. Copy and paste this into your test/test_helper.rb to enjoy this:
-
def self.test(name, &block)
-
test_name = "test: #{name.squish}".to_sym
-
defined = instance_method(test_name) rescue false
-
raise "#{test_name} is already defined in #{self}" if defined
-
define_method(test_name, &block)
-
end
My test method now becomes:
-
test "a message with a password protected channel as recipient will be delivered to a user’s mailbox, if that user is subscribed to said channel" do
-
…
-
end
Permalink
June 25, 2008 at 12:32 pm
· Filed under Passenger
Permalink
June 23, 2008 at 12:27 pm
· Filed under Ruby, Ruby Enterprise Edition
Ruby 1.8.6-p230/1.8.7 include fixes for the recently discovered security vulnerabilities, but they also break some apps. We’ve backported the security patches to 1.8.6-p111 and made a Ruby Enterprise Edition release based on that. See http://blog.phusion.nl/2008/06/23/ruby-186-p230187-broke-your-app-ruby-enterprise-edition-to-the-rescue/ for details.
Permalink
June 18, 2008 at 9:15 am
· Filed under Passenger
Harris Jacob has started working on Solaris support for Phusion Passenger, and he’s looking for testers. Please lend him a hand if you have a Solaris machine and would like to run Phusion Passenger in the future.
Permalink
June 11, 2008 at 8:09 pm
· Filed under Passenger
WSGI support is not documented in the Users guide because WSGI is mostly a proof of concept right now. But, just in case people want to tinker around with it, here’s how you can host a WSGI application on Phusion Passenger:
$ mkdir /webapps
$ mkdir /webapps/wsgi
$ cd /webapps/wsgi
$ mkdir public
$ mkdir tmp
$ some_favorite_editor passenger_wsgi.py
....edit file...
$ cat passenger_wsgi.py
def application(environ, start_response):
start_response('200 OK', [('Content-type', 'text/plain'), ('X-Foo', 'bar')])
return ['Hello World!<br><img src="http://www.squidz.com/c_snakey.jpg">']
Next, add a virtual host directive to your Apache config file:
<VirtualHost *:80>
ServerName www.wsgi.test
DocumentRoot /webapps/wsgi/public
</VirtualHost>
Permalink
June 9, 2008 at 10:38 pm
· Filed under Passenger, Ruby Enterprise Edition, Ruby on Rails
Phusion Passenger™ 2.0 RC 1 and Ruby Enterprise Edition have finally been released. See http://blog.phusion.nl/2008/06/09/phusion-passenger-20-rc-1-and-ruby-enterprise-edition-released/ for the announcement.
Permalink
June 7, 2008 at 6:20 pm
· Filed under General
Urgh, jetlag… I went to sleep at 7 AM local time, and woke up at 6 PM. 
Permalink
June 5, 2008 at 11:08 am
· Filed under Phusion
Magnus Holm blogged about Ruby Enterprise Edition. He, along with some other people on RubyFlow, criticized our workflow. I felt obligated to reply. Unfortunately his blog doesn’t allow comments.
We had already sent this patch to the Ruby core mailing list. Magnus, search the mailing list archives and this blog’s archives if you don’t believe me. We’re providing Ruby Enterprise Edition because upstream is unclear about what they intent to do with the patch. But in the mean time, there exists clear demand for the functionality provided by this patch, and so we’ve chosen to temporarily maintain our own fork.
The eventual fate of Ruby Enterprise Edition is, and has been since the beginning, to be merged back upstream. This is explained on the Ruby Enterprise Edition website, which is currently being worked on. This is also why we have chosen to use git as version control system: so that any changes we make can be relatively easily merged back. This all has been planned since the very beginning.
The reason why we pulled it out temporarily is because we felt that there are improvements to be made. We don’t want people to use a half-baked product, because first experiences are very important.
We are a commercial company, and we’ve never made this a secret. We could have easily chosen not to write/publish any of this at all. And yet we have, and we’re even providing all this to you for free. I’m not sure what your point is. Regarding any kinds of profit that we MIGHT generate, should we apologize for trying to put bread on the table? That kind of defeats the point of being a company right?
Magnus said:
Unfornately, I immediately think of a company which does what ever they can to promote their products. As a programmer, I don’t like promoting. I like code. Hard facts that I can verify. That’s the reason not everybody is satisfied with the demo of MagLev.
Magnus, the code is available, along with promotion. What is the problem? Should we not do any promotion at all?
Finally, Magnus also said:
The strange thing is that Phusion actually produce awesome stuff. Passenger is really neat and simple; Ruby Enterprise Edition looks like a great patch. And I’m pretty sure that they will come up with even more genius products.
Still, I think it’s a little fishy…
So what is the actual complaint?
Permalink
June 3, 2008 at 6:27 am
· Filed under Passenger, Phusion, RailsConf, Ruby Enterprise Edition
Hi guys.
RailsConf 2008 was great, and our talk on Phusion Passenger and Ruby Enterprise Edition went really well. Fabio Akita has some pictures of our talk. For other pictures, see Fabio’s .mac gallery!

We promised to release Passenger 2.0 and Ruby Enterprise Edition on the same day. Unfortunately we’ve been too optimistic about Internet access. We’re currently at the airport and we have limited internet access until we are back in the Netherlands (which should be in about 4 days or so), but in the meantime, the Passenger version with Rack and WSGI support has already been pushed to github, so feel free to tinker around with it. We’ve also put the latest Users Guide (with Rack support) online.
Thanks for the support Chad!
We’re trying our best to find a way to push out Ruby Enterprise Edition as well, and ask the hardcopy guys to not release it prior to the moment that we’re able to push it (which should be in about 4 days). This launch will also be accompanied by a site etc… Feel free to blog about it though, and the reason why we’re asking this is because we want to keep the support at Phusion related places. This will prevent any ‘noise’ in communication.
Thanks for the support mateys!
Cheers,
Hongli Lai
Tinco Andringa
Ninh Bui
Permalink
May 13, 2008 at 10:16 pm
· Filed under Passenger, Ruby Enterprise Edition, Ruby on Rails
http://www.RubyEnterpriseEdition.com/ has been “launched”.
Next hint to be revealed on May 20, 2008.
Permalink