jtorreggiani / tree-mapper-app

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

TreeMapperApp

TreeMapperApp rails project to make scaffolding web projects.

Installation

Clone the repository

git clone git@github.com:jtorreggiani/skeleton.git
cd skeleton

System Dependencies

  • node
  • yarn
  • sqlite3
  • chromdriver
  • heroku

Data Model

  • User
  • Post

Setup

Run rails setup script

./bin/setup

Ruby Gems

  • rspec-rails
  • simplecov
  • yard
  • yardstick
  • rubocop
  • brakeman
  • rails_best_practices
  • rubycritic
  • bullet
  • webpacker
  • capybara
  • pry-rails
  • cucumber-rails
  • selenium-webdriver
  • devise

Development Environment

Run the development server

bundle exec rails server
open http://localhost:3000

Debugging

Add pry binding to debug code

def index
  binding.pry
  @variable = SomeModel.find(params[:id])
end

Automated Testing

Run the tests

bundle exec rspec

Include spec documentation

bundle exec rspec --format=documentation

View test coverage

open coverage/index.html

Acceptance Testing

Run acceptance tests

bundle exec cucumber

Static Code Analysis

Run rubocop

bundle exec rubocop

Run rubycritic

bundle exec rubycritic --no-browser

Documentation

Build documentation

bundle exec yard

Run documentation server

bundle exec yard server
open http://localhost:8808

Measure documentation coverage

bundle exec yardstick .

Security

Run brakeman to check for security issues

bundle exec brakeman

Best Practices

Run best practices tool

bundle exec rails_best_practices .

Continuous Integration (CI)

Continuous Integration is the practice of merging code into the master version control branch at any time during they day. For default CI strategy for this application is CircleCI. The CI progress is configured in .circleci/config.yml.

Deployment

The default deployment strategy for the application is Heroku. Future tutorials will demonstrate deployment to different IaaS providers like AWS and Google Cloud. To get started make sure you have the Heroku CLI installed. Instructions for getting the CLI can be found here.

Initial setup

Login to Heroku

heroku login
heroku: Enter your login credentials
Email: example@example.com
Password: *****************
Logged in as example@example.com

Staging Environment

Create staging environment

heroku apps:create application-name-staging --remote staging

Set staging environment variables

heroku config:set SKELETON_DATABASE_NAME=application_name_staging --remote staging
heroku config:set SKELETON_DATABASE_USERNAME=application_name_user --remote staging
heroku config:set SKELETON_DATABASE_PASSWORD=SECURE_PASSWORD --remote staging

Push code to staging environment

git push staging master

Migration staging database

heroku run rake db:migrate --remote staging

Ensure you have a dyno running

heroku ps:scale web=1 --remote production

Open app

heroku open --remote staging

Production Environment

Create production environment

heroku apps:create application-name-staging --remote production

Set staging environment variables

heroku config:set SKELETON_DATABASE_NAME=application_name_production --remote production
heroku config:set SKELETON_DATABASE_USERNAME=application_name_user --remote production
heroku config:set SKELETON_DATABASE_PASSWORD=SECURE_PASSWORD --remote production

Push code to production environment

git push production master

Migrate production database

heroku run rake db:migrate --remote production

Ensure you have a dyno running

heroku ps:scale web=1 --remote production

Open app

heroku open --remote production

About


Languages

Language:Ruby 85.2%Language:HTML 8.5%Language:JavaScript 3.3%Language:CSS 3.0%