Episode #21 | Rapid Prototyping with Zambezi Template

Wednesday, 23 Jan 2019 Kudzai Nyandoro 12:33 Minutes


This is a basic Rails starter template with Bootstrap, RSpec and Devise configurations set up. To get started, go to your terminal and do the following. Note, this assumes that you're on a Unix-like operating system such Mac OS X, Ubuntu, etc.


Set Up

Clone the Zambezi Template to your local machine

$ git clone git@github.com:kode47/zambeziTemplate.git

Run the following command to create your new Rails project. Here the name is 'blog' but you can give any name you like.

 $ rails new blog -m zambeziTemplate/template.rb # where ```blog``` is the name of your application

A new Rails application will be created with a home page, user authentication and a root route pointing to the home page.

Enter into your new project directory

$ cd blog

Fire up your Rails server

$ rails s 

Go to your browser and type in localhost:3000

Alternatively you can use a differnt port other than 3000 buy running rails s -p 4000 or another port number of your choosing in your terminal. After that you'd have to visit locahost:4000 in your browser to view your new application and signup as s new user.

Optional: Prepare for Heroku Deployment Make sure you have Heroku installed.

$ heroku create

You can also name your Heroku app when you create it

$ heroku create MyAppName

Get the name of your app by running the line below in your terminal

$ heroku info

An example of what's returned is shown below. You will need the web URL portion for your production.rb setting shown below if you're going to be setting up Sendgrid to send email confirmation, password resets etc.

[master]$ heroku info
=== MyAppName
Addons:         heroku-postgresql:hobby-dev
Auto Cert Mgmt: false
Dynos:          web: 1
Git URL:        https://git.heroku.com/MyAppName.git
Owner:          kudzai@example.com
Region:         us
Repo Size:      88 KB
Slug Size:      50 MB
Stack:          heroku-16
Web URL:        https://MyAppName.herokuapp.com/

If want to change the name of your application just run the following line

$ heroku rename MyNewAppName

Configure Sendgrid if you're using Sendgrid

Open your config/environtments/production.rb file and update the app name near or at line #18.

  # Sendgrid
  config.action_mailer.raise_delivery_errors = true
  config.action_mailer.delivery_method = :smtp
  host = 'MyAppName.herokuapp.com'

Add the Sendgrid starter pack to your app

$ heroku addons:add sendgrid:starter

View all you current Heroku addons

$ heroku addons

Get sendgrid username

$ heroku config:get SENDGRID_USERNAME

Get sendgrid password

$ heroku config:get SENDGRID_PASSWORD

Push your application to heroku

$ git push heroku master

Create your databases on Heroku
$ heroku run rails db:migrate

Seed your databases on Heroku
$ heroku run rails db:seed

Open your heroku app from the terminal

$ heroku open