Updating regex for Rails 4 compatibility

Replaces all ```^``` and ```$``` symbols with ```\A``` and ```\z```, respectively.

Also, minor Gemfile clean-up, and adding newlines to files missing them.