Refactor gem sources switching scripts