This repository has some features that twitter has as it's named. :-) It also has the admin page (http://localhost:3000/admin), but it consists of sample code that intends to show how to write basic features such as search, csv import/export and so on. So the page is nothing to do with twitter.
Haven't payed much attention to the design/style for now.
- This repository has some
NOTE
here and there. But they are for education purposes. You shouldn't mimic them when you write code for production. ridgepole
is used instead of the Rails default db migration.ridgepole
is especially useful where many developers are working on the same repository and many services are referring to the same database.
- Ruby 2.5.0
- Ruby on Rails 5.1.6
- Postgresql 9.3 or later
The following software should be installed (by brew on Mac)
- yarn
-
Install packages
$ bundle install --path vendor/bundle
$ yarn install
-
Database setup
$ bin/rails db:create $ bundle exec rails ridgepole:apply
# You should run the commands above intead of bin/rails db:setup as ridgepole is used. # You should pass RAILS_ENV, like RAILS_ENV=production, for an environment besides development as follows. $ bundle exec rails ridgepole:apply RAILS_ENV=production
-
Setup environment variables if needed (Maybe not. Skip the step if the yml file doesn't exist.)
config/settings.yml
-
Start local servers
$ bundle exec foreman start => You should access http://localhost:5000/ or (Execute the following commands on different tabs) $ bin/rails server $ bin/webpack-dev-server
-
You have to sign up first from http://localhost:3000/signup to login.
-
If you want to create test data, see below.
$ bundle exec rspec
$ bin/rails dev:generate_data
# You can specify arguments
$ bin/rails 'dev:generate_data[100,10,20]'
-> A test user is created with the following email and password ([email protected] / password).
Setup overcommit for git hooks
$ bundle exec overcommit --install
$ bundle exec overcommit --sign
In case you have to ignore hooks
SKIP=HOOK COMMAND
e.g. SKIP=RuboCop git commit ...
e.g. OVERCOMMIT_DISABLE=1 git commit ...
Until this merge is released, RuboCop raises 'Extra line detected'. Fix manually.
lograge is used. So the following command should be used instead of Rails.logger
.
LogrageLogger.call({ message: 'error message comes here' }, error: e)