diff options
author | The Bundler Bot <bot@bundler.io> | 2017-08-01 14:57:28 +0000 |
---|---|---|
committer | The Bundler Bot <bot@bundler.io> | 2017-08-01 14:57:28 +0000 |
commit | f184adfc13089770b7a5579e6561a677f80dbadc (patch) | |
tree | 696d498648af2e6e449024eb6c2807d85184b8e5 /lib/bundler | |
parent | db82c57899d5057a8baabcdb7f53db9603a6505a (diff) | |
parent | 932732eb387e506248adcdcc9e078c9d7fc257ab (diff) | |
download | bundler-f184adfc13089770b7a5579e6561a677f80dbadc.tar.gz |
Auto merge of #5909 - koic:print_only_version_number, r=segiddins
[2.0] Print only version number from `bundler --version`
### What was the end-user problem that led to this PR?
(Fix #4706)
The behavior was different from [Bundler 2 RFC](https://github.com/bundler/rfcs/pull/6/files#diff-0579edc0374571613cd01f0a42c19bdaR38).
### What was your diagnosis of the problem?
When it is `bundler_2_mode`, it behaves as written in RFC.
### What is your fix for the problem, implemented in this PR?
This PR will switch `Bundler.feature_flag` using `bundler_2_mode`.
### Why did you choose this fix out of the possible options?
Since #4708 does not use `Bundler.feature_flag`, then compatibility with Bundler 1 will be lost.
In addition, this PR adds specs for Bundler 2.
Diffstat (limited to 'lib/bundler')
-rw-r--r-- | lib/bundler/cli.rb | 7 | ||||
-rw-r--r-- | lib/bundler/feature_flag.rb | 1 | ||||
-rw-r--r-- | lib/bundler/settings.rb | 1 |
3 files changed, 8 insertions, 1 deletions
diff --git a/lib/bundler/cli.rb b/lib/bundler/cli.rb index 31f5bb04c8..0d559a8f76 100644 --- a/lib/bundler/cli.rb +++ b/lib/bundler/cli.rb @@ -423,7 +423,12 @@ module Bundler if ARGV.include?("version") build_info = " (#{BuildMetadata.built_at} commit #{BuildMetadata.git_commit_sha})" end - Bundler.ui.info "Bundler version #{Bundler::VERSION}#{build_info}" + + if Bundler.feature_flag.print_only_version_number? + Bundler.ui.info "#{Bundler::VERSION}#{build_info}" + else + Bundler.ui.info "Bundler version #{Bundler::VERSION}#{build_info}" + end end map %w[-v --version] => :version diff --git a/lib/bundler/feature_flag.rb b/lib/bundler/feature_flag.rb index 67b89d89d3..39e2be978c 100644 --- a/lib/bundler/feature_flag.rb +++ b/lib/bundler/feature_flag.rb @@ -41,6 +41,7 @@ module Bundler settings_flag(:only_update_to_newer_versions) { bundler_2_mode? } settings_flag(:plugins) { @bundler_version >= Gem::Version.new("1.14") } settings_flag(:prefer_gems_rb) { bundler_2_mode? } + settings_flag(:print_only_version_number) { bundler_2_mode? } settings_flag(:setup_makes_kernel_gem_public) { !bundler_2_mode? } settings_flag(:skip_default_git_sources) { bundler_2_mode? } settings_flag(:specific_platform) { bundler_2_mode? } diff --git a/lib/bundler/settings.rb b/lib/bundler/settings.rb index 15168b42e4..fc59631608 100644 --- a/lib/bundler/settings.rb +++ b/lib/bundler/settings.rb @@ -42,6 +42,7 @@ module Bundler path.system plugins prefer_gems_rb + print_only_version_number setup_makes_kernel_gem_public silence_root_warning skip_default_git_sources |