Today I’m going to be helping one of our investment companies, ByteWire set themselves up with a subversion based development environment for their Street Crime game. They will use a straight forward workflow whereby they will develop and test their code locally on their iMacs, commit working code to a subversion repository, and then check out code the live site when they are happy with it.
We’re going to be using Unfuddle to provide subversion hosting, project management and bug tracking.
- Create a free unfuddle account, e.g. Bytewire
- Set up your first project e.g. Street Crime
- Create a repository: http://bytewire.unfuddle.com/svn/bytewire_streetcrime/
LOCAL DOMAIN ON OSX
Set-up a local test domain on OS X
- Add it to the hosts file
printf "127.0.0.1\tstreetcrime\n" | sudo tee -a /etc/hosts
- This should now be accessible via http://streetcrime/
MAMP is an excellent bundle of Apache, MySQL and PHP for use on Macs. These tools do come pre-installed with Leopard by default, but php in particular is missing a fair few modules which you can only really add by re-compiling – MAMP makes it a lot easier. It installs new versions of PHP, MySQL and Apache alongside the default versions (on different ports), so that both can be run at the same time.
- Download it from: http://www.mamp.info/en/downloads/index.html
- Once you have installed it, you can configure it to work with your local test domains.
- Create a folder where the site code will be placed, e.g. /Applications/MAMP/htdocs/streetcrime/http/
- Open up /Applications/MAMP/conf/apache/httpd.conf with a text editor.
- Uncomment the NameVirtualHost line, and add a couple of news lines to define the new virtual host. It should look like:
NameVirtualHost * <VirtualHost *> DocumentRoot /Applications/MAMP/htdocs/ ServerName localhost </VirtualHost> <VirtualHost *> DocumentRoot /Applications/MAMP/htdocs/streetcrime/http/ ServerName streetcrime </VirtualHost>
- Restart MAMP through the MAMP control applet or widget. You should then be able to access the site at http://streetcrime:8888/
INITIAL COMMIT OF CODE
- Make the trunk folder inside the repository where your site code will initially be kept.
svn -m '' mkdir http://bytewire.unfuddle.com/svn/bytewire_streetcrime/trunk/
- Check out the trunk to your project top level folder
svn co http://bytewire.unfuddle.com/svn/bytewire_streetcrime/trunk/ /sites/street-crime.com/
- Check through the folder structure and look for anything that should be excluded:
du -h --max-depth=1 /sites/street-crime.com/http/
- Edit the svn:ignore property
svn add /sites/street-crime.com/http/
svn propedit svn:ignore /sites/street-crime.com/http/
- List the files & folders that you want to ignore, and then save and quit.
PSD gangster-game-forum gangster-game-wiki gangster-game-blog logs uploads
- Add the remaining files and commit (excluding uploads etc with svn:ignore)
svn add --force /sites/street-crime.com/http/
svn commit -m 'Importing main files'
CHECKING OUT CODE TO THE OSX DEVELOPMENT WORKSTATION
- Change directory to the folder you set up locally for development.
svn co http://bytewire.unfuddle.com/svn/bytewire_streetcrime/trunk/ .
TESTING THE SITE
- Visit http://streetcrime:8888/ – it showed a blank page for me. That would suggest error reporting is off, so enable in /Applications/MAMP/conf/php5/php.ini