2018-02-28 11:36:23 +00:00
|
|
|
#: * `irb` [`--examples`] [`--pry`]:
|
2016-04-08 16:28:43 +02:00
|
|
|
#: Enter the interactive Homebrew Ruby shell.
|
|
|
|
#:
|
|
|
|
#: If `--examples` is passed, several examples will be shown.
|
2018-02-28 11:36:23 +00:00
|
|
|
#: If `--pry` is passed or HOMEBREW_PRY is set, pry will be
|
|
|
|
#: used instead of irb.
|
2012-08-30 22:54:24 -04:00
|
|
|
|
2018-03-24 20:04:45 +05:30
|
|
|
require "cli_parser"
|
|
|
|
require "utils/env"
|
|
|
|
|
2012-08-31 08:09:50 -04:00
|
|
|
class Symbol
|
2015-01-04 21:37:27 -05:00
|
|
|
def f(*args)
|
|
|
|
Formulary.factory(to_s, *args)
|
2012-08-31 08:09:50 -04:00
|
|
|
end
|
|
|
|
end
|
2017-02-23 06:04:32 +01:00
|
|
|
|
2012-08-30 22:54:24 -04:00
|
|
|
class String
|
2015-01-04 21:37:27 -05:00
|
|
|
def f(*args)
|
|
|
|
Formulary.factory(self, *args)
|
2012-08-30 22:54:24 -04:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2014-06-18 22:41:47 -05:00
|
|
|
module Homebrew
|
2016-09-26 01:44:51 +02:00
|
|
|
module_function
|
|
|
|
|
2012-08-06 14:41:55 -04:00
|
|
|
def irb
|
2018-03-24 20:04:45 +05:30
|
|
|
args = Homebrew::CLI::Parser.new do
|
|
|
|
switch "--examples"
|
|
|
|
switch "--pry"
|
|
|
|
end.parse
|
|
|
|
|
|
|
|
if args.examples?
|
2014-06-19 19:13:45 -05:00
|
|
|
puts "'v8'.f # => instance of the v8 formula"
|
2012-08-31 08:09:50 -04:00
|
|
|
puts ":hub.f.installed?"
|
|
|
|
puts ":lua.f.methods - 1.methods"
|
2013-04-10 11:52:54 -05:00
|
|
|
puts ":mpd.f.recursive_dependencies.reject(&:installed?)"
|
2018-02-28 11:36:23 +00:00
|
|
|
return
|
|
|
|
end
|
|
|
|
|
2018-03-24 20:04:45 +05:30
|
|
|
if args.pry? || Utils::EnvVars.pry?
|
2018-02-28 11:36:23 +00:00
|
|
|
Homebrew.install_gem_setup_path! "pry"
|
|
|
|
require "pry"
|
|
|
|
Pry.config.prompt_name = "brew"
|
|
|
|
else
|
|
|
|
require "irb"
|
|
|
|
end
|
|
|
|
|
|
|
|
require "formula"
|
|
|
|
require "keg"
|
|
|
|
|
|
|
|
$LOAD_PATH.unshift("#{HOMEBREW_LIBRARY_PATH}/cask/lib")
|
|
|
|
require "hbc"
|
|
|
|
|
|
|
|
ohai "Interactive Homebrew Shell"
|
|
|
|
puts "Example commands available with: brew irb --examples"
|
2018-03-24 20:04:45 +05:30
|
|
|
if args.pry? || Utils::EnvVars.pry?
|
2018-02-28 11:36:23 +00:00
|
|
|
Pry.start
|
2012-08-06 14:41:55 -04:00
|
|
|
else
|
2012-08-21 09:51:28 -04:00
|
|
|
IRB.start
|
2012-08-06 14:41:55 -04:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|