Using Bazaar to Contribute Code: Difference between revisions

From IHRIS Wiki
Line 21: Line 21:
**[https://code.launchpad.net/~intrahealth+informatics/ihris-plan/1.1-dev ihris-plan] bzr branch lp:ihris-plan
**[https://code.launchpad.net/~intrahealth+informatics/ihris-plan/1.1-dev ihris-plan] bzr branch lp:ihris-plan
**[https://code.launchpad.net/~intrahealth+informatics/ihris-qualify/3.2-dev ihris-qualify] bzr branch lp:ihris-qualify
**[https://code.launchpad.net/~intrahealth+informatics/ihris-qualify/3.2-dev ihris-qualify] bzr branch lp:ihris-qualify
===Working On The Code===
Suppose you want to setup a development server on your machine to play around with the code.  Here are some steps that you can take to install iHRIS Manage under your home directory and setup up the apache and mysql web server.
sudo apt-get tasksel install lamp-server
sudo apt-get install php-apc php5-gd php5-tidy
You can create the database, which we will call ihris_manage by:
mysql -u root -p
mysql> CREATE DATABASE ihris_manage;
mysql> GRANT ALL PRIVILEGES ON ihris_manage.* TO ihris_manage@localhost identified by 'PASS';
here you should change 'PASS' to whatever you want.  You can also use phpmyadmin to create the database.
Now we want to get the code from launchpad.
mkdir ~/ihris-dev
cd ~ihris-dev
bzr branch lp:i2ce
bzr branch lp:ihris-common common
bzr branch lp:ihris-manage manage
bzr branch lp:textlayout/3.1 textlayout
In iHRIS Manage, there is a demo site setup with sample data.  We can make this available in apache by doing the following:
cd /var/www
sudo mkdir ihris-dev
cd /var/www/ihris-dev
sudo ln -s ~/ihris-dev/manage/sites/Demo/pages manage
Once we complete some configuration options, you can access the site at:
http://127.0.0.1/ihris-dev/manage
To complete the configuration we need to tell the application which database we want to use:
We will now edit the configuration to let the site know about the database user and options:
gedit ~/ihris-dev/manage/sites/Demo/pages/config.values.php
We now need to uncomment and set the value of a few variables.  They are:
<center>
<table border='1' padding='2'>
<tr><th> Variable Name </th><th> Value</th></tr>
<tr><td>  $i2ce_site_i2ce_path </td><td> /var/lib/iHRIS/current/I2CE </td></tr>
<tr><td> $i2ce_site_database </td><td> ihris_manage </td></tr>
<tr><td> $i2ce_site_database_user  </td><td> ihris_manage </td></tr>
<tr><td> $i2ce_site_database_password  </td><td> YYYYY (the password you set above) </td></tr>
<tr><td>$i2ce_site_module_config </td><td> /var/lib/iHRIS/sites/manage/iHRIS-Manage-Site.xml </td></tr>
</table>
</center>
Save and quit.


==Coding Policy==
==Coding Policy==

Revision as of 07:39, 26 May 2009

We maintain all of our code in Launchpad using the Bazaar version control system.

Bazaar

Installing Bazaar

You can install bazaar under ubuntu via

sudo apt-get install bzr bzrtools

Using Bazaar

You should try the five minute tutorial.

Bazaar Branches

There are a few software components that we maintain, and for each there is a release and development trunk.

Working On The Code

Suppose you want to setup a development server on your machine to play around with the code. Here are some steps that you can take to install iHRIS Manage under your home directory and setup up the apache and mysql web server.

sudo apt-get tasksel install lamp-server
sudo apt-get install php-apc php5-gd php5-tidy

You can create the database, which we will call ihris_manage by:

mysql -u root -p
mysql> CREATE DATABASE ihris_manage;
mysql> GRANT ALL PRIVILEGES ON ihris_manage.* TO ihris_manage@localhost identified by 'PASS';

here you should change 'PASS' to whatever you want. You can also use phpmyadmin to create the database.

Now we want to get the code from launchpad.

mkdir ~/ihris-dev
cd ~ihris-dev
bzr branch lp:i2ce 
bzr branch lp:ihris-common common
bzr branch lp:ihris-manage manage
bzr branch lp:textlayout/3.1 textlayout

In iHRIS Manage, there is a demo site setup with sample data. We can make this available in apache by doing the following:

cd /var/www
sudo mkdir ihris-dev
cd /var/www/ihris-dev
sudo ln -s ~/ihris-dev/manage/sites/Demo/pages manage

Once we complete some configuration options, you can access the site at:

http://127.0.0.1/ihris-dev/manage

To complete the configuration we need to tell the application which database we want to use: We will now edit the configuration to let the site know about the database user and options:

gedit ~/ihris-dev/manage/sites/Demo/pages/config.values.php

We now need to uncomment and set the value of a few variables. They are:

Variable Name Value
$i2ce_site_i2ce_path /var/lib/iHRIS/current/I2CE
$i2ce_site_database ihris_manage
$i2ce_site_database_user ihris_manage
$i2ce_site_database_password YYYYY (the password you set above)
$i2ce_site_module_config /var/lib/iHRIS/sites/manage/iHRIS-Manage-Site.xml

Save and quit.

Coding Policy

Indentation and Formatting

No tabs please. All tabs should be converted to 4 spaces. The indentation style for (PHP) code should be bsd.

Documentation

We document our php code with phpdoc.