aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.travis.yml7
-rw-r--r--Library/Homebrew/brew.sh10
-rw-r--r--Library/Homebrew/dev-cmd/irb.rb (renamed from Library/Homebrew/cmd/irb.rb)34
-rw-r--r--Library/Homebrew/dev-cmd/linkage.rb2
-rwxr-xr-xLibrary/Homebrew/dev-cmd/ruby.rb2
-rw-r--r--Library/Homebrew/dev-cmd/tap-new.rb3
-rw-r--r--Library/Homebrew/extend/ARGV.rb4
-rw-r--r--Library/Homebrew/extend/ENV.rb4
-rw-r--r--Library/Homebrew/extend/os/mac/formula_cellar_checks.rb2
-rw-r--r--Library/Homebrew/language/python.rb7
-rw-r--r--Library/Homebrew/linkage_checker.rb (renamed from Library/Homebrew/os/mac/linkage_checker.rb)0
-rw-r--r--Library/Homebrew/manpages/brew.1.md.erb9
-rw-r--r--Library/Homebrew/test/ENV_spec.rb14
-rw-r--r--Library/Homebrew/test/dev-cmd/ruby_spec.rb13
-rw-r--r--docs/Manpage.md21
-rw-r--r--manpages/brew.122
16 files changed, 107 insertions, 47 deletions
diff --git a/.travis.yml b/.travis.yml
index 37417a10a..fef0f91ca 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -3,7 +3,7 @@ cache:
directories:
- $HOME/Library/Caches/Homebrew/style
- $HOME/Library/Caches/Homebrew/tests
- - $HOME/Library/Homebrew/vendor/bundle
+ - Library/Homebrew/vendor/bundle
branches:
only:
- master
@@ -37,11 +37,6 @@ before_install:
sudo rm -rf "$HOMEBREW_REPOSITORY";
sudo ln -s "$PWD" "$HOMEBREW_REPOSITORY";
fi
- - if [ "$MACOS" ]; then
- travis_retry git -C Library/Taps/homebrew/homebrew-core fetch --depth=1 origin;
- else
- travis_retry git clone --depth=1 https://github.com/Homebrew/homebrew-core Library/Taps/homebrew/homebrew-core;
- fi
- travis_retry git clone --depth=1 https://github.com/Homebrew/homebrew-test-bot Library/Taps/homebrew/homebrew-test-bot
script:
diff --git a/Library/Homebrew/brew.sh b/Library/Homebrew/brew.sh
index 77a60dfc7..590dde363 100644
--- a/Library/Homebrew/brew.sh
+++ b/Library/Homebrew/brew.sh
@@ -253,6 +253,14 @@ then
then
export HOMEBREW_DEV_CMD_RUN="1"
fi
+
+ # Don't allow non-developers to customise Ruby warnings.
+ unset HOMEBREW_RUBY_WARNINGS
+fi
+
+if [[ -z "$HOMEBREW_RUBY_WARNINGS" ]]
+then
+ export HOMEBREW_RUBY_WARNINGS="-W0"
fi
if [[ -f "$HOMEBREW_LIBRARY/Homebrew/cmd/$HOMEBREW_COMMAND.sh" ]]
@@ -371,5 +379,5 @@ else
# Unshift command back into argument list (unless argument list was empty).
[[ "$HOMEBREW_ARG_COUNT" -gt 0 ]] && set -- "$HOMEBREW_COMMAND" "$@"
- { update-preinstall; exec "$HOMEBREW_RUBY_PATH" -W0 "$HOMEBREW_LIBRARY/Homebrew/brew.rb" "$@"; }
+ { update-preinstall; exec "$HOMEBREW_RUBY_PATH" $HOMEBREW_RUBY_WARNINGS "$HOMEBREW_LIBRARY/Homebrew/brew.rb" "$@"; }
fi
diff --git a/Library/Homebrew/cmd/irb.rb b/Library/Homebrew/dev-cmd/irb.rb
index 4cd3d4c9e..700cbe009 100644
--- a/Library/Homebrew/cmd/irb.rb
+++ b/Library/Homebrew/dev-cmd/irb.rb
@@ -1,11 +1,9 @@
-#: * `irb` [`--examples`]:
+#: * `irb` [`--examples`] [`--pry`]:
#: Enter the interactive Homebrew Ruby shell.
#:
#: If `--examples` is passed, several examples will be shown.
-
-require "formula"
-require "keg"
-require "irb"
+#: If `--pry` is passed or HOMEBREW_PRY is set, pry will be
+#: used instead of irb.
class Symbol
def f(*args)
@@ -23,17 +21,33 @@ module Homebrew
module_function
def irb
- $LOAD_PATH.unshift("#{HOMEBREW_LIBRARY_PATH}/cask/lib")
- require "hbc"
-
if ARGV.include? "--examples"
puts "'v8'.f # => instance of the v8 formula"
puts ":hub.f.installed?"
puts ":lua.f.methods - 1.methods"
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
- ohai "Interactive Homebrew Shell"
- puts "Example commands available with: brew irb --examples"
IRB.start
end
end
diff --git a/Library/Homebrew/dev-cmd/linkage.rb b/Library/Homebrew/dev-cmd/linkage.rb
index 31e9bd103..c33c181a1 100644
--- a/Library/Homebrew/dev-cmd/linkage.rb
+++ b/Library/Homebrew/dev-cmd/linkage.rb
@@ -10,7 +10,7 @@
#: If `--reverse` is passed, print the dylib followed by the binaries
#: which link to it for each library the keg references.
-require "os/mac/linkage_checker"
+require "linkage_checker"
module Homebrew
module_function
diff --git a/Library/Homebrew/dev-cmd/ruby.rb b/Library/Homebrew/dev-cmd/ruby.rb
index 2df212301..c5696d6bb 100755
--- a/Library/Homebrew/dev-cmd/ruby.rb
+++ b/Library/Homebrew/dev-cmd/ruby.rb
@@ -8,6 +8,6 @@ module Homebrew
module_function
def ruby
- exec ENV["HOMEBREW_RUBY_PATH"], "-I#{HOMEBREW_LIBRARY_PATH}", "-rglobal", "-rcmd/irb", *ARGV
+ exec ENV["HOMEBREW_RUBY_PATH"], "-I#{HOMEBREW_LIBRARY_PATH}", "-rglobal", "-rdev-cmd/irb", *ARGV
end
end
diff --git a/Library/Homebrew/dev-cmd/tap-new.rb b/Library/Homebrew/dev-cmd/tap-new.rb
index 38cdb1c2e..31299d2b0 100644
--- a/Library/Homebrew/dev-cmd/tap-new.rb
+++ b/Library/Homebrew/dev-cmd/tap-new.rb
@@ -50,8 +50,7 @@ module Homebrew
osx_image: xcode9.2
cache:
directories:
- - $HOME/.gem/ruby
- - Library/Homebrew/vendor/bundle
+ - /usr/local/Homebrew/Library/Homebrew/vendor/bundle
branches:
only:
- master
diff --git a/Library/Homebrew/extend/ARGV.rb b/Library/Homebrew/extend/ARGV.rb
index d9da014f0..2bc84620a 100644
--- a/Library/Homebrew/extend/ARGV.rb
+++ b/Library/Homebrew/extend/ARGV.rb
@@ -267,6 +267,10 @@ module HomebrewArgvExtension
include? "--fetch-HEAD"
end
+ def pry?
+ include?("--pry") || !ENV["HOMEBREW_PRY"].nil?
+ end
+
# eg. `foo -ns -i --bar` has three switches, n, s and i
def switch?(char)
return false if char.length > 1
diff --git a/Library/Homebrew/extend/ENV.rb b/Library/Homebrew/extend/ENV.rb
index 374be49b9..002220764 100644
--- a/Library/Homebrew/extend/ENV.rb
+++ b/Library/Homebrew/extend/ENV.rb
@@ -28,9 +28,9 @@ module EnvActivation
end
def clear_sensitive_environment!
- ENV.each_key do |key|
+ each_key do |key|
next unless /(cookie|key|token|password)/i =~ key
- ENV.delete key
+ delete key
end
end
end
diff --git a/Library/Homebrew/extend/os/mac/formula_cellar_checks.rb b/Library/Homebrew/extend/os/mac/formula_cellar_checks.rb
index 901d8945f..0b1a1643e 100644
--- a/Library/Homebrew/extend/os/mac/formula_cellar_checks.rb
+++ b/Library/Homebrew/extend/os/mac/formula_cellar_checks.rb
@@ -1,4 +1,4 @@
-require "os/mac/linkage_checker"
+require "linkage_checker"
module FormulaCellarChecks
def check_shadowed_headers
diff --git a/Library/Homebrew/language/python.rb b/Library/Homebrew/language/python.rb
index 3908f4b8f..648abb5b1 100644
--- a/Library/Homebrew/language/python.rb
+++ b/Library/Homebrew/language/python.rb
@@ -15,10 +15,11 @@ module Language
def self.each_python(build, &block)
original_pythonpath = ENV["PYTHONPATH"]
- ["python", "python3"].each do |python|
- next if build.without? python
+ { "python@3" => "python3", "python@2" => "python2.7" }.each do |python_formula, python|
+ python_formula = Formulary.factory(python_formula)
+ next if build.without? python_formula.to_s
version = major_minor_version python
- ENV["PYTHONPATH"] = if Formulary.factory(python).installed?
+ ENV["PYTHONPATH"] = if python_formula.installed?
nil
else
homebrew_site_packages(version)
diff --git a/Library/Homebrew/os/mac/linkage_checker.rb b/Library/Homebrew/linkage_checker.rb
index cf6c12f22..cf6c12f22 100644
--- a/Library/Homebrew/os/mac/linkage_checker.rb
+++ b/Library/Homebrew/linkage_checker.rb
diff --git a/Library/Homebrew/manpages/brew.1.md.erb b/Library/Homebrew/manpages/brew.1.md.erb
index 533e1d594..618e050f6 100644
--- a/Library/Homebrew/manpages/brew.1.md.erb
+++ b/Library/Homebrew/manpages/brew.1.md.erb
@@ -183,6 +183,10 @@ can take several different forms:
*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`:
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
fetching relevant issues on a failed install.
- * `HOMEBREW_INSTALL_BADGE`:
- Text printed before the installation summary of each successful build.
- Defaults to the beer emoji.
+ * `HOMEBREW_PRY`:
+ If set, Homebrew will use `pry` for the `brew irb` command.
* `HOMEBREW_SVN`:
When exporting from Subversion, Homebrew will use `HOMEBREW_SVN` if set,
diff --git a/Library/Homebrew/test/ENV_spec.rb b/Library/Homebrew/test/ENV_spec.rb
index 07f6cdb6b..8b39e52d7 100644
--- a/Library/Homebrew/test/ENV_spec.rb
+++ b/Library/Homebrew/test/ENV_spec.rb
@@ -141,6 +141,20 @@ shared_examples EnvActivation do
expect(subject["MAKEFLAGS"]).to eq("-j4")
end
+
+ describe "#clear_sensitive_environment!" do
+ it "removes sensitive environment variables" do
+ subject["SECRET_TOKEN"] = "password"
+ subject.clear_sensitive_environment!
+ expect(subject).not_to include("SECRET_TOKEN")
+ end
+
+ it "leaves non-sensitive environment variables alone" do
+ subject["FOO"] = "bar"
+ subject.clear_sensitive_environment!
+ expect(subject["FOO"]).to eq "bar"
+ end
+ end
end
describe Stdenv do
diff --git a/Library/Homebrew/test/dev-cmd/ruby_spec.rb b/Library/Homebrew/test/dev-cmd/ruby_spec.rb
new file mode 100644
index 000000000..e05bccc83
--- /dev/null
+++ b/Library/Homebrew/test/dev-cmd/ruby_spec.rb
@@ -0,0 +1,13 @@
+describe "brew ruby", :integration_test do
+ it "executes ruby code with Homebrew's libraries loaded" do
+ expect { brew "ruby", "-e", "exit 0" }
+ .to be_a_success
+ .and not_to_output.to_stdout
+ .and not_to_output.to_stderr
+
+ expect { brew "ruby", "-e", "exit 1" }
+ .to be_a_failure
+ .and not_to_output.to_stdout
+ .and not_to_output.to_stderr
+ end
+end
diff --git a/docs/Manpage.md b/docs/Manpage.md
index 6b6dc91ab..ff3346685 100644
--- a/docs/Manpage.md
+++ b/docs/Manpage.md
@@ -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
creating patches to the software.
- * `irb` [`--examples`]:
- Enter the interactive Homebrew Ruby shell.
-
- If `--examples` is passed, several examples will be shown.
-
* `leaves`:
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`:
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`:
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.
+ * `HOMEBREW_INSTALL_BADGE`:
+ Text printed before the installation summary of each successful build.
+ Defaults to the beer emoji.
+
* `HOMEBREW_LOGS`:
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
fetching relevant issues on a failed install.
- * `HOMEBREW_INSTALL_BADGE`:
- Text printed before the installation summary of each successful build.
- Defaults to the beer emoji.
+ * `HOMEBREW_PRY`:
+ If set, Homebrew will use `pry` for the `brew irb` command.
* `HOMEBREW_SVN`:
When exporting from Subversion, Homebrew will use `HOMEBREW_SVN` if set,
diff --git a/manpages/brew.1 b/manpages/brew.1
index 0f99f3af6..60cd7cc80 100644
--- a/manpages/brew.1
+++ b/manpages/brew.1
@@ -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\.
.
.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
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\.
.
.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
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\.
.
.TP
+\fBHOMEBREW_INSTALL_BADGE\fR
+Text printed before the installation summary of each successful build\. Defaults to the beer emoji\.
+.
+.TP
\fBHOMEBREW_LOGS\fR
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\.
.
.TP
-\fBHOMEBREW_INSTALL_BADGE\fR
-Text printed before the installation summary of each successful build\. Defaults to the beer emoji\.
+\fBHOMEBREW_PRY\fR
+If set, Homebrew will use \fBpry\fR for the \fBbrew irb\fR command\.
.
.TP
\fBHOMEBREW_SVN\fR