fix(directory_cache): put commands inside of if statement

Any commands inside of an `if' block needs to be called on the argument
that is passed to the block, otherwise they appear before the if block.
This is because `if' yields self as part of being created, see
lib/travis/build/shell/node.rb:43, and so the block is called when the
node is initialized, but adding itself to the parent node of the if
statement instead of as children of the if statement.

This caused the bug in travis-ci/travis-worker#90.