CAT forum is the content management system of MNTC's CAT Forum, a web forum for CAT preparations. We use heroku for deployment.
It is written in Ruby on Rails and uses Bootstrap for UI design. We use haml
as our HTML templating engine. Some legacy templates are written in simple HTML (PR please!). Please use HAML while writing template code. You can learn HAML from the HAML Tutorial or HAML documentation. Some key features of CAT-Forum include:
- Posting and editing threads
- Replying to threads
- An upvoting and flagging system
- User reputation system
- User profile and activity tracking using
public_activity
gem - User login and authentication using
devise
gem and facebook login usingomniauth-facebook
- A loose search interface using the
pg_search
gem.
We have recently changed our default branch to master
which was github_master
previously. Please update your repo to reflect the same. All stable changes will be merged to the master
henceforth.
You can use any Ruby managers for Ruby management. We use RVM (https://rvm.io/). Install rvm along with Ruby using these command
gpg --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3
\curl -sSL https://get.rvm.io | bash -s stable --ruby
Ubuntu users: You may need to enable Run command as a login shell
in Ubuntu's Terminal, under Edit > Profile Preferences > Title and Command. Close the terminal and reopen it. You may also want to run source ~/.rvm/scripts/rvm
to load RVM.
We use PostgreSQL both in production and development. Please install the PostgreSQL dev package needed by the pg
gem
- For Debian/Ubuntu:
sudo apt-get install postgresql postgresql-contrib libpq-dev
- Fedora/Red Hat/CentOS:
sudo yum install postgresql-server postgresql-contrib postgresql-devel
- Mac OS X (using brew):
brew install postgres
We use cloudinary as a cloud storage for images. Signup for a cloudinary account so that you can get the cloud name, api key and secret. We use carrierwave
to manage uploads to cloudinary.
- We have all our secrets in secret.yml.example. You only need to rename it to secret.yml and fill in the secrets
- Use
rake secret
to generate the secret key, copy the generated key and paste it fordevise_key
. Do the same forsecret_key_base
. Enter the cloud_name, api_key and api_secret that you got from cloudinary in thecloud_name
,cloud_api_key
andcloud_api_secret
fields - If you would like to use fb login too, sign up with fb developers site, get your app key and app secret and paste it in
fb_app
andfb_secret
- Rename the database.yml.example file present in the config/ directory to database.yml
- For database settings you will have to fill in the username and password of your own local pg env.
$ cd cat-forum
# install gems
$ bundle install
# setup the database
$ rake db:setup
# start rails server
$ rails s
Go to localhost:3000
in your broswer. Congratulations! Now you are running on rails.
rake db:setup
creates the development and test database using rake db:create
, populates the database using the schema.rb file and seeds the data using rake db:seed
. When a new migration is introduced you don't need to run rake db:setup
again, instead run rake db:migrate
to run the migrations and update the database schema.
Run tests using the command rspec
or bundle exec rspec
. We are using Rspec as our testing framework. Writing good tests ensure that all new features introduced don't break previous ones. Please, write tests to explain the change you are suggesting.
We use Rubocop for code analyzing and lint-checking for Ruby. It follows the Ruby Style Guide. Cleaner code is always easier to read and handle. Please run rubocop
before submitting any code for lint errors. You can correct them using Ruby Style Guide. The travis build will fail if there are any lint errors.
We welcome contributions, and are especially interested in welcoming first time contributors. Read more about how to contribute in our Contribution Guidelines.
CAT-Forum is is available as open source under the terms of the MIT License.