diff --git a/Formula/ruby@1.9.rb b/Formula/ruby@1.9.rb index 601af1f492..4c4ebaca3a 100644 --- a/Formula/ruby@1.9.rb +++ b/Formula/ruby@1.9.rb @@ -3,7 +3,7 @@ class RubyAT19 < Formula homepage "https://www.ruby-lang.org/" url "https://cache.ruby-lang.org/pub/ruby/1.9/ruby-1.9.3-p551.tar.bz2" sha256 "b0c5e37e3431d58613a160504b39542ec687d473de1d4da983dabcf3c5de771e" - revision 7 + revision 8 bottle do sha256 "0aa012a4c8ae0dd20ff32f5b572e5a5af37a20de5667a82fa937ec0f3adac0f9" => :high_sierra @@ -28,8 +28,8 @@ class RubyAT19 < Formula # but a revision bump should not be forced every update # unless there are security fixes in that Rubygems release. resource "rubygems" do - url "https://rubygems.org/rubygems/rubygems-2.6.14.tgz" - sha256 "406a45d258707f52241843e9c7902bbdcf00e7edc3e88cdb79c46659b47851ec" + url "https://rubygems.org/rubygems/rubygems-2.7.4.tgz" + sha256 "bbe35ce6646e4168fcb1071d5f83b2d1154924f5150df0f5fca0f37d2583a182" end def program_suffix @@ -44,6 +44,10 @@ class RubyAT19 < Formula "1.9.1" end + def rubygems_bindir + HOMEBREW_PREFIX/"lib/ruby/gems/#{api_version}/bin" + end + def install args = %W[ --prefix=#{prefix} @@ -102,10 +106,24 @@ class RubyAT19 < Formula # Drop in the new version. rg_in.install Dir[buildpath/"vendor_gem/lib/*"] bin.install buildpath/"vendor_gem/bin/gem" => "gem#{program_suffix}" + (libexec/"gembin").install buildpath/"vendor_gem/bin/bundle" => "bundle#{program_suffix}" + (libexec/"gembin").install_symlink "bundle#{program_suffix}" => "bundler#{program_suffix}" end end def post_install + # Since Gem ships Bundle we want to provide that full/expected installation + # but to do so we need to handle the case where someone has previously + # installed bundle manually via `gem install`. + rm_f %W[ + #{rubygems_bindir}/bundle + #{rubygems_bindir}/bundle#{program_suffix} + #{rubygems_bindir}/bundler + #{rubygems_bindir}/bundler#{program_suffix} + ] + rm_rf Dir[HOMEBREW_PREFIX/"lib/ruby/gems/#{api_version}/gems/bundler-*"] + rubygems_bindir.install_symlink Dir[libexec/"gembin/*"] + # Customize rubygems to look/install in the global gem directory # instead of in the Cellar, making gems last across reinstalls config_file = lib/"ruby/#{api_version}/rubygems/defaults/operating_system.rb" @@ -116,13 +134,6 @@ class RubyAT19 < Formula %w[sitearchdir vendorarchdir].each do |dir| mkdir_p `#{ruby} -rrbconfig -e 'print RbConfig::CONFIG["#{dir}"]'` end - - # Create the version-specific bindir used by rubygems - mkdir_p rubygems_bindir - end - - def rubygems_bindir - "#{HOMEBREW_PREFIX}/lib/ruby/gems/#{api_version}/bin" end def rubygems_config; <<~EOS @@ -201,6 +212,14 @@ class RubyAT19 < Formula test do hello_text = shell_output("#{bin}/ruby#{program_suffix} -e 'puts :hello'") assert_equal "hello\n", hello_text - system "#{bin}/gem#{program_suffix}", "list", "--local" + ENV["GEM_HOME"] = testpath + system "#{bin}/gem#{program_suffix}", "install", "json" + + (testpath/"Gemfile").write <<~EOS + source 'https://rubygems.org' + gem 'gemoji' + EOS + system rubygems_bindir/"bundle#{program_suffix}", "install", "--binstubs=#{testpath}/bin" + assert_predicate testpath/"bin/gemoji", :exist?, "gemoji is not installed in #{testpath}/bin" end end