got it mostly working. needs to run one command outside of ruby