gitignore everything inside a directory

There are many cases where it’s important to ignore all of the files inside a directory.  Generally, files such as uploads, logs, and caches should not be stored in your git repository. Lets say you want to ignore all of the files in your /logs directory. You can ignore the entire directory by adding this...

Using Capistrano to deploy Drupal (or other non-Rails) projects – step 1

Step 1: install RVM, Ruby 1.9.2 and Capistrano (or skip to step 2) These instructions will leave you with a single-user RVM installation. This works for me because I’m only deploying with one user. If you want more than one user to have access to RVM-installed Rubies on your server, you’ll need go the Multi-User...

Testing Rails 3 with Guard and Zeus

Zeus is a really great tool for speeding up development in Rails 3. It “preloads your Rails app so that your normal development tasks such as console, server, generate, and specs/tests take less than one second.” Guard responds to changes in your files, making it easy to automate tests. guard-zeus-client tells Guard to use Zeus...

An error occurred while installing libv8 – Mavericks

I upgraded to OS X Mavericks, and I’ve been seeing this error while bundling older Rails projects: Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension. ... Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/usr/include/c++/4.2.1 Unable to find a compiler officially supported by v8. It is recommended to use GCC v4.4 or higher Using compiler: g++ ... An error occurred...

Precompiling assets with Capistrano 3.0.1

For some reason Capistrano 3.0.1 runs rake assets:precompile instead of bundle exec rake assets:precompile. This may cause issues if you have multiple versions of gems installed on your server. I was running into this error. rake aborted! You have already activated rake 0.9.6, but your Gemfile requires rake 10.1.0. Using bundle exec may solve this....

RVM aliases

Problem: I recently upgraded RVM, and now every time I cd into a directory with a .rvmrc file that has ruby_string="ruby-1.9.3", I get this warning: ruby-1.9.3-p392 is not installed. To install do: 'rvm install ruby-1.9.3-p392' Unfortunately, I’m too busy to install the newer patch level Ruby right now. Solution: Create a RVM alias that points...

Use SSH agent forwarding to deploy via Capistrano

Setting up and maintaining deploy keys in github can be annoying. If you’re looking for a workaround, follow github’s instructions to deploy using your own personal SSH key. Moving forward, we’ll assume you’ve generated SSH keys on your local machine. Step 1: add a few lines to the ~/.ssh/config file on your local machine. We’re...

Serving @font-face fonts to Firefox from an S3 bucket

I’m building a Rails site that uses the excellent asset_sync gem to push my assets up to an S3 bucket on deploy, and I ran into an issue where @font-face fonts were rendering fine in all browsers except Firefox. After a little googling, I found that it’s an issue with Firefox’s “file uri origin” policy. http://stackoverflow.com/questions/2856502/css-font-face-not-working-with-firefox-but-working-with-chrome-and-ie http://stackoverflow.com/questions/5008944/how-to-add-an-access-control-allow-origin-header The...

Upgrading to Lion

I just upgraded to Lion and ran into a few issues trying to compile Ruby via RVM. Turns out you need to update Xcode and manually install the Command Line Tools. Makes sense, but I got hung up for a few minutes trying to figure out why it didn’t “just work.” UPDATE I also had...

import a gzipped database backup

I’ve been gunzipping my MySQL dumps before importing them.  This was always mildly annoying – especially when working on Drupal projects where the database seems to get passed around a lot. Today I found a more concise approach: use gzcat to read the contents of the gzipped file directly into your database like this: gzcat...

Setting up MCFileManager on Drupal 7 with Capistrano

I needed to install MCFileManager on a capified Drupal 7 project.  I followed these instructions, but changing the upload directory and getting things to work with Capistrano was slightly complicated.  Here are a few lessons I learned… 1. The filemanager module must be installed in /sites/all/modules I’ve been installing all contributed modules in /sites/all/modules/contrib, but this didn’t work...

Reindexing node types in Drupal 6

I’ve been reworking search functionality on a fairly large Drupal 6 installation.  Until recently, every time I changed what the search indexed for a custom module, I just went to /admin/settings/search and clicked ‘Re-index site’. This works on smaller websites, but when a website grows to have thousands and thousands of searchable nodes, re-running the...