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?

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:



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

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.



56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
# File 'dev-cmd/irb.rb', line 56

def run
  clean_argv

  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.livecheckable?
    EOS
    return
  end

  if args.pry?
    Homebrew.install_bundler_gems!(groups: ["pry"])
    require "pry"
  else
    require "irb"
  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"

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

    IRB.start
  end
end