Manage your application's gem dependencies with less pain
Ruby
Latest commit 2b64972 Jul 26, 2016 @homu homu Auto merge of #4810 - NickLaMuro:fix_git_version_for_apple_git, r=seg…
…iddins

Removes OSX/msysgit strings from Bundler::Source::Git::GitProxy#version

Overview
--------

When running the previous version of `Bundler::Source::Git::GitProxy#version` output through `Gem::Version.create` when the git version is something like

    $ git --version
    git version 1.2.3 (Apple Git-22)

Ruby blows up with the error:

    ArgumentError:  Malformed version number string 1.2.3 (Apple Git-22)

The '(Apple Git-22)' and any additions that are added by `msysgit` (ex: `1.8.3.msysgit.0`) can be safely ignored as they are additions to the git version string for those specific versions, but should still line up with the core git version.

This regression was added in #4717, so this is not in a release of the gem yet, only in `1.13.0.rc1` installation.  This prevented:

* running tests on OSX or on any OS with a non-core git installation
* running `bundle install/update` with any git gem dependencies  in the Gemfile on OSX or any OS with a non-core git installation

This change simply regexps those version additions out, in addition to removing the `git version`, so only the version number (containing numbers or `.`s) will be parsed by this regexp.

Also, another method, `full_version` has been added to allow the `Bundler::Env` to report on the specific version of git being used, which is useful  when error reports are submitted.

Note about tests
----------------
The tests stub out any shell cmd and mocks a return value, which was easier to test the functionality of the regexp and requiring different git executable versions.  I also didn't add integration tests to address the regression caused by #4717, but simply tested that the versions parsed would work when sent through `Gem::Version.create`

This does mean I only tested a sample of git version types, so there might be something that I missed.  Also, the test for `full_version` working in reports was kinda jank, but it was the best I could do...

README.md

Version     Build Status Code Climate Inline docs

Bundler: a gem to bundle gems

Bundler makes sure Ruby applications run the same code on every machine.

It does this by managing the gems that the application depends on. Given a list of gems, it can automatically download and install those gems, as well as any other gems needed by the gems that are listed. Before installing gems, it checks the versions of every gem to make sure that they are compatible, and can all be loaded at the same time. After the gems have been installed, Bundler can help you update some or all of them when new versions become available. Finally, it records the exact versions that have been installed, so that others can install the exact same gems.

Installation and usage

gem install bundler
bundle init
echo 'gem "rspec"' >> Gemfile
bundle install
bundle exec rspec

See bundler.io for the full documentation.

Troubleshooting

For help with common problems, see ISSUES.

Other questions

To see what has changed in recent versions of Bundler, see the CHANGELOG.

Feel free to chat with the Bundler core team (and many other users) on IRC in the #bundler channel on Freenode, or via email on the Bundler mailing list.

Contributing

If you'd like to contribute to Bundler, that's awesome, and we <3 you. There's a guide to contributing to Bundler (both code and general help) over in DEVELOPMENT.

Code of Conduct

Everyone interacting in the Bundler project’s codebases, issue trackers, chat rooms, and mailing lists is expected to follow the Bundler code of conduct.