These setup instructions are for Linux. Instructions for OSX are similar. If you want to set it up on Windows, you are on your own.
This application uses PostgreSQL as the DBMS.
Ensure your user has the required permissions to connect to and create new databases.
These instructions assume your user can connect to PostgreSQL through a local Unix socket,
so no password is necessary. E.g. the following entry in your pg_hba.conf
configuration file should be enough:
local postgres <your_user_name> peer
Check if your user can connect to PostgreSQL.
$ psql postgres
...
postgres=>
Check if your user has permissions to create databases.
postgres=> \dg
...
<your_user_name> | Create DB | {}
...
Create databases.
$ createdb -E UTF8 -O $USER satchel_development
$ createdb -E UTF8 -O $USER satchel_test
To allow your user to connect to the databases, add the following two lines to your pg_hba.conf
local satchel_development <your_user_name> peer
local satchel_test <your_user_name> peer
Reload your postgresql configuration. Depending on your operating system the instructions might be different, but it should be similar to (as root):
# service postgresql reload
Check if you can connect to the databases.
$ psql satchel_development
...
satchel_development=>
$ psql satchel_development
...
satchel_test=>
Clone this repository:
git clone https://github.com/unoduetre/satchel.git
cd satchel
Install ruby version (assumes you use rbenv, other ruby version managers can be used as well).
$ rbenv install
Initialize the database.
$ ./bin/rails db:setup
As this was not a part of the requirements, I have not configured Docker Compose setup, but please, let me know if you need that as well.
First you might want to generate some data in the database. Open Rails console and run:
$ ./bin/rails c
Loading development environment (Rails 7.1.1)
[1] pry(main)> 10.times { FactoryBot.create(:item) }
Exit Rails console and run:
$ ./bin/dev
Then go to http://localhost:3000
in your browser.
Run:
$ ./bin/rspec
Test coverage is also generated by that command.
It is available in coverage/index.html
.
Check code standards:
$ ./bin/rubocop
Check security issues:
$ ./bin/brakeman
$ bundle audit