Development Setup

Version 14 (Jeremy Wright, 08/23/2012 12:41 pm)

1 1 Matthew Sears
h1. Development Setup
2 1 Matthew Sears
3 2 J. Simmons
The following instructions are meant to help get the ODE application up and running on your local workstation.  Note, these instructions assume you are setting up a development environment on Linux/OS X.
4 1 Matthew Sears
5 3 J. Simmons
h1. Prerequisites
6 3 J. Simmons
7 3 J. Simmons
* SVN
8 6 J. Simmons
* MySQL
9 9 J. Simmons
* Ruby 1.8.7 (with Development Tools)
10 14 Jeremy Wright
* Bundler (may need to update gem to 1.4+)
11 14 Jeremy Wright
<pre>gem install bundler</pre>
12 14 Jeremy Wright
* To update gem you may need to run (su to root):
13 14 Jeremy Wright
<pre>REALLY_GEM_UPDATE_SYSTEM=1 gem update --system</pre>
14 14 Jeremy Wright
* After this update you'll need to reinstall bundler.
15 3 J. Simmons
16 1 Matthew Sears
h1.  Code checkout
17 1 Matthew Sears
18 1 Matthew Sears
To get started, create a local repository with svn checkout:
19 1 Matthew Sears
20 1 Matthew Sears
<pre>
21 1 Matthew Sears
svn checkout https://opendesignengine.net/svn/ode/trunk
22 1 Matthew Sears
</pre>
23 1 Matthew Sears
24 1 Matthew Sears
h1. Create Development Database
25 1 Matthew Sears
26 11 Jeremy Wright
You will need to setup a local development MySQL database and call it 'ode_development'.  Next we need to create a new database.yml so the application knows how to connect to the database.  To accomplish this, simple copy the database.yml.exampe file:
27 1 Matthew Sears
28 1 Matthew Sears
<pre>
29 5 J. Simmons
cd trunk
30 4 J. Simmons
cp config/database.yml.example config/database.yml
31 1 Matthew Sears
</pre>
32 1 Matthew Sears
33 12 Jeremy Wright
Under the production: section of the the config file, fill in the database name, username, and password.  Be sure to create the database in MySQL afterwards.
34 1 Matthew Sears
35 1 Matthew Sears
h1. Bundler
36 1 Matthew Sears
37 1 Matthew Sears
To install the required third-party gems to run the ODE application, we run the following Bundler command:
38 1 Matthew Sears
39 1 Matthew Sears
<pre>
40 1 Matthew Sears
bundle install
41 1 Matthew Sears
</pre>
42 1 Matthew Sears
43 13 Jeremy Wright
Note: you will need to install Bundler first (gem install bundler), and you may also need to install the libmysqlclient-dev package to get the MySQL gem to install.
44 1 Matthew Sears
45 1 Matthew Sears
h1. Database Preparation
46 1 Matthew Sears
47 1 Matthew Sears
To prepare the database, we first need to run migrations:
48 1 Matthew Sears
49 1 Matthew Sears
<pre>
50 1 Matthew Sears
RAILS_ENV=production rake db:migrate
51 1 Matthew Sears
</pre>
52 1 Matthew Sears
53 1 Matthew Sears
We now need some seed data to get started:
54 1 Matthew Sears
55 1 Matthew Sears
<pre>
56 1 Matthew Sears
RAILS_ENV=production rake db:seed
57 1 Matthew Sears
</pre>
58 1 Matthew Sears
59 1 Matthew Sears
h1. Running the Application
60 1 Matthew Sears
61 1 Matthew Sears
Now we should be ready to run the application locally:
62 1 Matthew Sears
63 1 Matthew Sears
<pre>
64 1 Matthew Sears
RAILS_ENV=production script/server
65 1 Matthew Sears
</pre>
66 1 Matthew Sears
67 1 Matthew Sears
If all goes well, you should be able to open the application at http://localhost:3000