github/gitignore — pull request #834 by arcresu (2013-11-10 10:37:47+00:00)
Title: Unify approach to ruby environment normalisation

There is some disagreement on whether or not to version-control certain environment normalisation files in ruby projects. This is my understanding of the files and how they should be treated:

* `Gemfile.lock` is generated by [bundler](http://bundler.io) and locks the dependencies to a particular version so that all collaborators have the same version. It's relatively uncontroversial that this [should be checked in](http://bundler.io/v1.3/bundler_sharing.html), but it [should be ignored if the repo is for a gem](http://yehudakatz.com/2010/12/16/clarifying-the-roles-of-the-gemspec-and-gemfile/)
* `.ruby-version` is used (at least) by [rbenv](https://github.com/sstephenson/rbenv), [rbfu](https://github.com/hmans/rbfu), and [rvm](rvm.io) to normalise the ruby version. For the same reason as above, this is good practice to check in unless for gem development
* `.ruby-gemset` is used by rvm for similar reasons and should be treated the same
* `.rvmrc` is a shell script which is automatically run by rvm and typically sets ruby version and gemset but can also execute arbitrary code. For these reasons, [rvm versions](http://rvm.io/workflow/projects) since `1.11.0` [prefer](http://stackoverflow.com/questions/15708916/use-rvmrc-or-ruby-version-file-to-set-a-project-gemset-with-rvm) the declarative `.ruby-version` and `.ruby-gemset`. Hence `.rvmrc` is only relevant for older rvm versions or if a more complicated setup requiring shell scripting is used
* various other similar files exist such as rvm's `.versions.conf`, but these are probably uncommon enough not to bother addressing in the gitignore templates

Now rails projects are generally not gems and so should check in all but the last two of these items, but other ruby projects may or may not need to check them in. To cover this, I propose adding comments that contain the abridged version of this argument and check the files in by default.

This fixes #560 more permanently since it adds comments. It fixes #559, fixes #673, fixes #671 which each propose to ignore some or all of these files unconditionally.

It also tightens some of the other rules, but doesn't add or remove anything otherwise.