Learn to build a Rails app using Heroku and Git
Hi All:
I have recently discover Heroku service for building applications. It is extremely useful and extremely easy to use. It is also based in Git a SCM system which is also revolutionazing the version control systems.
To install Git, we could use this guide located on the progit or also you can see this page which explains how to use textmate with git
We set git configuration:
$ git config --global user.name "Your Name" $ git config --global user.email youremail@example.com
There is a great Quickstart for using Heroku which I used as a base for this post: http://docs.heroku.com/quickstart
- Sign in in Heroku
- Install Heroku gem:
$ sudo gem install heroku
- Create the local application in your mac: rails myapp
- Access to the rails app: cd myapp
- Install git
- Execute git: $ git init
- Do git add: $ git add .
- We access to the following command:
-
- Do git first commit:
$ git commit -m "new app"
- We open the application, and we start the local server ruby script/server and access to localserver using http://127.0.0.1:3000
- As usual, we generate a index or home controller. I generally call them dashboard as it is sexy: $ ruby script/generate controller dashboard index
- We delete the entry page: $ rm public/index.html
- We modify the config/routes.rb to enter the following route map:
- We create the heroku application directly on the heroku site from our computer merely using the Heroku’s gem
- Now the web site will be visible on the following address: http://severe-stone-45.heroku.com. Sustitute the name by the name provided by Heroku and you got it. As the heroku repository is blank when we create the application we need to deploy the code to a specific branch, we deploy the code throuh this instruction
- Do git first commit:
$ rake db:create db/development.sqlite3 already exists
map.connect ':controller/:action/:id' map.connect ':controller/:action/:id.:format' # Enter the route to access to enter the dashboard map.root :controller => "dashboard"
rake db:migrate
heroku create Created http://severe-stone-45.heroku.com/ | git@heroku.com:severe-stone-45.git
$ git push heroku master
Categories: Ruby, RubyonRails
Outer Space Messages