Wednesday 15 August 2007

'git'ting wikitect

PROJECT: install wikitect onto my domain, which is on a commercial server (at the excellent Penguin service), using my mac os X 10.4 machine. [Linux users, the wikitect page may be enough, and the steps below may be similar. I know nothing of windows, I'm afraid - please add a (polite!) comment if you do!]

Please note, I am not a computer professional, hacker, coder - some of this may seem very simplistic to some, but may be greek to others. Some of it I understand, other bits have been 'parrot fashion'. Feel free to contact me if it doesn't work for you - but be aware of my limitations!

I'm assuming you've got here via some rational process, and that you'll have some idea of what wikitect is. If not, you may want to learn more - you could look here or here.

I start my quest at the wikitect page of AboutUs. The 'What We Have' segment there has the critical info on accessing the current wikitect code. Version control is handled by something called 'git', an instance of which needs to be installed on my machine, so that it can talk to the git server on the source site.

So I need to install 'git' . I found some useful instructions here. Please look at them (open in a new tab):
  • download the ‘expat’ utility from sourceforge as instructed.
make sure you don’t let Stuffit unpack the .tar.gz file, just save it to disk. Remember or find the location you saved it into.

Next, you will be using the Terminal application - found in applications/utilities

Following the same instructions: you may need to create the ~/.bash_login file, if it doesn’t exist:
[I used ‘pico’]
$ pico .bash_login
then add the line:
export PATH="/usr/local/bin:$PATH
ctrl-O to save
ctrl-X to exit
quit from ‘Terminal’
restart ‘Terminal’
use ‘cd’ to get to the directory which expat was downloaded into. Follow the instructions some more:
tar xvzf expat-2.0.1.tar.gz
cd expat-2.0.1
./configure --prefix=/usr/local
Oh-oh! At this stage, I got these error messages from ‘configure’
checking for gcc... no
checking for cc... no
checking for cc... no
checking for cl... no
configure: error: no acceptable C compiler found in $PATH
See `config.log' for more details.
The problem was that I didn’t install Apple's ‘Xcode’ tools when I installed the OS, so I went and did this from my original system disks - separate install process from OS X.
IF YOU DON’T HAVE AN X-CODE DISK:
go here: http://developer.apple.com/tools/download/
and make a free registration (click ‘not a member’), then make the (enormous) download of the Xcode .dmg
Try again:
./configure --prefix=/usr/local
Success! So continuing on:
make
sudo make install
Done with installing expat.

Now, go and download ‘git’ from its source page.
Next, unpack and install -
use ‘cd’ to get to the directory you downloaded into.
tar xvzf git-1.5.2.4.tar.gz
cd git-1.5.2.4
make configure
./configure --prefix=/usr/local
make all
sudo make install
Done with installing git. Your machine now has git as part of its application set, and can talk to the git server that holds the wikitect source code:

Still in Terminal, follow the steps from the Wikitect page:

I omitted this next step - this assumes you want to serve the wikitect up from your own local machine - this is fine, but you won't be able to share it unless your machine acts as a web server, and mine doesn't. In theory, this is straightforward on Mac OS X, once you turn on 'personal web sharing' in the system preferences>sharing pane, but I haven't figured out how to get my browser to access the scripts.
cd public_html
All I want to do is get the source code, so here goes:
git clone git://c2.com/wikitect.git

It works - although the first time it failed as the remote server didn't seem to want to respond - I tried again a minute later, and got my own little wikitect folder.
Because I want my domain host machine to serve the wikitect, I need to upload the files to them. I used an ftp client called Transmit - there are many others [my hosting service also offers an upload facility as part of the site administration tools]. You will need to know where to put files of type 'cgi-bin' (Wikitect is a set of PERL scripts) on your server for them to be accessible. I think this is likely to vary widely, but my service (Linux based), needs them to go into /var/www/cgi-bin.

The next step is all about permissions - because wikitect makes and modifies files, and this is normally disallowed for web-sites, we need to change the permissions to allow it to do its stuff. We need to do this on your hosting machine, not your local machine, so we're finished with Terminal.
If the host is a linux system, and you have command line access, then the next command may be all that you need.
chmod 755 wikitect wikitect/*.cgi
My hosting service doesn't allow me this sort of access - for excellent security reasons, I'm sure. The site administration tool does allow permissions to be altered, but only one file at a time. The helpful Penguins told me that most ftp clients have tools for altering permissions, and indeed, Transmit does have an excellent tool - hidden away as a 'get info' menu item. so that's how I did it. If your system doesn't do permissions as numeric (the '755' in the command line above), then here is how it translates into the Read, Write, eXecute (rwx) mode:

User or Owner: 7 = rwx = Yes for read, yes for write, yes for execute
Group: 5 = r-x = Yes for read, no for write, yes for execute
Other: 5 = r-x = Yes for read, no for write, yes for execute

[For more information on linux/unix permissions, you could look here]
And now, you've done it! Congratulations!
But there's one last problem. How will you access wikitect from a browser? Well, apparently this depends on the host system, again. you may need help from them. I'm embarrassed to say that I needed help from the Penguins to come up with this:

http:***slash******slash***www***dot***dilgreenarchitect***dot***co***dot***uk***slash***cgi-bin***slash***wikitect***slash***index.cgi
[NB I have had to unlink and disguise this address as bad things happened - please use your brain to reconstruct it].

Obvious, really.

Well, that's all for now. Next project is to set up an empty wikitect and start rolling my own.
Don't hold your breath.