Ce diaporama a bien été signalé.
Nous utilisons votre profil LinkedIn et vos données d’activité pour vous proposer des publicités personnalisées et pertinentes. Vous pouvez changer vos préférences de publicités à tout moment.

Rails Metal, Rack, and Sinatra

23 198 vues

Publié le

Slides from my Railsconf 2009 talk

Publié dans : Technologie, Business
  • I got a much better car than I thought I would get for the money. Thanks Gov-Auctions, I am glad I became a member.Learn more... =>> https://w.url.cn/s/Ayy1McS
       Répondre 
    Voulez-vous vraiment ?  Oui  Non
    Votre message apparaîtra ici
  • Hey Gov-Auctions - great service. My wife is stoked with her new wheels and it was fun! ➤➤ https://w.url.cn/s/AVD5j1m
       Répondre 
    Voulez-vous vraiment ?  Oui  Non
    Votre message apparaîtra ici
  • Get Result In Week One! Thank you, thank you, thank you! I've been plagued with small breasts for 30 years and even when I thought I couldn't do anything, your guide helped me to grow 1 cup size! I'm so pleased and I started seeing results in the first week. Thanks again Jenny, your work is amazing!! ➽➽ https://dwz1.cc/aRWJhQS6
       Répondre 
    Voulez-vous vraiment ?  Oui  Non
    Votre message apparaîtra ici
  • DOWNLOAD THE BOOK INTO AVAILABLE FORMAT (New Update) ......................................................................................................................... ......................................................................................................................... Download Full PDF EBOOK here { https://urlzs.com/UABbn } ......................................................................................................................... Download Full EPUB Ebook here { https://urlzs.com/UABbn } ......................................................................................................................... Download Full doc Ebook here { https://urlzs.com/UABbn } ......................................................................................................................... Download PDF EBOOK here { https://urlzs.com/UABbn } ......................................................................................................................... Download EPUB Ebook here { https://urlzs.com/UABbn } ......................................................................................................................... Download doc Ebook here { https://urlzs.com/UABbn } ......................................................................................................................... ......................................................................................................................... ................................................................................................................................... eBook is an electronic version of a traditional print book THE can be read by using a personal computer or by using an eBook reader. (An eBook reader can be a software application for use on a computer such as Microsoft's free Reader application, or a book-sized computer THE is used solely as a reading device such as Nuvomedia's Rocket eBook.) Users can purchase an eBook on diskette or CD, but the most popular method of getting an eBook is to purchase a downloadable file of the eBook (or other reading material) from a Web site (such as Barnes and Noble) to be read from the user's computer or reading device. Generally, an eBook can be downloaded in five minutes or less ......................................................................................................................... .............. Browse by Genre Available eBOOK .............................................................................................................................. Art, Biography, Business, Chick Lit, Children's, Christian, Classics, Comics, Contemporary, CookBOOK, Manga, Memoir, Music, Mystery, Non Fiction, Paranormal, Philosophy, Poetry, Psychology, Religion, Romance, Science, Science Fiction, Self Help, Suspense, Spirituality, Sports, Thriller, Travel, Young Adult, Crime, EBOOK, Fantasy, Fiction, Graphic Novels, Historical Fiction, History, Horror, Humor And Comedy, ......................................................................................................................... ......................................................................................................................... .....BEST SELLER FOR EBOOK RECOMMEND............................................................. ......................................................................................................................... Blowout: Corrupted Democracy, Rogue State Russia, and the Richest, Most Destructive Industry on Earth,-- The Ride of a Lifetime: Lessons Learned from 15 Years as CEO of the Walt Disney Company,-- Call Sign Chaos: Learning to Lead,-- StrengthsFinder 2.0,-- Stillness Is the Key,-- She Said: Breaking the Sexual Harassment Story THE Helped Ignite a Movement,-- Atomic Habits: An Easy & Proven Way to Build Good Habits & Break Bad Ones,-- Everything Is Figureoutable,-- What It Takes: Lessons in the Pursuit of Excellence,-- Rich Dad Poor Dad: What the Rich Teach Their Kids About Money THE the Poor and Middle Class Do Not!,-- The Total Money Makeover: Classic Edition: A Proven Plan for Financial Fitness,-- Shut Up and Listen!: Hard Business Truths THE Will Help You Succeed, ......................................................................................................................... .........................................................................................................................
       Répondre 
    Voulez-vous vraiment ?  Oui  Non
    Votre message apparaîtra ici
  • Sex in your area is here: ❤❤❤ http://bit.ly/2F7hN3u ❤❤❤
       Répondre 
    Voulez-vous vraiment ?  Oui  Non
    Votre message apparaîtra ici

Rails Metal, Rack, and Sinatra

  1. Rails Metal, Rack, and Sinatra Adam Wiggins Railsconf 2009
  2. Show of hands, how many of you...
  3. metal
  4. Show of hands, how many of you...
  5. “The gateway drug”
  6. “The gateway drug”* * it’s a myth, but makes good analogy
  7. Rails Metal is a gateway
  8. Rails Metal is a gateway to the world of Rack
  9. What can you do with Metal?
  10. Replace selected URLs for a speed boost
  11. Example: auction site
  12. Example: auction site
  13. Example: auction site on
  14. Majority of traffic goes to: GET /auctions/id.xml
  15. app/controller/auctions_controller.rb
  16. app/controller/auctions_controller.rb class AuctionsController < ApplicationController def show @auction = Auction.find(params[:id]) respond_to do |format| format.html format.xml { render :xml => @auction } end end end
  17. app/metal/auctions_api.rb
  18. app/metal/auctions_api.rb class AuctionsApi def self.call(env) # implementation goes here end end
  19. app/metal/auctions_api.rb class AuctionsApi def self.call(env) url_pattern = %r{/auctions/(d+).xml} if m = env['PATH_INFO'].match(url_pattern) # render the auction api else # pass (do nothing) end end end
  20. app/metal/auctions_api.rb class AuctionsApi def self.call(env) url_pattern = %r{/auctions/(d+).xml} if m = env['PATH_INFO'].match(url_pattern) auction = Auction.find(m[1]) [ 200, {quot;Content-Typequot; => quot;text/xmlquot;}, auction.to_xml ] else [ 404, {}, '' ] end end end
  21. [ 200, {quot;Content-Typequot;=>quot;text/plainquot;}, quot;Hello, Rack!quot; ]
  22. [ 200, {quot;Content-Typequot;=>quot;text/plainquot;}, quot;Hello, Rack!quot; ]
  23. http://www.slideshare.net/adamwiggins/ ruby-isnt-just-about-rails-presentation
  24. An explosion of Ruby projects in the past 2 years
  25. Tests/Specs Web Layer Test::Unit ActionController RSpec Merb Shoulda Sinatra ORM Templating ActiveRecord Erb DataMapper Haml Sequel Erubis Web Server HTTP Client Mongrel ActiveResource Thin RestClient Ebb HTTParty
  26. Tests/Specs Web Layer Test::Unit ActionController ORM Templating ActiveRecord Erb Web Server HTTP Client Mongrel ActiveResource
  27. Tests/Specs Web Layer Test::Unit ActionController ORM Templating ActiveRecord Erb Web Server HTTP Client Mongrel ActiveResource
  28. Tests/Specs Web Layer Test::Unit ActionController RSpec Merb Shoulda Sinatra ORM Templating ActiveRecord Erb DataMapper Haml Sequel Erubis Web Server HTTP Client Mongrel ActiveResource Thin RestClient Ebb HTTParty
  29. Tests/Specs Web Layer Test::Unit ActionController RSpec Merb Shoulda Sinatra ORM Templating ActiveRecord Erb DataMapper Haml Sequel Erubis Web Server HTTP Client Mongrel ActiveResource Thin RestClient Ebb HTTParty
  30. Tests/Specs Web Layer Test::Unit ActionController RSpec Merb Shoulda Sinatra ORM Templating ActiveRecord Erb DataMapper Haml Sequel Erubis Web Server HTTP Client Mongrel ActiveResource Thin RestClient Ebb HTTParty
  31. The world of Rack is now within reach from Rails
  32. Sinatra The classy microframework for Ruby http://sinatrarb.com
  33. require 'rubygems' require 'sinatra' get '/hello' do quot;Hello, whirledquot; end
  34. $ ruby hello.rb == Sinatra/0.9.1.1 has taken the stage >> Thin web server (v1.0.0) >> Maximum connections set to 1024 >> Listening on 0.0.0.0:4567
  35. $ ruby hello.rb == Sinatra/0.9.1.1 has taken the stage >> Thin web server (v1.0.0) >> Maximum connections set to 1024 >> Listening on 0.0.0.0:4567 $ curl http://localhost:4567/hello Hello, whirled
  36. A minimalist paradise
  37. require 'rubygems' require 'sinatra' require 'lib/article' post '/articles' do article = Article.create! params redirect quot;/articles/#{article.id}quot; end get '/articles/:id' do @article = Article.find(params[:id]) erb :article end
  38. Sinatra in your Rails app?
  39. Replace selected URLs for a speed boost
  40. Replace selected URLs for a speed boost
  41. Replace selected URLs with Sinatra
  42. app/metal/articles.rb
  43. app/metal/articles.rb require 'sinatra/base' class Articles < Sinatra::Base post '/articles' do article = Article.create! params redirect quot;/articles/#{article.id}quot; end get '/articles/:id' do @article = Article.find(params[:id]) erb :article end end
  44. Back to the auction example
  45. Back to the auction example
  46. ActionController class AuctionsController < ApplicationController def show @auction = Auction.find(params[:id]) respond_to do |format| format.html format.xml { render :xml => @auction } end end end
  47. Pure Rack class AuctionsApi def self.call(env) url_pattern = /^/auctions/(d+).xml$/ if m = env['PATH_INFO'].match(url_pattern) auction = Auction.find(m[1]) [ 200, {quot;Content-Typequot; => quot;text/xmlquot;}, auction.to_xml ] else [ 404, {}, '' ] end end end
  48. Sinatra get '/auctions/:id.xml' Auction.find(params[:id]).to_xml end
  49. Sinatra get '/auctions/:id.xml' Auction.find(params[:id]).to_xml end Now that’s what I call minimalist.
  50. The End. http://railscasts.com/episodes/150-rails-metal http://rack.rubyforge.org http://sinatrarb.com http://adam.blog.heroku.com Adam Wiggins Railsconf 2009

×