Using Bazaar to Contribute Code: Difference between revisions

From IHRIS Wiki
No edit summary
No edit summary
 
(22 intermediate revisions by 4 users not shown)
Line 1: Line 1:
This page has been deprecated. Please see the updated [[Linux (Ubuntu) Installation | installation instructions]].
We maintain all of our code in [http://www.launchpad.net  Launchpad ] using the [http://bazaar-vcs.org/  Bazaar] version control system.
We maintain all of our code in [http://www.launchpad.net  Launchpad ] using the [http://bazaar-vcs.org/  Bazaar] version control system.
==Bazaar==
==Bazaar==
Line 5: Line 7:
  sudo apt-get install bzr bzrtools
  sudo apt-get install bzr bzrtools
===Using Bazaar===
===Using Bazaar===
You should try the [http://doc.bazaar-vcs.org/latest/en/mini-tutorial/index.html  five minute tutorial].
You should try the [http://doc.bazaar-vcs.org/latest/en/mini-tutorial/index.html  five minute tutorial]. The software sources are below as well as some directions to set up a development server.  Happy committing.
 
===Bazaar Branches===
===Bazaar Branches===
There are a few software components that we maintain, and for each there is a release and development trunk.
There are a few software components that we maintain, and for each there is a release and development trunk.
*Release  
*Release
**i2ce
**[https://code.launchpad.net/~intrahealth+informatics/i2ce/3.1.4-release i2ce] bzr branch lp:i2ce/3.1
**ihris-common
**[https://code.launchpad.net/~intrahealth+informatics/ihris-common/3.1.4-release ihris-common] bzr branch lp:ihris-common/3.1
**ihris-manage
**[https://code.launchpad.net/~intrahealth+informatics/ihris-manage/3.1.4-release ihris-manage] bzr branch lp:ihris-manage/3.1
**ihris-plan
**[https://code.launchpad.net/~intrahealth+informatics/ihris-plan/1.0.4-release ihris-plan] bzr branch lp:ihris-plan/1.0
**ihris-qualify
**[https://code.launchpad.net/~intrahealth+informatics/ihris-qualify/3.1.4-release ihris-qualify] bzr branch lp:ihris-qualify/3.1
**textlayout
**[https://code.launchpad.net/~intrahealth+informatics/textlayout/3.1.4-release textlayout] bzr branch lp:textlayout/3.1
*Development
*Development
**[https://code.launchpad.net/~intrahealth+informatics/i2ce/3.2-dev i2ce] bzr branch lp:i2ce
**[https://code.launchpad.net/~intrahealth+informatics/ihris-common/3.2-dev ihris-common] bzr branch lp:ihris-common
**[https://code.launchpad.net/~intrahealth+informatics/ihris-manage/3.2-dev ihris-manage] bzr branch lp:ihris-manage
**[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
==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.
===Installing The Required Software===
First we need to install some prerequisites for the software
sudo apt-get tasksel install lamp-server
sudo apt-get install php-apc php5-gd php5-tidy
===Creating The Database===
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.
===Getting The Code===
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
===Binding The Code===
You may wish to bind your branch to the launchpad hosted branch to automatically commit there. For example,
for iHRIS Manage, you can do:
bzr bind bzr+ssh://<YOUR USER NAME>@bazaar.launchpad.net/~intrahealth+informatics/ihris-manage/3.2-dev/
===Configuring The Software===
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> /home/YOUR_USER_NAME/ihris-dev/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> PASS (the password you set above) </td></tr>
<tr><td>$i2ce_site_module_config </td><td> /home/YOUR_USER_NAME/ihris-dev/manage/sites/Demo/iHRIS-Manage-Demo.xml </td></tr>
</table>
</center>
Save and quit.
===URL Rewriting===
Finally, we can make our url's pretty by turning on rewriting.  This is an optional step.
sudo a2enmod rewrite
cd ~/ihris-dev/manage/sites/Demo/pages
cp htaccess.TEMPLATE .htaccess
gedit .htaccess
We need to look for the line RewriteBase and change it to the web directory we want to use we are using, ''/ihris-dev/manage''. You may now save and quit.
To make sure we can use our new .htaccess file do:
sudo gedit /etc/apache2/sites-available/default
and change:
<Directory /var/www/>
  Options Indexes FollowSymLinks MultiViews
  AllowOverride None
  Order allow,deny
  allow from all
</Directory>
to:
<Directory /var/www/>
  Options Indexes FollowSymLinks MultiViews
  AllowOverride All
  Order allow,deny
  allow from all
</Directory>


==Coding Policy==
==Coding Policy==
Line 23: Line 104:
===Documentation===
===Documentation===
We document our php code with [http://www.phpdoc.org/  phpdoc].
We document our php code with [http://www.phpdoc.org/  phpdoc].
[[Category:Developer Pages]]

Latest revision as of 07:27, 21 August 2019

This page has been deprecated. Please see the updated installation instructions.

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. The software sources are below as well as some directions to set up a development server. Happy committing.

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.

Installing The Required Software

First we need to install some prerequisites for the software

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

Creating The Database

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.

Getting The Code

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

Binding The Code

You may wish to bind your branch to the launchpad hosted branch to automatically commit there. For example, for iHRIS Manage, you can do:

bzr bind bzr+ssh://<YOUR USER NAME>@bazaar.launchpad.net/~intrahealth+informatics/ihris-manage/3.2-dev/

Configuring The Software

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 /home/YOUR_USER_NAME/ihris-dev/i2ce
$i2ce_site_database ihris_manage
$i2ce_site_database_user ihris_manage
$i2ce_site_database_password PASS (the password you set above)
$i2ce_site_module_config /home/YOUR_USER_NAME/ihris-dev/manage/sites/Demo/iHRIS-Manage-Demo.xml

Save and quit.

URL Rewriting

Finally, we can make our url's pretty by turning on rewriting. This is an optional step.

sudo a2enmod rewrite
cd ~/ihris-dev/manage/sites/Demo/pages
cp htaccess.TEMPLATE .htaccess
gedit .htaccess

We need to look for the line RewriteBase and change it to the web directory we want to use we are using, /ihris-dev/manage. You may now save and quit.

To make sure we can use our new .htaccess file do:

sudo gedit /etc/apache2/sites-available/default

and change:

<Directory /var/www/>
 Options Indexes FollowSymLinks MultiViews
 AllowOverride None
 Order allow,deny
 allow from all
</Directory>

to:

<Directory /var/www/>
 Options Indexes FollowSymLinks MultiViews
 AllowOverride All
 Order allow,deny
 allow from all
</Directory>

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.