Dave Johnson on open web technologies, social software and Java
UPDATE: things have changed quite a bit since I published this blog entry. There is now a Ruby Gem for installing Ape and the process is much easier than the one I describe here. See Sam Ruby's post Migratory Ape for details - Dave (March 1, 2008)
There's some very cool Atom news from Tim Bray this week. First, there's mod_atom, a plugin for the Apache HTTPD web server that provides a stripped down Atom server (written in C) that stores Atom entries as files. So now any HTTPD server can serve as a simple Atom store.
Second, Tim mentioned that he's updated his Atom Protocol Exerciser (Ape) to support the new Atom protocol namespace and to add a couple of new tests. That's perfect timing for me because I'm starting to work on Roller's APP implementation and some other APP based things.
I need my own local copy of the Ape, so I decided to download the code an get it up and running. To make things easy, I decided to do this work on my Ubuntu system because it's already setup with gcc, cvs, Apache HTTPD and Ruby. For my future reference and to help other Atom fans to get started, here are my notes from my Ape setup experience.
Tim told me that the Ape needs Ruby 1.8.6, but Ubuntu has only 1.8.4 and apt-get upgrade ruby didn't help so I downloaded and built 1.8.6 myself. Here's what I did:
% wget ftp://ftp.ruby-lang.org/pub/ruby/1.8/ruby-1.8.6.tar.gz % tar xzvf ruby-1.8.6.tar.gz % cd ruby-1.8.6 % ./configure % make % sudo make install
Once the make install finished, I found that I had a fresh new copy of Ruby in /usr/local. Next, I set up my environment for running Ruby by adding the following three lines to my .bashrc file.
export RUBY_HOME=/usr/local export RUBYLIB=$RUBY_HOME/lib/ruby:$PREFIX/lib/site_ruby/1.8 PATH=$RUBY_HOME/bin:$PATH
But that's not all the Ruby you need for the Ape, you also need some RubyGems so I downloaded and built the latest version of that too. I followed nearly the same steps as with Ruby:
% wget http://rubyforge.org/frs/download.php/20989/rubygems-0.9.4.tgz % tar xzvf rubygems-0.9.4.tgz % cd rubygems-0.9.4 % ./configure % make % sudo make install
Next, I setup environment for running RubyGems by adding GEM_HOME to my .bashrc. I did this by adding the following line after the definition of RUBY_HOME.
Ape needs the RubyGems Builder, so I ran this command to get the latest version of the Builder from the RubyGems repository:
% sudo gem install builder
Finally, I've got enough Ruby in place to get going. So next I got the latest source for the Ape. Unfortunately, I think you need a Java.net account for this part. Here's what I did:
% cd /home/dave/src.downloads % cvs -d :pserver:email@example.com:/cvs login % cvs -d :pserver:firstname.lastname@example.org:/cvs checkout ape
Next, I created a ScriptAlias so I can run the Ape via CGI. I did this by adding the following to the end of my Apache config file (/etc/apache2/apache2.conf on Ubuntu):
ScriptAlias /apecgi/ /home/dave/src.downloads/ape/src/ <Directory /home/dave/src.downloads/ape/src/> Options +ExecCGI </Directory>
The Ape scripts don't the have the #!/path/to/ruby line that you'd expect to find in a CGI script, so initially I couldn't figure out how to get them to run. I pinged Tim and he told me that he uses a bash CGI script to run the Ape's entry-point go.rb script. Following Tim's example, I created a file named "go" in the Ape src directory with the following contents:
#!/bin/bash export RUBY_HOME=/usr/local export GEM_HOME=$RUBY_HOME/lib/ruby/gems/1.8 export RUBYLIB=$RUBY_HOME/lib/ruby:$PREFIX/lib/site_ruby/1.8 PATH=$RUBY_HOME/bin:$PATH export PATH ruby go.rb
So the Ape code is in place and ready to run, but I still need to serve Ape's HTML form. I decided to serve the form from HTTPD docroot, so I created a directory for it mkdir /var/www/ape. Then I went looking for the HTML form. Turns out, it's not in CVS. So I browsed to http://tbray.org/ape and used Firefox's "Save Page As..." and "Web Page, complete" to save index.html. Then I copied that index.html file into /var/www/ape and modified the
This is just one entry in the weblog Blogging Roller. You may want to visit the main page of the weblog
Below are the most recent entries in the category Feeds, some may be related to this entry.