This is a template that I continue to update for getting started on a any cool new web apps I'm looking to build.
- Back-end
- Ruby 2.2.1
- Rails 4.2.0
- Unicorn
- PostgreSQL
- Ubuntu (Depends on hosting provider... but probably Heroku)
- Front-End
- Styling: SCSS
- JavaScript: JQuery and Underscore
- Framework: Bourbon with Bitter and Neat
This is a brief guide to getting this template started.
# Max OS X
$ brew install qt
# Ubuntu
$ sudo aptitude install qt
# Mac OS X
$ brew install postgresql
# Ubuntu
$ sudo aptitude install postgresql
Install from NodeJS.org.
This app was started prior to Rails 4.2 so we have to update the name of the application manually. Hopefully, I'll make this unncessary sometime in the future. You can also install the rename gem if you wish. Start by replacing all instances of the Template
class with the name of your app:
#config/application.rb:9
module [app_name]
#config/environments/production.rb:1
#config/environments/development.rb:1
#config/environments/test.rb:1
[app_name]::Application.configure do
#config/initializers/secret_token.rb:1
[app_name]::Application.config.secret_key_base = "..."
#config/initializers/session_store.rb:3
Rails.application.config.session_store :cookie_store, key: '_[app_name]_session'
#package.json
#This one is a little more manual - just give it a read.
#README.md
$ npm install -g grunt-cli # the local node modules aren't in the $PATH, hence the global installation.
$ npm install
Don't forget to copy the .env.example file to just .env and setup your development environment variables.
$ mv .env.example .env
You should not commit your secret_key_base
to version control. Use .env
and your production environment variables to store that value. Also, this has been set up to allow for easily adding a gmail address to send emails while in development.
Rename the database to something unique to the app.
#config/database.yml
...
default:
...
database: [app_name]_development
test:
...
database: [app_name]_test
In order to confirm that the setup is working, just run rake
. I've overwritten the default task so that it will run all linting and tests including JSHint, Rubocop, and RSpec.
$ rake
These are some of the basic steps needed for most web applications.
In order to generate a devise user model, start by running:
rails generate devise user
rake db:migrate
Optionally, you can then generate the views and controllers to allow for customization. The below will generate shared views for all models, but you can also pass in the specific model you would like to customize.
rails generate devise views
rails generate devise controllers