ramaze
DESCRIPTION
Proudcloud Talks presentationTRANSCRIPT
Ramaze Alternative Ruby Framework(ra-ma-ze)
My Background
Used Ramaze in 2009 as an alternative to Rails Heterogenous team of developers Some ruby first-timers Problems/resistance with Rails
conventions Built a production app serving 10k+
users
Ramaze
Simple, light, modular web framework
MVC Agnostic
Database/ORM (no default) Templating (default Etanni)
Based off of Nitro No set structure
prototypes Dependency: Rack
Installation
http://github.com/ramaze/ramaze Maintained by 4 guys
gem install ramaze
Innate Core Ramaze Innate Rack Innate = Sinatra, Ramaze = Padrino
Hello World
Simple. One file(4kb) vs Rails (900kb).
Listing 1: hello.rb
Run
ramaze start ruby hello.rb thin start Pow, Passenger, Mongrel etc
Rack based
POLS
Principle of Least Surprise Law of Least Astonishment It should work because I made it
work No “magic”
Freedom
No set structure for organizing your files Flexible BUT: Could lead to messed up code Use what makes most sense to you (and
your team) Sensible defaults
Prototypes ramaze create project
Views
Listing 2: view/index.rhtml (using Erubis)
By default Ramaze looks for the template in the path called ‘view’, but can beoverriden via setting Ramaze.options.views = ‘view_path’Add @message in controller
You could also add inline views in your really wanted to.
Models
Use any ORM Sequel Active Record Standalone classes
Models (cont.)
Simple Model: in hello.rb
*Modify controller to use this
Organizing your code
Use prototype Allows opportunity to refactor and build
our code as we go along Ex:
Remove model and controller from hello.rb into separate files
Ramaze.acquire – broken in 1.9.2 as of 5/2011
Routing
controllers/another_controller.rb
Looks for views in ‘view/bye/’ view_path/route_name
Routing (cont.)
You can also specify routes via configuration regex routes
Other Stuff
Layouts Placed in view path Just call layout ‘layout_name’ in controller
to set Helpers
paginate user flash https://github.com/Ramaze/ramaze/tree/master/lib/ramaze/helper
Middlewares
Great things about Ramaze
Low memory usage Cheaper than Rails Uses 60% less memory vs Padrino
Freedom Simple codebase Focus on Ruby, rather than the
framework
Cons
Outdated documentation Slightly slower compared to Padrino Can’t use Rails specific gems
You can but with slightly more work
Still Great Things
Good community Freenode #ramaze Google groups
Know exactly what your code does Know where to place/find your code
(because you organized it)
Conclusion
Great to use for smallish projects When server memory is an issue
Great way to help transition developers from other technologies who are used to their “own way of doing things”
Let’s you focus on Ruby Good alternative to Rails, use it when you
are sick of Rails In the end, Ramaze, Rails, Sinatra are tools:
It’s what’s in your heart that counts, use frameworks that make you happy.
ENDQuestions?