Installing and running Ruby-rack on OpenSolaris

Rack is a webserver interface for the Ruby open source programming environment.  Amanda Waite took the trouble of making this package available via the OpenSolaris packaging mechanism; ultimately, ruby-rack will be in the OpenSolaris "contrib" repository, but not until it gets a little testing and review, and some votes from the community, this functionality is now in the OpenSolaris "pending" repository.  I admit to great naivete about Ruby, so I'll refer you to this excellent explanation of what Rack does for Ruby developers.  (my summary of what I got from the explanation: Rack is a web framework for Ruby developers; in other words, if you like writing Ruby code and you want to write code to create a web-based application, Rack is a nice extension to Ruby to make doing this easy).

Anyway, been doing some testing of the package that Amanda submitted.  Here's what I did and what I observed:

First, I made sure I had access to the OpenSolaris Source Juicer "pending" repository.  As I've noted before, two steps:
  1. type "pfexec pkg set-publisher -O http://jucr.opensolaris.org/pending jucr-pending"
  2. type "pfexec pkg refresh"
After that, the next time you launch the Package Manager application, look on the right side of the application and you can choose "jucr-pending" from the pop-up menu.  Do that, and after a moment you'll see a list of all the packages in the "pending" repository.  You will find the package "ruby-rack" there.  Note that case matters; the package name is all lowercase.

So I did this and downloaded the package.  The package notes that it depends on the Ruby package.  The Package Manager pulled it in just fine.  How do I know?  Before installation, I could not type "ruby" and get anything back.  Afterward, it worked.

Next step:

$ cd /usr/ruby/1.8/lib/ruby/gems/1.8/gems/rack-1.0.1/example
$ rackup lobster.ru


This starts a web server on port 9292 with a little "lobster" program.  I launch the web browser and go to "http://localhost:9292" and I saw a simple web app that shows a crude "picture" of a lobster, and two things I can do: flip the lobster from right to left and back again, and show a crash dump of the Ruby Rack program.  I tried both of those things; they worked just fine.

After this, I killed the "rackup" program then tried it again with the other ".ru" file in that same directory, "protectedlobster.ru".  That gives an added feature of authenticating into the web app (password is "secret"; as far as I can tell, use any username you wish).  That worked, too: if I didn't provide the right password, nothing happened.  If I provided the right password, it worked fine.

So that all worked just fine.  The next set of tests was more in-depth, running a partial test suite.  For this set of steps, I had to install both the "SUNWgcc" and "SUNWgmake" packages, again with the Package Manager.  I did these steps:
  1. su - (i.e., pretend you're root; without doing this, step 3 below complained that it couldn't write to /var/ruby/1.8/gem_home/bin)
  2. Add /var/ruby/1.8/gem_home/bin to your $PATH
  3. type CXX=/usr/sfw/bin/g++ gem install memcache-client ruby-openid camping mongrel thin test-spec --no-ri --no-rdoc
  4. type "gem install rake"
  5. type "rake test".
The output showed it compiling some stuff, then it said "Started" followed by a bunch of periods showing status, then "Finish in 3.960495 seconds."  Finally, a results line said "267 tests, 928 assertions, 0 failures, 0 errors".

That sounds like good news to me!

So folks: the Ruby Rack web framework is available via OpenSolaris.  Check it out and see if it works for you, Ruby developers.  Let us know how it goes, will ya?


Powered by ScribeFire.

Comments:

Post a Comment:
  • HTML Syntax: NOT allowed
About

The views expressed on this blog are my own and do not necessarily reflect the views of Oracle. What more do you need to know, really?

Search

Archives
« April 2014
SunMonTueWedThuFriSat
  
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
   
       
Today