aboutsummaryrefslogtreecommitdiffstats
path: root/Library
diff options
context:
space:
mode:
authorMike McQuaid2017-05-13 11:42:01 +0100
committerMike McQuaid2017-05-13 11:42:01 +0100
commit8205e61e6493f7c0a91c0311a321a80830f70bc3 (patch)
tree99de15601ca526b829aac5884c2c9b2194e082d9 /Library
parent459fef3b09b25d3e24cce6aa6f2e3a7bd5460a2b (diff)
downloadbrew-8205e61e6493f7c0a91c0311a321a80830f70bc3.tar.bz2
More environment filtering tweaks
- only document HOMEBREW_* variables in the manpage (although still read from all the original environment variables). - resort manpage environment variables in alphabetical order - check the original path for trailing slashes
Diffstat (limited to 'Library')
-rw-r--r--Library/Homebrew/diagnostic.rb2
-rw-r--r--Library/Homebrew/download_strategy.rb3
-rw-r--r--Library/Homebrew/manpages/brew.1.md.erb39
-rwxr-xr-xLibrary/Homebrew/shims/scm/git1
-rw-r--r--Library/Homebrew/test/diagnostic_spec.rb2
-rw-r--r--Library/Homebrew/utils.rb4
6 files changed, 21 insertions, 30 deletions
diff --git a/Library/Homebrew/diagnostic.rb b/Library/Homebrew/diagnostic.rb
index 1544e6765..6bb5c8b8e 100644
--- a/Library/Homebrew/diagnostic.rb
+++ b/Library/Homebrew/diagnostic.rb
@@ -100,7 +100,7 @@ module Homebrew
# See https://github.com/Homebrew/legacy-homebrew/pull/9986
def check_path_for_trailing_slashes
- bad_paths = PATH.new(ENV["PATH"]).select { |p| p.end_with?("/") }
+ bad_paths = PATH.new(ENV["HOMEBREW_PATH"]).select { |p| p.end_with?("/") }
return if bad_paths.empty?
inject_file_list bad_paths, <<-EOS.undent
diff --git a/Library/Homebrew/download_strategy.rb b/Library/Homebrew/download_strategy.rb
index a0025cef3..d74efe0bb 100644
--- a/Library/Homebrew/download_strategy.rb
+++ b/Library/Homebrew/download_strategy.rb
@@ -520,6 +520,9 @@ class S3DownloadStrategy < CurlDownloadStrategy
bucket = $1
key = $2
+ ENV["AWS_ACCESS_KEY_ID"] = ENV["HOMEBREW_AWS_ACCESS_KEY_ID"]
+ ENV["AWS_SECRET_ACCESS_KEY"] = ENV["HOMEBREW_AWS_SECRET_ACCESS_KEY"]
+
obj = AWS::S3.new.buckets[bucket].objects[key]
begin
s3url = obj.url_for(:get)
diff --git a/Library/Homebrew/manpages/brew.1.md.erb b/Library/Homebrew/manpages/brew.1.md.erb
index 5b0228e3f..29f8d0bec 100644
--- a/Library/Homebrew/manpages/brew.1.md.erb
+++ b/Library/Homebrew/manpages/brew.1.md.erb
@@ -98,8 +98,15 @@ can take several different forms:
The formula file will be cached for later use.
## ENVIRONMENT
+ * `HOMEBREW_ARTIFACT_DOMAIN`:
+ If set, instructs Homebrew to use the given URL as a download mirror for bottles and binaries.
+
+ * `HOMEBREW_AUTO_UPDATE_SECS`:
+ If set, Homebrew will only check for autoupdates once per this seconds interval.
+
+ *Default:* `60`.
- * `AWS_ACCESS_KEY_ID`, `AWS_SECRET_ACCESS_KEY`:
+ * `HOMEBREW_AWS_ACCESS_KEY_ID`, `HOMEBREW_AWS_SECRET_ACCESS_KEY`:
When using the `S3` download strategy, Homebrew will look in
these variables for access credentials (see
<https://docs.aws.amazon.com/cli/latest/userguide/cli-chap-getting-started.html#cli-environment>
@@ -107,30 +114,9 @@ can take several different forms:
the `S3` download strategy will download with a public
(unsigned) URL.
- * `BROWSER`:
- If set, and `HOMEBREW_BROWSER` is not, use `BROWSER` as the web browser
- when opening project homepages.
-
- * `EDITOR`:
- If set, and `HOMEBREW_EDITOR` and `VISUAL` are not, use `EDITOR` as the text editor.
-
- * `GIT`:
- When using Git, Homebrew will use `GIT` if set,
- a Homebrew-built Git if installed, or the system-provided binary.
-
- Set this to force Homebrew to use a particular git binary.
-
* `HOMEBREW_BOTTLE_DOMAIN`:
If set, instructs Homebrew to use the given URL as a download mirror for bottles.
- * `HOMEBREW_ARTIFACT_DOMAIN`:
- If set, instructs Homebrew to use the given URL as a download mirror for bottles and binaries.
-
- * `HOMEBREW_AUTO_UPDATE_SECS`:
- If set, Homebrew will only check for autoupdates once per this seconds interval.
-
- *Default:* `60`.
-
* `HOMEBREW_BROWSER`:
If set, uses this setting as the browser when opening project homepages,
instead of the OS default browser.
@@ -178,6 +164,12 @@ can take several different forms:
If set, Homebrew will always use its vendored, relocatable Ruby 2.0 version
even if the system version of Ruby is >=2.0.
+ * `HOMEBREW_GIT`:
+ When using Git, Homebrew will use `GIT` if set,
+ a Homebrew-built Git if installed, or the system-provided binary.
+
+ Set this to force Homebrew to use a particular git binary.
+
* `HOMEBREW_GITHUB_API_TOKEN`:
A personal access token for the GitHub API, which you can create at
<https://github.com/settings/tokens>. If set, GitHub will allow you a
@@ -243,9 +235,6 @@ can take several different forms:
* `HOMEBREW_VERBOSE`:
If set, Homebrew always assumes `--verbose` when running commands.
- * `VISUAL`:
- If set, and `HOMEBREW_EDITOR` is not, use `VISUAL` as the text editor.
-
## USING HOMEBREW BEHIND A PROXY
Homebrew uses several commands for downloading files (e.g. `curl`, `git`, `svn`).
diff --git a/Library/Homebrew/shims/scm/git b/Library/Homebrew/shims/scm/git
index 82bb47c25..bfb779c25 100755
--- a/Library/Homebrew/shims/scm/git
+++ b/Library/Homebrew/shims/scm/git
@@ -86,7 +86,6 @@ fi
case "$(lowercase "$SCM_FILE")" in
git)
[[ -n "$HOMEBREW_GIT" ]] && safe_exec "$(which "$HOMEBREW_GIT")" "$@"
- [[ -n "$GIT" ]] && safe_exec "$(which "$GIT")" "$@"
;;
svn)
[[ -n "$HOMEBREW_SVN" ]] && safe_exec "$(which "$HOMEBREW_SVN")" "$@"
diff --git a/Library/Homebrew/test/diagnostic_spec.rb b/Library/Homebrew/test/diagnostic_spec.rb
index 12a8e0c42..c4373671e 100644
--- a/Library/Homebrew/test/diagnostic_spec.rb
+++ b/Library/Homebrew/test/diagnostic_spec.rb
@@ -7,7 +7,7 @@ describe Homebrew::Diagnostic::Checks do
end
specify "#check_path_for_trailing_slashes" do
- ENV["PATH"] += File::PATH_SEPARATOR + "/foo/bar/"
+ ENV["HOMEBREW_PATH"] += File::PATH_SEPARATOR + "/foo/bar/"
expect(subject.check_path_for_trailing_slashes)
.to match("Some directories in your path end in a slash")
end
diff --git a/Library/Homebrew/utils.rb b/Library/Homebrew/utils.rb
index c37633e41..28d7fc283 100644
--- a/Library/Homebrew/utils.rb
+++ b/Library/Homebrew/utils.rb
@@ -320,7 +320,7 @@ def which_all(cmd, path = ENV["PATH"])
end
def which_editor
- editor = ENV.values_at("HOMEBREW_EDITOR", "VISUAL").compact.reject(&:empty?).first
+ editor = ENV.values_at("HOMEBREW_EDITOR", "HOMEBREW_VISUAL").compact.reject(&:empty?).first
if editor
editor_name, _, editor_args = editor.partition " "
editor_path = which(editor_name, ENV["HOMEBREW_PATH"])
@@ -356,7 +356,7 @@ def exec_editor(*args)
end
def exec_browser(*args)
- browser = ENV["HOMEBREW_BROWSER"] || ENV["BROWSER"]
+ browser = ENV["HOMEBREW_BROWSER"]
browser ||= OS::PATH_OPEN if defined?(OS::PATH_OPEN)
return unless browser
safe_exec(browser, *args)