From e517e2e41d2166d967a5ca8a71d4e178804a360c Mon Sep 17 00:00:00 2001 From: Martin Afanasjew Date: Thu, 26 May 2016 16:27:53 +0200 Subject: [PATCH] utils: avoid using 'gem' as an identifier (#278) Avoid breaking code highlighting of some editors (e.g. Sublime Text) when `gem` is used as an identifier. This messes up the highlighting below the first use and makes working with the file rather annoying. --- Library/Homebrew/utils.rb | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/Library/Homebrew/utils.rb b/Library/Homebrew/utils.rb index 6502d5070f..caa1a87e2d 100644 --- a/Library/Homebrew/utils.rb +++ b/Library/Homebrew/utils.rb @@ -242,7 +242,7 @@ module Homebrew end end - def self.install_gem_setup_path!(gem, version = nil, executable = gem) + def self.install_gem_setup_path!(name, version = nil, executable = name) require "rubygems" # Add Gem binary directory and (if missing) Ruby binary directory to PATH. @@ -251,9 +251,9 @@ module Homebrew path.unshift("#{Gem.user_dir}/bin") ENV["PATH"] = path.join(File::PATH_SEPARATOR) - if Gem::Specification.find_all_by_name(gem, version).empty? - ohai "Installing or updating '#{gem}' gem" - install_args = %W[--no-ri --no-rdoc --user-install #{gem}] + if Gem::Specification.find_all_by_name(name, version).empty? + ohai "Installing or updating '#{name}' gem" + install_args = %W[--no-ri --no-rdoc --user-install #{name}] install_args << "--version" << version if version # Do `gem install [...]` without having to spawn a separate process or @@ -267,12 +267,12 @@ module Homebrew rescue Gem::SystemExitException => e exit_code = e.exit_code end - odie "Failed to install/update the '#{gem}' gem." if exit_code != 0 + odie "Failed to install/update the '#{name}' gem." if exit_code != 0 end unless which executable odie <<-EOS.undent - The '#{gem}' gem is installed but couldn't find '#{executable}' in the PATH: + The '#{name}' gem is installed but couldn't find '#{executable}' in the PATH: #{ENV["PATH"]} EOS end