From 79fa2c53edbae7692845594cc81a0185aa31f8cc Mon Sep 17 00:00:00 2001 From: Dominyk Tiller Date: Thu, 28 Dec 2017 13:45:29 +0000 Subject: [PATCH] ruby@2.2: update gem to 2.7.4 --- Formula/ruby@2.2.rb | 41 ++++++++++++++++++++++++++++++----------- 1 file changed, 30 insertions(+), 11 deletions(-) diff --git a/Formula/ruby@2.2.rb b/Formula/ruby@2.2.rb index 1a8d6538a3a..1ba99353c8c 100644 --- a/Formula/ruby@2.2.rb +++ b/Formula/ruby@2.2.rb @@ -3,7 +3,7 @@ class RubyAT22 < Formula homepage "https://www.ruby-lang.org/" url "https://cache.ruby-lang.org/pub/ruby/2.2/ruby-2.2.9.tar.xz" sha256 "313b44b1105589d00bb30b9cccf7da44d263fe20a2d8d269ada536d4a7ef285c" - revision 1 + revision 2 bottle do sha256 "bcde97f083584bd4d404c5304081fc542e39d7951df032060e3c9239db01fe80" => :high_sierra @@ -30,8 +30,8 @@ class RubyAT22 < 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 @@ -46,6 +46,10 @@ class RubyAT22 < Formula "2.2.0" end + def rubygems_bindir + HOMEBREW_PREFIX/"lib/ruby/gems/#{api_version}/bin" + end + def install args = %W[ --prefix=#{prefix} @@ -110,10 +114,24 @@ class RubyAT22 < 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" @@ -124,13 +142,6 @@ class RubyAT22 < 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 @@ -209,6 +220,14 @@ class RubyAT22 < 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