aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew/utils.rb
diff options
context:
space:
mode:
Diffstat (limited to 'Library/Homebrew/utils.rb')
-rw-r--r--Library/Homebrew/utils.rb27
1 files changed, 14 insertions, 13 deletions
diff --git a/Library/Homebrew/utils.rb b/Library/Homebrew/utils.rb
index 8d91c15c0..04d157262 100644
--- a/Library/Homebrew/utils.rb
+++ b/Library/Homebrew/utils.rb
@@ -151,7 +151,9 @@ def interactive_shell(f = nil)
end
module Homebrew
- def self._system(cmd, *args)
+ module_function
+
+ def _system(cmd, *args)
pid = fork do
yield if block_given?
args.collect!(&:to_s)
@@ -166,12 +168,12 @@ module Homebrew
$?.success?
end
- def self.system(cmd, *args)
+ def system(cmd, *args)
puts "#{cmd} #{args*" "}" if ARGV.verbose?
_system(cmd, *args)
end
- def self.core_tap_version_string
+ def core_tap_version_string
require "tap"
tap = CoreTap.instance
return "N/A" unless tap.installed?
@@ -183,7 +185,7 @@ module Homebrew
end
end
- def self.install_gem_setup_path!(name, version = nil, executable = name)
+ def install_gem_setup_path!(name, version = nil, executable = name)
# Respect user's preferences for where gems should be installed.
ENV["GEM_HOME"] = ENV["GEM_OLD_HOME"].to_s
ENV["GEM_HOME"] = Gem.user_dir if ENV["GEM_HOME"].empty?
@@ -218,20 +220,19 @@ module Homebrew
odie "Failed to install/update the '#{name}' gem." if exit_code.nonzero?
end
- unless which executable
- odie <<-EOS.undent
- The '#{name}' gem is installed but couldn't find '#{executable}' in the PATH:
- #{ENV["PATH"]}
- EOS
- end
+ return if which(executable)
+ odie <<-EOS.undent
+ The '#{name}' gem is installed but couldn't find '#{executable}' in the PATH:
+ #{ENV["PATH"]}
+ EOS
end
# Hash of Module => Set(method_names)
- @@injected_dump_stat_modules = {}
+ @injected_dump_stat_modules = {}
def inject_dump_stats!(the_module, pattern)
- @@injected_dump_stat_modules[the_module] ||= []
- injected_methods = @@injected_dump_stat_modules[the_module]
+ @injected_dump_stat_modules[the_module] ||= []
+ injected_methods = @injected_dump_stat_modules[the_module]
the_module.module_eval do
instance_methods.grep(pattern).each do |name|
next if injected_methods.include? name