Apache Bundle Upgrade

Feb 11, 2008

The Apache bundle, which I originally contributed in the early days of TextMate, was due an upgrade. So I’ve made a few improvements…

Start, Stop, Restart and Graceful commands (⌘R)

These commands, which all target apachectl, are now bound to ⌘R under the source.apache-config scope which makes it more convenient to directly control httpd from TextMate. As apachectl requires sudo privileges I used applescript for authentication. For reasons only known to Apple the password request dialog would launch but not get focus - leaving you to reach for the mouse to target the input field. Moving away from the keyboard is slow so this was something that really annoyed me. I’ve now switched to using the excellent tm_dialog system which makes things much smoother. It is also possible to store your admin password in your Keychain, this is done by selecting the “Add to Keychain” toggle in the password request dialog box. I’m more than happy with the security implications of this as I’m fairly good at keeping my machines locked. If you do choose to do this then the command line security app will have access to the keychain item and is the only way someone could gain access.

Documentation (⌃H)

This now searches a documentation index file for the current word/selection then redirects or presents a list of matches as appropriate. If you appear to have the documentation installed locally then the script favours it over the apache website.

Open Include (⇧⌘D)

The language definition has been improved to add a scope for Includes. Using the key combination apple-shift-D on this scope opens the file referenced by the inlcude, or directory if it is wild carded.

Open Config… (⇧⌘C)

Previously there were various commands to open the apache.conf files these have now been consolidated into one command which searches the apache install directory, either /etc/apache2 or /private/etc/httpd depending on your version of OS X and the /users, /extra and /other subdirectories. All the conf files found are presented in pop-up from which one can be choosen to open.

Bundle Configuration

It is now possible to override the default bundle behaviour by setting the following environmental variables.

TM_APACHE_DIRECTORY
TM_APACHE_ACCESS_LOG
TM_APACHE_ERROR_LOG
TM_APACHE_MANUAL_URI

all allow the custom targeting of files and directories. See the bundle help for a detailed explanation.


Comments:

Dan - Sep 3, 2009

Hi, same problem here with apache2 installed via macports. Basically it woul be enough if conf-path and the path to apachectl were configurable. Cheers, Dan


Drew - Jun 4, 2009

Hi, I’m using this bundle with a custom install of Apache2. I like the config variables, but I cannot get it to fit my installation. Apache is installed in /usr/local/apache2/ with the following subdirs bin … conf … error … manual If I set TM_APACHE_DIRECTORY to /usr/local/apache2/ I cannot open the config files via the TM bundle. I also cannot use the apachectl command in the bundle, the built in Apache gets started/stopped instead. I currently use /usr/local/apache2/conf/ to allow the opening of the configs via the bundle menu. Is there any way to add a variable to assign the location of Apache config independently to the Apachectl binary? Sorry if this would be more appropriate to be posted elsewhere, thanks for the bundle. Drew