Skip to content

Setting up the development environment

vesse edited this page Mar 14, 2013 · 8 revisions

Introduction

QA Reports is a Ruby on Rails application so you need to install a bunch of stuff to get it up and running. This documentation has been tested to work on a fresh install of Ubuntu 12.04 LTS (Desktop) on 2013-03-12. Please file an issue if you notice something is not working as expected.

If you just wish to get everything needed quickly installed jump to tl;dr.

Install prerequisites

Install Ruby

This guide uses Ruby Version Manager (rvm) for installing Ruby. This is because distribution packaged versions may not work as expected, and installing and upgrading by hand from sources is so last season.

  • Install dependencies: sudo apt-get install curl libyaml-0-2
  • Install RVM: curl -L https://get.rvm.io | bash -s stable
    • Follow instructions on screen to get RVM activated on your current terminal
  • Install Ruby: rvm install 1.9.3
    • Note: QA Reports works with Ruby 2.0.0 as well
  • Take Ruby in use: rvm use --default 1.9.3

Install MariaDB

This guide uses MariaDB (an enhanced, open source drop-in replacement for MySQL). You may use MySQL as well, just install MySQL equivalents of the packages below. Check current installation instructions from MariaDB web site if the instructions below don't work.

sudo apt-get install python-software-properties
sudo apt-key adv --recv-keys --keyserver keyserver.ubuntu.com 0xcbcb082a1bb943db
sudo add-apt-repository 'deb http://ftp.heanet.ie/mirrors/mariadb/repo/5.5/ubuntu precise main'
sudo apt-get update
sudo apt-get install mariadb-server

Create databases

  • Open MariaDB client: mysql -u root -p
  • Execute:
create user 'qa_reports'@'localhost' identified by '<password_of_your_choosing>';
create database qa_reports_development;
create database qa_reports_test;
grant all on qa_reports_development.* to 'qa_reports'@'localhost';
grant all on qa_reports_test.* to 'qa_reports'@'localhost';
exit

Set up QA Reports

Install prerequisites

  • sudo apt-get install git-core
  • gem install bundler --no-ri --no-rdoc
  • Gems required by QA Reports require some additional packages:
sudo apt-get install libxml2-dev libxslt1-dev libqt4-dev build-essential libmariadbclient-dev libssl-dev

Setup

  • git clone https://github.com/leonidas/qa-reports.git
  • cd qa-reports
  • bundle install --without staging production
  • cp config/database.example.yml config/database.yml

Configure QA Reports to use MariaDB databases by editing config/database.yml as shown below

development:
    adapter: mysql2
    encoding: utf8
    reconnect: false
    database: qa_reports_development
    pool: 5
    username: qa_reports
    password: <password_of_your_choosing>
    socket: /var/run/mysqld/mysqld.sock

test:
    adapter: mysql2
    encoding: utf8
    reconnect: false
    database: qa_reports_test
    pool: 5
    username: qa_reports
    password: <password_of_your_choosing>
    socket: /var/run/mysqld/mysqld.sock

Setup database: bundle exec rake db:setup

Run the tests and start the server:

  • bundle exec rake spec, all unit tests should pass
  • bundle exec rake cucumber, all integration tests should pass
  • Start the server: bundle exec rails server
  • Register a new account for yourself: http://localhost:3000/users/register

Note: If you're using Ruby 1.9.3 you may wish to use Zeus since it speeds up development by preloading the app.

tl;dr

sudo apt-get install python-software-properties
sudo apt-key adv --recv-keys --keyserver keyserver.ubuntu.com 0xcbcb082a1bb943db
sudo add-apt-repository 'deb http://ftp.heanet.ie/mirrors/mariadb/repo/5.5/ubuntu precise main'
sudo apt-get update
sudo apt-get install curl libyaml-0-2 mariadb-server git-core libxml2-dev libxslt1-dev libqt4-dev build-essential libmariadbclient-dev libssl-dev
curl -L https://get.rvm.io | bash -s stable
source ~/.bashrc && source ~/.bash_profile
rvm install 1.9.3
rvm use --default 1.9.3
gem install bundler --no-ri --no-rdoc
git clone https://github.com/leonidas/qa-reports.git
cd qa-reports
bundle install --without staging production
cp config/database.example.yml config/database.yml

Then create databases as instructed, setup config/database.yml, and run bundle exec rake db:setup

Clone this wiki locally