@matthewd I've been digging how rails puts strings into Gemfile and I don't see a right way how to escape single quotes.
The only way I came up with, is using another gsub:
```ruby
def quote(str)
  str.gsub!("'") { %q(\\\') }
  "'#{str}'"
end
```
But I must put `\\\'` (three backslashes) because after that, `replace!` method in Thor gem removes backslash `\\` [by using `gsub`](https://github.com/erikhuda/thor/blob/master/lib/thor/actions/inject_into_file.rb#L100). That mean we depends here from Thor behavior, which is not good. 
So, we are going to use `inspect` if a single quote is present.