If you've already set up ruby on your own machine, you may skip this step. Otherwise, please see the advanced setup instructions document.
You can download a .zip version of this repository by clicking the "Clone or Download" button in the top right on GitHub. Open the directory in your favorite text editor (we recommend Atom) and run your commands at the command line.
Each exercise has its own spec file in the spec
directory. Open the
spec file to read the directions. Each exercise will have you modify a corresponding file in the lib
directory.
To run the specs, you'll need to install RSpec. First, run gem install bundler
in the root directory of your project. Then, run bundle install
. To run a single spec file, run a command like this: bundle exec rspec spec/00_hello_spec.rb
. To run all of the specs at once, run bundle exec rspec
.
What's happening here?
In the root directory of the project, you'll see a file called "Gemfile". This is a manifest of all of the Ruby gems needed to make your project work. bundle install
is a command you'll use often to install all of the gems you need to run a program. gem install bundler
installs the bundler gem, which is what makes bundle install
work. bundle exec rspec
simply tells your machine to run the version of RSpec specified in the Gemfile.
Here is a broad survey of many resources you may find useful. Don't try to read them all! Just browse around when you feel like learning more about Ruby.
- Ruby Koans by Jim Weirich and Joe O'Brien (inspired by Metakoans by ara.t.howard and Ruby Learning Tests by Mike Clark)
- Test-First Teaching by Sarah Allen and Alex
Chaffee
- Learning TDD Through Test First Teaching talk by Sarah Allen at East Bay Ruby Meetup
- Growing OO Software In Ruby by Brian Marick - a Ruby version of Growing Object-Oriented Software Guided by Tests
- ruby-warrior by Ryan Bates - a game written in Ruby for learning Ruby
- Ruby Kickstart by Josh Cheek - another set of test-driven exercises
- Try Ruby runs a Ruby interpreter in your browser, with hints and advice
- Learn To Program by Chris Pine - great Ruby tutorial, available online (1st ed.) or in a PragProg book (2nd ed.)
- Ruby Learning - Ruby tutorial
- Rails for Zombies - learn Ruby and Rails in your browser, no setup required
- Learn Ruby The Hard Way - a Ruby translation of Zed Shaw's "Learn Python The Hard Way"
- Read Ruby a book about Ruby, quite technical but well written. Free online.
- Ruby Mission
- RailsBridge
- CS Unplugged - "CS Unplugged provides an extensive collection of free resources that teach principles of Computer Science such as binary numbers, algorithms and data compression through engaging games and puzzles that use cards, string, crayons and lots of running around."
- Everyday Scripting with Ruby by Brian Marick
- Programming Ruby (the Pick Axe) by Dave Thomas
- Nice User's Guide: http://www.rubyist.net/~slagell/ruby/
- Michael Hartl's Rails Tutorial
- http://ruby4kids.com
- Ruby in 100 Minutes by Jeff Casimir
- Ruby Mendicant University
- Trainer on Rails "Ruby For Rails" tutorial
- "My 10 Favorite Things About Ruby" by Yehuda Katz
- "How To Count" by Steven Frank, vol. 1 in "Programming for Mere Mortals", a series of books designed to introduce the concepts of programming from the ground up to a reader who has never written a line of code.
- http://www.ruby-lang.org
- http://www.ruby-doc.org/
- http://www.gotapi.com/rubyrails
- http://apidock.com/
irb
- when in doubt, try it out!- http://www.rubular.com/ - an online Ruby regular expression calculator
- Concept by Alex Chaffee
- Exercises by Alex Chaffee, Sarah Allen, Liah Hansen, Kai Middleton
- Early quality assurance by Sumiki, Dimitri, Liah, Michael, and Brendan