using Compass during `grunt build` on Heroku with Strider CD

Long story short:

Environment plugin setup

First, I have to set the Gem install directory to path that can actually be written to by programs executed by Strider. I set the GEM_HOME environment variable to /tmp/gems using Strider’s environment plugin.

gem-heroku-strider-env

Custom Scripts plugin setup

Next, here’s the code to install and use compass used in the required phases of the build

Environment phase:

gem install compass

Prepare phase:

# add compass to the path
export PATH=$PATH:/tmp/gems/bin

optional lines for debugging:

# print the version number
compass -v
 
# show the compass binary's path 
which compass

gem-heroku-strider-scripts

Note that export PATH=$PATH:/tmp/gems/bin is above grunt build. Reverse the order and you’ll notice the grunt task can’t find compass on your machine since it isn’t added to the PATH variable util after the build fails.

rsync files from vagrant box to AWS server

I just transferred a directory full of audio files that I didn’t want to check into a project’s Git repository with this command:

 rsync -avz -e "ssh -i /home/vagrant/key.pem" ./source-directory user@host.ca:/home/user/destination-directory

notes:

  • key.pem is the same file I usually SSH into the host AWS server with
  • copy the key file from the Vagrant box’s host machine (my dev machine) into a non-shared directory in the Vagrant machine (/home/vagrant), and set the permissions on it to 0600, otherwise rsync complains that the key has the wrong permissions and the command does not work.
  • a flag means archive mode which preserves more properties of files and is recursive
  • v flag means verbose
  • z flag enables compression
  • e flag specifies the remote shell user to use (the usual user I SSH as). This is the most important flag to understand for my use case

more rsync info and more rsync examples