This README would normally document whatever steps are necessary to get the application up and running. For the reference, we follow from here.
If you need to study rails first, you can follow resources provided by Vincent here.
Things you may want to cover:
- Kollab - Online Platform for Project Collaboration
- Ruby and Rails Version
- Javascript Version
- Environment Configuration
- Database
- Editor Configuration
- Style Guide
- Testing
- Up and Running
- Debugging
To be updated
- System dependencies
- How to run the test suite
- Services (job queues, cache servers, search engines, etc.)
- Deployment instructions
ruby 2.6.5
rails 6.0.2.1
We use rbenv as a Ruby Version Manager. Please follow this tutorial(Thai) for initial setup.
node v12.14.0
npm v6.13.4
yarn v1.21.1
Use nvm
as a Javascript Version Manager. Install it from here.
Go to kollab/
then run:
$ nvm use
$ nvm install
$ nvm exec
$ nvm which
Reading plain text while debugging is painful. Lucklily, we have gem called awesome_print to handle this for us.
Put .irbrc
and .pryrc
file to your home directory (~). Content could be copied from my Github gist
After bundle install
the rails gems, run the following command to find the location of awesome_print gem.
$ gem which awesome_print
Do not copy all path, copy only until .../lib/
. Replace the copied path to the first line of both files. Now you will have beautiful debug outputs. No more pain!
In the process of deciding, please read this article.
Install this version PostgreSQL 12.1
via homebrew. Then make it run at start up.
$ brew services start postgresql
Important: Request password from project manager before create database user.
Add the requested password to your ~/.bash_profile
or ~/.zshrc
or other shell configuration file depends on your prefer shell.
export KOLLAB_DATABASE_PASSWORD="requested_password"
Create user named kollab
and enter the requeted password by:
$ createuser -P -d kollab
Create a new database from kollab/
by:
$ rails db:setup
$ rails db:migrate
The recommended extensions are defined in .vscode/extensions.json
The recommended settings are defined in .vscode/settings
To improve code readability and consistency, we need to have some standard rules for writing our code. Fortunately, solargraph
and prettier
is good enough in auto formatting code in vscode
, but it is also good to know some of the basic.
You don't need to remember it all! Skimming through it is enough.
We follow style guide from Airbnb Style Guide. Please read and try to follow for the best practice.
We follow style guide from here. Please read and try to follow for the best practice.
We follow style guide from here. Please read and try to follow for the best practice.
Testing is as important as implementing since it makes sure that your code perform as you expected and knows when someone break your code. We use alternative framework for testing called RSpec. Please make sure you know how to write the test properly. You can follow the guide from the official guide or another guide.
After running your tests, open coverage/index.html
in the browser of your choice. We use simplecov gem.
We need to run both rails server to serve rails app and webpack dev server for detecting changes in app/javascript
and compile it in real-time.
You can run both separately but we suggests you to use app called Overmind. The app allow you to run two processes simultaneously and allow you to connect to specific process too.
$ brew install overmind
To start a rails server, run overmind from the project root directory:
$ overmind start
You can access your rails server from localhost:5000
.
To debug put pry at any line of your code:
binding.pry
If you are using Overmind you need to open another terminal and run:
$ overmind connect web
After you done your debugging, you can safely disconnect from the window by hitting Ctrl b
and then d
.