There are some very trivial administration tasks that I find myself doing over and over again in Drupal which can’t currently be done from the admin interface. As of right now, these include installing a theme or module from drupal.org or adding a new site to an existing Drupal install. So, I’ve built a tiny Capistrano file that allows me to automate these tasks.
The tasks that I’ve setup are:
cap drupal:install:theme cap drupal:install:module cap drupal:install:site
All this task requires is a path to the tar file of the theme that you want to install. What I do is browse over to the list of Drupal themes, find one that I want to try out, and copy the location of the “Download” link for the correct theme. In Firefox and Safari its as simple as right clicking the link and selecting “Copy Link Location”. Make sure the version of the theme corresponds to the version of Drupal you have installed.
Once you’ve got the location to your theme copied, run the task with
cap drupal:install:theme. It will ask you for the path to the theme location which you can then paste in. That’s it. You should be able to browse to
admin/build/themes and see your newly installed theme.
Currently this task assumes that you want all your themes to be downloaded in
/var/www/drupal/sites/all/themes/. This is very easy to change in the capfile.
This is very similar to theme installation task and it just requires the path to the module you want installed. Again, browse to the list of modules find the one you want installed, copy its tar location and enter in the prompt after you run
This also assumes you want all your modules to be downloaded into
/var/www/drupal/sites/all/modules. Another easy change.
This task creates a new site and its database from parameters you can specify. It creates the necessary folder in the sites directory and creates the settings file with the correct database name, username, and password. One thing you might want to change here is my use of mysqli vs. mysql.
Besides the ones listed above, the other big assumption I make is that you have curl installed (an easy apt-get install curl in Debian). I’m using curl to grab the tar files from Drupal.org. I could have easily used wget, but I like curl better. Just a preference that you can easily change in the file if you don’t like it.
There you have it. Now installing a theme, module, or new site is only a
cap drupal:install away.
This really shouldn’t have been that hard, but it took quite a bit of searching and playing around to finally get this to work.
curl -O ftp://ftp.cac.washington.edu/imap/c-client.tar.Z
tar -xzvf c-client.tar.Z
sudo make oxp
sudo mkdir /usr/local/imap-2007h/lib
sudo mkdir /usr/local/imap-2007h/include
cp imap-2007a/*.h /usr/local/imap-2007a/include
cp imap-2007a/*.c /usr/local/imap-2007a/lib
cp c-client.a /usr/local/imap-2007a/lib/libc-client.a
When Apple built Leopard they forgot to include the MySQL header files, but were kind enough to offer them up for download at http://www.opensource.apple.com/darwinsource/other/. Download the MySQL binaries, untar and follow the instructions in the README. Its very simple.
Now that we have IMAP ready to go, and the required MySQL header files in place, we need to make sure we have openssl and iconv libraries installed. (Or, if you don’t want to use openssl or iconv you can omit them from your configuration) I already had them installed through macports, but you can compile them manually if you’re feeling like you want to further torture yourself during this process. With macports its a simple sudo port install openssl and libiconv.
When Apple compiled PHP on Leopard they were kind enough to leave behind the PHP source they compiled from in /SourceCache. So now we can…
sudo ./configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --disable-dependency-tracking --with-apxs2=/usr/sbin/apxs --with-ldap=/usr --with-kerberos=/usr --enable-cli --with-zlib-dir=/usr --enable-trans-sid --with-xml --enable-exif --enable-ftp --enable-mbstring --enable-mbregex --enable-dbx --enable-sockets --with-iodbc=/usr --with-curl=/usr --with-config-file-path=/etc --sysconfdir=/private/etc --with-mysql-sock=/var/mysql --with-mysqli=/usr/bin/mysql_config --with-mysql=/usr --with-iconv=shared,/opt/local --with-openssl=shared,/opt/local --with-xmlrpc --with-xsl=/usr --with-imap=/usr/local/imap-2007a --without-pear
sudo make install
sudo apachectl restart
That should be it. If you got errors during any part of that, all I can say is, I’m sorry. It worked for me. I’m posting several links I used to figure all this out that might help you if you run into any snags.
http://discussions.apple.com/thread.jspa?threadID=969019&tstart=0 http://discussions.apple.com/message.jspa?messageID=6112771 http://diymacserver.com/forum/topic/86 http://blog.phpdoc.info/archives/83-php-5.2.5-on-Leopard.html#extended