Replace bash commands by ruby code