Skip to content

Xiaohong-Deng/mooqita-icccg

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Iterative Crowdsourcing Comprehension Challenge Game

TravisCI Maintainability Test Coverage Waffle.io - Columns and their card count

This is a Rails implementation of the ICCG game based on the paper Paritosh, P., & Marcus, G. (2016). Toward a comprehension challenge, using crowdsourcing as a tool. AI Magazine, 37(1), 23-31.

Project Setup with Physical Machine (Recommended)

Note the ruby and node.js versions in this project are locked to 2.4.1 and 8.10.0. If you choose to use gemset with rvm or rbenv the gemset name is locked to iccg. You are welcomed to try the versions you want at your own risk.

Set Up Rails Environment

If you haven't already, please set up your Ruby on Rails development environment. Here is a good reference link Setup Ruby on Rails

Note to install postgresql. This is the database this project uses in development and production environment.

Install Gems

To avoid polluting your default gemset you can either bundle install --path vendor or use gemset functionality that rvm or rbenv provides. Add vendor/ruby to .gitignore if you choose the former. You can choose other directories inside your project root path to install required gems if you like.

Set Up Database

bundle exec rails db:create
bundle exec rails db:migrate
bundle exec rails db:seed

If gems are installed to system default path bundle exec can be omitted.

Install Redis, Yarn and Javascript Dependencies

brew install redis
brew install yarn
bundle exec rails yarn:install

For Mac user remember brew services start redis

If rails yarn:install complains about node version, one way is to do the following

brew install nvm
nvm install VERSION_NUMBER

nvm is node.js version manager that allows you to install multiple versions of node.js

Run Tests

bundle exec rspec
bundle exec cucumber
bundle exec teaspoon

If you install ruby gems inside the project directory you might want to skip the folder such that simplecov does not generate a large report file. You need to add add_filter "FOLDER_OR_FILE_TO_IGNORE" to the block in ./.simplecov. We have done it for you if you choose vendor as the gem install directory.

Run Project Locally in Development Environment

bundle exec rails s

then go to localhost:3000 in your web browser.

Project Setup with Virtual Machine

To ease up the start of the development process, you can use the the project's virtual development environment based on Vagrant.

First Run Usage

  1. Install in your computer the software listed the requirements section.
  2. Clone the repository into your machine.
  3. Run vagrant up and wait for the machine to be built.
  4. When the machine is ready, run vagrant ssh to log into it.
  5. Move into the project directory with cd /vagrant.
  6. Install the project gems with bundle install.
  7. Install the required Node modules with rake yarn:install.
  8. Build the database structure with rails db:schema:load.
  9. Load seed data with rails db:seed.

Now check that everything works with rails s and opening http://localhost:3000 in your browser.

Software Requirements

Project Development

The trunk development style is used on this repo, so follow the next steps to work on new features and fixes:

  • If using the virtual development environment:
    • Start the project's box with 'vagrant up'.
    • Log into the box with vagrant ssh.
    • Move into the project directory with cd /vagrant.
  • Ensure dependencies are up to date:
    • bundle install
    • rake yarn:install
  • Run pending migrations and load seed data:
    • rails db:migrate
    • rails db:seed
  • Create a new branch from the master branch.
  • Try to work on atomic commits related to the feature.
  • Try to add TDD and/or BDD tests for your code.
  • On finish, send a push request targeting the master branch for review.

Testing

This project relies on RSpec, Cucumber, Jasmine and Capybara.

Test Coverage Report

Teaspoon is a JavaScript test runner with various perks. It can generate javascript coverage report. SimpleCov generates ruby coverage report automatically after running RSpec and Cucumber. Generated reports go into ./coverage

Deployment

Manually Deploy to Heroku

First set up Heroku account and Heroku CLI. Then in terminal, login, add SSH keys, and create your app.

heroku login
heroku keys:add
heroku create PROJECT_NAME
heroku addons:add redistogo

Before pushing to heroku, set up your consumer configuration. First run heroku config:set RAILS_HOST=YOUR_APP_URL. In ./config/environments/production.rb do the following

config.action_cable.url = "wss://#{ENV['RAILS_HOST']}/cable"
config.web_socket_server_url = "wss://#{ENV['RAILS_HOST']}/cable"
config.action_cable.allowed_request_origins = [
'127.0.0.1',
/(http|https):\/\/#{ENV['RAILS_HOST']}.*/
]

Then push to heroku and initialize the database.

git push heroku master
heroku run rails db:migrate
heroku run rails db:seed

Try to visit PROJECT_NAME.herokuapp.com to see if everything works.

Automatic Deployment through CI Services

Please refer to the documentation from the service provider of your choice.