Only run blocks if needed

ruby blocks will always run and are not aware if file operations
actually changed anything or not.

Use not_if and some grep to decide if we need to run at all.