Ruby Isn't Just About Rails

Loading...

Flash Player 9 (or above) is needed to view presentations.
We have detected that you do not have it on your computer. To install it, go here.

0 comments

Post a comment

    Post a comment
    Embed Video
    Edit your comment Cancel

    18 Favorites

    Ruby Isn't Just About Rails - Presentation Transcript

    1. Ruby Isn’t Just About Rails Adam Wiggins Codemash 2009
    2. ?
    3. ? Ruby
    4. You can’t sell a platform
    5. You can’t sell a platform ...without a killer app.
    6. A programming language is a platform
    7. is the killer app Ruby for
    8. Came for Rails, stayed for Ruby
    9. An explosion of Ruby projects in the past 2 years
    10. Let’s take a tour!
    11. Rails is: ORM - ActiveRecord Web Layer - ActionPack Templating - ERB Test Framework - Test::Unit
    12. ORM ActiveRecord
    13. class CreatePosts < ActiveRecord::Migration create_table :posts do |t| t.string :title t.text :body t.datetime :created_at t.integer :post_id end end $ rake db:migrate class Post < ActiveRecord::Base has_many :comments end Post.find(:first, :conditions => [ \"title = ?\", \"First post\" ])
    14. ORM ActiveRecord DataMapper Sequel
    15. Define schema in the code instead of the database http://datamapper.org
    16. class Post include DataMapper::Resource property :id, Serial property :title, String property :body, Text property :created_at, DateTime has n, :comments end DataMapper.auto_upgrade! Post.first(:title => \"First Post\")
    17. Access a database with just hashes - or map models http://sequel.rubyforge.org
    18. db = Sequel.connect('mysql://root@localhost/db') db.create_table :posts do primary_key :id varchar :title text :body datetime :created_at end db[:posts].filter(:title => \"First Post\").first
    19. Web Layer ActionPack
    20. ActionController::Routing::Routes.draw do |map| map.resource :posts end class PostsController < ApplicationController def create @post = Post.create! params redirect_to(@post) end def show @post = Post.find(params[:id]) end end
    21. Web Layer ActionPack Merb Sinatra
    22. The hacker’s framework “No code is faster than no code” http://merbivore.org
    23. Merb::Router.prepare do |router| resource :posts end class Posts < Merb::Controller def create @post = Post.create params redirect(url(:post, @post)) end def show @post = Post.find(params[:id]) display @post end end
    24. use_orm :datamapper use_test :rspec use_template_engine :erb
    25. Merb 2.0 == Rails 3.0
    26. Sinatra The classy microframework for Ruby “Exposed simplicity instead of hidden complexity” http://sinatra.rubyforge.org
    27. require 'rubygems' require 'sinatra' require 'lib/posts' post '/posts' post = Post.create! params redirect \"/posts/#{post.id}\" end get '/posts/:id' do @post = Post.find(params[:id]) erb :post end
    28. Test Framework
    29. Unit tests
    30. TDD Test-Driven Development
    31. BDD Behavior-Driven Development http://behaviour-driven.org
    32. TATFT Test All The Darn Time
    33. Test Framework Test::Unit
    34. class PostTest < Test::Unit::TestCase def test_simple_slug post = Post.new :title => \"First Post\" assert_equal \"first_post\", post.slug end def test_complex_slug post = Post.new :title => \"My Post!\") assert_equal \"my_post\", post.slug end end
    35. RSpec Behavior-Driven Development http://rspec.info
    36. describe Post do it \"generates a url slug from the title\" do post = Post.new :title => \"First Post\" post.slug.should == \"first_post\" end it \"drops punctuation from the url slug\" do post = Post.new :title => \"My Post!\" post.slug.should == \"my_post\" end end
    37. $ rake spec:doc Post - generates a url slug from the title - drops punctuation from the url slug
    38. Templating Engine ERB
    39. <div class=\"post\"> <h1><%= @post.title %></h1> <div class=\"body\"> <%= @post.body %> </div> </div>
    40. Templating Engine ERB Haml
    41. Haml Markup haiku http://haml.hamptoncatlin.com
    42. .post %h1= @post.title .body= @post.body
    43. Ties it all together http://rack.rubyforge.org
    44. The End. http://adam.blog.heroku.com Adam Wiggins Codemash 2009

    + Adam WigginsAdam Wiggins, 10 months ago

    custom

    3728 views, 18 favs, 7 embeds more stats

    A whirlwind tour of the Rails-inspired Ruby ecosyst more

    More info about this document

    © All Rights Reserved

    Go to text version

    • Total Views 3728
      • 3467 on SlideShare
      • 261 from embeds
    • Comments 0
    • Favorites 18
    • Downloads 127
    Most viewed embeds
    • 245 views on http://adam.blog.heroku.com
    • 7 views on http://ranchero.com
    • 4 views on http://static.slideshare.net
    • 2 views on http://lj-toys.com
    • 1 views on http://localhost:3000

    more

    All embeds
    • 245 views on http://adam.blog.heroku.com
    • 7 views on http://ranchero.com
    • 4 views on http://static.slideshare.net
    • 2 views on http://lj-toys.com
    • 1 views on http://localhost:3000
    • 1 views on http://uptolife.blogspot.com
    • 1 views on http://adamblog.heroku.com

    less

    Flagged as inappropriate Flag as inappropriate
    Flag as inappropriate

    Select your reason for flagging this presentation as inappropriate. If needed, use the feedback form to let us know more details.

    Cancel
    File a copyright complaint
    Having problems? Go to our helpdesk?

    Categories