This repository contains all of the code that runs on worldcubeassociation.org.
- Clone this repo! (And navigate into it)
git clone https://github.com/thewca/worldcubeassociation.org cd worldcubeassociation.org
- Ensure you have the correct Ruby version installed. We recommend using a Ruby version manager like rvm or rbenv. They should both read the
.ruby-version
file to use the correct version (rvm current
orrbenv version
to confirm). - Ensure Bundler 2 is installed
- To update from bundler 1:
gem update --system bundle update --bundler
- Or, if you haven't installed bundler previously:
gem update --system gem install bundler
- To update from bundler 1:
- Set up git pre-commit hook. Optional, but very useful.
(cd WcaOnRails; bundle install && bundle exec pre-commit install) && git config pre-commit.ruby "scripts/ruby_in_wca_on_rails.sh"
- Set up MySQL with a user with username "root" with an empty password.
If it poses problems, try the following:
# Install MySQL if you hadn't already. # Using apt that would be: sudo apt install mysql-server # Then run MySQL CLI as administrator and set an empty password for the root user: sudo mysql -u root ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY '';
- Install dependencies and load development database.
cd WcaOnRails/
- Install yarn if you hadn't
bundle install && bin/yarn
bin/rake db:load:development
- Download and import the developer's database export.bin/rails server
- Run rails. The server will be accessible at localhost:3000
- Run tests. Setup instructions follow
before_script
in.travis.yml
.RAILS_ENV=test bin/rake db:reset
- Set up test database.RAILS_ENV=test bin/rake assets:precompile
- Compile some assets needed for tests to run.bin/rspec
- Run tests.
- Mailcatcher is a good tool for catching emails in development.
Run in Vagrant (gets everything working, but is very slow, recommended only if you need to run the PHP portions of the website)
- Install Vagrant, which requires VirtualBox.
vagrant up all
- Once the VM finishes initializing (which can take some time), the website will be accessible at http://localhost:2331.- Note: There are some minor issues with development on Windows.
- All emails will be accessible at
http://localhost:2332
. - Please take a look at this wiki page for more detailed informations about the application's internals.