diff options
| author | Markus Reiter | 2016-09-26 01:44:51 +0200 | 
|---|---|---|
| committer | Markus Reiter | 2016-10-02 00:24:47 +0200 | 
| commit | 0ab750bf24dac2cb411d76c05a0edb9b1f1b9333 (patch) | |
| tree | b442b10ea2d0a02fb1c90c59d64c953affc14b0e /Library/Homebrew/cmd | |
| parent | fa14c262454c2678ca9c8a1caa2f0080833ac67a (diff) | |
| download | brew-0ab750bf24dac2cb411d76c05a0edb9b1f1b9333.tar.bz2 | |
Use `module_function` for commands.
Diffstat (limited to 'Library/Homebrew/cmd')
54 files changed, 127 insertions, 20 deletions
| diff --git a/Library/Homebrew/cmd/--cache.rb b/Library/Homebrew/cmd/--cache.rb index d73d0cce1..2c407cefe 100644 --- a/Library/Homebrew/cmd/--cache.rb +++ b/Library/Homebrew/cmd/--cache.rb @@ -7,6 +7,8 @@  require "cmd/fetch"  module Homebrew +  module_function +    def __cache      if ARGV.named.empty?        puts HOMEBREW_CACHE diff --git a/Library/Homebrew/cmd/--cellar.rb b/Library/Homebrew/cmd/--cellar.rb index e1c641ce1..f35847ead 100644 --- a/Library/Homebrew/cmd/--cellar.rb +++ b/Library/Homebrew/cmd/--cellar.rb @@ -7,6 +7,8 @@  #:    without any sort of versioned directory as the last path.  module Homebrew +  module_function +    def __cellar      if ARGV.named.empty?        puts HOMEBREW_CELLAR diff --git a/Library/Homebrew/cmd/--env.rb b/Library/Homebrew/cmd/--env.rb index 0feb338dc..323964dad 100644 --- a/Library/Homebrew/cmd/--env.rb +++ b/Library/Homebrew/cmd/--env.rb @@ -6,6 +6,8 @@ require "build_environment"  require "utils/shell"  module Homebrew +  module_function +    def __env      ENV.activate_extensions!      ENV.deps = ARGV.formulae if superenv? diff --git a/Library/Homebrew/cmd/--prefix.rb b/Library/Homebrew/cmd/--prefix.rb index 07b43693c..c59830833 100644 --- a/Library/Homebrew/cmd/--prefix.rb +++ b/Library/Homebrew/cmd/--prefix.rb @@ -5,6 +5,8 @@  #:    Display the location in the cellar where <formula> is or would be installed.  module Homebrew +  module_function +    def __prefix      if ARGV.named.empty?        puts HOMEBREW_PREFIX diff --git a/Library/Homebrew/cmd/--repository.rb b/Library/Homebrew/cmd/--repository.rb index b3ad8367a..7a25aba1c 100644 --- a/Library/Homebrew/cmd/--repository.rb +++ b/Library/Homebrew/cmd/--repository.rb @@ -8,6 +8,8 @@  require "tap"  module Homebrew +  module_function +    def __repository      if ARGV.named.empty?        puts HOMEBREW_REPOSITORY diff --git a/Library/Homebrew/cmd/--version.rb b/Library/Homebrew/cmd/--version.rb index 9a571abe1..736048341 100644 --- a/Library/Homebrew/cmd/--version.rb +++ b/Library/Homebrew/cmd/--version.rb @@ -2,6 +2,8 @@  #:    Print the version number of Homebrew to standard output and exit.  module Homebrew +  module_function +    def __version      # As a special case, `--version` is implemented directly in `brew.rb`. This      # file merely serves as a container for the documentation. It also catches diff --git a/Library/Homebrew/cmd/analytics.rb b/Library/Homebrew/cmd/analytics.rb index 649c53710..2efa5a2d2 100644 --- a/Library/Homebrew/cmd/analytics.rb +++ b/Library/Homebrew/cmd/analytics.rb @@ -9,6 +9,8 @@  #:    Regenerate UUID used in Homebrew's analytics.  module Homebrew +  module_function +    def analytics      config_file = HOMEBREW_REPOSITORY/".git/config" diff --git a/Library/Homebrew/cmd/cat.rb b/Library/Homebrew/cmd/cat.rb index a2fbd2f00..7439869d3 100644 --- a/Library/Homebrew/cmd/cat.rb +++ b/Library/Homebrew/cmd/cat.rb @@ -2,6 +2,8 @@  #:    Display the source to <formula>.  module Homebrew +  module_function +    def cat      # do not "fix" this to support multiple arguments, the output would be      # unparsable, if the user wants to cat multiple formula they can call diff --git a/Library/Homebrew/cmd/cleanup.rb b/Library/Homebrew/cmd/cleanup.rb index 6e0915c9a..5b46e0872 100644 --- a/Library/Homebrew/cmd/cleanup.rb +++ b/Library/Homebrew/cmd/cleanup.rb @@ -15,6 +15,8 @@ require "cleanup"  require "utils"  module Homebrew +  module_function +    def cleanup      if ARGV.named.empty?        Cleanup.cleanup diff --git a/Library/Homebrew/cmd/command.rb b/Library/Homebrew/cmd/command.rb index b76468f62..39e8ba6fc 100644 --- a/Library/Homebrew/cmd/command.rb +++ b/Library/Homebrew/cmd/command.rb @@ -4,6 +4,8 @@  require "commands"  module Homebrew +  module_function +    def command      abort "This command requires a command argument" if ARGV.empty?      cmd = ARGV.first diff --git a/Library/Homebrew/cmd/commands.rb b/Library/Homebrew/cmd/commands.rb index 4fad764ca..34f0b14e9 100644 --- a/Library/Homebrew/cmd/commands.rb +++ b/Library/Homebrew/cmd/commands.rb @@ -5,6 +5,8 @@  #:    With `--include-aliases`, the aliases of internal commands will be included.  module Homebrew +  module_function +    def commands      if ARGV.include? "--quiet"        cmds = internal_commands + external_commands @@ -48,11 +50,10 @@ module Homebrew      end.sort    end -  private -    def find_internal_commands(directory)      directory.children.each_with_object([]) do |f, cmds|        cmds << f.basename.to_s.sub(/\.(?:rb|sh)$/, "") if f.file?      end    end +  private_class_method :find_internal_commands  end diff --git a/Library/Homebrew/cmd/config.rb b/Library/Homebrew/cmd/config.rb index b5f2502b0..daaa51f32 100644 --- a/Library/Homebrew/cmd/config.rb +++ b/Library/Homebrew/cmd/config.rb @@ -6,6 +6,8 @@  require "system_config"  module Homebrew +  module_function +    def config      SystemConfig.dump_verbose_config    end diff --git a/Library/Homebrew/cmd/deps.rb b/Library/Homebrew/cmd/deps.rb index acaf922d7..a5089392f 100644 --- a/Library/Homebrew/cmd/deps.rb +++ b/Library/Homebrew/cmd/deps.rb @@ -42,6 +42,8 @@ require "formula"  require "ostruct"  module Homebrew +  module_function +    def deps      mode = OpenStruct.new(        installed?: ARGV.include?("--installed"), diff --git a/Library/Homebrew/cmd/desc.rb b/Library/Homebrew/cmd/desc.rb index 9bb737e40..3ef02288b 100644 --- a/Library/Homebrew/cmd/desc.rb +++ b/Library/Homebrew/cmd/desc.rb @@ -12,6 +12,8 @@ require "descriptions"  require "cmd/search"  module Homebrew +  module_function +    def desc      search_type = []      search_type << :either if ARGV.flag? "--search" diff --git a/Library/Homebrew/cmd/diy.rb b/Library/Homebrew/cmd/diy.rb index 95ec7fe35..a8f6440df 100644 --- a/Library/Homebrew/cmd/diy.rb +++ b/Library/Homebrew/cmd/diy.rb @@ -11,6 +11,8 @@  require "formula"  module Homebrew +  module_function +    def diy      path = Pathname.getwd diff --git a/Library/Homebrew/cmd/doctor.rb b/Library/Homebrew/cmd/doctor.rb index 89f32dc25..df4bba419 100644 --- a/Library/Homebrew/cmd/doctor.rb +++ b/Library/Homebrew/cmd/doctor.rb @@ -8,6 +8,8 @@  require "diagnostic"  module Homebrew +  module_function +    def doctor      inject_dump_stats!(Diagnostic::Checks, /^check_*/) if ARGV.switch? "D" diff --git a/Library/Homebrew/cmd/fetch.rb b/Library/Homebrew/cmd/fetch.rb index 9c42eda23..f42f140a5 100644 --- a/Library/Homebrew/cmd/fetch.rb +++ b/Library/Homebrew/cmd/fetch.rb @@ -24,6 +24,8 @@  require "formula"  module Homebrew +  module_function +    def fetch      raise FormulaUnspecifiedError if ARGV.named.empty? @@ -93,8 +95,6 @@ module Homebrew      opoo "Patch reports different #{e.hash_type}: #{e.expected}"    end -  private -    def retry_fetch?(f)      @fetch_failed ||= Set.new      if ARGV.include?("--retry") && @fetch_failed.add?(f) @@ -106,6 +106,7 @@ module Homebrew        false      end    end +  private_class_method :retry_fetch?    def fetch_fetchable(f)      f.clear_cache if ARGV.force? @@ -126,4 +127,5 @@ module Homebrew      f.verify_download_integrity(download)    end +  private_class_method :fetch_fetchable  end diff --git a/Library/Homebrew/cmd/gist-logs.rb b/Library/Homebrew/cmd/gist-logs.rb index 200ad9fb5..e55eefc17 100644 --- a/Library/Homebrew/cmd/gist-logs.rb +++ b/Library/Homebrew/cmd/gist-logs.rb @@ -15,6 +15,8 @@ require "stringio"  require "socket"  module Homebrew +  module_function +    def gistify_logs(f)      files = load_logs(f.logs)      build_time = f.logs.ctime diff --git a/Library/Homebrew/cmd/help.rb b/Library/Homebrew/cmd/help.rb index 2a814b90b..c533885ad 100644 --- a/Library/Homebrew/cmd/help.rb +++ b/Library/Homebrew/cmd/help.rb @@ -34,6 +34,8 @@ EOS  require "commands"  module Homebrew +  module_function +    def help(cmd = nil, flags = {})      # Resolve command aliases and find file containing the implementation.      if cmd @@ -69,8 +71,6 @@ module Homebrew      exit 0    end -  private -    def command_help(path)      help_lines = path.read.lines.grep(/^#:/)      if help_lines.empty? @@ -86,4 +86,5 @@ module Homebrew        end.join.strip      end    end +  private_class_method :command_help  end diff --git a/Library/Homebrew/cmd/home.rb b/Library/Homebrew/cmd/home.rb index 0c3009545..50f3936e8 100644 --- a/Library/Homebrew/cmd/home.rb +++ b/Library/Homebrew/cmd/home.rb @@ -5,6 +5,8 @@  #:    Open <formula>'s homepage in a browser.  module Homebrew +  module_function +    def home      if ARGV.named.empty?        exec_browser HOMEBREW_WWW diff --git a/Library/Homebrew/cmd/info.rb b/Library/Homebrew/cmd/info.rb index 6f242039c..857f1090e 100644 --- a/Library/Homebrew/cmd/info.rb +++ b/Library/Homebrew/cmd/info.rb @@ -25,6 +25,8 @@ require "tab"  require "utils/json"  module Homebrew +  module_function +    def info      # eventually we'll solidify an API, but we'll keep old versions      # awhile around for compatibility diff --git a/Library/Homebrew/cmd/install.rb b/Library/Homebrew/cmd/install.rb index 8a8323252..328df07ce 100644 --- a/Library/Homebrew/cmd/install.rb +++ b/Library/Homebrew/cmd/install.rb @@ -64,6 +64,8 @@ require "hardware"  require "development_tools"  module Homebrew +  module_function +    def install      raise FormulaUnspecifiedError if ARGV.named.empty? diff --git a/Library/Homebrew/cmd/irb.rb b/Library/Homebrew/cmd/irb.rb index 1db0855bb..d162e3f4a 100644 --- a/Library/Homebrew/cmd/irb.rb +++ b/Library/Homebrew/cmd/irb.rb @@ -19,6 +19,8 @@ class String  end  module Homebrew +  module_function +    def irb      if ARGV.include? "--examples"        puts "'v8'.f # => instance of the v8 formula" diff --git a/Library/Homebrew/cmd/leaves.rb b/Library/Homebrew/cmd/leaves.rb index 37e379d49..4038aee4c 100644 --- a/Library/Homebrew/cmd/leaves.rb +++ b/Library/Homebrew/cmd/leaves.rb @@ -6,6 +6,8 @@ require "tab"  require "set"  module Homebrew +  module_function +    def leaves      installed = Formula.installed      deps_of_installed = Set.new diff --git a/Library/Homebrew/cmd/link.rb b/Library/Homebrew/cmd/link.rb index 6486e6f18..a8612865b 100644 --- a/Library/Homebrew/cmd/link.rb +++ b/Library/Homebrew/cmd/link.rb @@ -15,6 +15,8 @@  require "ostruct"  module Homebrew +  module_function +    def link      raise KegUnspecifiedError if ARGV.named.empty? @@ -71,11 +73,10 @@ module Homebrew      end    end -  private -    def keg_only?(rack)      Formulary.from_rack(rack).keg_only?    rescue FormulaUnavailableError, TapFormulaAmbiguityError, TapFormulaWithOldnameAmbiguityError      false    end +  private_class_method :keg_only?  end diff --git a/Library/Homebrew/cmd/linkapps.rb b/Library/Homebrew/cmd/linkapps.rb index c7685855f..4f46362cc 100644 --- a/Library/Homebrew/cmd/linkapps.rb +++ b/Library/Homebrew/cmd/linkapps.rb @@ -11,6 +11,8 @@ require "keg"  require "formula"  module Homebrew +  module_function +    def linkapps      target_dir = linkapps_target(local: ARGV.include?("--local")) @@ -55,10 +57,9 @@ module Homebrew      end    end -  private -    def linkapps_target(opts = {})      local = opts.fetch(:local, false)      Pathname.new(local ? "~/Applications" : "/Applications").expand_path    end +  private_class_method :linkapps_target  end diff --git a/Library/Homebrew/cmd/list.rb b/Library/Homebrew/cmd/list.rb index d2eebb5f1..b6bee87fb 100644 --- a/Library/Homebrew/cmd/list.rb +++ b/Library/Homebrew/cmd/list.rb @@ -22,6 +22,8 @@ require "metafiles"  require "formula"  module Homebrew +  module_function +    def list      # Use of exec means we don't explicitly exit      list_unbrewed if ARGV.flag? "--unbrewed" @@ -58,8 +60,6 @@ module Homebrew      end    end -  private -    UNBREWED_EXCLUDE_FILES = %w[.DS_Store].freeze    UNBREWED_EXCLUDE_PATHS = %w[      .github/* @@ -101,6 +101,7 @@ module Homebrew      cd HOMEBREW_PREFIX      exec "find", *args    end +  private_class_method :list_unbrewed    def filtered_list      names = if ARGV.named.empty? @@ -127,6 +128,7 @@ module Homebrew        end      end    end +  private_class_method :filtered_list  end  class PrettyListing diff --git a/Library/Homebrew/cmd/log.rb b/Library/Homebrew/cmd/log.rb index 9492c1e1e..734460e88 100644 --- a/Library/Homebrew/cmd/log.rb +++ b/Library/Homebrew/cmd/log.rb @@ -5,6 +5,8 @@  require "formula"  module Homebrew +  module_function +    def log      if ARGV.named.empty?        cd HOMEBREW_REPOSITORY @@ -16,8 +18,6 @@ module Homebrew      end    end -  private -    def git_log(path = nil)      if File.exist? "#{`git rev-parse --show-toplevel`.chomp}/.git/shallow"        opoo <<-EOS.undent @@ -29,4 +29,5 @@ module Homebrew      args += ["--", path] unless path.nil?      exec "git", "log", *args    end +  private_class_method :git_log  end diff --git a/Library/Homebrew/cmd/migrate.rb b/Library/Homebrew/cmd/migrate.rb index 27ca5261f..2726b1480 100644 --- a/Library/Homebrew/cmd/migrate.rb +++ b/Library/Homebrew/cmd/migrate.rb @@ -8,6 +8,8 @@  require "migrator"  module Homebrew +  module_function +    def migrate      raise FormulaUnspecifiedError if ARGV.named.empty? diff --git a/Library/Homebrew/cmd/missing.rb b/Library/Homebrew/cmd/missing.rb index bbd514223..525461108 100644 --- a/Library/Homebrew/cmd/missing.rb +++ b/Library/Homebrew/cmd/missing.rb @@ -7,6 +7,8 @@ require "tab"  require "diagnostic"  module Homebrew +  module_function +    def missing      return unless HOMEBREW_CELLAR.exist? diff --git a/Library/Homebrew/cmd/options.rb b/Library/Homebrew/cmd/options.rb index 690acd016..843d3a1ee 100644 --- a/Library/Homebrew/cmd/options.rb +++ b/Library/Homebrew/cmd/options.rb @@ -12,6 +12,8 @@ require "formula"  require "options"  module Homebrew +  module_function +    def options      if ARGV.include? "--all"        puts_options Formula.to_a diff --git a/Library/Homebrew/cmd/outdated.rb b/Library/Homebrew/cmd/outdated.rb index a6fa1f003..5dc77857e 100644 --- a/Library/Homebrew/cmd/outdated.rb +++ b/Library/Homebrew/cmd/outdated.rb @@ -21,6 +21,8 @@ require "formula"  require "keg"  module Homebrew +  module_function +    def outdated      formulae = if ARGV.resolved_formulae.empty?        Formula.installed diff --git a/Library/Homebrew/cmd/pin.rb b/Library/Homebrew/cmd/pin.rb index a54ef6e7b..c5087f6d4 100644 --- a/Library/Homebrew/cmd/pin.rb +++ b/Library/Homebrew/cmd/pin.rb @@ -5,6 +5,8 @@  require "formula"  module Homebrew +  module_function +    def pin      raise FormulaUnspecifiedError if ARGV.named.empty? diff --git a/Library/Homebrew/cmd/postinstall.rb b/Library/Homebrew/cmd/postinstall.rb index e0bd8e31b..1e205e65d 100644 --- a/Library/Homebrew/cmd/postinstall.rb +++ b/Library/Homebrew/cmd/postinstall.rb @@ -4,6 +4,8 @@  require "sandbox"  module Homebrew +  module_function +    def postinstall      ARGV.resolved_formulae.each { |f| run_post_install(f) if f.post_install_defined? }    end diff --git a/Library/Homebrew/cmd/prune.rb b/Library/Homebrew/cmd/prune.rb index 83979064a..e2e6d77b8 100644 --- a/Library/Homebrew/cmd/prune.rb +++ b/Library/Homebrew/cmd/prune.rb @@ -12,6 +12,8 @@ require "cmd/tap"  require "cmd/unlinkapps"  module Homebrew +  module_function +    def prune      ObserverPathnameExtension.reset_counts! diff --git a/Library/Homebrew/cmd/readall.rb b/Library/Homebrew/cmd/readall.rb index e77e68865..7c1a085c9 100644 --- a/Library/Homebrew/cmd/readall.rb +++ b/Library/Homebrew/cmd/readall.rb @@ -9,6 +9,8 @@  require "readall"  module Homebrew +  module_function +    def readall      if ARGV.include?("--syntax")        ruby_files = [] diff --git a/Library/Homebrew/cmd/reinstall.rb b/Library/Homebrew/cmd/reinstall.rb index bda6022bf..618835d74 100644 --- a/Library/Homebrew/cmd/reinstall.rb +++ b/Library/Homebrew/cmd/reinstall.rb @@ -5,6 +5,8 @@ require "formula_installer"  require "development_tools"  module Homebrew +  module_function +    def reinstall      FormulaInstaller.prevent_build_flags unless DevelopmentTools.installed? diff --git a/Library/Homebrew/cmd/search.rb b/Library/Homebrew/cmd/search.rb index 5342b23b6..8d6e5ad7c 100644 --- a/Library/Homebrew/cmd/search.rb +++ b/Library/Homebrew/cmd/search.rb @@ -21,6 +21,8 @@ require "official_taps"  require "descriptions"  module Homebrew +  module_function +    SEARCH_ERROR_QUEUE = Queue.new    def search diff --git a/Library/Homebrew/cmd/sh.rb b/Library/Homebrew/cmd/sh.rb index 11f57b660..09e7f435e 100644 --- a/Library/Homebrew/cmd/sh.rb +++ b/Library/Homebrew/cmd/sh.rb @@ -9,6 +9,8 @@ require "extend/ENV"  require "formula"  module Homebrew +  module_function +    def sh      ENV.activate_extensions! diff --git a/Library/Homebrew/cmd/style.rb b/Library/Homebrew/cmd/style.rb index e666eb200..9538b890a 100644 --- a/Library/Homebrew/cmd/style.rb +++ b/Library/Homebrew/cmd/style.rb @@ -17,6 +17,8 @@ require "utils"  require "utils/json"  module Homebrew +  module_function +    def style      target = if ARGV.named.empty?        nil diff --git a/Library/Homebrew/cmd/switch.rb b/Library/Homebrew/cmd/switch.rb index a44514880..6eed1fd96 100644 --- a/Library/Homebrew/cmd/switch.rb +++ b/Library/Homebrew/cmd/switch.rb @@ -6,6 +6,8 @@ require "keg"  require "cmd/link"  module Homebrew +  module_function +    def switch      if ARGV.named.length != 2        onoe "Usage: brew switch <name> <version>" diff --git a/Library/Homebrew/cmd/tap-info.rb b/Library/Homebrew/cmd/tap-info.rb index 432d51287..71a98813d 100644 --- a/Library/Homebrew/cmd/tap-info.rb +++ b/Library/Homebrew/cmd/tap-info.rb @@ -18,6 +18,8 @@  require "tap"  module Homebrew +  module_function +    def tap_info      if ARGV.include? "--installed"        taps = Tap @@ -34,8 +36,6 @@ module Homebrew      end    end -  private -    def print_tap_info(taps)      if taps.none?        tap_count = 0 @@ -80,8 +80,10 @@ module Homebrew        end      end    end +  private_class_method :print_tap_info    def print_tap_json(taps)      puts Utils::JSON.dump(taps.map(&:to_hash))    end +  private_class_method :print_tap_json  end diff --git a/Library/Homebrew/cmd/tap-pin.rb b/Library/Homebrew/cmd/tap-pin.rb index 74e9fae3f..41957f265 100644 --- a/Library/Homebrew/cmd/tap-pin.rb +++ b/Library/Homebrew/cmd/tap-pin.rb @@ -5,6 +5,8 @@  require "tap"  module Homebrew +  module_function +    def tap_pin      ARGV.named.each do |name|        tap = Tap.fetch(name) diff --git a/Library/Homebrew/cmd/tap-unpin.rb b/Library/Homebrew/cmd/tap-unpin.rb index 7ea2831f2..05bfc7c8b 100644 --- a/Library/Homebrew/cmd/tap-unpin.rb +++ b/Library/Homebrew/cmd/tap-unpin.rb @@ -4,6 +4,8 @@  require "tap"  module Homebrew +  module_function +    def tap_unpin      ARGV.named.each do |name|        tap = Tap.fetch(name) diff --git a/Library/Homebrew/cmd/tap.rb b/Library/Homebrew/cmd/tap.rb index 8ad63e4ba..5b4ed2475 100644 --- a/Library/Homebrew/cmd/tap.rb +++ b/Library/Homebrew/cmd/tap.rb @@ -34,6 +34,8 @@  require "tap"  module Homebrew +  module_function +    def tap      if ARGV.include? "--repair"        Tap.each(&:link_manpages) diff --git a/Library/Homebrew/cmd/uninstall.rb b/Library/Homebrew/cmd/uninstall.rb index f4ca8ff87..8bcfc31fb 100644 --- a/Library/Homebrew/cmd/uninstall.rb +++ b/Library/Homebrew/cmd/uninstall.rb @@ -9,6 +9,8 @@ require "formula"  require "migrator"  module Homebrew +  module_function +    def uninstall      raise KegUnspecifiedError if ARGV.named.empty? diff --git a/Library/Homebrew/cmd/unlink.rb b/Library/Homebrew/cmd/unlink.rb index adf091709..a105f9c56 100644 --- a/Library/Homebrew/cmd/unlink.rb +++ b/Library/Homebrew/cmd/unlink.rb @@ -9,6 +9,8 @@  require "ostruct"  module Homebrew +  module_function +    def unlink      raise KegUnspecifiedError if ARGV.named.empty? diff --git a/Library/Homebrew/cmd/unlinkapps.rb b/Library/Homebrew/cmd/unlinkapps.rb index fc53470ec..0df6de929 100644 --- a/Library/Homebrew/cmd/unlinkapps.rb +++ b/Library/Homebrew/cmd/unlinkapps.rb @@ -12,19 +12,20 @@  require "cmd/linkapps"  module Homebrew +  module_function +    def unlinkapps      target_dir = linkapps_target(local: ARGV.include?("--local"))      unlinkapps_from_dir(target_dir, dry_run: ARGV.dry_run?)    end -  private -    def unlinkapps_prune(opts = {})      opts = opts.merge(prune: true)      unlinkapps_from_dir(linkapps_target(local: false), opts)      unlinkapps_from_dir(linkapps_target(local: true), opts)    end +  private_class_method :unlinkapps_prune    def unlinkapps_from_dir(target_dir, opts = {})      return unless target_dir.directory? @@ -57,6 +58,7 @@ module Homebrew        puts "Unlinked #{n} app#{plural(n)} from #{target_dir}"      end    end +  private_class_method :unlinkapps_from_dir    UNLINKAPPS_PREFIXES = %W[      #{HOMEBREW_CELLAR}/ @@ -76,4 +78,5 @@ module Homebrew        ARGV.kegs.any? { |keg| app.start_with?("#{keg}/", "#{keg.opt_record}/") }      end    end +  private_class_method :unlinkapps_unlink?  end diff --git a/Library/Homebrew/cmd/unpack.rb b/Library/Homebrew/cmd/unpack.rb index 1a3044c2e..6f4caea18 100644 --- a/Library/Homebrew/cmd/unpack.rb +++ b/Library/Homebrew/cmd/unpack.rb @@ -13,6 +13,8 @@ require "stringio"  require "formula"  module Homebrew +  module_function +    def unpack      formulae = ARGV.formulae      raise FormulaUnspecifiedError if formulae.empty? diff --git a/Library/Homebrew/cmd/unpin.rb b/Library/Homebrew/cmd/unpin.rb index 4eb476bdf..a669df1ec 100644 --- a/Library/Homebrew/cmd/unpin.rb +++ b/Library/Homebrew/cmd/unpin.rb @@ -5,6 +5,8 @@  require "formula"  module Homebrew +  module_function +    def unpin      raise FormulaUnspecifiedError if ARGV.named.empty? diff --git a/Library/Homebrew/cmd/untap.rb b/Library/Homebrew/cmd/untap.rb index be91191b5..0d363b7b5 100644 --- a/Library/Homebrew/cmd/untap.rb +++ b/Library/Homebrew/cmd/untap.rb @@ -4,6 +4,8 @@  require "tap"  module Homebrew +  module_function +    def untap      raise "Usage is `brew untap <tap-name>`" if ARGV.empty? diff --git a/Library/Homebrew/cmd/update-report.rb b/Library/Homebrew/cmd/update-report.rb index 18f2f370c..84faf6289 100644 --- a/Library/Homebrew/cmd/update-report.rb +++ b/Library/Homebrew/cmd/update-report.rb @@ -10,6 +10,8 @@ require "cleanup"  require "utils"  module Homebrew +  module_function +    def update_preinstall_header      @header_already_printed ||= begin        ohai "Auto-updated Homebrew!" if ARGV.include?("--preinstall") @@ -106,11 +108,10 @@ module Homebrew      end    end -  private -    def shorten_revision(revision)      Utils.popen_read("git", "-C", HOMEBREW_REPOSITORY, "rev-parse", "--short", revision).chomp    end +  private_class_method :shorten_revision    def install_core_tap_if_necessary      core_tap = CoreTap.instance @@ -120,6 +121,7 @@ module Homebrew      ENV["HOMEBREW_UPDATE_BEFORE_HOMEBREW_HOMEBREW_CORE"] = revision      ENV["HOMEBREW_UPDATE_AFTER_HOMEBREW_HOMEBREW_CORE"] = revision    end +  private_class_method :install_core_tap_if_necessary    def migrate_legacy_cache_if_necessary      legacy_cache = Pathname.new "/Library/Caches/Homebrew" @@ -174,6 +176,7 @@ module Homebrew        end      end    end +  private_class_method :migrate_legacy_cache_if_necessary    def migrate_legacy_repository_if_necessary      return unless HOMEBREW_PREFIX.to_s == "/usr/local" @@ -292,6 +295,7 @@ module Homebrew      EOS      $stderr.puts e.backtrace    end +  private_class_method :migrate_legacy_repository_if_necessary    def link_completions_and_docs(repository = HOMEBREW_REPOSITORY)      command = "brew update" @@ -309,6 +313,7 @@ module Homebrew          #{e}      EOS    end +  private_class_method :link_completions_and_docs  end  class Reporter diff --git a/Library/Homebrew/cmd/upgrade.rb b/Library/Homebrew/cmd/upgrade.rb index f2c3799ab..40805b4ca 100644 --- a/Library/Homebrew/cmd/upgrade.rb +++ b/Library/Homebrew/cmd/upgrade.rb @@ -18,6 +18,8 @@ require "cleanup"  require "development_tools"  module Homebrew +  module_function +    def upgrade      FormulaInstaller.prevent_build_flags unless DevelopmentTools.installed? diff --git a/Library/Homebrew/cmd/uses.rb b/Library/Homebrew/cmd/uses.rb index 79b57eb23..4acf1b9f1 100644 --- a/Library/Homebrew/cmd/uses.rb +++ b/Library/Homebrew/cmd/uses.rb @@ -23,6 +23,8 @@ require "formula"  # The intersection is harder to achieve with shell tools.  module Homebrew +  module_function +    def uses      raise FormulaUnspecifiedError if ARGV.named.empty? | 
