Sinatra: прошлое, будущее и настоящее
Upcoming SlideShare
Loading in...5
×
 

Sinatra: прошлое, будущее и настоящее

on

  • 1,874 views

онстантин часто выступает на конференциях с рассказами на совершенно разные и очень полезные Ruby-темы, но мы ...

онстантин часто выступает на конференциях с рассказами на совершенно разные и очень полезные Ruby-темы, но мы рады, что нам удалось сохранить изначальную тему выступления — Константин будет рассказывать именно о Sinatra: о истории, текущем состоянии и будущем фреймворка.

Statistics

Views

Total Views
1,874
Views on SlideShare
1,872
Embed Views
2

Actions

Likes
4
Downloads
9
Comments
0

1 Embed 2

https://twitter.com 2

Accessibility

Categories

Upload Details

Uploaded via as Adobe PDF

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

Sinatra: прошлое, будущее и настоящее Sinatra: прошлое, будущее и настоящее Presentation Transcript

  • SinatraPast, Present and Future Konstantin Haase
  • Hi!Im Konstantin. I write code.
  • Back in the internet, Im akaed as@konstantinhaase on Titter rkh on GitHub khaase on IRC rkh.im on DNS
  • "The big lesson in life, baby, is never be scared of anyone or anything." Frank Sinatra
  • "Outlines are great, quotes are terrible."Ben Orenstein (Speaking For Hackers)
  • Outline The Past The Present The Future
  • Lets pretend you dont know a thing... ... about Sinatra ... about Rails ... about Rack
  • The PastOr: "How We Do HTTP"
  • 1993CGI
  • #!/usr/bin/env perlprint "Content-type: text/htmln";if ($ENV{"REQUEST_METHOD"} != "HEAD") { print "n<h1>Hello Perl!</h1>n"}
  • No structure (Hello, inline SQL!)Enormous performance overheadNo asynchronous/streaming API Perl? Seriously?
  • December 21, 1995Ruby 0.95
  • #!/usr/bin/env rubyputs "Content-Type: text/html"if ENV["REQUEST_METHOD"] != "HEAD" puts "", "<h1>Hello Ruby!</h1>"end
  • Servlets
  • require webrickclass Simple < WEBrick::HTTPServlet def do_GET(req, res) res.status = 200 res[Content-Type] = "text/html" res.body = "<h1>Hello Ruby!</h1>" endend
  • Not web server independentNo asynchronous/streaming API Limited eco system
  • July 2004Ruby On Rails
  • OhMyGod!
  • Convention Over Configuration Do Not Repeat Yourself Model - View - Controler Testing The eco system, oh my!
  • Did not play well with others Framework, not a libraryNo asynchronous/streaming API
  • Summer 2005I discover Ruby! Woohoo!
  • December 13, 2005 Rails 1.0
  • March 2007Rack 0.1
  • proc do |env| [200, {"Content-Type" => "text/html"}, ["<h1>Hello Ruby!</h1>"]]end
  • The simplest thing possible Zero dependency applicationsGreat middleware/router infrastrucutre Server independent applications Easy testing
  • Near unusable directly Rails didnt use itNo asynchronous/streaming API
  • September 9, 2007Sinatra 0.0.1
  • get(/) { body "Hello World!" }post(/) { erb :posted }
  • Simple and clean DSL for writing Rack application. Library, not framework Plays well with anything Rack No hidden magic
  • Pollutes Object Uses instance_eval (slow)No asynchronous/streaming API One application per process
  • October 7, 2007Sinatra 0.1.0
  • October 8, 2007Sinatra 0.1.5
  • before { puts "starting" }get(/) { "Hello World!" }delete(/) { haml :deleted }after { puts "done" }
  • November 21, 2007rm -Rf sinatra
  • April 12, 2008Sinatra 0.2.0 (Complete Rewrite)
  • before { halt 404 if path !~ /css/ }error(404) { "page not found" }get /:name.css, :agent => /Firefox/ do sass :firefoxend
  • April 14, 2008rm -Rf sinatra
  • September 8, 2008Sinatra 0.3.0
  • use Rack::Lintconfigure { enable :lock }get(/*.css) { sass :style }__END__@@ stylebody color: red
  • # config.ruuse SomeMiddlewaremap(/a) { run Sinatra::Application }map(/b) { run Merb::Application }
  • December 13, 2008rm -Rf sinatra
  • January 18, 2009Sinatra 0.9.0
  • class MyApp < Sinatra::Base get /js(on)?/, :provides => "json" do pass unless params[:pwd] == "foo" "Hello World".to_json end get "*" do "wrong password, probably" endend
  • No more instance_eval for routesMore than one application per process
  • March 23, 2010 Sinatra 1.0Major Refactorings since 0.9.0
  • Tilt has been extractedA ton of new helper methods Semantic Versioning
  • April - September 2010Maintainance crisis
  • October 24, 2010 1.1.0
  • before agent: /Firefox/ do headers[X-Is-Firefox] = "yes"endget(/) { markdown "# Hello World!" }
  • March 3, 2011 1.2.0Major Refactoring
  • Live release at Ruby Use Group Berlin Better extension API Better security Long term support
  • September 30, 2011 1.3.0
  • Live release at RubyConf in New Orleans Better HTTP compatibility Better security (rack-protection) Stream/asynchronous API, finally!
  • get / do stream do |out| out << "Its gonna be legen -n" sleep 0.5 out << " (wait for it) n" sleep 1 out << "- dary!n" endend
  • connections = []get / do stream(:keep_open) do |out| connections << out endendpost / do connections.each do |out| out << params[:message] end "message sent"end
  • The Present
  • Whos using it? Travis CI, Integrity, CI Joe Picky, Resque, Gollum Heroku, Github, Engine YardSongbird, University of Lausanne, StanfordApple, LinkedIn, British Government, BBC ...
  • It inspired a lot of other projects!Ruby: Almost Sinatra, Astaire, Cuba, Padrino (based on Sinatra), Pakyow, Renee PHP: Fat-Free, Fitzgerald, Glue, klein, Laravel, Limonade, MiMViC, Silex, Slim JavaScript: Express, Picard, Roundabout, SammyCoffeeScript: Zappa Python: Bottle, Denied, Flask, itty, Juno Erlang: Fresh, Spooky Groovy: Graffiti, Ratpack Scala: Scalatra, BlueEyes .NET: Martin, Nancy, Nina Perl: Dancer, Mojolicious Java: Spark, Napalm, Htmleasy Haskell: Bird, Loli Fancy: Sinatra.fy Bash: Astley, sh.inatra C: Bogart F#: Frank Lua: Mercury, Orbit Mirah: Shatner Objective-C: RCRouter Vala: Valatra Smalltalk: RatPack Thats 52 projects in 20 languages.
  • The Future
  • 2012Sinatra 1.4.0
  • No longer pollute Object
  • # Sinatra since 0.9.0include Sinatra::Delegator10.send(:get, /) do "this works, but it shouldnt"end
  • def foo 42endfoo # => 42"hi there".foo # => 42
  • self # => maindef self.foo 42endfoo # => 42"hi there".foo # NoMethodError
  • class << self include Sinatra::Delegatorend10.send(:get, /) do "Now this raises a NoMethodError"end
  • extend Sinatra::Delegator10.send(:get, /) do "Now this raises a NoMethodError"end
  • some daySinatra 2.0
  • Use successor of Rack (code name Ponies) rm -Rf sinatra?
  • Thanks!github.com / rkh / presentations