[Logo] Menta Developers Blog
  [Search] Search   [Recent Topics] Recent Topics   [Hottest Topics] Hottest Topics   [Members]  Member Listing   [Groups] Back to home page 
[Moderation Log] Moderation Log   [Register] Register / 
[Login] Login 
[Logo]
MentaOnRuby: Porting Mentawai to Ruby  XML
Forum Index » Computer Programming and IT (English)
Author Message
saoj


[Avatar]

Joined: 13/12/2007 14:28:28
Messages: 38
Offline

I have just released the first version of MentaOnRuby, a port of Mentawai for Ruby:

http://rubyforge.org/projects/mentawai/

Here I will walk you through the first MentaOnRuby sample application so you can get a feel for Ruby, Merb and Mentawai.

The first thing you need to know is that Mentawai runs on top of Merb, which is a kind of Servet Container for the Ruby world built on top of Mongrel. Below I will show the major steps to get Merb up and running:

If you installed Ruby, chances are that it already came with RubyGems. If not, go here: http://www.rubygems.org/ and install RubyGems.

After installing, just type gem -v to see its version:

If you don't see version 1.0.1 or above, you need to upgrade your RubyGems. Just do:

With your RubyGems up-to-date, you can now install Merb:

After the installation you should now be able to run Merb from the command line:

Now go to a directory where you want to create your application and execute the command below:
(OBS: It will create the HelloMenta directory for you!)

Go here and download the latest MentaOnRuby files: http://rubyforge.org/projects/mentawai

(Note: It takes sometime for RubyForge to make the files available for download. Click here instead to download the MentaOnRuby.zip file from the Mentawai site)

Unzip the mentawai.zip file inside your application's lib folder (HelloMenta/lib).

Now we will tell Merb to use the Mentawai controller for all requests ending with .mtw. To do that you should do the following modifications in the config/router.rb file:

Import the controller.rb file:

Comment out the merb default routes

Add the line below to map the Mentawai controller:

Now let's create our first Mentawai action: app/controllers/hello.rb

Now let's create our ERB file app/views/sayHello.html.erb (you can consider that a Ruby Server Page or RSP):

Now our application manager: app/controllers/app_manager.rb

That's it! Now go inside your application directory and run the merb server:

Type the following URL in your browser and you should see your action being executed:

http://localhost:4000/Hello.mtw?username=Sergio

The version 0.3b already supports inner actions, filters, global filters, consequences, global consequences, invocation chain, etc. Of course there many other Mentawai features not yet implemented.
comechao



Joined: 05/04/2008 15:13:09
Messages: 1
Offline

Bom trabalho! Sou programador Ruby e estou estudando Java. Achei interessante a sua idéia de portar algo feito em java para ruby!
[WWW]
 
Forum Index » Computer Programming and IT (English)
Go to:   
Powered by JForum 2.1.8 © JForum Team