Skip to content

mrkushjain/herokuapp

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

App Link - rails-heroku-app-by-kush.herokuapp.com

Setting Up Heroku Rails app

  1. Install ruby-1.9.3-p392 using rvm
$ rvm install 1.9.3-p392 
$ rvm use 1.9.3-p392 --default
  1. Install postgreSQL 9.2.4
$ brew install postgresql (on Mac)
  1. Install bundler

    $ gem install bundler
    
  2. Create an account on heroku Signup on Heroku

  3. Install Heroku toolbelt Heroku Toolbelt

  4. Login to Heroku

    $ heroku login
    

    Enter your heroku email and password

  5. Create a new rails app

    $ rails new myapp --database=postgresql
    $ cd myapp
    
  6. Install bundler

    $ gem install bundler
    
  7. Start the postgres server

    $ pg_ctl -D /usr/local/var/postgres -l /usr/local/var/postgres/server.log start
    
  8. Execute the SQL script from the following location: db.sql

    $ psql -f db.sql
    
  9. Open config/database.yml and modify

    password
    

    with

    password: password1
    

    everywhere in the file. Then add the line

    host: localhost
    

    at the end of each group

  10. Create database

    $ rake db:migrate
    $ rake db:setup
    
  11. Add the gem rails_12factor in gemfile by adding the following line in it

    gem 'rails_12factor', group: :production
    
  12. Specify ruby version in gemfile by adding the following line in it

    ruby "1.9.3"
    
  13. Run bundle install

    $ bundle install
    
  14. In config/application.rb set the following configuration

    config.assets.initialize_on_precompile = false
    
  15. Store your app in git

    $ git init
    $ git add .
    $ git commit -m "init"
    
  16. Create heroku app

    $ heroku create
    
  17. Add your ssh keys to heroku

    $ heroku keys:add ~/.ssh/id_rsa.pub
    
  18. Deploy your code to heroku

    $ git push heroku master
    
  19. Ensure we have one dyno running the web process type

    $ heroku ps:scale web=1
    
  20. To see your app on heroku

    $ heroku open
    
  21. To see your app locally

    $ bundle exec rails s
    
  22. Open Github and login with your username and password

  23. Create a new repository with the name herokuapp

  24. To add your app to github

    $ git remote add github git@github.com:mrkushjain/herokuapp.git
    $ git push github master
    

View your app info

  • Get Heroku Info

    $ heroku info
    
  • Get Remote info

    $ git remote -v
    

Renaming the app

  1. Go to heroku app dashboard on browser and click on settings next to the app

  2. Enter a new name and click on save

  3. On the terminal type

    $ git remote rm heroku
    $ heroku git:remote -a newname
    

    where newname is the app's new name

  4. Your new app is now accessible at new-name-of-app.herokuapp.com

Adding Tests

Adding rspec tests

  1. Add rspec rails in your gemfile

    group :development, :test do
      gem 'rspec-rails'
    end
    
  2. Run bundle install

    $ bundle install
    
  3. Go to your terminal and use the same ruby version as you had you used while compiling postgres

    $ rvm use ruby-1.9.3-p392
    
  4. Initialize the spec/ directory

    $ rails generate rspec:install
    
  5. Run Tests with

    $ bundle exec rake spec
    

Adding Factory Girl

  1. Add gem factory_girl_rails under development and test groups

    group :development, :test do
      gem 'rspec-rails'
      gem 'factory_girl_rails'
    end
    
  2. Run bundle install

    $ bundle install
    

Adding Should matchers

  1. Add gem shoulda matchers in your gem under test

    group :test do
      gem "shoulda-matchers"
    end
    
    
  2. Run bundle install

    $ bundle install
    

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published