Category: Tools

  • Lindo testing helper gets some love

    Lindo helps you write and verify Rails functional and integration tests by opening the HTTP response body in the default browser for inspection. This can be a real time-saver when you’re trying to figure out why your assert_select or have_tag calls aren’t passing.

    In its initial version, Lindo assumed that your app was running at localhost:3000 (a fair assumption given the prevalence of Mongrel last year). Now that Passenger is on the scene, something better needed to be done. The reliance on a running app server was a disadvantage to begin with. Now Lindo doesn’t require anything to be running. It dumps the HTML to disk, fixes any relative asset URLs, and opens the file using your default browser.

    Once you’ve written your first test with the assistance of Lindo, you won’t want to go back!

    Lindo was developed by my company, Adeptware, and can be pulled from GitHub. I’ve also posted a brief introduction to Lindo and some basic installation instructions.

  • Auto timeout sessions in Rails

    Time Out!I released the initial version of my auto-session-timeout plugin for Rails at West End Ruby tonight.

    Have you ever wanted to force your users off your app if they go idle for a certain period of time? Many online banking sites use this technique. If your app is used on any kind of public computer system, this type of functionality is essential for maintaining the privacy of your data.

    After installing the plugin, a small snippet of JavaScript is placed on each page. The JS polls the server every minute to see if the session is still active. If the user has been idle for at least an hour, they are immediately redirected to a timeout page. The session will not timeout as long as the user keeps clicking around. The timeout and polling intervals are both configurable.

    The plugin is dead simple to install and configure. To get started:

    script/plugin install git://github.com/pelargir/auto-session-timeout.git
    

    Then hit the README for step-by-step instructions.

  • Where does TextMate store its bundles anyway?

    After spending nearly an hour tracking down where a particular TextMate bundle was coming from, I have surmised that there are no less than four places on my Mac’s hard drive where bundles may be lurking. In no particular order, they are:

    ~/Library/Application Support/TextMate/Pristine Copy/Bundles
    ~/Library/Application Support/TextMate/Bundles
    /Applications/TextMate.app/Contents/SharedSupport/Bundles
    /Library/Application Support/TextMate/Bundles
    
  • Brightkite is fun

    I’m really enjoying using Brightkite. It’s a location-based social networking tool that lets you see what other people in your vicinity are doing. A GPS unit isn’t required and it integrates fairly well with Twitter and GMaps. (I’d love to see even tighter Twitter integration in the future.) Drop a comment on this post if you want an invite.

  • Key_read/uudecode failed when pulling from git

    I began getting a strange error message from git earlier this week:

    key_read: uudecode (random SSH key junk here)
     ssh-rsa (more random SSH key junk here)
     failed
    

    The error message only showed up when I ran git pull. Google didn’t find much to help me, but acting on a hunch I removed the IP address of my git repo from my known hosts. The error immediately went away.

    If you’re getting the same message, determine the IP address or domain name of your git repo. Search for those values in your ~/.ssh/known_hosts file and remove them. You should be good to go after that.

  • Introducing the Lindo (response_visualizer) plugin for Rails

    Being at RubyConf this weekend has provided the necessary motivation for me to finally release a new Ruby gem I’ve been building. It’s an extraction from a project I’ve been working on for Relevance.

    I’m a regular user of assert_select in my functional tests. I find myself frequently doing something like this when the assertion is failing and I can’t figure out why:

    def test_something
      post :something
      raise @response.body.inspect
      assert_select "div[id=header]"
    end
    

    Inspecting the response body usually leads me to a solution, but it’s tedious parsing through the huge amount of HTML that gets returned, often in a semi-unreadable format. Enter the response_visualizer plugin (which has since been renamed Lindo):

    script/plugin install http://github.com/adeptware/lindo/
    

    Or clone the project directly:

    git clone http://github.com/adeptware/lindo/
    

    The plugin provides a vr method to your functional tests. When this method is called, the response body is automatically opened in the default browser allowing for easy visual inspection of the page’s content:

    post :new
    vr
    ...
    

    If you’d prefer to jump straight to the source code, passing the :html symbol will open the formatted HTML in the default text editor:

    post :new
    vr(:html)
    ...
    

    This has saved me a lot of time in figuring out why a specific assertion is failing. Instead of parsing through the HTML, I can view the entire page and immediately tell if something is missing or out of place. I find myself calling vr even before I write my assertions now.

    After installing, check out the README file for additional documentation. There is also a GitHub project if you’d like to contribute a patch or fork the code. Enjoy!

  • Deploying PHP apps with Capistrano

    Capistrano is a wonderful tool. I have this really old PHP-based web site, TolkienMovies.com, that I needed to make a change to earlier today. (The spam bots had finally found my news submission form.) I decided this was as good a time as any to automate deployment of the app. This article was very helpful. Staring at a task like this can be daunting, but once I actually got in there and started hacking it wasn’t half as bad as I thought it would be. And now I have a warm, fuzzy feeling knowing that deployment of this stinkin’ PHP app is only one “cap deploy” command away. Hallelujah.

  • SVN diffs from TextMate

    I picked up a neat TextMate trick while pair programming with Justin Gehtland on Monday. Check out a directory from a Subversion repository and open it in TextMate. Click on the root directory of the project and hold down Ctrl-Shift-A. A menu will appear allowing you to select from a number of SVN options, including adding and deleting from the repo, diffing files, and so on. Very nice, especially if you’d prefer not to jump to the command line for such actions.

  • Highrise is now taking leases

    37 Signals’ latest web application, Highrise, is now open for business. They offer a free account so you can try out the service without laying down any dinero. Looks like a useful tool. It’ll be interesting to see how tightly it integrates with Basecamp.

  • Fantastic Foxmarks

    Foxmarks LogoHave you wondered how to effectively synch bookmarks between work and home? I discovered the Foxmarks plugin for Firefox almost by accident last week and it does the trick for me. Better still, it’s fast and lightweight, the perfect companion for an agile developer.

    Foxmarks installs into Firefox in seconds. Once running, all we need to do is hit Command-Shift-S to synch our bookmarks with a remote server. Hop on to a second system, install the plugin again, and hit Command-Shift-S to download the bookmarks we just synched. End of story? Not quite. What if we add a different bookmark on both computers at the same time? Foxmarks is smart enough to handle merging both bookmarks the next time we synch.

    Foxmarks is a really wonderful tool and I highly recommend it. I no longer have to worry about my bookmarks getting out of synch between the computers that I work on. This has saved me a lot of time and angst.