Fix gemfile generation 4.1

I used @neoeno commits and add some fixes for supporting both, 4.0 and 4.1 rails.

Fixes #130 and #129