From 81db0e9551f213b6ddc94d7bbad1128cc8591a51 Mon Sep 17 00:00:00 2001 From: Jonathan Chang Date: Mon, 4 Nov 2019 21:00:20 +1100 Subject: [PATCH 1/2] dev-cmd: enable frozen string literals Now that we use Ruby 2.6 we can fix these last two files. --- Library/Homebrew/dev-cmd/bottle.rb | 12 +++++------- Library/Homebrew/dev-cmd/man.rb | 6 ++---- 2 files changed, 7 insertions(+), 11 deletions(-) diff --git a/Library/Homebrew/dev-cmd/bottle.rb b/Library/Homebrew/dev-cmd/bottle.rb index 485570c3a1..368fe15e86 100644 --- a/Library/Homebrew/dev-cmd/bottle.rb +++ b/Library/Homebrew/dev-cmd/bottle.rb @@ -1,6 +1,4 @@ -# Uses ERB so can't use Frozen String Literals until >=Ruby 2.4: -# https://bugs.ruby-lang.org/issues/12031 -# frozen_string_literal: false +# frozen_string_literal: true require "formula" require "utils/bottles" @@ -11,7 +9,7 @@ require "cli/parser" require "utils/inreplace" require "erb" -BOTTLE_ERB = <<-EOS.freeze +BOTTLE_ERB = <<-EOS bottle do <% if !root_url.start_with?(HOMEBREW_BOTTLE_DEFAULT_DOMAIN) %> root_url "<%= root_url %>" @@ -43,7 +41,7 @@ module Homebrew def bottle_args Homebrew::CLI::Parser.new do - usage_banner <<~EOS.freeze + usage_banner <<~EOS `bottle` [] Generate a bottle (binary package) from a formula that was installed with @@ -382,7 +380,7 @@ module Homebrew "#{key}: old: #{old_value}, new: #{value}" end - odie <<~EOS.freeze + odie <<~EOS --keep-old was passed but there are changes in: #{mismatches.join("\n")} EOS @@ -493,7 +491,7 @@ module Homebrew end unless mismatches.empty? - odie <<~EOS.freeze + odie <<~EOS --keep-old was passed but there are changes in: #{mismatches.join("\n")} EOS diff --git a/Library/Homebrew/dev-cmd/man.rb b/Library/Homebrew/dev-cmd/man.rb index 8122c594ef..e453cc2ffb 100644 --- a/Library/Homebrew/dev-cmd/man.rb +++ b/Library/Homebrew/dev-cmd/man.rb @@ -1,6 +1,4 @@ -# Uses ERB so can't use Frozen String Literals until >=Ruby 2.4: -# https://bugs.ruby-lang.org/issues/12031 -# frozen_string_literal: false +# frozen_string_literal: true require "formula" require "erb" @@ -18,7 +16,7 @@ module Homebrew def man_args Homebrew::CLI::Parser.new do - usage_banner <<~EOS.freeze + usage_banner <<~EOS `man` [] Generate Homebrew's manpages. From d76c7f238080381259c98f1188126157b1f9b8cf Mon Sep 17 00:00:00 2001 From: Jonathan Chang Date: Mon, 4 Nov 2019 21:06:27 +1100 Subject: [PATCH 2/2] brew.rb: update Ruby version check --- Library/Homebrew/brew.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Library/Homebrew/brew.rb b/Library/Homebrew/brew.rb index e29bc89cfa..11dd3ff30b 100644 --- a/Library/Homebrew/brew.rb +++ b/Library/Homebrew/brew.rb @@ -6,8 +6,8 @@ std_trap = trap("INT") { exit! 130 } # no backtrace thanks # check ruby version before requiring any modules. RUBY_X, RUBY_Y, = RUBY_VERSION.split(".").map(&:to_i) -if RUBY_X < 2 || (RUBY_X == 2 && RUBY_Y < 3) - raise "Homebrew must be run under Ruby 2.3! You're running #{RUBY_VERSION}." +if RUBY_X < 2 || (RUBY_X == 2 && RUBY_Y < 6) + raise "Homebrew must be run under Ruby 2.6! You're running #{RUBY_VERSION}." end # Load Bundler first of all if it's needed to avoid Gem version conflicts.