Programming for the Web with Ruby
Please note: We never share your personal information. Please see our Privacy Policy for more information.
Sponsors
Support us by making a donation of whatever amount you find suitable, so that people from across the globe can learn Ruby programming for free. There are costs involved in developing course-ware, writing eBooks, hosting and maintaining the site and over time it gets expensive. Click on the Donate link below.
We have so far collected US$ 225 only.
Foreword
Web-based applications offer numerous advantages, such as instant access, automatic upgrades, and opportunities for collaboration on a massive scale. However, creating Web applications requires different approaches than traditional applications and involves the integration of numerous technologies. RubyLearning.org has scheduled a free, online course on topics that hopefully will help those that have some knowledge of Ruby programming to get started with web programming - call it "Programming for the Web with Ruby" (this does not cover Ruby on Rails). The course material is almost ready and I am looking for help from you to add / subtract / modify the topics and material for this course. We also require many problems/solutions for the course participants. Can you help?
The course is scheduled for 20th Feb. 2012 and we would have 3-4 mentors helping out the participants during the course.
Contributing to this project
- The best ways to start contributing to this project is by opening an issue and mentioning whatever bugs / typos you have discovered.
- You can just fork the repository and add things relevant to web programming in Ruby. Michael or Satish can commit your pull requests.
Course Contents
- Day 1 - Git, GitHub, RVM, Pik, Gem, Heroku, Bundle (the basics)
- Using Git
- What's Version Control
- What's Git?
- Downloading and Installing Git
- Create a local folder
- Let us start using Git
- Introduce yourself to Git
- Create your SSH Key
- Using GitHub
- What's GitHub?
- Set up your GitHub account
- Creating a new repository
- Add your SSH key to GitHub
- What's GitHub?
- Using RVM (for *nix)
- What is RVM?
- Prerequisites
- Installing RVM
- Loading RVM into your shell
- Reload shell configuration and test
- Install a Ruby interpreter
- Using pik (for Windows)
- What's pik?
- Installing pik
- Using pik
- What's a Ruby Gem?
- What's Heroku?
- Create an account on Heroku
- Install Bundle
- Exercise: URL of your GitHub repo
- Fun Exercise: Watching Repos
- DAY 2
- Creating a simple webpage using HTML5, CSS and JavaScript
- A Webpage, Step by Step
- Before we begin, Launch a Text Editor
- Step 1: Start with content
- Step 2: Give the document structure
- Step 3: Identify text elements
- Step 4: Add an image
- Step 5: Change the look with a style sheet
- Add some JavaScript
- Store your webpage files on GitHub
- Exercise: URL of GitHub repo for your webpage
- DAY 3
- Understanding HTTP concepts
- What's HTTP?
- Loading a web page
- HTTP request methods (verbs)
- GET
- POST
- PUT
- DELETE
- Using cURL
- HTTP response codes
- cURL Exercise
- net/http library
- Using URI
- Using open-uri
- Using Hpricot
- Using Nokogiri
- Fetching documents from web
- Searching inside HTML documents
- What's HTTP?
- Exercise: Using net/http library and URI, open-uri, Hpricot, Nokogiri
- DAY 4
- Creating one's own Ruby Gem
- Let us create a simple Ruby library
- Steps for publishing our gem
- Exercise - Create your gem
- Deleting your gem at Rubygems.org
- DAY 5 and 6
- Learning Rack
- Revisiting Ruby's proc object
- my_proc1.rb
- Rack Documentation
- Rack Source Code
- Why Rack is important
- Rack Specification
- A Rack App without using the Rack gem
- A simple Rack app - my_rack_proc
- my_rack_proc.rb
- A Simple Rack Exercise
- A Rack App without using the Rack gem
- Installing Rack gem
- my_rack_proc2.rb
- Another Rack app - my_method
- my_rack2.rb
- A Simple Rack Exercise with rack gem
- Using rackup
- my_app.rb
- Exercise: A Simple Rack app with rackup
- Using Rack::Request and Rack::Response
- A very basic practical Rack app
- Another practical Rack app
- Exercise: An app using Rack::Request and Rack::Response
- Rack middleware
- An Exercise on Rack middleware
- Using Lobster
- Rack::Builder
- More on Rack
- Revisiting Ruby's proc object
- DAY 7
- Deploying Pure Rack Apps to Heroku
- Deploy your app to Heroku
- Exercise on deployment
- DAY 8
- Deploying a static webpage to Heroku
- Exercise: Deploy your static site to Heroku
- DAY 9
- What's JSON?
- Using MongoDB with Ruby Mongo driver
- What's NoSQL?
- What's MongoDB?
- Setup MongoDB
- MongoDB Core Concepts
- The Basics
- Switch databases
- Insert a document
- Use find()
- Removing all documents
- Query Selectors
- Updating a document
- MongoDB Ruby Driver - mongo
- Installation
- Using the mongo gem
- Making a Connection
- Getting a List Of Collections
- Getting a Collection
- Inserting a Document
- Updating a Document
- MongoHQ the hosted database
- Sign Up
- Create a database
- Accessing the database
- Exercise: Create a database on MongoHQ
- DAY 10
- Sinatra with MongoDB
- What's Sinatra?
- Create a folder on your hard disk
- Install Sinatra
- Which web server?
- Our trivial Sinatra application
- ERB and View
- ERB
- View
- Handlers and Form parameters
- Exercise: A simple text reversing service
- Deploy a Sinatra app to Heroku
- Exercise: Deploy the simple text reversing service app to Heroku
- Sinatra and Rack Middleware
- Sinatra and Rack HTTP Basic Authentication
- References
Acknowledgments
- Al Snow for his various suggestions.
- Arvinder Singh Kang for beautifying the css and for the note on "Using RVM"
- Konstantin Haase for providing us with another practical Rack app.
- Matt Aimonetti for the GET/POST example related to Rack.
- Michael Kohl for proof reading and making relevant corrections to chapters 1 and 2.
- Oto Brglez for the note on "Using Nokogiri"
- Samnang Chhun for suggesting changes in chapter 1.
- Victor Goff for his various suggestions.
- Willian Molinari for creating the GitHub page for this project.
- Zhang Hailong for making relevant corrections in chapter 2.
About RubyLearning.org
RubyLearning.org, since 2005, has been helping Ruby Newbies go from zero to awesome!
Copyright and license
Intermediate Ruby Tutorial: Preparing Ruby newbies for web programming. Copyright @ 2012 by Satish Talim. All source code in Programming for the Web with Ruby Tutorial is available under the MIT License and the Beerware License.
Copyright (c) 2012 RubyLearning.org Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. /* * ------------------------------------------------------------ * "THE BEERWARE LICENSE" (Revision 42): * Satish Talim wrote this file. As long as you retain this * notice, you can do whatever you want with this stuff. If we * meet someday, and you think this stuff is worth it, you can * buy me a beer in return. * ------------------------------------------------------------ */