Web development with Ruby on Rails Unit 1: Introduction and Installation Is This Thing On?
Can you see the presentation? Are you comfortable? Does everyone have a favorite editor? Does everyone have a favorite programming language? Course Objectives
Become familiar with web development Learn the features and idioms of Ruby Learn to develop web applications in Rails Learn how to engage with the Ruby community Course plan
Setup Git, Heroku
HTTP, HTML, CSS Ruby
Rails Format
Class: Wednesday 1:30pm - 2:30pm Office hours: Wednesday mornings and 30 min after class Weekly(ish) homeworks Live coding Questions encouraged Homework
10 small assignments (after each class) 1 midterm review quiz 1 final project (start today) Final project
A Rails app of your choosing Groups okay* Graded on: Completeness Use of testing Seperation of concerns Proper use routes and view helpers Deployment Homework submission
Commit to Github & Heroku Submit textfile with links to both via Lore* Due by 12pm the following Monday Grading
10pts x 10 assignments = 100 pts 50pts midterm review 10pts x 5 final project criteria Total / 200 pts (some bonuses available) Slide conventions
~/this/is/a/file/path class This def is_some :code end end About Me
Mat Schaffer Mashion.net, Philly.rb, Comcast @matschaffer http://about.me/matschaffer About Jennifer
Jennifer Cahalane [email protected] About David
David Xu [email protected] Here we go! Why Rails? What is Rails?
Developed for BaseCamp by 37 signals DSL for web applications
Setup: Windows
RailsInstaller Make sure the "Add to PATH box" is ticked before installing. Restart after the install finishes. Setup: Mac
RailsInstaller Setup: Mac
Or Homebrew http://mxcl.github.com/homebrew/
~/.profile export PATH="/usr/local/bin: /usr/local/Cellar/ruby/1.9.3-p194/bin: $PATH" Setup: Linux
Package manager should have "ruby" and/or "rubygems" Ubuntu is pretty well supported Install Check ruby --version # 1.9 or higher gem --version # 1.8 or higher Rails gem install rails Aside: Editors
Sublime Text 2 TextMate jEdit MacVim Komodo Edit Aptana Your first rails app rails new plusdollar cd plusdollar rails server Deployment to Heroku (heroku.com) via Git (git-scm.org) What's heroku?
THE CLOUD Easy hosting of Rails apps Deploy via git Lots of Add-ons (extra databases, logging, search, etc) GOTCHAS: Can't use the HD, Runs postgres What's git?
Keeps your code safe Makes sharing code easier Helps you look at code history Git Basics
Security: SSH Keys
Used by SSH and Git Two parts Private key (id_rsa), keep this on your computer Public key (id_rsa.pub), upload this to the server Make a key
> ssh-keygen Generating public/private rsa key pair Enter file in which to save the key (/Users/mat/.ssh/id_rsa): Enter passphrase (empty for no passphrase): Enter same passphrase again:
Commit to git git init git add . git commit -m "Initial commit" git remote add origin \ git@github.com:matschaffer/plusdollar git push -u origin master Sign up for heroku Use postgresql in production
Gemfile group :development do gem 'sqlite3' end group :production do gem 'pg' end Run 'bundle' and commit the changes bundle --without production git add . git commit -m "Initial commit" Push it to heroku.com gem install heroku heroku create plusdollar git push heroku master Next up:
HTTP HTML CSS Homework
Set up a new rails app Store code on github replace public/index.html with a LOLCat* deploy it to heroku Need Help? irc.freenode.net#philly.rb http://groups.google.com/group/phillyrb