Press enter after choosing selection

Drupal Development Tricks

by ejk

Last week I was privileged to attend the drupal4lib camp at Darien Library. I was prepared to give a lightning talk on my development environment for drupal but we ran out of time. I thought I'd share a couple of tricks I've found here. Nothing earth shattering, but they've become very helpful to me in my day-to-day code monkeying.

1) Use SSHFS to access remote files

If you've ever tried modifying code on a server you know what a pain it can be to transfer the files from the machine you're working on to the remote machine. You can use an FTP client to pull copies to your local drive and push them back up after you're done. But that's a lot of extra clicks, especially when you're trying to track down a nit-pick bug. Some editors have built in support for remote access, like FTP, SFTP, etc. But there's usually a painful server configuration process where you have to enter your username and password, and then you're tied into the copy that's open in that editor. The programs you run on your own machine work best with files on your local drive, and SSHFS allows you to do exactly that. It allows you to connect to your server via SSH and map any directory to a local folder. You can then copy files to and from that directory with any program on your local machine.

Let's say I wanted to be able to access my home directory on a server called margo.aadl.org. First I need to create a local folder to hold the connection, I'll create it in my home directory

mkdir ~/margo_home

Now that I have the folder, I just initiate the connection using the sshfs command

sshfs ejk@margo.aadl.org: ~/margo_home

It'll prompt me for my password, then ta-da, I can browse my home directory on the server just like any other folder on my local machine. Plus, the entire connection is SSH encrypted so I don't need to worry about someone intercepting file transfers.

SSHFS is available for Linux, and as part of the MacFuse project for OS X.

2) Komodo Edit

I use ActiveState's Komodo Edit editor to write my PHP files. It's the free, open-source component of their larger Development Environment. One of the most helpful features of Komodo Edit is the code completion feature. If you start typing the characters of a variable or PHP function, a little drop-down menu will appear with the possible completions. This works with all PHP functions out of the box, but if you create a new komodo edit "Project" file in the root of your codebase, it'll autocomplete the custom functions defined in that code as well. What I do is create a new Komodo Edit Project file in the root of my drupal installation, and I can easily remember and autocomplete all of the drupal functions as well as any custom module functions I have created.

Another cool thing about Komodo Edit is that it is extensible like Firefox because it's built on the same foundation. ActiveState even has a hosted plugins library that you can browse and install from inside the program. My favorite plugin is the Komodo Source Tree, which puts a drop down list of all the current file's functions inside a pane, with easy double-click access.

Komodo Edit is available from ActiveState.com for all platforms.

Comments

Thank you for posting these; I was just looking for something similar to Source Tree for Komodo but sshfs is *definitely* something I'll be using.

Graphic for blog posts

Blog Post