/wit-cart

Test for witliving

Primary LanguageHTML

Documenation

Build Status Maintainability Test Coverage

Wit pratical test


Requirements

First step

You can choose use the traditional installation or use the project with Docker.

Traditional Installation

Install RVM: see RVM installation guide.

Install Ruby

$ rvm install ruby-2.4.2

Install nodejs

curl -sL https://deb.nodesource.com/setup_8.x | sudo -E bash -
sudo apt-get install -y nodejs

Install bundler

$ gem install bundler --no-ri --no-rdoc

Perform bundle install

$ bundle install

Install PostgreSQL

Ubuntu 16.10

$ sudo add-apt-repository "deb http://apt.postgresql.org/pub/repos/apt/ xenial-pgdg main"
$ wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -
$ sudo apt-get update
$ sudo apt-get install postgresql-9.6

Or see PostgreSQL installation WIKI.

Setup your .env(s)

$ cp -pRfv .env.production.sample .env.production
$ cp -pRfv .env.development.sample .env.development
$ cp -pRfv .env.test.sample .env.test

Update your .env.prouction, .env.development or .env.test if necessary.

configure bundle for postgresql

$ bundle config build.pg --with-pg-config=/path/to/pg_config

Configure the database development

$ bundle exec rake db:create
$ bundle exec rake db:migrate

Run application

$ bundle exec rails s -b 0.0.0.0

Testing

Configure the database tests

$ RAILS_ENV=test bundle exec rake db:create && bundle exec rake db:migrate && bundle exec rake db:test:prepare

Rspec

$ bundle exec rspec

Docker (optional installation)

Install Docker here

Build images:

$ make rebuild

Create databases:

make docker-createdb

Start the application:

$ make up

If you need use another instance of application in Docker (for run the rails console for example):

make bash

To finish all Docker instances:

$ make down

Access: http://localhost:3000

pgAdmin4: http://localhost:5050