Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.
Upcoming SlideShare
HQ Control Basic Tutorial 2
Next
Download to read offline and view in fullscreen.

Share

Ramaze - The Underrated Ruby Web Framework

Download to read offline

Slides from my talk at RubyConf 08 on Ramaze

Related Audiobooks

Free with a 30 day trial from Scribd

See all

Ramaze - The Underrated Ruby Web Framework

  1. 1. The Underrated Web Framework
  2. 2. underrated: Not given enough recognition for its quality
  3. 3. Motivation
  4. 4. What's your experience with Ramaze? <ul><li>a) Never heard of it </li></ul><ul><li>b) Noob </li></ul><ul><li>c) Expert </li></ul>
  5. 5. Getting Started
  6. 6. Simple Light Modular
  7. 7. sudo gem install ramaze
  8. 8. http://github.com/manveru/ramaze
  9. 11. Features
  10. 12. M V C
  11. 13. KISS
  12. 14. Light <ul><ul><li>You can write an application in one file. </li></ul></ul>
  13. 15. Modular
  14. 16. Only one dependency
  15. 17. ORM-agnostic
  16. 18. Templating Engines: <ul><li>Ezamar </li></ul><ul><li>Erubis </li></ul><ul><li>Haml </li></ul><ul><li>Liquid </li></ul><ul><li>Markaby </li></ul><ul><li>Maruku </li></ul><ul><li>Nagoro </li></ul><ul><li>Redcloth </li></ul><ul><li>Sass </li></ul><ul><li>Tagz </li></ul><ul><li>Tenjin </li></ul><ul><li>XSLT </li></ul><ul><li>Amrita </li></ul><ul><li>Builder </li></ul><ul><li>Remarkably </li></ul>
  17. 19. Stable <ul><ul><li>...started more than 2 years ago. </li></ul></ul>
  18. 20. Well Documented
  19. 21. Beautiful Code
  20. 22. BDD
  21. 23. Ruby 1.9
  22. 24. <ul><ul><li>Most bugs fixed in 48 hours. </li></ul></ul>
  23. 25. IRC Population
  24. 26. Basics
  25. 27. Controllers
  26. 28. MainController maps to '/'
  27. 29. BlueController maps to '/blue'
  28. 30. ...unless you use map
  29. 31. _ .
  30. 32. Action methods accept arguments via URL
  31. 33. http://localhost:7000/archive? page=2 request[:page] == '2'
  32. 34. Errors redirect to error action
  33. 35. Routing (String Routers) Ramaze::Route [ '/foo' ] = '/bar' # '/foo' => '/bar'
  34. 36. Routing (Regex Routers) Ramaze::Route [ %r!^/(+)txt$! ] = &quot;/text/%d&quot; # '/123.txt' => '/text/123'
  35. 37. Routing Ramaze::Route [ 'name of route' ] = lambda { |path, request| '/bar' if path == '/foo' and request[ :bar ] == '1' } (Lambda Routers) # '/foo' => '/foo' # '/foo?bar=1' => '/bar'
  36. 38. Testing
  37. 39. Views
  38. 40. Ezamar Erubis (bundled) (default) (my favorite) (plenty of other choices)
  39. 41. inline vs. external
  40. 42. START NO YES Run return value of action through templating engine Send to browser External Template Is there an external template?
  41. 43. Instance variables set in the action can be accessed in template (just like in Rails)
  42. 44. (convention) /view
  43. 45. (configuration) view_root 'my_templates'
  44. 46. Layouts
  45. 47. # apply to all actions except index layout :layout deny_layout :index # apply only to index layout :layout => [ :index ] Layouts
  46. 48. Ezamar Very simple reimplementation of the Templating-engine found in Nitro. <?r rubycode ?> == <% rubycode %> #{ rubycode } == <%= rubycode %>
  47. 49. Ezamar::Element
  48. 50. Ezamar::Element
  49. 51. Models
  50. 52. That's up to you to figure out...
  51. 53. ActiveRecord DataMapper Sequel Og DBI
  52. 54. Ramaze::Store
  53. 55. Helpers
  54. 56. Default Helpers <ul><li>CGI </li></ul><ul><li>File </li></ul><ul><li>Link </li></ul><ul><li>Redirect </li></ul><ul><li>Session/Flash </li></ul>Optional Helpers <ul><li>Aspect </li></ul><ul><li>Auth </li></ul><ul><li>Cache </li></ul><ul><li>Identity (OpenID) </li></ul><ul><li>Pager </li></ul><ul><li>Form </li></ul><ul><li>Partial </li></ul><ul><li>Captcha </li></ul><ul><li>etc... </li></ul>Custom Helpers
  55. 57. Link Helper R(AdminController, :index) => /admin/index Rs(:index) => /admin/index Rs(:/) => / A('text') => <a href=”/text”>text</a> A('foo/bar') => <a href=”/foo/bar”>foo/bar</a> A('Home', :href => Rs(:/)) => <a href=”/”>Home</a>
  56. 58. Aspect Helper Allows you to wrap different Actions on your Controller with code.
  57. 59. Extras
  58. 61. Deployment <ul><li>Adapters exist for: </li></ul><ul><li>Thin </li></ul><ul><li>Mongrel </li></ul><ul><li>Evented Mongrel </li></ul><ul><li>Webrick </li></ul><ul><li>CGI </li></ul><ul><li>FCGI </li></ul>
  59. 62. Deployment thin start --servers 1 --socket /tmp/thin-socket -R start.ru
  60. 63. Two Things <ul><li>Options::DSL </li></ul><ul><ul><li>Pretty neat DSL to store global options </li></ul></ul><ul><ul><li>lib/ramaze/option/dsl.rb </li></ul></ul><ul><li>Poor Man's Fibers </li></ul><ul><ul><li>Implemented by Aman Gupta </li></ul></ul><ul><ul><li>http://gist.github.com/4631 </li></ul></ul><ul><ul><li>lib/ramaze/snippets/fiber.rb </li></ul></ul>
  61. 64. Live Coding Small Blog Example: http://pastie.org/319647
  62. 65. Where to learn more <ul><li>http://www.ramaze.net </li></ul><ul><li>IRC: #ramaze </li></ul><ul><li>http://dambalah.com </li></ul><ul><li>github.com/ramaze </li></ul><ul><li>http://blog.purepistos.net </li></ul>
  63. 66. RTFC
  64. 67. Thank you. Questions?
  • LittleLeo

    Feb. 7, 2010
  • adorepump

    May. 9, 2009

Slides from my talk at RubyConf 08 on Ramaze

Views

Total views

4,938

On Slideshare

0

From embeds

0

Number of embeds

343

Actions

Downloads

59

Shares

0

Comments

0

Likes

2

×