I wrote a post series about my experience at the past Ruby Fun Day at Buenos Aires, in Spanish:
Mi Día en el Ruby Fun Day with @bendycode
Now, I want to write my learning steps following the chapter 2 of Michael Hartl book Ruby on Rails 3 Tutorial: Learn from Example.
I installed Ruby on my Windows box, using http://rubyinstaller.org/ (more options at http://www.ruby-lang.org/en/downloads/). In Windows, you should install DevKit (a minimalist GNU for windows (mingw)). See Ruby Installer page for link download. The instructions to install it are at http://github.com/oneclick/rubyinstaller/wiki/Development-Kit. (some details in Spanish).
Then, I executed the command (at any command prompt)
gem install rails
that installs Ruby on Rails, a web framework for Ruby. Go to a working directory (in my case c:\Git), and execute
rails
Output:
Then I executed
rails new RailsDemoApp
with output:
Change to the new directory:
cd RailsDemoApp
Now, you have a folder tree like:
Ruby manages gems (package to install and use). Rails itself is a gem. And Rails application have a GemFile that list the gems our new application will use. Just in case we have a new gem to install, execute:
bundle install
Bundle is the new package installer used in Ruby on Rails 3. It reads the GemFile and installs (in Ruby gem directory, in our machine, it’s not per application) the needed gems. Then, you can execute:
bundle show
I configured the current directory (Git\RailsDemoApp) to be a Git repo:
git init
git add .
git commit –m “Initial Commit”
I added a new repository in my GitHub Account using https://github.com/repositories/new:
The new repo: https://github.com/ajlopez/RailsDemoApp
I added and pushed to the remote repo:
git remote add origin git@github.com:ajlopez/RailsDemoApp.git
git push origin master
You can launch the initial server with
rails server
or its shortcut
rails s
See the result at http://localhost:3000
Next steps: adding a simple model (users, micropost), database, views, controllers, scaffolding, and Heroku deploy. Scaffolding (quick CRUD code generation) will be the approach to use in this series, but in a following post series I want to show (and learn
the making of a Rails application, step by step, as in Hartl book.
Keep tuned!
Angel “Java” Lopez
http://www.ajlopez.com
http://twitter.com/ajlopez