use ruby script to construct dependency graph to build images in proper order