Development:Setup:OSX

From PG_Wiki
Jump to: navigation, search

Contents

Prerequisites

Install Git

Git for OS X

Get Expertiza

Fork Expertiza to your Github

Merge your changes to Expertiza

[DEPRECATED. DO NOT USE UNLESS ADVISED]

Expertiza Repository URLs
Default [DEPRECATED]
git clone <remote>
git clone git@github.com:expertiza/expertiza.git
Options
git clone -b <branch> <remote>
git clone -b production git@github.com:expertiza/expertiza.git

Install Homebrew

http://mxcl.github.io/homebrew

Install RBENV

$ brew update
$ brew install rbenv
$ brew install ruby-build

Install Ruby v. 2.1.5

https://github.com/sstephenson/ruby-build/wiki#installing-187-on-os-x-108-mountain-lion

Install Native Expertiza Dependencies

Dependencies are for the gems raspell, rjb, nokogiri, and mysql.

brew install aspell gcc47 libxml2 libxslt graphviz openssl

Install Bundled Gems

Set JAVA_HOME for the rjb gem (set it to a valid location, your path may vary):

export JAVA_HOME=/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/
bundle install

Possible alternate step if _bundle install_ command has build errors:

$ bundle config build.eventmachine --with-cppflags=-I/usr/local/opt/openssl/include
$ brew install apple-gcc42
$ brew unlink apple-gcc42
$ brew link apple-gcc42
$ export CC=/usr/local/Cellar/apple-gcc42/4.2.1-5666.3/bin/gcc-4.2
$ export CXX=/usr/local/Cellar/apple-gcc42/4.2.1-5666.3/bin/g++-4.2
$ export CPP=/usr/local/Cellar/apple-gcc42/4.2.1-5666.3/bin/cpp-4.2

Set Up the Database

Set the MySql Root Password

This step is not necessary, but it is advised to set a root mysql password.

mysqladmin -u root password

Run SQL script to scrub DB

Here is the link of Expertiza scrubbed DB (https://drive.google.com/a/ncsu.edu/file/d/0B2vDvVjH76uEMDJhNjZVOUFTWmM/view?usp=sharing) Download the file, unzip it and dump to MySQL.

mysql -uroot -p -h localhost < expertiza_scrubbed.sql
Log in to MySql
mysql -uroot -p

The following commands are executed inside mysql

Create the Expertiza User
create user expertiza@localhost;
Create the Databases
create database expertiza_development;
create database expertiza_test;
Grant Privileges to the Expertiza User
grant all on expertiza_development.* to expertiza@localhost;
grant all on expertiza_test.* to expertiza@localhost;


Build the Expertiza Database

First, you have to copy the sample database config to a real one.

cp config/database.yml.example config/database.yml

Then edit the file and put your mysql password in there so it can log into the db

vi config/database.yml

Notice: You may need to prepend the following commands with bundle exec.

rake db:migrate
rake db:test:prepare

Set up secrets file

cp config/secrets.yml.example config/secrets.yml

Setup Bower

First, install bower with npm (install npm first if not already installed)

npm install bower -g

Then run this from the expertiza directory

bower install --allow-root

Setup Redis

Please install redis on your machine and then run redis-server command. These commands will help you run redis easily: $ wget http://download.redis.io/releases/redis-4.0.1.tar.gz $ tar xzf redis-4.0.1.tar.gz $ cd redis-4.0.1 $ make $ src/redis-server

Start rails server

rails server

Then direct your browser to http://localhost:3000

You can log in using instructor6. student5000, student5001, etc. are good too. The password for any account is "password".

Import Production Data (Optional)

This step requires that you have your ssh private/public key pairs loaded in the production server under the rails user.
How to Add SSH Keys to the Expertiza Production Server
You must run the following command from your local Expertiza project directory.

cap production load_data
Personal tools
Namespaces
Variants
Actions
Navigation
Toolbox