Search
The Way of the Software Engineer

There are a few critical things you’ll need to get started with OpenAds development:

- Subversion
- Java VM (JDK 6)
- Ant builder
- PHPDocumentor

I’m quite sure this isn’t the only way to set up this environment, so you’ll need to modify my instructions to suit your own needs. This assumes you are using a *nix server running Apache with database software already installed. I use VIM.

Conventions in this document:
I’m assuming your DocumentRoot directory is called ‘www’ and I will refer to this as ‘/var/www’.

Getting the Source

Make sure you have subversion (svn) installed on you development system. Doing a `which svn` will let you know. If this isn’t installed, go google on how to install this and come back.

The svn repository location is at https://svn.openads.org/openads/ and you can browse the source using that url. To checkout the source, use this command:

svn co https://svn.openads.org/openads/trunk

If you’re familiar with the OpenAds code, you’ll notice all the directories you’re familiar with, plus a few with a _dev extension. The _dev directories are the actual code locations, and the non-_dev directories are ‘mashups’ created by ant from the controlled source. The reasons for this will become clear later, but to build them you’ll need ant.

Java 6 JDK

You may have this installed already, but it’s still in beta so it’s not installed by default. You can test your java install by doing `java -version` which should report “build 1.6.0″ among other things. If you’re using a Mac, you can follow my instructions here [ http://www.codebudo.com/2007/09/21/java-16-on-os-x/ ].

Installing the OpenAds ant utilities

This is covered in detail on the wiki here [ https://developer.openads.org/wiki/AntUsage ], so I’ll just give the highlights.

Make sure ant is installed: `which ant; ant -version`
Move to a temp directory somewhere: `cd ~/tmp/`
Checkout the ant build scripts from the svn repository: `svn co https://svn.openads.org/openads/branches/ant-plugins/trunk ant-plugins`
`cd ant-plugins`
`ant install -Dinstall.dir=/usr/local/ant/lib`

You can test the install by moving to your openads checkout (ie. `cd /var/www/mywebsite/ads/`) and running `ant -projecthelp` which should produce the following output.

PHPDocumentor

OpenAds has several scripts to automate development tasks. One of these is the scripts/updateDocs.sh script which requires the phpdoc to run. If you’re running php5 and see an error like this:

./updateDocs.sh: line 58: /usr/local/php4/bin/phpdoc: No such file or directory

you’ll need to install the pear/PhpDocumentor extension. This is done quite easily from a command line: `sudo pear install –alldeps PhpDocumentor`. When pear has finished updating it’s local database and installing the dependencies (XML_Parser, XML_Util, and XML_Beautifier), you’ll need to edit the scripts/updateDocs.sh script. Note that the default script points to /var/local/php4/bin/ so we should all point and snicker at the programmer that put a full path in his code and change this.

If you haven’t already, begin by adding the php/bin directory to your path. Modify the following to match your install prefix: `export PATH=”/usr/local/php/bin:$PATH”`. Then use your favorite text editor and set PATH_PHPDOC to “phpdoc”, save and exit the editor. When you’re ready, run the ./updateDocs.sh script and go make coffee. This process took ~15minutes on a Core2Duo 1.5ghz proc, YMMV. When you’re well caffeinated and the process has finished, your {OpenAdsDocumentRoot}/docs/developer/api/ directory should be well populated.

Side note: If you come across the error “Parse error: syntax error, unexpected T_STRING in /var/www/ads/docs/developer/api/index.html on line 1″, then PHP is trying to parse the html files in this directory. Just add this block to either your .htaccess file, or httpd.conf:

    <Directory /var/www/woodworkingbyexample/ads/docs/developer/api >
        <IfModule mime_module>
            AddType text/html .html
        </IfModule>
    </Directory>

Something to say?

You must be logged in to post a comment.