-
Notifications
You must be signed in to change notification settings - Fork 0
Building and Running
Before building Dubsar, you need to install a few things.
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 is strongly recommended. Click here for a brief tutorial.
Install the bundler gem.
gem install bundler
Note: You should not use sudo
with the gem install
command if you are using RVM.
Install gems with the bundler.
bundle install
You are now ready to set up the database.
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:reset
Note rake db:reset
is simply a shortcut for:
rake db:drop rake db:create rake db:schema:load rake db:seed
The time-consuming task is db:seed
.
Set up the database.
rake db:create rake db:schema:load
Seed the database.
jdee@fatman:dubsar$ rake db:seed (in /home/jdee/github/jdee/dubsar) Sun Dec 05 21:32:17 -0600 2010 loaded verb frames Sun Dec 05 21:32:17 -0600 2010 loaded lexical names Sun Dec 05 21:32:18 -0600 2010 loaded verb sentences Sun Dec 05 21:32:19 -0600 2010 loaded sense index Sun Dec 05 21:32:19 -0600 2010 loaded irregular adjective inflections Sun Dec 05 21:32:19 -0600 2010 loading adjectives Sun Dec 05 21:41:29 -0600 2010 loaded 21538 adjectives (18156 synsets, 30004 senses) Sun Dec 05 21:41:29 -0600 2010 loaded irregular adverb inflections Sun Dec 05 21:41:29 -0600 2010 loading adverbs Sun Dec 05 21:43:26 -0600 2010 loaded 4481 adverbs (3621 synsets, 5580 senses) Sun Dec 05 21:43:26 -0600 2010 loaded irregular noun inflections Sun Dec 05 21:43:26 -0600 2010 loading nouns Sun Dec 05 22:32:00 -0600 2010 loaded 119034 nouns (82115 synsets, 146347 senses) Sun Dec 05 22:32:00 -0600 2010 loaded irregular verb inflections Sun Dec 05 22:32:00 -0600 2010 loading verbs Sun Dec 05 22:45:14 -0600 2010 loaded 11531 verbs (13767 synsets, 25047 senses) Sun Dec 05 22:45:14 -0600 2010 loading adjective pointers Sun Dec 05 22:57:27 -0600 2010 loading adverb pointers Sun Dec 05 22:58:16 -0600 2010 loading noun pointers Mon Dec 06 00:14:25 -0600 2010 loading verb pointers Mon Dec 06 00:27:27 -0600 2010 ### Dubsar DB seed complete ###
Note: Seeding the DB takes a couple of hours on a decent 64-bit processor. While you’re waiting, you can run the unit tests and generate local documentation. (See below.)
After seeding the DB, use the inflections rake task to check for valid inflections.
jdee@fatman:dubsar$ rake inflections (in /home/jdee/github/jdee/dubsar) dog (noun) passed hero (noun) passed cage (noun) passed man (noun) passed Man (noun) passed shaman (noun) passed be (verb) passed look (verb) passed take (verb) passed bake (verb) passed flow (verb) passed chip (verb) passed search (verb) passed die (verb) passed picnic (verb) passed occur (verb) passed diet (verb) passed span (verb) passed happen (verb) passed log-in (verb) passed crochet (verb) passed shoot the breeze (verb) passed visit (verb) passed quit (verb) passed hit (verb) passed splat (verb) passed 4 (noun) passed sabbatical (adjective) passed good (adjective) passed plainly (adverb) passed well (adverb) passed finished testing 31 test cases ### 31 passed, 0 failed ###
The list of inflections to check will continue to expand.
Dubsar has two development environments, development
and backup_dev
, as well as two production environments, production
and backup
. This makes it easy to switch back and forth while reseeding the database.
Run unit tests:
rake spec
or just:
rake
Generate local HTML documentation in doc/app/index.html
:
rake doc:app
Depending on your version of Ruby, the structure of doc/app
may vary a bit.
Once the database has been seeded, run the server.
rails server
Connect a browser to port 3000.