Fix issue9098 clean path
Created by: jdsn
Namespace.clean_path removed the last character from generated usernames. This is fixed along with two other changes to drop all trailing dots and all leading dashes (which is what the code most likely should have done).
Due to the ordering of the gsub statements the test in spec/models/namespace_spec.rb:93
was successful, but only because the filtering for valid characters was done after dropping the last character.