diff --git a/configure.ac b/configure.ac index b035e1688a8461..6d91d764456e36 100644 --- a/configure.ac +++ b/configure.ac @@ -113,10 +113,9 @@ AC_ARG_WITH(git, { test x"$HAVE_GIT" = xyes && command -v "$GIT" > /dev/null && - # `git -C`: 1.8.5 - # `git log --no-show-signature`: 2.10.0 + # see Dependencies in doc/contributing/building_ruby.md AS_CASE([`$GIT -C . --version 2> /dev/null | sed 's/.* //'`], - [0.*|1.*|2.@<:@0-9@:>@.*], [false], + [0.*|1.*|2.@<:@0-9@:>@.*|2.@<:@12@:>@@<:@0-9@:>@.*|2.3@<:@01@:>@.*], [false], [true]) } || HAVE_GIT=no GIT=never-use AC_SUBST(GIT) diff --git a/lib/bundler/cli.rb b/lib/bundler/cli.rb index 8151de713ae1f7..0635260e95c2db 100644 --- a/lib/bundler/cli.rb +++ b/lib/bundler/cli.rb @@ -187,12 +187,11 @@ def check long_desc <<-D Removes the given gems from the Gemfile while ensuring that the resulting Gemfile is still valid. If the gem is not found, Bundler prints a error message and if gem could not be removed due to any reason Bundler will display a warning. D - method_option "install", type: :boolean, banner: "Runs 'bundle install' after removing the gems from the Gemfile" + method_option "install", type: :boolean, banner: "Runs 'bundle install' after removing the gems from the Gemfile (removed)" def remove(*gems) if ARGV.include?("--install") - message = "The `--install` flag has been deprecated. `bundle install` is triggered by default." removed_message = "The `--install` flag has been removed. `bundle install` is triggered by default." - SharedHelpers.major_deprecation(2, message, removed_message: removed_message) + raise InvalidOption, removed_message end require_relative "cli/remove" @@ -210,7 +209,7 @@ def remove(*gems) If the bundle has already been installed, bundler will tell you so and then exit. D - method_option "binstubs", type: :string, lazy_default: "bin", banner: "Generate bin stubs for bundled gems to ./bin" + method_option "binstubs", type: :string, lazy_default: "bin", banner: "Generate bin stubs for bundled gems to ./bin (removed)" method_option "clean", type: :boolean, banner: "Run bundle clean automatically after install (removed)" method_option "deployment", type: :boolean, banner: "Install using defaults tuned for deployment environments (removed)" method_option "frozen", type: :boolean, banner: "Do not allow the Gemfile.lock to be updated after this install (removed)" @@ -240,6 +239,11 @@ def install remembered_flag_deprecation("deployment", negative: true) + if ARGV.include?("--binstubs") + removed_message = "The --binstubs option has been removed in favor of `bundle binstubs --all`" + raise InvalidOption, removed_message + end + require_relative "cli/install" Bundler.settings.temporary(no_install: false) do Install.new(options.dup).run diff --git a/lib/bundler/cli/install.rb b/lib/bundler/cli/install.rb index c4063f808ab64f..57c28379e5f57d 100644 --- a/lib/bundler/cli/install.rb +++ b/lib/bundler/cli/install.rb @@ -38,12 +38,6 @@ def run Bundler::Fetcher.disable_endpoint = options["full-index"] - if options["binstubs"] - Bundler::SharedHelpers.major_deprecation 2, - "The --binstubs option will be removed in favor of `bundle binstubs --all`", - removed_message: "The --binstubs option have been removed in favor of `bundle binstubs --all`" - end - Plugin.gemfile_install(Bundler.default_gemfile) if Bundler.feature_flag.plugins? # For install we want to enable strict validation diff --git a/lib/bundler/man/bundle-install.1 b/lib/bundler/man/bundle-install.1 index 47e8858f732940..2d7ef96b4490fd 100644 --- a/lib/bundler/man/bundle-install.1 +++ b/lib/bundler/man/bundle-install.1 @@ -13,11 +13,6 @@ If a \fBGemfile\.lock\fR does exist, and you have not updated your Gemfile(5), B If a \fBGemfile\.lock\fR does exist, and you have updated your Gemfile(5), Bundler will use the dependencies in the \fBGemfile\.lock\fR for all gems that you did not update, but will re\-resolve the dependencies of gems that you did update\. You can find more information about this update process below under \fICONSERVATIVE UPDATING\fR\. .SH "OPTIONS" .TP -\fB\-\-binstubs[=BINSTUBS]\fR -Binstubs are scripts that wrap around executables\. Bundler creates a small Ruby file (a binstub) that loads Bundler, runs the command, and puts it in \fBbin/\fR\. This lets you link the binstub inside of an application to the exact gem version the application needs\. -.IP -Creates a directory (defaults to \fB~/bin\fR when the option is used without a value, or to the given \fB\fR directory otherwise) and places any executables from the gem there\. These executables run in Bundler's context\. If used, you might add this directory to your environment's \fBPATH\fR variable\. For instance, if the \fBrails\fR gem comes with a \fBrails\fR executable, this flag will create a \fBbin/rails\fR executable that ensures that all referred dependencies will be resolved using the bundled gems\. -.TP \fB\-\-force\fR, \fB\-\-redownload\fR Force reinstalling every gem, even if already installed\. .TP diff --git a/lib/bundler/man/bundle-install.1.ronn b/lib/bundler/man/bundle-install.1.ronn index c37ec1eeb41c4c..b946cbf8322917 100644 --- a/lib/bundler/man/bundle-install.1.ronn +++ b/lib/bundler/man/bundle-install.1.ronn @@ -35,20 +35,6 @@ update process below under [CONSERVATIVE UPDATING][]. ## OPTIONS -* `--binstubs[=BINSTUBS]`: - Binstubs are scripts that wrap around executables. Bundler creates a small Ruby - file (a binstub) that loads Bundler, runs the command, and puts it in `bin/`. - This lets you link the binstub inside of an application to the exact gem - version the application needs. - - Creates a directory (defaults to `~/bin` when the option is used without a - value, or to the given `` directory otherwise) and places any - executables from the gem there. These executables run in Bundler's context. If - used, you might add this directory to your environment's `PATH` variable. For - instance, if the `rails` gem comes with a `rails` executable, this flag will - create a `bin/rails` executable that ensures that all referred dependencies - will be resolved using the bundled gems. - * `--force`, `--redownload`: Force reinstalling every gem, even if already installed. diff --git a/lib/bundler/man/bundle-remove.1 b/lib/bundler/man/bundle-remove.1 index 63ffe0f1576e39..4dc7a03b9f5de2 100644 --- a/lib/bundler/man/bundle-remove.1 +++ b/lib/bundler/man/bundle-remove.1 @@ -4,18 +4,12 @@ .SH "NAME" \fBbundle\-remove\fR \- Removes gems from the Gemfile .SH "SYNOPSIS" -\fBbundle remove [GEM [GEM \|\.\|\.\|\.]] [\-\-install]\fR +`bundle remove [GEM [GEM \|\.\|\.\|\.]] .SH "DESCRIPTION" Removes the given gems from the Gemfile while ensuring that the resulting Gemfile is still valid\. If a gem cannot be removed, a warning is printed\. If a gem is already absent from the Gemfile, and error is raised\. -.SH "OPTIONS" -.TP -\fB\-\-install\fR -Runs \fBbundle install\fR after the given gems have been removed from the Gemfile, which ensures that both the lockfile and the installed gems on disk are also updated to remove the given gem(s)\. .P Example: .P bundle remove rails .P bundle remove rails rack -.P -bundle remove rails rack \-\-install diff --git a/lib/bundler/man/bundle-remove.1.ronn b/lib/bundler/man/bundle-remove.1.ronn index ceb1a980be1a2b..49cb4dc1fdde77 100644 --- a/lib/bundler/man/bundle-remove.1.ronn +++ b/lib/bundler/man/bundle-remove.1.ronn @@ -3,21 +3,14 @@ bundle-remove(1) -- Removes gems from the Gemfile ## SYNOPSIS -`bundle remove [GEM [GEM ...]] [--install]` +`bundle remove [GEM [GEM ...]] ## DESCRIPTION Removes the given gems from the Gemfile while ensuring that the resulting Gemfile is still valid. If a gem cannot be removed, a warning is printed. If a gem is already absent from the Gemfile, and error is raised. -## OPTIONS - -* `--install`: - Runs `bundle install` after the given gems have been removed from the Gemfile, which ensures that both the lockfile and the installed gems on disk are also updated to remove the given gem(s). - Example: bundle remove rails bundle remove rails rack - -bundle remove rails rack --install diff --git a/lib/rubygems/package.rb b/lib/rubygems/package.rb index a8eba81ea06f4a..cd8dfdf37d1a15 100644 --- a/lib/rubygems/package.rb +++ b/lib/rubygems/package.rb @@ -436,8 +436,6 @@ def extract_tar_gz(io, destination_dir, pattern = "*") # :nodoc: symlinks << [full_name, link_target, destination, real_destination] end - FileUtils.rm_rf destination - mkdir = if entry.directory? destination diff --git a/spec/bundler/commands/remove_spec.rb b/spec/bundler/commands/remove_spec.rb index 3e163461959cd1..8a2e6778eafd4c 100644 --- a/spec/bundler/commands/remove_spec.rb +++ b/spec/bundler/commands/remove_spec.rb @@ -43,21 +43,6 @@ end end - context "when --install flag is specified" do - it "removes gems from .bundle" do - gemfile <<-G - source "https://gem.repo1" - - gem "myrack" - G - - bundle "remove myrack --install" - - expect(out).to include("myrack was removed.") - expect(the_bundle).to_not include_gems "myrack" - end - end - describe "remove single gem from gemfile" do context "when gem is present in gemfile" do it "shows success for removed gem" do diff --git a/spec/bundler/other/major_deprecation_spec.rb b/spec/bundler/other/major_deprecation_spec.rb index e9d62bc3b87df5..1749d7e6827eaf 100644 --- a/spec/bundler/other/major_deprecation_spec.rb +++ b/spec/bundler/other/major_deprecation_spec.rb @@ -398,17 +398,15 @@ describe "bundle install --binstubs" do before do - install_gemfile <<-G, binstubs: true + install_gemfile <<-G, binstubs: true, raise_on_error: false source "https://gem.repo1" gem "myrack" G end - it "should output a deprecation warning" do - expect(deprecations).to include("The --binstubs option will be removed in favor of `bundle binstubs --all`") + it "fails with a helpful error" do + expect(err).to include("The --binstubs option has been removed in favor of `bundle binstubs --all`") end - - pending "fails with a helpful error", bundler: "4" end context "bundle install with both gems.rb and Gemfile present" do @@ -669,13 +667,11 @@ end context "with --install" do - it "shows a deprecation warning" do - bundle "remove myrack --install" + it "fails with a helpful message" do + bundle "remove myrack --install", raise_on_error: false - expect(err).to include "[DEPRECATED] The `--install` flag has been deprecated. `bundle install` is triggered by default." + expect(err).to include "The `--install` flag has been removed. `bundle install` is triggered by default." end - - pending "fails with a helpful message", bundler: "4" end end diff --git a/test/json/json_generic_object_test.rb b/test/json/json_generic_object_test.rb index 71d105976d0cfa..57e3bf3c52b232 100644 --- a/test/json/json_generic_object_test.rb +++ b/test/json/json_generic_object_test.rb @@ -15,8 +15,6 @@ def setup else omit("JSON::GenericObject is not available") end - rescue NameError - omit("JSON::GenericObject is not available") end def test_attributes diff --git a/tool/sync_default_gems.rb b/tool/sync_default_gems.rb index 35183bc706e7e0..366f64ddfcec9b 100755 --- a/tool/sync_default_gems.rb +++ b/tool/sync_default_gems.rb @@ -455,17 +455,16 @@ def message_filter(repo, sha, input: ARGF) end def log_format(format, args, &block) - IO.popen(%W[git log --no-show-signature --format=#{format}] + args, "rb", &block) + IO.popen(%W[git -c core.autocrlf=false -c core.eol=lf + log --no-show-signature --format=#{format}] + args, "rb", &block) end # Returns commit list as array of [commit_hash, subject]. def commits_in_ranges(gem, repo, default_branch, ranges) # If -a is given, discover all commits since the last picked commit if ranges == true - # \r? needed in the regex in case the commit has windows-style line endings (because e.g. we're running - # tests on Windows) - pattern = "https://github\.com/#{Regexp.quote(repo)}/commit/([0-9a-f]+)\r?$" - log = log_format('%B', %W"-E --grep=#{pattern} -n1", &:read) + pattern = "https://github\.com/#{Regexp.quote(repo)}/commit/([0-9a-f]+)$" + log = log_format('%B', %W"-E --grep=#{pattern} -n1 --", &:read) ranges = ["#{log[%r[#{pattern}\n\s*(?i:co-authored-by:.*)*\s*\Z], 1]}..#{gem}/#{default_branch}"] end diff --git a/tool/test/test_sync_default_gems.rb b/tool/test/test_sync_default_gems.rb index aa089f20687115..adbde66fbff132 100755 --- a/tool/test/test_sync_default_gems.rb +++ b/tool/test/test_sync_default_gems.rb @@ -99,7 +99,8 @@ def setup # Generate a new unprotected key with default parameters that # expires after 30 seconds. if @gpgsign = system(*%w"gpg --quiet --batch --passphrase", "", - "--quick-generate-key", email, *%W"default default seconds=#{expire}") + "--quick-generate-key", email, *%W"default default seconds=#{expire}", + err: IO::NULL) # Fetch the generated public key. signingkey = IO.popen(%W"gpg --quiet --list-public-key #{email}", &:read)[/^pub .*\n +\K\h+/] end @@ -313,5 +314,5 @@ def test_delete_after_conflict assert_equal(":ok\n""Should.be_merged\n", File.read("src/lib/common.rb"), out) assert_not_operator(File, :exist?, "src/lib/bad.rb", out) end - end + end if /darwin|linux/ =~ RUBY_PLATFORM end diff --git a/win32/Makefile.sub b/win32/Makefile.sub index 21bd57e760e534..917c407a006124 100644 --- a/win32/Makefile.sub +++ b/win32/Makefile.sub @@ -525,7 +525,8 @@ HAVE_GIT = no !if "$(HAVE_GIT)" == "no" !else if [for /f "tokens=3" %I in ('git --version') do @(\ for /f "delims=. tokens=1-2" %I in ("%I") do @(\ - if %I lss 2 (exit 1) else if %J lss 10 (exit 1) else (exit 0)\ + if %I lss 2 (exit 1) else if %I gtr 2 (exit 0) \ + else if %J lss 32 (exit 1) else (exit 0)\ )\ )] HAVE_GIT = no