Refactor theme name calculation and add a switch themes script

These two commits do the following:

* Make the calculation of theme name from theme URL consistent
* Factor out the calculation of theme name from theme URL into a function
* Add tests for that function
* Add a switch-theme.rb script which may be useful for local development