Your SlideShare is downloading. ×
wwc start-launched
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×
Saving this for later? Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime – even offline.
Text the download link to your phone
Standard text messaging rates apply

wwc start-launched

697
views

Published on

Published in: Technology

0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
697
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
8
Comments
0
Likes
0
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide
  • \n
  • \n
  • \n
  • \n
  • \n
  • What are you interested/concerned about?\n- jobs\n- community involvement\n- notoriety\n- easy\n- fun\n
  • - Cake PHP, Symphony?\n- Spring Roo, MVC?\n- Django?\n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • Or no database. Use sqlite to get even your designers up and running quickly.\n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • Transcript

    • 1. slideshare.net/matschaffer/wwc-start-launched bit.ly/wwc-codeFrom Start to Launched with Ruby on Rails Wharton Web Conference
    • 2. Mat Schaffer mat@mashion.net @matschaffer matschaffer.com
    • 3. • Chapter 1: Overview and Installation• Chapter 2: Data and Views• Chapter 3: User Stories and Testing• Chapter 4: Deploy It!
    • 4. Chapter 1: Overview• Why Rails?• Rails overview• Dealing with Data• Live Console and Testing
    • 5. Why Rails?
    • 6. Rails Overview
    • 7. • Developed for BaseCamp by 37 signals• DSL for web applications
    • 8. Controller
    • 9. Controller
    • 10. ControllerModel
    • 11. ControllerModel
    • 12. ControllerModel View
    • 13. ControllerModel View
    • 14. Convention over Configuration
    • 15. GET /commentsCommentsController#index views/comments/index.html.erb
    • 16. GET /comments/4CommentsController#showviews/comments/show.html.erb
    • 17. GET /comments/4.jsCommentsController#showviews/comments/show.js.erb
    • 18. Data
    • 19. More Convention over Configuration
    • 20. Super simple•C reate•R etreive•U pdate•D elete
    • 21. Comment.create(:author => "mat")INSERT INTO comments(author) VALUES(mat);
    • 22. Comment.find_by_author("mat")SELECT * FROM commentsWHERE author = mat;
    • 23. c = Comment.find(1)c.update_attribute(:author, "mat")SELECT * FROM comments WHERE id = 1;UPDATE comments SET author = mat WHEREid = 1;
    • 24. c = Comment.find(1)c.destroySELECT * FROM comments WHERE id = 1;DELETE FROM comments WHERE id = 1;
    • 25. more data hotness• Schema management• Works the same across databases
    • 26. rails console• Try out code live• Inspect your data using code
    • 27. testing• Built into rails• Strong testing culture built into ruby
    • 28. servicesgithub.comheroku.comengineyard.comRailsHotline.com
    • 29. Installation
    • 30. • Mac needs XCode first http://developer.apple.com/xcode/• Linux or Mac, use RVM bootstrap http://bit.ly/unixrails• Windows http://railsinstaller.org• Ubuntu on VirtualBox is fun too
    • 31. Test your installrails new kickballappcd kickballapprails server(open a browser to http://localhost:3000)
    • 32. Our project:A League Manager
    • 33. Chapter 2: Data Views
    • 34. Data
    • 35. class Team• name• (id, created_at, updated_at)
    • 36. class Location• name• address• (id, created_at, updated_at)
    • 37. class Game• starts_at• ends_at• location• home_team• away_team• (id, created_at, updated_at)
    • 38. class Game• starts_at• ends_at class Location• location• home_team• away_team• (id, created_at, updated_at)
    • 39. class Game• starts_at• ends_at class Location• location• home_team class Team• away_team• (id, created_at, updated_at)
    • 40. CODE!(generating teams)
    • 41. Database Migrations• live in db/migrate• ordered• Abstracted SQL column types• includes id and timestamps by default
    • 42. MORE CODE!(location, game, migrating)
    • 43. RESTful Routes• GET /locations (show all locations)• GET /locations/3 (show one location)• POST /locations (make a location)• PUT /locations/3 (update one location)
    • 44. Can also be nested• GET /locations/3/games (show games for one location)
    • 45. ‘public’ folder• For all static files• Rails looks here first• Offers caching options
    • 46. Views
    • 47. ERB• Like JSP/ASP/PHP but in ruby• lots of helper functions for forms, etc.• layout → view → partials
    • 48. VIEW CODE!(fixing the teams)
    • 49. ActiveRecord Associations• 1 to 1 (belongs_to - has_one)• 1 to many (belongs_to - has_many)• many to many (has_many :through)
    • 50. Controllers
    • 51. Chapter 3:User Stories Testing
    • 52. User Stories
    • 53. In order to [value]As a [actor]I want [feature]
    • 54. Team roster / player list feature?
    • 55. In order to know who is on a teamAs a league managerI want to see a list of players onthe team page
    • 56. Feature: Player listings In order to know who is on a team As a league manager I want to see a list of players on the team page Scenario: listing on a team page Given I am on the teams page When I follow "Ballshevicks" Then I should see "Trotter"
    • 57. CucumberFeature: Player listings In order to know who is on a team As a league manager I want to see a list of players on the team page Scenario: listing on a team page Given I am on the teams page When I follow "Ballshevicks" Then I should see "Trotter"
    • 58. User Storiesas Integration Tests
    • 59. Setting up Cucumber1. Add `group :development, :test` to Gemfile2. Add ‘cucumber-rails’, ‘capybara’ and ‘database_cleaner’ in that group3. Run `bundle`4. Run `rails generate cucumber:install`5. `$EDITOR features/players.feature`
    • 60. CODE(setting it up)
    • 61. Running a scenario1. Put `@wip` above the scenario2. Run `rake cucumber:wip`
    • 62. CODE(running it)
    • 63. Debugging`Then show me the page`requires ‘launchy’ gem`Then debug` (debugger;1)requires ‘ruby-debug’ or ‘ruby-debug19’
    • 64. CODE(debugging it)
    • 65. Building data
    • 66. `$EDITOR features/support/fixtures.rb`Before do  Team.create(:name => "Ballshevicks")end
    • 67. • Any features/support/*.rb gets loaded• `Before` gets run before each Scenario
    • 68. Other Data Options• Load test/fixtures/*.yml• Use the ‘fabrication’ object factory gem
    • 69. CODE(giving it data)
    • 70. Defining Steps When I follow "Show" in the row with "Ballshevicks"When /^I follow "([^"]*)" in the row with "([^"]*)"$/ do |link, text|  When %Q|I follow "#{link}" within "tr:contains(#{text})"|end features/step_definitions/table_steps.rb
    • 71. Defining Steps When I follow "Show" in the row with "Ballshevicks" Regular ExpressionWhen /^I follow "([^"]*)" in the row with "([^"]*)"$/ do |link, text|  When %Q|I follow "#{link}" within "tr:contains(#{text})"|end features/step_definitions/table_steps.rb
    • 72. Defining Steps When I follow "Show" in the row with "Ballshevicks" Regular Expression Capturing groupsWhen /^I follow "([^"]*)" in the row with "([^"]*)"$/ do |link, text|  When %Q|I follow "#{link}" within "tr:contains(#{text})"|end features/step_definitions/table_steps.rb
    • 73. Defining Steps When I follow "Show" in the row with "Ballshevicks" Regular Expression Capturing groupsWhen /^I follow "([^"]*)" in the row with "([^"]*)"$/ do |link, text|  When %Q|I follow "#{link}" within "tr:contains(#{text})"|end features/step_definitions/table_steps.rb Definition in ruby code
    • 74. web_steps.rbGiven I am on the (rake routes) pageWhen I press “button” / follow “link”When I fill in “field” with “value”When I select “option” from “field”When I check “field”Then I should see “text” (within “section”)
    • 75. CODE(assigning teams?)
    • 76. Unit testing
    • 77. Use for direct testing of• Models (test/unit/*.rb)• Helpers (test/unit/helpers/*.rb)• Controllers (test/functional/*.rb)
    • 78. Example: Player#last_nameclass PlayerTest < ActiveSupport::TestCase  test "parses out last name" do    trotter = Player.new(:name => "Trotter Cashion")    assert_equal "Cashion", trotter.last_name  endend (Test First! At least try.)
    • 79. CODE(run and fix it)
    • 80. Chapter 4:Deploy It!
    • 81. (PaaS)Heroku
    • 82. (PaaS)Engine Yard
    • 83. (DIY)Phusion Passenger
    • 84. (DIY)LB + Mongrel/Thin
    • 85. (DIY)Tomcat + JRuby
    • 86. Herokuhttps://api.heroku.com/signup
    • 87. http://devcenter.heroku.com/articles/quickstart$ heroku createEnter your Heroku credentials.Email: joe@example.comPassword:Uploading ssh public key /Users/joe/.ssh/id_rsa.pubCreated http://high-sunrise-58.heroku.com/ |git@heroku.com:high-sunrise-58.gitGit remote heroku added$ git push heroku master...$ heroku rake db:migrate
    • 88. Heroku demo
    • 89. Thanks! Some resources• http://ruby5.envylabs.com/• http://railscasts.com/• http://guides.rubyonrails.org/• http://pragprog.com/book/rails4• http://www.manning.com/black2/