Class: Homebrew::DevCmd::Irb Private

Inherits:
AbstractCommand show all
Defined in:
dev-cmd/irb.rb,
sorbet/rbi/dsl/homebrew/dev_cmd/irb.rbi

This class is part of a private API. This class may only be used in the Homebrew/brew repository. Third parties should avoid using this class if possible, as it may be removed or changed without warning.

Defined Under Namespace

Classes: Args

Instance Method Summary collapse

Methods inherited from AbstractCommand

command, command_name, dev_cmd?, parser, ruby_cmd?

Methods included from Utils::Output::Mixin

#odebug, #odeprecated, #odie, #odisabled, #ofail, #oh1, #oh1_title, #ohai, #ohai_title, #onoe, #opoo, #opoo_outside_github_actions, #pretty_deprecated, #pretty_disabled, #pretty_duration, #pretty_installed, #pretty_outdated, #pretty_uninstalled

Constructor Details

#initialize(argv = nil) ⇒ void

This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.

work around IRB modifying ARGV.

Parameters:



22
# File 'dev-cmd/irb.rb', line 22

def initialize(argv = nil) = super(argv || ARGV.dup.freeze)

Instance Method Details

#argsHomebrew::DevCmd::Irb::Args

This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.



10
# File 'sorbet/rbi/dsl/homebrew/dev_cmd/irb.rbi', line 10

def args; end

#runvoid

This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.

This method returns an undefined value.



25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
# File 'dev-cmd/irb.rb', line 25

def run
  if args.examples?
    puts <<~EOS
      'v8'.f # => instance of the v8 formula
      :hub.f.latest_version_installed?
      :lua.f.methods - 1.methods
      :mpd.f.recursive_dependencies.reject(&:installed?)

      'vlc'.c # => instance of the vlc cask
      :tsh.c.livecheck_defined?
    EOS
    return
  end

  if args.pry?
    Homebrew.install_bundler_gems!(groups: ["pry"])
    require "pry"
  end

  require "keg"
  require "cask"

  ohai "Interactive Homebrew Shell", "Example commands available with: `brew irb --examples`"
  if args.pry?
    Pry.config.should_load_rc = false # skip loading .pryrc
    Pry.config.history_file = "#{Dir.home}/.brew_pry_history"
    Pry.config.prompt_name = "brew"

    require "brew_irb_helpers"

    Pry.start
  else
    ENV["IRBRC"] = (HOMEBREW_LIBRARY_PATH/"brew_irbrc").to_s

    $stdout.flush
    $stderr.flush
    exec File.join(RbConfig::CONFIG["bindir"], "irb"), "-I", $LOAD_PATH.join(File::PATH_SEPARATOR), *args.named
  end
end