irb: add pry support.
Make `brew irb` optionally support `pry`. While doing so, also make it a `dev-cmd`.
This commit is contained in:
parent
6302da37f6
commit
2205f62ec6
@ -1,11 +1,9 @@
|
|||||||
#: * `irb` [`--examples`]:
|
#: * `irb` [`--examples`] [`--pry`]:
|
||||||
#: Enter the interactive Homebrew Ruby shell.
|
#: Enter the interactive Homebrew Ruby shell.
|
||||||
#:
|
#:
|
||||||
#: If `--examples` is passed, several examples will be shown.
|
#: If `--examples` is passed, several examples will be shown.
|
||||||
|
#: If `--pry` is passed or HOMEBREW_PRY is set, pry will be
|
||||||
require "formula"
|
#: used instead of irb.
|
||||||
require "keg"
|
|
||||||
require "irb"
|
|
||||||
|
|
||||||
class Symbol
|
class Symbol
|
||||||
def f(*args)
|
def f(*args)
|
||||||
@ -23,17 +21,33 @@ module Homebrew
|
|||||||
module_function
|
module_function
|
||||||
|
|
||||||
def irb
|
def irb
|
||||||
$LOAD_PATH.unshift("#{HOMEBREW_LIBRARY_PATH}/cask/lib")
|
|
||||||
require "hbc"
|
|
||||||
|
|
||||||
if ARGV.include? "--examples"
|
if ARGV.include? "--examples"
|
||||||
puts "'v8'.f # => instance of the v8 formula"
|
puts "'v8'.f # => instance of the v8 formula"
|
||||||
puts ":hub.f.installed?"
|
puts ":hub.f.installed?"
|
||||||
puts ":lua.f.methods - 1.methods"
|
puts ":lua.f.methods - 1.methods"
|
||||||
puts ":mpd.f.recursive_dependencies.reject(&:installed?)"
|
puts ":mpd.f.recursive_dependencies.reject(&:installed?)"
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
if ARGV.pry?
|
||||||
|
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"
|
||||||
|
if ARGV.pry?
|
||||||
|
Pry.start
|
||||||
else
|
else
|
||||||
ohai "Interactive Homebrew Shell"
|
|
||||||
puts "Example commands available with: brew irb --examples"
|
|
||||||
IRB.start
|
IRB.start
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -267,6 +267,10 @@ module HomebrewArgvExtension
|
|||||||
include? "--fetch-HEAD"
|
include? "--fetch-HEAD"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def pry?
|
||||||
|
include?("--pry") || !ENV["HOMEBREW_PRY"].nil?
|
||||||
|
end
|
||||||
|
|
||||||
# eg. `foo -ns -i --bar` has three switches, n, s and i
|
# eg. `foo -ns -i --bar` has three switches, n, s and i
|
||||||
def switch?(char)
|
def switch?(char)
|
||||||
return false if char.length > 1
|
return false if char.length > 1
|
||||||
|
|||||||
@ -183,6 +183,10 @@ can take several different forms:
|
|||||||
|
|
||||||
*Note:* Homebrew doesn't require permissions for any of the scopes.
|
*Note:* Homebrew doesn't require permissions for any of the scopes.
|
||||||
|
|
||||||
|
* `HOMEBREW_INSTALL_BADGE`:
|
||||||
|
Text printed before the installation summary of each successful build.
|
||||||
|
Defaults to the beer emoji.
|
||||||
|
|
||||||
* `HOMEBREW_LOGS`:
|
* `HOMEBREW_LOGS`:
|
||||||
If set, Homebrew will use the given directory to store log files.
|
If set, Homebrew will use the given directory to store log files.
|
||||||
|
|
||||||
@ -220,9 +224,8 @@ can take several different forms:
|
|||||||
If set, Homebrew will not use the GitHub API for e.g searches or
|
If set, Homebrew will not use the GitHub API for e.g searches or
|
||||||
fetching relevant issues on a failed install.
|
fetching relevant issues on a failed install.
|
||||||
|
|
||||||
* `HOMEBREW_INSTALL_BADGE`:
|
* `HOMEBREW_PRY`:
|
||||||
Text printed before the installation summary of each successful build.
|
If set, Homebrew will use `pry` for the `brew irb` command.
|
||||||
Defaults to the beer emoji.
|
|
||||||
|
|
||||||
* `HOMEBREW_SVN`:
|
* `HOMEBREW_SVN`:
|
||||||
When exporting from Subversion, Homebrew will use `HOMEBREW_SVN` if set,
|
When exporting from Subversion, Homebrew will use `HOMEBREW_SVN` if set,
|
||||||
|
|||||||
@ -280,11 +280,6 @@ With `--verbose` or `-v`, many commands print extra debugging information. Note
|
|||||||
If `--git` (or `-g`) is passed, Homebrew will create a Git repository, useful for
|
If `--git` (or `-g`) is passed, Homebrew will create a Git repository, useful for
|
||||||
creating patches to the software.
|
creating patches to the software.
|
||||||
|
|
||||||
* `irb` [`--examples`]:
|
|
||||||
Enter the interactive Homebrew Ruby shell.
|
|
||||||
|
|
||||||
If `--examples` is passed, several examples will be shown.
|
|
||||||
|
|
||||||
* `leaves`:
|
* `leaves`:
|
||||||
Show installed formulae that are not dependencies of another installed formula.
|
Show installed formulae that are not dependencies of another installed formula.
|
||||||
|
|
||||||
@ -761,6 +756,13 @@ With `--verbose` or `-v`, many commands print extra debugging information. Note
|
|||||||
* `formula` `formula`:
|
* `formula` `formula`:
|
||||||
Display the path where `formula` is located.
|
Display the path where `formula` is located.
|
||||||
|
|
||||||
|
* `irb` [`--examples`] [`--pry`]:
|
||||||
|
Enter the interactive Homebrew Ruby shell.
|
||||||
|
|
||||||
|
If `--examples` is passed, several examples will be shown.
|
||||||
|
If `--pry` is passed or HOMEBREW_PRY is set, pry will be
|
||||||
|
used instead of irb.
|
||||||
|
|
||||||
* `linkage` [`--test`] [`--reverse`] `formula`:
|
* `linkage` [`--test`] [`--reverse`] `formula`:
|
||||||
Checks the library links of an installed formula.
|
Checks the library links of an installed formula.
|
||||||
|
|
||||||
@ -1029,6 +1031,10 @@ can take several different forms:
|
|||||||
|
|
||||||
*Note:* Homebrew doesn't require permissions for any of the scopes.
|
*Note:* Homebrew doesn't require permissions for any of the scopes.
|
||||||
|
|
||||||
|
* `HOMEBREW_INSTALL_BADGE`:
|
||||||
|
Text printed before the installation summary of each successful build.
|
||||||
|
Defaults to the beer emoji.
|
||||||
|
|
||||||
* `HOMEBREW_LOGS`:
|
* `HOMEBREW_LOGS`:
|
||||||
If set, Homebrew will use the given directory to store log files.
|
If set, Homebrew will use the given directory to store log files.
|
||||||
|
|
||||||
@ -1066,9 +1072,8 @@ can take several different forms:
|
|||||||
If set, Homebrew will not use the GitHub API for e.g searches or
|
If set, Homebrew will not use the GitHub API for e.g searches or
|
||||||
fetching relevant issues on a failed install.
|
fetching relevant issues on a failed install.
|
||||||
|
|
||||||
* `HOMEBREW_INSTALL_BADGE`:
|
* `HOMEBREW_PRY`:
|
||||||
Text printed before the installation summary of each successful build.
|
If set, Homebrew will use `pry` for the `brew irb` command.
|
||||||
Defaults to the beer emoji.
|
|
||||||
|
|
||||||
* `HOMEBREW_SVN`:
|
* `HOMEBREW_SVN`:
|
||||||
When exporting from Subversion, Homebrew will use `HOMEBREW_SVN` if set,
|
When exporting from Subversion, Homebrew will use `HOMEBREW_SVN` if set,
|
||||||
|
|||||||
@ -291,13 +291,6 @@ If \fB\-\-interactive\fR (or \fB\-i\fR) is passed, download and patch \fIformula
|
|||||||
If \fB\-\-git\fR (or \fB\-g\fR) is passed, Homebrew will create a Git repository, useful for creating patches to the software\.
|
If \fB\-\-git\fR (or \fB\-g\fR) is passed, Homebrew will create a Git repository, useful for creating patches to the software\.
|
||||||
.
|
.
|
||||||
.TP
|
.TP
|
||||||
\fBirb\fR [\fB\-\-examples\fR]
|
|
||||||
Enter the interactive Homebrew Ruby shell\.
|
|
||||||
.
|
|
||||||
.IP
|
|
||||||
If \fB\-\-examples\fR is passed, several examples will be shown\.
|
|
||||||
.
|
|
||||||
.TP
|
|
||||||
\fBleaves\fR
|
\fBleaves\fR
|
||||||
Show installed formulae that are not dependencies of another installed formula\.
|
Show installed formulae that are not dependencies of another installed formula\.
|
||||||
.
|
.
|
||||||
@ -781,6 +774,13 @@ Open \fIformula\fR in the editor\.
|
|||||||
Display the path where \fIformula\fR is located\.
|
Display the path where \fIformula\fR is located\.
|
||||||
.
|
.
|
||||||
.TP
|
.TP
|
||||||
|
\fBirb\fR [\fB\-\-examples\fR] [\fB\-\-pry\fR]
|
||||||
|
Enter the interactive Homebrew Ruby shell\.
|
||||||
|
.
|
||||||
|
.IP
|
||||||
|
If \fB\-\-examples\fR is passed, several examples will be shown\. If \fB\-\-pry\fR is passed or HOMEBREW_PRY is set, pry will be used instead of irb\.
|
||||||
|
.
|
||||||
|
.TP
|
||||||
\fBlinkage\fR [\fB\-\-test\fR] [\fB\-\-reverse\fR] \fIformula\fR
|
\fBlinkage\fR [\fB\-\-test\fR] [\fB\-\-reverse\fR] \fIformula\fR
|
||||||
Checks the library links of an installed formula\.
|
Checks the library links of an installed formula\.
|
||||||
.
|
.
|
||||||
@ -1048,6 +1048,10 @@ A personal access token for the GitHub API, which you can create at \fIhttps://g
|
|||||||
\fINote:\fR Homebrew doesn\'t require permissions for any of the scopes\.
|
\fINote:\fR Homebrew doesn\'t require permissions for any of the scopes\.
|
||||||
.
|
.
|
||||||
.TP
|
.TP
|
||||||
|
\fBHOMEBREW_INSTALL_BADGE\fR
|
||||||
|
Text printed before the installation summary of each successful build\. Defaults to the beer emoji\.
|
||||||
|
.
|
||||||
|
.TP
|
||||||
\fBHOMEBREW_LOGS\fR
|
\fBHOMEBREW_LOGS\fR
|
||||||
If set, Homebrew will use the given directory to store log files\.
|
If set, Homebrew will use the given directory to store log files\.
|
||||||
.
|
.
|
||||||
@ -1089,8 +1093,8 @@ While ensuring your downloads are fully secure, this is likely to cause from\-so
|
|||||||
If set, Homebrew will not use the GitHub API for e\.g searches or fetching relevant issues on a failed install\.
|
If set, Homebrew will not use the GitHub API for e\.g searches or fetching relevant issues on a failed install\.
|
||||||
.
|
.
|
||||||
.TP
|
.TP
|
||||||
\fBHOMEBREW_INSTALL_BADGE\fR
|
\fBHOMEBREW_PRY\fR
|
||||||
Text printed before the installation summary of each successful build\. Defaults to the beer emoji\.
|
If set, Homebrew will use \fBpry\fR for the \fBbrew irb\fR command\.
|
||||||
.
|
.
|
||||||
.TP
|
.TP
|
||||||
\fBHOMEBREW_SVN\fR
|
\fBHOMEBREW_SVN\fR
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user