Skip to content

Building and Running

jdee edited this page Nov 1, 2010 · 24 revisions

Prerequisites

System packages

PostgreSQL

Once PostgreSQL is installed and running:

sudo -u postgres createuser $LOGNAME

Make the new user (yourself) a superuser. Edit the user name and password (if any) in config/database.yml to agree with the PostgreSQL user you just created.

RVM

RVM is strongly recommended. Click here for a brief tutorial.

Bundler

Install the bundler gem.

gem install bundler

Note: You should not use sudo with the gem install command if you are using RVM.

Dubsar

Install gems with the bundler.

bundle install

Re-seeding vs. migrations

The WordNet® data set used by Dubsar is quite static, so there is little point in migrating the data. In some cases, it may be desirable to add a small migration (to add an index, for example). However, when making a major update to the database (each time the data model expands), it makes more sense to re-seed from scratch each time. If you pull and migrate, but find that things aren’t working after a significant change to the database, your best bet is to re-seed from scratch:

rake db:drop
rake db:setup

Note rake db:setup is simply a shortcut for:

rake db:create
rake db:schema:load
rake db:seed

Seeding the database

Set up the database.

rake db:create
rake db:schema:load

Seed the database.

jdee@fatman:models$ rake db:seed
(in /home/jdee/github/jdee/dubsar)
Sun Oct 31 11:51:21 -0500 2010 loaded irregular adjective inflections
Sun Oct 31 11:51:21 -0500 2010 loading adjectives
Sun Oct 31 12:04:57 -0500 2010 loaded 21844 adjectives (18156 synsets, 30004 senses)
Sun Oct 31 12:04:57 -0500 2010 done
Sun Oct 31 12:04:57 -0500 2010 loaded irregular adverb inflections
Sun Oct 31 12:04:57 -0500 2010 loading adverbs
Sun Oct 31 12:08:11 -0500 2010 loaded 4481 adverbs (3621 synsets, 5580 senses)
Sun Oct 31 12:08:11 -0500 2010 done
Sun Oct 31 12:08:11 -0500 2010 loaded irregular noun inflections
Sun Oct 31 12:08:11 -0500 2010 loading nouns
Sun Oct 31 13:37:49 -0500 2010 loaded 119034 nouns (82115 synsets, 146347 senses)
Sun Oct 31 13:37:49 -0500 2010 done
Sun Oct 31 13:37:49 -0500 2010 loaded irregular verb inflections
Sun Oct 31 13:37:49 -0500 2010 loading verbs
Sun Oct 31 13:58:00 -0500 2010 loaded 11531 verbs (13767 synsets, 25047 senses)
Sun Oct 31 13:58:00 -0500 2010 done
Sun Oct 31 13:58:00 -0500 2010 ### Dubsar DB seed complete ###

Note: Seeding the DB takes an hour or two on a decent 64-bit processor. While you’re waiting, you can run the unit tests and generate local documentation.

Run unit tests.

rake test

Generate local HTML documentation in doc/app/index.html:

rake doc:app

Once the database has been seeded, run the server.

rails server

Connect a browser to port 3000.

Clone this wiki locally