language stringclasses 1
value | owner stringlengths 2 15 | repo stringlengths 2 21 | sha stringlengths 45 45 | message stringlengths 7 36.3k | path stringlengths 1 199 | patch stringlengths 15 102k | is_multipart bool 2
classes |
|---|---|---|---|---|---|---|---|
Other | Homebrew | brew | 363355ae47d323a6f2328d0776d9b4091b5d93e1.json | CompilerSelector: prefer the gcc verion offered by the gcc formula
When GCC is used (default for Linux), we should prefer the gcc offered
by the gcc formula. As such even if users install a gcc with higher
version from `gcc@*` formula, it will not be picked up to build other
formulae. This would also allow users to safely delete `gcc@*` formula.
Closes #5953. | Library/Homebrew/compilers.rb | @@ -105,11 +105,19 @@ def compiler
private
+ def gnu_gcc_versions
+ # prioritize gcc version provided by gcc formula.
+ v = Formulary.factory("gcc").version.to_s.slice(/\d/)
+ GNU_GCC_VERSIONS - [v] + [v] # move the version to the end of the list
+ rescue FormulaUnavailableError
+ GNU_GCC_VERSIONS
+ end
+
def find_compiler
compilers.each do |compiler|
case compiler
when :gnu
- GNU_GCC_VERSIONS.reverse_each do |v|
+ gnu_gcc_versions.reverse_each do |v|
name = "gcc-#{v}"
version = compiler_version(name)
yield Compiler.new(name, version) unless version.null? | true |
Other | Homebrew | brew | 363355ae47d323a6f2328d0776d9b4091b5d93e1.json | CompilerSelector: prefer the gcc verion offered by the gcc formula
When GCC is used (default for Linux), we should prefer the gcc offered
by the gcc formula. As such even if users install a gcc with higher
version from `gcc@*` formula, it will not be picked up to build other
formulae. This would also allow users to safely delete `gcc@*` formula.
Closes #5953. | Library/Homebrew/test/compiler_selector_spec.rb | @@ -39,6 +39,12 @@
expect(subject.compiler).to eq("gcc-7")
end
+ it "returns gcc-6 if gcc formula offers gcc-6" do
+ software_spec.fails_with(:clang)
+ allow(Formulary).to receive(:factory).with("gcc").and_return(double(version: "6.0"))
+ expect(subject.compiler).to eq("gcc-6")
+ end
+
it "raises an error when gcc or llvm is missing" do
software_spec.fails_with(:clang)
software_spec.fails_with(gcc: "7") | true |
Other | Homebrew | brew | c59c03e2f873201fbe5344eb0e02281e0e1df745.json | Remove search from brew-cask man page
`brew cask` no longer supports the `search` command and was removed from
the `homebrew/brew-cask` documentation. However, it's still in the
`brew` man page for `brew-cask`.
Remove search from the man page. | Library/Homebrew/manpages/brew-cask.1.md | @@ -19,13 +19,6 @@ graphical user interface.
* `uninstall` [--force] <token> [ <token> ... ]:
Uninstall Cask identified by <token>.
- * `search` <text> | /<regexp>/:
- Perform a substring search of known Cask tokens for <text>. If the text
- is delimited by slashes, it is interpreted as a Ruby regular expression.
-
- The tokens returned by `search` are suitable as arguments for most other
- commands, such as `install` or `uninstall`.
-
## COMMANDS
* `audit` [--language=<iso-language>[,<iso-language> ... ]] [ <token> ... ]:
@@ -92,13 +85,6 @@ graphical user interface.
* `reinstall` [--no-quarantine] <token> [ <token> ... ]:
Reinstall the given Cask.
- * `search` or `-S` [<text> | /<regexp>/]:
- Without an argument, display all locally available Casks for install; no
- online search is performed.
- Otherwise perform a substring search of known Cask tokens for <text> or,
- if the text is delimited by slashes (/<regexp>/), it is interpreted as a
- Ruby regular expression.
-
* `style` [--fix] [ <token> ... ]:
Check the given Casks for correct style using RuboCop (with custom Cask cops).
If no tokens are given on the command line, all Casks are checked. | true |
Other | Homebrew | brew | c59c03e2f873201fbe5344eb0e02281e0e1df745.json | Remove search from brew-cask man page
`brew cask` no longer supports the `search` command and was removed from
the `homebrew/brew-cask` documentation. However, it's still in the
`brew` man page for `brew-cask`.
Remove search from the man page. | manpages/brew-cask.1 | @@ -22,13 +22,6 @@ Install Cask identified by \fItoken\fR\.
\fBuninstall\fR [\-\-force] \fItoken\fR [ \fItoken\fR \.\.\. ]
Uninstall Cask identified by \fItoken\fR\.
.
-.TP
-\fBsearch\fR \fItext\fR | /\fIregexp\fR/
-Perform a substring search of known Cask tokens for \fItext\fR\. If the text is delimited by slashes, it is interpreted as a Ruby regular expression\.
-.
-.IP
-The tokens returned by \fBsearch\fR are suitable as arguments for most other commands, such as \fBinstall\fR or \fBuninstall\fR\.
-.
.SH "COMMANDS"
.
.TP
@@ -95,10 +88,6 @@ Without token arguments, display all the installed Casks that have newer version
Reinstall the given Cask\.
.
.TP
-\fBsearch\fR or \fB\-S\fR [\fItext\fR | /\fIregexp\fR/]
-Without an argument, display all locally available Casks for install; no online search is performed\. Otherwise perform a substring search of known Cask tokens for \fItext\fR or, if the text is delimited by slashes (/\fIregexp\fR/), it is interpreted as a Ruby regular expression\.
-.
-.TP
\fBstyle\fR [\-\-fix] [ \fItoken\fR \.\.\. ]
Check the given Casks for correct style using RuboCop (with custom Cask cops)\. If no tokens are given on the command line, all Casks are checked\. With \fB\-\-fix\fR, auto\-correct any style errors if possible\.
. | true |
Other | Homebrew | brew | 774adaf43537c536ccdaaf0ffe0b208d737d44cc.json | exceptions: remove unused scp exception.
The code was removed but the exception was not. | Library/Homebrew/exceptions.rb | @@ -512,13 +512,6 @@ def initialize(url)
end
end
-# Raised in {ScpDownloadStrategy#fetch}.
-class ScpDownloadStrategyError < RuntimeError
- def initialize(cause)
- super "Download failed: #{cause}"
- end
-end
-
# Raised by {#safe_system} in `utils.rb`.
class ErrorDuringExecution < RuntimeError
attr_reader :cmd | false |
Other | Homebrew | brew | 9f33a9b1be1ea6d135205ecbd25f7fb21b49181c.json | brew.sh: improve Docker whitelist on Azure pipelines. | Library/Homebrew/brew.sh | @@ -355,8 +355,8 @@ fi
check-run-command-as-root() {
[[ "$(id -u)" = 0 ]] || return
- # Allow Docker to do everything as root (as it's normal there)
- [[ -f /proc/1/cgroup ]] && grep docker -q /proc/1/cgroup && return
+ # Allow Azure Pipelines/Docker to do everything as root (as it's normal there)
+ [[ -f /proc/1/cgroup ]] && grep -E "azpl_job|docker" -q /proc/1/cgroup && return
# Homebrew Services may need `sudo` for system-wide daemons.
[[ "$HOMEBREW_COMMAND" = "services" ]] && return | false |
Other | Homebrew | brew | 028b8b408dd959bb4ade72cf2365f92a68e3df6d.json | Remove use of bash | Library/Homebrew/dev-cmd/extract.rb | @@ -81,7 +81,8 @@ def extract_args
Look through repository history to find the most recent version of <formula> and
create a copy in <tap>`/Formula/`<formula>`@`<version>`.rb`. If the tap is not
- installed yet, attempt to install/clone the tap before continuing.
+ installed yet, attempt to install/clone the tap before continuing. To extract
+ a <formula> from a tap that is not homebrew/core use <user>/<repo>/<formula>.
EOS
flag "--version=",
@@ -112,7 +113,12 @@ def extract
destination_tap.install unless destination_tap.installed?
repo = source_tap.path
- pattern = source_tap.core_tap? ? repo/"Formula/#{name}.rb" : repo/"{,**/}#{name}.rb"
+ pattern = if source_tap.core_tap?
+ [repo/"Formula/#{name}.rb"]
+ else
+ # A formula can technically live in the root directory of a tap or in any of its subdirectories
+ [repo/"#{name}.rb", repo/"**/#{name}.rb"]
+ end
if args.version
ohai "Searching repository history"
@@ -138,6 +144,7 @@ def extract
end
odie "Could not find #{name}! The formula or version may not have existed." if test_formula.nil?
else
+ # Search in the root directory of <repo> as well as recursively in all of its subdirectories
files = Dir[repo/"{,**/}"].map do |dir|
Pathname.glob(["#{dir}/#{name}.rb"]).find(&:file?)
end.compact | true |
Other | Homebrew | brew | 028b8b408dd959bb4ade72cf2365f92a68e3df6d.json | Remove use of bash | Library/Homebrew/test/dev-cmd/extract_spec.rb | @@ -1,5 +1,5 @@
describe "brew extract", :integration_test do
- it "retrieves the specified version of formula from core tap, defaulting to most recent" do
+ it "retrieves the specified version of formula, defaulting to most recent" do
path = Tap::TAP_DIRECTORY/"homebrew/homebrew-foo"
(path/"Formula").mkpath
target = Tap.from_path(path)
@@ -29,69 +29,4 @@
expect(Formulary.factory(path/"Formula/testball@0.1.rb").version).to be == "0.1"
end
-
- it "retrieves the specified version of formula from a tap other than core, defaulting to most recent" do
- destination = Tap::TAP_DIRECTORY/"homebrew/homebrew-foo"
- (destination/"Formula").mkpath
- destination_tap = Tap.from_path(destination)
-
- source = Tap::TAP_DIRECTORY/"homebrew/homebrew-bar"
- source.mkpath
- source_tap = Tap.from_path(source)
-
- tarball = if OS.linux?
- TEST_FIXTURE_DIR/"tarballs/testball-0.1-linux.tbz"
- else
- TEST_FIXTURE_DIR/"tarballs/testball-0.1.tbz"
- end
-
- content = <<~RUBY
- desc "Some test"
- homepage "https://brew.sh/testball"
- url "file://#{tarball}"
- sha256 "#{tarball.sha256}"
-
- option "with-foo", "Build with foo"
-
- def install
- (prefix/"foo"/"test").write("test") if build.with? "foo"
- prefix.install Dir["*"]
- (buildpath/"test.c").write \
- "#include <stdio.h>\\nint main(){return printf(\\"test\\");}"
- bin.mkpath
- system ENV.cc, "test.c", "-o", bin/"test"
- end
- RUBY
-
- formula_file = source_tap.path/"testball.rb"
- formula_file.write <<~RUBY
- class Testball < Formula
- #{content}
- end
- RUBY
-
- source_tap.path.cd do
- system "git", "init"
- system "git", "add", "--all"
- system "git", "commit", "-m", "testball 0.1"
- contents = File.read(formula_file)
- contents.gsub!("testball-0.1", "testball-0.2")
- File.write(formula_file, contents)
- system "git", "add", "--all"
- system "git", "commit", "-m", "testball 0.2"
- end
- expect { brew "extract", "homebrew/bar/testball", destination_tap.name }
- .to be_a_success
-
- expect(destination/"Formula/testball@0.2.rb").to exist
-
- expect(Formulary.factory(destination/"Formula/testball@0.2.rb").version).to be == "0.2"
-
- expect { brew "extract", "homebrew/bar/testball", destination_tap.name, "--version=0.1" }
- .to be_a_success
-
- expect(destination/"Formula/testball@0.1.rb").to exist
-
- expect(Formulary.factory(destination/"Formula/testball@0.1.rb").version).to be == "0.1"
- end
end | true |
Other | Homebrew | brew | 028b8b408dd959bb4ade72cf2365f92a68e3df6d.json | Remove use of bash | Library/Homebrew/utils/git.rb | @@ -4,7 +4,11 @@ module Git
module_function
def last_revision_commit_of_file(repo, file, before_commit: nil)
- args = [before_commit.nil? ? "--skip=1" : before_commit.split("..").first]
+ args = if before_commit.nil?
+ ["--skip=1"]
+ else
+ [before_commit.split("..").first]
+ end
out, = Open3.capture3(
HOMEBREW_SHIMS_PATH/"scm/git", "-C", repo,
@@ -14,17 +18,26 @@ def last_revision_commit_of_file(repo, file, before_commit: nil)
out.chomp
end
- def last_revision_commit_of_files(repo, file, before_commit: nil)
- args = [before_commit.nil? ? "--skip=1" : before_commit.split("..").first]
+ def last_revision_commit_of_files(repo, files, before_commit: nil)
+ args = if before_commit.nil?
+ ["--skip=1"]
+ else
+ [before_commit.split("..").first]
+ end
- cmd = [
- HOMEBREW_SHIMS_PATH/"scm/git", "-C", repo,
- "log", "--format=%h", "--abbrev=7", "--max-count=1", "--name-only",
- *args, "--", file
- ]
- out, = Open3.capture3("/bin/bash", "-c", cmd.join(" "))
- rev, *files = out.chomp.split(/\n/).reject(&:empty?)
- [rev, files]
+ # git log output format:
+ # <commit_hash>
+ # <file_path1>
+ # <file_path2>
+ # ...
+ # return [<commit_hash>, [file_path1, file_path2, ...]]
+ out, = Open3.capture3(
+ HOMEBREW_SHIMS_PATH/"scm/git", "-C", repo, "log",
+ "--pretty=format:%h", "--abbrev=7", "--max-count=1",
+ "--diff-filter=d", "--name-only", *args, "--", *files
+ )
+ rev, *paths = out.chomp.split(/\n/).reject(&:empty?)
+ [rev, paths]
end
def last_revision_of_file(repo, file, before_commit: nil) | true |
Other | Homebrew | brew | 028b8b408dd959bb4ade72cf2365f92a68e3df6d.json | Remove use of bash | docs/Manpage.md | @@ -785,7 +785,8 @@ Homebrew repository for editing if no *`formula`* is provided.
Look through repository history to find the most recent version of *`formula`* and
create a copy in *`tap`*`/Formula/`*`formula`*`@`*`version`*`.rb`. If the tap is not
-installed yet, attempt to install/clone the tap before continuing.
+installed yet, attempt to install/clone the tap before continuing. To extract a
+*`formula`* from a tap that is not homebrew/core use *`user`*/*`repo`*/*`formula`*.
* `--version`:
Extract the provided *`version`* of *`formula`* instead of the most recent. | true |
Other | Homebrew | brew | 028b8b408dd959bb4ade72cf2365f92a68e3df6d.json | Remove use of bash | manpages/brew.1 | @@ -985,7 +985,7 @@ Generate the new formula in the provided tap, specified as \fIuser\fR\fB/\fR\fIr
Open a formula in the editor set by \fBEDITOR\fR or \fBHOMEBREW_EDITOR\fR, or open the Homebrew repository for editing if no \fIformula\fR is provided\.
.
.SS "\fBextract\fR [\fIoptions\fR] \fIformula\fR \fItap\fR"
-Look through repository history to find the most recent version of \fIformula\fR and create a copy in \fItap\fR\fB/Formula/\fR\fIformula\fR\fB@\fR\fIversion\fR\fB\.rb\fR\. If the tap is not installed yet, attempt to install/clone the tap before continuing\.
+Look through repository history to find the most recent version of \fIformula\fR and create a copy in \fItap\fR\fB/Formula/\fR\fIformula\fR\fB@\fR\fIversion\fR\fB\.rb\fR\. If the tap is not installed yet, attempt to install/clone the tap before continuing\. To extract a \fIformula\fR from a tap that is not homebrew/core use \fIuser\fR/\fIrepo\fR/\fIformula\fR\.
.
.TP
\fB\-\-version\fR | true |
Other | Homebrew | brew | 021468c8c0b5d587d6102535be2d4dc66d3b5863.json | bump-formula-pr: improve no formula output.
This means the help text will be output. | Library/Homebrew/dev-cmd/bump-formula-pr.rb | @@ -109,7 +109,7 @@ def bump_formula_pr
odie "Couldn't guess formula for sure: could be one of these:\n#{guesses}"
end
end
- odie "No formula found!" unless formula
+ raise FormulaUnspecifiedError unless formula
check_for_duplicate_pull_requests(formula) unless checked_for_duplicates
| false |
Other | Homebrew | brew | fbaa0c35a6668b31b74af3a890d5449a446bb93a.json | bump-formula-pr: move auto-update to brew.sh
It’s always run anyway but this at least means Homebrew/brew and tap code is all up to date before we start querying any objects.
Fixes #5876. | Library/Homebrew/brew.sh | @@ -420,6 +420,7 @@ update-preinstall() {
[[ -z "$HOMEBREW_UPDATE_PREINSTALL" ]] || return
if [[ "$HOMEBREW_COMMAND" = "install" || "$HOMEBREW_COMMAND" = "upgrade" ||
+ "$HOMEBREW_COMMAND" = "bump-formula-pr" ||
"$HOMEBREW_COMMAND" = "tap" && $HOMEBREW_ARG_COUNT -gt 1 ||
"$HOMEBREW_CASK_COMMAND" = "install" || "$HOMEBREW_CASK_COMMAND" = "upgrade" ]]
then | true |
Other | Homebrew | brew | fbaa0c35a6668b31b74af3a890d5449a446bb93a.json | bump-formula-pr: move auto-update to brew.sh
It’s always run anyway but this at least means Homebrew/brew and tap code is all up to date before we start querying any objects.
Fixes #5876. | Library/Homebrew/dev-cmd/bump-formula-pr.rb | @@ -166,12 +166,6 @@ def bump_formula_pr
end
end
- if args.dry_run?
- ohai "brew update"
- else
- safe_system "brew", "update"
- end
-
old_formula_version = formula_version(formula, requested_spec)
replacement_pairs = [] | true |
Other | Homebrew | brew | 803ea4ed1a8d7c4710f7b0e91f393c2ec1970ba1.json | tab#to_json: allow zero parameters. | Library/Homebrew/tab.rb | @@ -324,7 +324,7 @@ def source_modified_time
Time.at(super)
end
- def to_json(_opts)
+ def to_json(options = nil)
attributes = {
"homebrew_version" => homebrew_version,
"used_options" => used_options.as_flags,
@@ -344,7 +344,7 @@ def to_json(_opts)
"source" => source,
}
- JSON.generate(attributes)
+ JSON.generate(attributes, options)
end
def write | false |
Other | Homebrew | brew | 56ac7ed58b0aa3ed7e05a62b6a18f8e6f6624bfe.json | man: omit global options from shell command usage
When reading the comment header of a shell command, omit options that
are in Homebrew::CLI::Parser.global_options, since they are documented
separately for all commands. | Library/Homebrew/dev-cmd/man.rb | @@ -195,6 +195,9 @@ def cmd_comment_manpage_lines(cmd_path)
line = line.slice(4..-1)
next unless line
+ # Omit the common global_options documented separately in the man page.
+ next if line =~ /--(debug|force|help|quiet|verbose) /
+
# Format one option or a comma-separated pair of short and long options.
lines << line.gsub(/^ +(-+[a-z-]+), (-+[a-z-]+) +/, "* `\\1`, `\\2`:\n ")
.gsub(/^ +(-+[a-z-]+) +/, "* `\\1`:\n ") | true |
Other | Homebrew | brew | 56ac7ed58b0aa3ed7e05a62b6a18f8e6f6624bfe.json | man: omit global options from shell command usage
When reading the comment header of a shell command, omit options that
are in Homebrew::CLI::Parser.global_options, since they are documented
separately for all commands. | docs/Manpage.md | @@ -540,9 +540,6 @@ Fetch the newest version of Homebrew and all formulae from GitHub using `git`(1)
* `--merge`:
`git merge` is used to include updates (rather than `git rebase`).
-* `--force`:
- Always do a slower, full update check (even if unnecessary).
-
### `update-reset` [*`repository`*]
Fetches and resets Homebrew and all tap repositories (or any specified `repository`) using `git`(1) to their latest `origin/master`. Note this will destroy all your uncommitted or committed changes.
| true |
Other | Homebrew | brew | 56ac7ed58b0aa3ed7e05a62b6a18f8e6f6624bfe.json | man: omit global options from shell command usage
When reading the comment header of a shell command, omit options that
are in Homebrew::CLI::Parser.global_options, since they are documented
separately for all commands. | manpages/brew.1 | @@ -660,10 +660,6 @@ Fetch the newest version of Homebrew and all formulae from GitHub using \fBgit\f
\fB\-\-merge\fR
\fBgit merge\fR is used to include updates (rather than \fBgit rebase\fR)\.
.
-.TP
-\fB\-\-force\fR
-Always do a slower, full update check (even if unnecessary)\.
-.
.SS "\fBupdate\-reset\fR [\fIrepository\fR]"
Fetches and resets Homebrew and all tap repositories (or any specified \fBrepository\fR) using \fBgit\fR(1) to their latest \fBorigin/master\fR\. Note this will destroy all your uncommitted or committed changes\.
. | true |
Other | Homebrew | brew | 705f03ef9f8576016853bdc34c63a053e9bce986.json | info: support analytics for cask-install | Library/Homebrew/cmd/info.rb | @@ -26,7 +26,7 @@ def info_args
flag "--category",
depends_on: "--analytics",
description: "The value for `category` must be `install`, `install-on-request`, "\
- "`build-error` or `os-version`. The default is `install`."
+ "`cask-install`, `build-error` or `os-version`. The default is `install`."
switch "--github",
description: "Open a browser to the GitHub History page for provided <formula>. "\
"To view formula history locally: `brew log -p` <formula>"
@@ -223,7 +223,7 @@ def formulae_api_json(endpoint)
nil
end
- def analytics_table(category, days, results, os_version: false)
+ def analytics_table(category, days, results, os_version: false, cask_install: false)
oh1 "#{category} (#{days} days)"
total_count = results.values.inject("+")
formatted_total_count = format_count(total_count)
@@ -234,6 +234,8 @@ def analytics_table(category, days, results, os_version: false)
percent_header = "Percent"
name_with_options_header = if os_version
"macOS Version"
+ elsif cask_install
+ "Token"
else
"Name (with options)"
end
@@ -314,7 +316,7 @@ def output_analytics(filter: nil)
raise UsageError, "days must be one of #{valid_days.join(", ")}" unless valid_days.include?(days)
category = args.category || "install"
- valid_categories = %w[install install-on-request build-error os-version]
+ valid_categories = %w[install install-on-request cask-install build-error os-version]
unless valid_categories.include?(category)
raise UsageError, "category must be one of #{valid_categories.join(", ")}"
end
@@ -323,10 +325,13 @@ def output_analytics(filter: nil)
return if json.blank? || json["items"].blank?
os_version = category == "os-version"
+ cask_install = category == "cask-install"
results = {}
json["items"].each do |item|
key = if os_version
item["os_version"]
+ elsif cask_install
+ item["cask"]
else
item["formula"]
end
@@ -341,7 +346,7 @@ def output_analytics(filter: nil)
return
end
- analytics_table(category, days, results, os_version: os_version)
+ analytics_table(category, days, results, os_version: os_version, cask_install: cask_install)
end
def output_formula_analytics(f) | true |
Other | Homebrew | brew | 705f03ef9f8576016853bdc34c63a053e9bce986.json | info: support analytics for cask-install | docs/Manpage.md | @@ -203,7 +203,7 @@ Display brief statistics for your Homebrew installation.
* `--days`:
The value for `days` must be `30`, `90` or `365`. The default is `30`.
* `--category`:
- The value for `category` must be `install`, `install-on-request`, `build-error` or `os-version`. The default is `install`.
+ The value for `category` must be `install`, `install-on-request`, `cask-install`, `build-error` or `os-version`. The default is `install`.
* `--github`:
Open a browser to the GitHub History page for provided *`formula`*. To view formula history locally: `brew log -p` *`formula`*
* `--json`: | true |
Other | Homebrew | brew | 705f03ef9f8576016853bdc34c63a053e9bce986.json | info: support analytics for cask-install | manpages/brew.1 | @@ -243,7 +243,7 @@ The value for \fBdays\fR must be \fB30\fR, \fB90\fR or \fB365\fR\. The default i
.
.TP
\fB\-\-category\fR
-The value for \fBcategory\fR must be \fBinstall\fR, \fBinstall\-on\-request\fR, \fBbuild\-error\fR or \fBos\-version\fR\. The default is \fBinstall\fR\.
+The value for \fBcategory\fR must be \fBinstall\fR, \fBinstall\-on\-request\fR, \fBcask\-install\fR, \fBbuild\-error\fR or \fBos\-version\fR\. The default is \fBinstall\fR\.
.
.TP
\fB\-\-github\fR | true |
Other | Homebrew | brew | fbb28175d8220ea89556f0275238387f4dfe386a.json | info: use UsageError, extend timeout | Library/Homebrew/cmd/info.rb | @@ -214,7 +214,7 @@ def info_formula(f)
def formulae_api_json(endpoint)
return if ENV["HOMEBREW_NO_ANALYTICS"] || ENV["HOMEBREW_NO_GITHUB_API"]
- output, = curl_output("--max-time", "3",
+ output, = curl_output("--max-time", "5",
"https://formulae.brew.sh/api/#{endpoint}")
return if output.blank?
@@ -311,12 +311,12 @@ def analytics_table(category, days, results, os_version: false)
def output_analytics(filter: nil)
days = args.days || "30"
valid_days = %w[30 90 365]
- raise ArgumentError("Days must be one of #{valid_days.join(", ")}!") unless valid_days.include?(days)
+ raise UsageError, "days must be one of #{valid_days.join(", ")}" unless valid_days.include?(days)
category = args.category || "install"
valid_categories = %w[install install-on-request build-error os-version]
unless valid_categories.include?(category)
- raise ArgumentError("Categories must be one of #{valid_categories.join(", ")}")
+ raise UsageError, "category must be one of #{valid_categories.join(", ")}"
end
json = formulae_api_json("analytics/#{category}/#{days}d.json") | false |
Other | Homebrew | brew | 330015ffbdd766b1af260ae4eb3efa41e6e8c19b.json | Fix incorrect formula name from file name | Library/Homebrew/dev-cmd/extract.rb | @@ -142,7 +142,7 @@ def extract
# The class name has to be renamed to match the new filename,
# e.g. Foo version 1.2.3 becomes FooAT123 and resides in Foo@1.2.3.rb.
- class_name = name.capitalize
+ class_name = Formulary.class_s(name.to_s)
versioned_name = Formulary.class_s("#{class_name}@#{version}")
result.gsub!("class #{class_name} < Formula", "class #{versioned_name} < Formula")
| false |
Other | Homebrew | brew | a8c4136e9edb02e6b637b53357af7a921538c149.json | os/mac: Use delegation for Mach-O methods | Library/Homebrew/os/mac/mach.rb | @@ -2,6 +2,10 @@
require "os/mac/architecture_list"
module MachOShim
+ extend Forwardable
+
+ delegate [:dylib_id, :rpaths, :delete_rpath] => :macho
+
# @private
def macho
@macho ||= begin
@@ -56,18 +60,6 @@ def dynamically_linked_libraries(except: :none)
lcs.map(&:name).map(&:to_s).uniq
end
- def dylib_id
- macho.dylib_id
- end
-
- def rpaths
- macho.rpaths
- end
-
- def delete_rpath(rpath)
- macho.delete_rpath(rpath)
- end
-
def archs
mach_data.map { |m| m.fetch :arch }.extend(ArchitectureListExtension)
end | false |
Other | Homebrew | brew | d2dc4e559982774b8e7d1e3eb0cdf40c97180778.json | mac/keg_relocate: Drop unnecessary parens | Library/Homebrew/extend/os/mac/keg_relocate.rb | @@ -79,7 +79,7 @@ def expand_rpath(file, bad_name)
suffix = bad_name.sub(/^@rpath/, "")
file.rpaths.each do |rpath|
- return (rpath/suffix) if (rpath/suffix).exist?
+ return rpath/suffix if (rpath/suffix).exist?
end
opoo "Could not find library #{bad_name} for #{file}" | false |
Other | Homebrew | brew | 27d6cfb12e0a5cac753ab1b1157ebfb9d371f4f3.json | [WIP] mac/keg_relocate: Emulate dylinker behavior
Instead of assuming that #{lib} is the correct RPATH expansion,
test all RPATHS and substitute the first one that works. | Library/Homebrew/extend/os/mac/keg_relocate.rb | @@ -75,6 +75,20 @@ def fix_dynamic_linkage
generic_fix_dynamic_linkage
end
+ def expand_rpath(file, bad_name)
+ suffix = bad_name.sub(/^@rpath/, "")
+
+ # short circuit: we expect lib to be usually correct, so we try it first
+ return (lib + suffix) if (lib + suffix).exist?
+
+ file.rpaths.each do |rpath|
+ return (rpath + suffix) if (rpath + suffix).exist?
+ end
+
+ opoo "Could not expand an RPATH in #{file}"
+ bad_name
+ end
+
# If file is a dylib or bundle itself, look for the dylib named by
# bad_name relative to the lib directory, so that we can skip the more
# expensive recursive search if possible.
@@ -88,7 +102,7 @@ def fixed_name(file, bad_name)
elsif file.mach_o_executable? && (lib + bad_name).exist?
"#{lib}/#{bad_name}"
elsif bad_name.start_with? "@rpath"
- bad_name.sub("@rpath", lib)
+ expand_rpath bad_name
elsif (abs_name = find_dylib(bad_name)) && abs_name.exist?
abs_name.to_s
else | false |
Other | Homebrew | brew | 54e6cbb34347a7f03844eae98aa7f856d6e5ac07.json | mac/keg_relocate: Rewrite rpaths in install names | Library/Homebrew/extend/os/mac/keg_relocate.rb | @@ -87,6 +87,8 @@ def fixed_name(file, bad_name)
"@loader_path/#{bad_name}"
elsif file.mach_o_executable? && (lib + bad_name).exist?
"#{lib}/#{bad_name}"
+ elsif bad_name.start_with? "@rpath"
+ bad_name.sub("@rpath", lib)
elsif (abs_name = find_dylib(bad_name)) && abs_name.exist?
abs_name.to_s
else
@@ -97,7 +99,7 @@ def fixed_name(file, bad_name)
def each_install_name_for(file, &block)
dylibs = file.dynamically_linked_libraries
- dylibs.reject! { |fn| fn =~ /^@(loader_|executable_|r)path/ }
+ dylibs.reject! { |fn| fn =~ /^@(loader_|executable_)path/ }
dylibs.each(&block)
end
| false |
Other | Homebrew | brew | 5c068ef82cfb3344f10d7ab3c42003069dd000bb.json | elf.rb: avoid corrupted elf files
Some elf files like unittest files or memory dumps may not be completely
readable by readelf.
Readelf will fail after the following message:
readelf: Warning: possibly corrupt ELF header - it has a non-zero program header offset, but no program headers
This patches avoid these files when there is a non zero offset but no
program headers | Library/Homebrew/os/linux/elf.rb | @@ -133,8 +133,10 @@ def needed_libraries_using_readelf(path)
soname = nil
needed = []
command = ["readelf", "-d", path.expand_path.to_s]
- lines = Utils.safe_popen_read(*command).split("\n")
+ lines = Utils.popen_read(*command, err: :out).split("\n")
lines.each do |s|
+ next if s.start_with?("readelf: Warning: possibly corrupt ELF header")
+
filename = s[/\[(.*)\]/, 1]
next if filename.nil?
| false |
Other | Homebrew | brew | e0db3a214ae5601c8158c8a4a41c14bd146f0828.json | docs/_config.yml: shorten search placeholder.
Current one is truncated on macOS. | docs/_config.yml | @@ -22,7 +22,7 @@ defaults:
path: ""
values:
image: /assets/img/homebrew-256x256.png
- search_name: Homebrew Documentation
+ search_name: Documentation
search_site: docs
logo: /assets/img/homebrew-256x256.png | false |
Other | Homebrew | brew | 2ac9242562bb52ca1abbd550aa53a1b6f9897d26.json | docs/_config.yml: enable documentation search.
Set the search placeholder badge, the index and trigger a new GitHub
Pages build (by merging this). | docs/_config.yml | @@ -22,6 +22,8 @@ defaults:
path: ""
values:
image: /assets/img/homebrew-256x256.png
+ search_name: Homebrew Documentation
+ search_site: docs
logo: /assets/img/homebrew-256x256.png
| false |
Other | Homebrew | brew | adb3a17fef865882bdc7a5bd48c2491f99240439.json | Brew: remove prune completion for Bash | completions/bash/brew | @@ -384,16 +384,6 @@ _brew_postinstall() {
__brew_complete_installed
}
-_brew_prune() {
- local cur="${COMP_WORDS[COMP_CWORD]}"
- case "$cur" in
- --*)
- __brewcomp "--dry-run --verbose"
- return
- ;;
- esac
-}
-
_brew_pull() {
local cur="${COMP_WORDS[COMP_CWORD]}"
case "$cur" in | false |
Other | Homebrew | brew | 95c1c8eb615c879f76ea587262f7e586f280bf80.json | completions/zsh: Improve caching behaviour
Fixes #5839
- Eliminate reliance on external utility calls for cache invalidation
- Update cache policy to also invalidate if cache file is >=2 weeks old or if
tap indexes are non-existent
- Do not override any cache policy the user might already have set
- Handle default cache policy determination as early as possible to ensure that
a default is set appropriately for all helpers (this will mostly be useful if
other helpers need caching in the future) | completions/zsh/_brew | @@ -41,18 +41,19 @@ __brew_formulae_or_ruby_files() {
# completions remain in cache until any tap has new commits
__brew_completion_caching_policy() {
- # rebuild cache if no cache file exists (anyway we cannot proceed further down)
- ! [[ -f "$1" ]] && return 0
- # cache file modification date (seconds since epoch)
- local -i cache_mtime=$(date -r "$1" +%s)
- # latest modified homebrew tap index file
- local latest_modified_git_index=(${HOMEBREW_REPOSITORY:-/usr/local/Homebrew}/Library/Taps/*/*/.git/index(om[1]))
- local -i commit_mtime=$(date -r "$latest_modified_git_index" +%s)
- (( $cache_mtime < $commit_mtime ))
+ local -a tmp
+
+ # invalidate if cache file is missing or >=2 weeks old
+ tmp=( $1(mw-2N) )
+ (( $#tmp )) || return 0
+
+ # otherwise, invalidate if latest tap index file is missing or newer than
+ # cache file
+ tmp=( ${HOMEBREW_REPOSITORY:-/usr/local/Homebrew}/Library/Taps/*/*/.git/index(om[1]N) )
+ [[ -z $tmp || $tmp -nt $1 ]]
}
__brew_formulae() {
- zstyle ":completion:${curcontext}:" cache-policy __brew_completion_caching_policy
local -a formulae
local comp_cachename=brew_formulae
if _cache_invalid $comp_cachename || ! _retrieve_cache $comp_cachename; then
@@ -147,7 +148,6 @@ __brew_common_commands() {
}
__brew_all_commands() {
- zstyle ":completion:${curcontext}:" cache-policy __brew_completion_caching_policy
local -a commands
local comp_cachename=brew_all_commands
if _cache_invalid $comp_cachename || ! _retrieve_cache $comp_cachename; then
@@ -808,15 +808,23 @@ _brew_vendor_install() {
# the main completion function
_brew() {
local curcontext="$curcontext" state state_descr line expl
- local ret=1
+ local tmp ret=1
_arguments -C : \
'(-v)-v[verbose]' \
'1:command:->command' \
'*::options:->options' && return 0
case "$state" in
- command) __brew_commands && return 0 ;;
+ command)
+ # set default cache policy
+ zstyle -s ":completion:${curcontext%:*}:*" cache-policy tmp
+ [[ -n $tmp ]] ||
+ zstyle ":completion:${curcontext%:*}:*" cache-policy \
+ __brew_completion_caching_policy
+
+ __brew_commands && return 0
+ ;;
options)
local command_or_alias command
local -A aliases
@@ -827,7 +835,14 @@ _brew() {
command="${aliases[$command_or_alias]:-$command_or_alias}"
# change context to e.g. brew-list
- curcontext="${curcontext%:*:*}:brew-${command}"
+ curcontext="${curcontext%:*}-${command}:${curcontext##*:}"
+
+ # set default cache policy (we repeat this dance because the context
+ # service differs from above)
+ zstyle -s ":completion:${curcontext%:*}:*" cache-policy tmp
+ [[ -n $tmp ]] ||
+ zstyle ":completion:${curcontext%:*}:*" cache-policy \
+ __brew_completion_caching_policy
# call completion for named command e.g. _brew_list
local completion_func="_brew_${command//-/_}" | false |
Other | Homebrew | brew | 141db031933eec278ff6815226fd97de5ac6f3cc.json | vendor-gems: fix output location, also run pristine.
This means the output is consistent and ensures that we get rid of any local cruft when installing. | Library/Homebrew/dev-cmd/vendor-gems.rb | @@ -20,8 +20,11 @@ def vendor_gems
Homebrew.install_bundler!
- ohai "cd #{HOMEBREW_LIBRARY_PATH}/vendor"
+ ohai "cd #{HOMEBREW_LIBRARY_PATH}"
HOMEBREW_LIBRARY_PATH.cd do
+ ohai "bundle pristine"
+ safe_system "bundle", "pristine"
+
ohai "bundle install --standalone"
safe_system "bundle", "install", "--standalone"
| false |
Other | Homebrew | brew | aead4a720df0b52725cf0f0eab1f01001df30d77.json | outdated & tap-info: set default value for --json
Matching what's already been done for `brew info`. | Library/Homebrew/cmd/outdated.rb | @@ -19,15 +19,16 @@ def outdated_args
description: "List only the names of outdated brews (takes precedence over `--verbose`)."
switch :verbose,
description: "Display detailed version information."
- flag "--json=",
- description: "Show output in JSON format for provided <version>. Currently the only "\
- "accepted value of <version> is `v1`."
+ flag "--json",
+ description: "Print output in JSON format. Currently the default and only accepted "\
+ "value for <version> is `v1`. See the docs for examples of using the JSON "\
+ "output: <https://docs.brew.sh/Querying-Brew>"
switch "--fetch-HEAD",
description: "Fetch the upstream repository to detect if the HEAD installation of the "\
"formula is outdated. Otherwise, the repository's HEAD will be checked for "\
"updates when a new stable or development version has been released."
switch :debug
- conflicts "--quiet", "--verbose", "--json="
+ conflicts "--quiet", "--verbose", "--json"
end
end
@@ -39,7 +40,9 @@ def outdated
else
ARGV.resolved_formulae
end
- if args.json == "v1"
+ if args.json
+ raise UsageError, "invalid JSON version: #{args.json}" unless ["v1", true].include? args.json
+
outdated = print_outdated_json(formulae)
else
outdated = print_outdated(formulae) | true |
Other | Homebrew | brew | aead4a720df0b52725cf0f0eab1f01001df30d77.json | outdated & tap-info: set default value for --json
Matching what's already been done for `brew info`. | Library/Homebrew/cmd/tap-info.rb | @@ -13,10 +13,10 @@ def tap_info_args
EOS
switch "--installed",
description: "Display information on all installed taps."
- flag "--json=",
- description: "Print a JSON representation of <taps>. Currently the only accepted value for "\
- "<version> is `v1`. See the docs for examples of using the JSON output: "\
- "<https://docs.brew.sh/Querying-Brew>"
+ flag "--json",
+ description: "Print a JSON representation of <taps>. Currently the default and only accepted "\
+ "value for <version> is `v1`. See the docs for examples of using the JSON "\
+ "output: <https://docs.brew.sh/Querying-Brew>"
switch :debug
end
end
@@ -32,7 +32,9 @@ def tap_info
end
end
- if args.json == "v1"
+ if args.json
+ raise UsageError, "invalid JSON version: #{args.json}" unless ["v1", true].include? args.json
+
print_tap_json(taps.sort_by(&:to_s))
else
print_tap_info(taps.sort_by(&:to_s)) | true |
Other | Homebrew | brew | aead4a720df0b52725cf0f0eab1f01001df30d77.json | outdated & tap-info: set default value for --json
Matching what's already been done for `brew info`. | docs/Manpage.md | @@ -339,7 +339,7 @@ By default, version information is displayed in interactive shells, and
suppressed otherwise.
* `--json`:
- Show output in JSON format for provided *`version`*. Currently the only accepted value of *`version`* is `v1`.
+ Print output in JSON format. Currently the default and only accepted value for *`version`* is `v1`. See the docs for examples of using the JSON output: <https://docs.brew.sh/Querying-Brew>
* `--fetch-HEAD`:
Fetch the upstream repository to detect if the HEAD installation of the formula is outdated. Otherwise, the repository's HEAD will be checked for updates when a new stable or development version has been released.
@@ -479,7 +479,7 @@ Display a brief summary of all installed taps if no *`tap`* are passed.
* `--installed`:
Display information on all installed taps.
* `--json`:
- Print a JSON representation of *`taps`*. Currently the only accepted value for *`version`* is `v1`. See the docs for examples of using the JSON output: <https://docs.brew.sh/Querying-Brew>
+ Print a JSON representation of *`taps`*. Currently the default and only accepted value for *`version`* is `v1`. See the docs for examples of using the JSON output: <https://docs.brew.sh/Querying-Brew>
### `tap-pin` *`tap`*
| true |
Other | Homebrew | brew | aead4a720df0b52725cf0f0eab1f01001df30d77.json | outdated & tap-info: set default value for --json
Matching what's already been done for `brew info`. | manpages/brew-cask.1 | @@ -1,7 +1,7 @@
.\" generated with Ronn/v0.7.3
.\" http://github.com/rtomayko/ronn/tree/0.7.3
.
-.TH "BREW\-CASK" "1" "February 2019" "Homebrew" "brew-cask"
+.TH "BREW\-CASK" "1" "March 2019" "Homebrew" "brew-cask"
.
.SH "NAME"
\fBbrew\-cask\fR \- a friendly binary installer for macOS | true |
Other | Homebrew | brew | aead4a720df0b52725cf0f0eab1f01001df30d77.json | outdated & tap-info: set default value for --json
Matching what's already been done for `brew info`. | manpages/brew.1 | @@ -1,7 +1,7 @@
.\" generated with Ronn/v0.7.3
.\" http://github.com/rtomayko/ronn/tree/0.7.3
.
-.TH "BREW" "1" "February 2019" "Homebrew" "brew"
+.TH "BREW" "1" "March 2019" "Homebrew" "brew"
.
.SH "NAME"
\fBbrew\fR \- The missing package manager for macOS
@@ -438,7 +438,7 @@ By default, version information is displayed in interactive shells, and suppress
.
.TP
\fB\-\-json\fR
-Show output in JSON format for provided \fIversion\fR\. Currently the only accepted value of \fIversion\fR is \fBv1\fR\.
+Print output in JSON format\. Currently the default and only accepted value for \fIversion\fR is \fBv1\fR\. See the docs for examples of using the JSON output: \fIhttps://docs\.brew\.sh/Querying\-Brew\fR
.
.TP
\fB\-\-fetch\-HEAD\fR
@@ -603,7 +603,7 @@ Display information on all installed taps\.
.
.TP
\fB\-\-json\fR
-Print a JSON representation of \fItaps\fR\. Currently the only accepted value for \fIversion\fR is \fBv1\fR\. See the docs for examples of using the JSON output: \fIhttps://docs\.brew\.sh/Querying\-Brew\fR
+Print a JSON representation of \fItaps\fR\. Currently the default and only accepted value for \fIversion\fR is \fBv1\fR\. See the docs for examples of using the JSON output: \fIhttps://docs\.brew\.sh/Querying\-Brew\fR
.
.SS "\fBtap\-pin\fR \fItap\fR"
Pin \fItap\fR, prioritising its formulae over core when formula names are supplied by the user\. See also \fBtap\-unpin\fR\. | true |
Other | Homebrew | brew | b6cbe1afa250fe7f717033f5e25b9c5f7557dcc8.json | docs: linkify some links | docs/Releases.md | @@ -22,14 +22,14 @@ If this is a major or minor release (e.g. X.0.0 or X.Y.0) then there are a few m
1. Before creating the tag you should delete any `odisabled` code, make any
`odeprecated` code `odisabled` and add any new `odeprecations` that are
desired.
-2. Write up a release notes blog post to https://brew.sh
- e.g. https://github.com/Homebrew/brew.sh/pull/319.
+2. Write up a release notes blog post to <https://brew.sh>
+ e.g. [brew.sh#319](https://github.com/Homebrew/brew.sh/pull/319).
This should use `brew release-notes` as input but have the wording adjusted
to be more human readable and explain not just what has changed but why.
3. When the release has shipped and the blog post has been merged, tweet the
- blog post as the @MacHomebrew Twitter account or tweet it yourself and
- retweet it with the @MacHomebrew Twitter account (credentials are in
- 1Password).
+ blog post as the [@MacHomebrew Twitter account](https://twitter.com/MacHomebrew)
+ or tweet it yourself and retweet it with the @MacHomebrew Twitter account
+ (credentials are in 1Password).
4. Send the email to the Homebrew TinyLetter email list (credentials are in
1Password).
5. Consider whether to submit it to other sources e.g. Hacker News, Reddit. | false |
Other | Homebrew | brew | b796174d2cfb6d912f7d349d800f5a9a77899d36.json | Allow head in new formulas | Library/Homebrew/dev-cmd/audit.rb | @@ -640,18 +640,14 @@ def audit_specs
problem "Formulae should not have a `devel` spec" if formula.devel
- if formula.head
+ if formula.head && @versioned_formula
head_spec_message = "Formulae should not have a `HEAD` spec"
- if @new_formula
- new_formula_problem head_spec_message
- elsif @versioned_formula
- versioned_head_spec = %w[
- bash-completion@2
- imagemagick@6
- python@2
- ]
- problem head_spec_message unless versioned_head_spec.include?(formula.name)
- end
+ versioned_head_spec = %w[
+ bash-completion@2
+ imagemagick@6
+ python@2
+ ]
+ problem head_spec_message unless versioned_head_spec.include?(formula.name)
end
throttled = %w[ | false |
Other | Homebrew | brew | 9dbd04ac094c8b47aeba242165fbb810c79de9ed.json | python_virtualenv_constants: upgrade virtualenv to 16.4.3 | Library/Homebrew/language/python_virtualenv_constants.rb | @@ -1,6 +1,6 @@
PYTHON_VIRTUALENV_URL =
- "https://files.pythonhosted.org/packages/51/aa" \
- "/c395a6e6eaaedfa5a04723b6446a1df783b16cca6fec66e671cede514688" \
- "/virtualenv-16.4.0.tar.gz".freeze
+ "https://files.pythonhosted.org/packages/37/db" \
+ "/89d6b043b22052109da35416abc3c397655e4bd3cff031446ba02b9654fa" \
+ "/virtualenv-16.4.3.tar.gz".freeze
PYTHON_VIRTUALENV_SHA256 =
- "cceab52aa7d4df1e1871a70236eb2b89fcfe29b6b43510d9738689787c513261".freeze
+ "984d7e607b0a5d1329425dd8845bd971b957424b5ba664729fab51ab8c11bc39".freeze | false |
Other | Homebrew | brew | e295570f00536f65375b74ef732a28b9c76d3997.json | Add varenc/ffmpeg to list of interesting taps | docs/Interesting-Taps-and-Forks.md | @@ -6,6 +6,7 @@ Homebrew has the capability to add (and remove) multiple taps to your local inst
Your taps are Git repositories located at `$(brew --repository)/Library/Taps`.
## Unsupported interesting taps
+* [varenc/ffmpeg](https://github.com/varenc/homebrew-ffmpeg): A tap for FFmpeg with additional options, including nonfree additions.
* [denji/nginx](https://github.com/denji/homebrew-nginx): A tap for NGINX modules, intended for its `nginx-full` formula which includes more module options.
| false |
Other | Homebrew | brew | 128300a754eb1539691ce868efbc51b268b9e802.json | utils/gems: install Bundler 2.
Our Gemfile requires it and it will result in a more consistent configuration. | Library/Homebrew/utils/gems.rb | @@ -50,7 +50,7 @@ def setup_gem_environment!(gem_home: nil, gem_bindir: nil)
ENV["PATH"] = paths.compact.join(":")
end
- def install_gem!(name, version = nil, setup_gem_environment: true)
+ def install_gem!(name, version: nil, setup_gem_environment: true)
setup_gem_environment! if setup_gem_environment
return unless Gem::Specification.find_all_by_name(name, version).empty?
@@ -63,8 +63,8 @@ def install_gem!(name, version = nil, setup_gem_environment: true)
odie_if_defined "failed to install the '#{name}' gem."
end
- def install_gem_setup_path!(name, executable: name, setup_gem_environment: true)
- install_gem!(name, setup_gem_environment: setup_gem_environment)
+ def install_gem_setup_path!(name, version: nil, executable: name, setup_gem_environment: true)
+ install_gem!(name, version: version, setup_gem_environment: setup_gem_environment)
return if ENV["PATH"].split(":").any? do |path|
File.executable?("#{path}/#{executable}")
end
@@ -77,7 +77,7 @@ def install_gem_setup_path!(name, executable: name, setup_gem_environment: true)
def install_bundler!
setup_gem_environment!(gem_home: Gem.user_dir, gem_bindir: gem_user_bindir)
- install_gem_setup_path!("bundler", executable: "bundle", setup_gem_environment: false)
+ install_gem_setup_path!("bundler", version: ">=2", executable: "bundle", setup_gem_environment: false)
end
def install_bundler_gems! | false |
Other | Homebrew | brew | 45c61cdcdbe182d2ed2d8deb8dab2b3ab2507095.json | pull: fix tap name for linuxbrew | Library/Homebrew/dev-cmd/pull.rb | @@ -109,10 +109,10 @@ def pull
elsif (api_match = arg.match HOMEBREW_PULL_API_REGEX)
_, user, repo, issue = *api_match
url = "https://github.com/#{user}/#{repo}/pull/#{issue}"
- tap = Tap.fetch(user, repo) if repo.start_with?("homebrew-")
+ tap = Tap.fetch(user, repo) if repo.match?(HOMEBREW_OFFICIAL_REPO_PREFIXES_REGEX)
elsif (url_match = arg.match HOMEBREW_PULL_OR_COMMIT_URL_REGEX)
url, user, repo, issue = *url_match
- tap = Tap.fetch(user, repo) if repo.start_with?("homebrew-")
+ tap = Tap.fetch(user, repo) if repo.match?(HOMEBREW_OFFICIAL_REPO_PREFIXES_REGEX)
else
odie "Not a GitHub pull request or commit: #{arg}"
end | true |
Other | Homebrew | brew | 45c61cdcdbe182d2ed2d8deb8dab2b3ab2507095.json | pull: fix tap name for linuxbrew | Library/Homebrew/tap.rb | @@ -26,7 +26,7 @@ def self.fetch(*args)
# We special case homebrew and linuxbrew so that users don't have to shift in a terminal.
user = user.capitalize if ["homebrew", "linuxbrew"].include? user
- repo = repo.delete_prefix "homebrew-"
+ repo = repo.sub(HOMEBREW_OFFICIAL_REPO_PREFIXES_REGEX, "")
return CoreTap.instance if ["Homebrew", "Linuxbrew"].include?(user) && ["core", "homebrew"].include?(repo)
| true |
Other | Homebrew | brew | 45c61cdcdbe182d2ed2d8deb8dab2b3ab2507095.json | pull: fix tap name for linuxbrew | Library/Homebrew/tap_constants.rb | @@ -8,3 +8,4 @@
HOMEBREW_TAP_PATH_REGEX = Regexp.new(HOMEBREW_TAP_DIR_REGEX.source + %r{(?:/.*)?$}.source)
# match official taps' casks, e.g. homebrew/cask/somecask or homebrew/cask-versions/somecask
HOMEBREW_CASK_TAP_CASK_REGEX = %r{^(?:([Cc]askroom)/(cask|versions)|(homebrew)/(cask|cask-[\w-]+))/([\w+-.]+)$}.freeze
+HOMEBREW_OFFICIAL_REPO_PREFIXES_REGEX = /^(home|linux)brew-/.freeze | true |
Other | Homebrew | brew | 97958410f453eca9332330a873947e64d4d90f8d.json | dev-cmd/tests: improve parallel args naming. | Library/Homebrew/dev-cmd/tests.rb | @@ -44,6 +44,7 @@ def tests
ENV.delete("HOMEBREW_NO_GITHUB_API")
ENV.delete("HOMEBREW_NO_EMOJI")
ENV.delete("HOMEBREW_DEVELOPER")
+ ENV.delete("HOMEBREW_PRY")
ENV["HOMEBREW_NO_ANALYTICS_THIS_RUN"] = "1"
ENV["HOMEBREW_NO_COMPAT"] = "1" if args.no_compat?
ENV["HOMEBREW_TEST_GENERIC_OS"] = "1" if args.generic?
@@ -85,7 +86,7 @@ def tests
Dir.glob("test/**/*_spec.rb")
end
- opts = if ENV["CI"]
+ parallel_args = if ENV["CI"]
%w[
--combine-stderr
--serialize-stdout
@@ -123,7 +124,7 @@ def tests
puts "Randomized with seed #{seed}"
if parallel
- system "bundle", "exec", "parallel_rspec", *opts, "--", *bundle_args, "--", *files
+ system "bundle", "exec", "parallel_rspec", *parallel_args, "--", *bundle_args, "--", *files
else
system "bundle", "exec", "rspec", *bundle_args, "--", *files
end | false |
Other | Homebrew | brew | 0c7c45a131251aaef24dfe5e6b803d136d51fbde.json | missing_formula: add message for Asymptote
Per Homebrew/legacy-homebrew#23029, there is no formula for Asymptote
because you may well already have it installed via MacTeX anyway. | Library/Homebrew/missing_formula.rb | @@ -26,6 +26,10 @@ def blacklisted_reason(name)
Minimal installation:
brew cask install basictex
EOS
+ when "asymptote" then <<~EOS
+ Asymptote is bundled with MacTeX. Install it via TeX Live Utility or:
+ tlmgr install asymptote
+ EOS
when "pip" then <<~EOS
pip is part of the python formula:
brew install python | false |
Other | Homebrew | brew | d959a780d43ba2aa119f557b8750447b295c5e3c.json | use python flock firstly | Library/Homebrew/utils/lock.sh | @@ -45,12 +45,12 @@ _create_lock() {
if [[ -x "$ruby" ]] && "$ruby" -e "exit(RUBY_VERSION >= '1.8.7')"
then
"$ruby" -e "File.new($lock_fd).flock(File::LOCK_EX | File::LOCK_NB) || exit(1)"
- elif [[ -x "$(type -P flock)" ]]
- then
- flock -n "$lock_fd"
elif [[ -x "$python" ]]
then
"$python" -c "import fcntl; fcntl.flock($lock_fd, fcntl.LOCK_EX | fcntl.LOCK_NB)"
+ elif [[ -x "$(type -P flock)" ]]
+ then
+ flock -n "$lock_fd"
else
onoe "Cannot create $name lock, please avoid running Homebrew in parallel."
fi | false |
Other | Homebrew | brew | 8abc67a414f6361e9a7ef5d521aab7d951d1c30d.json | vendor-install: Add portable-ruby for aarch64 (ARM64) | Library/Homebrew/cmd/vendor-install.sh | @@ -29,6 +29,11 @@ then
ruby_URL2="https://github.com/Homebrew/homebrew-portable-ruby/releases/download/2.3.7/portable-ruby-2.3.7.x86_64_linux.bottle.tar.gz"
ruby_SHA="9df214085a0e566a580eea3dd9eab14a2a94930ff74fbf97fb1284e905c8921d"
;;
+ aarch64)
+ ruby_URL="$HOMEBREW_BOTTLE_DOMAIN/bottles-portable-ruby/portable-ruby-2.3.7.aarch64_linux.bottle.tar.gz"
+ ruby_URL2="https://github.com/Homebrew/homebrew-portable-ruby/releases/download/2.3.7/portable-ruby-2.3.7.aarch64_linux.bottle.tar.gz"
+ ruby_SHA="e5a72a9deabe500d5d2eaed29e2eb84868ade962eda3ddc68ea169adbb7ac5a2"
+ ;;
armv[67]*)
ruby_URL="$HOMEBREW_BOTTLE_DOMAIN/bottles-portable-ruby/portable-ruby-2.3.7.armv6_linux.bottle.tar.gz"
ruby_URL2="https://github.com/Homebrew/homebrew-portable-ruby/releases/download/2.3.7/portable-ruby-2.3.7.armv6_linux.bottle.tar.gz" | false |
Other | Homebrew | brew | 5e42f6778357f9509f2335c7fe34c5fd5bf5c43a.json | Dockerfile: install zlib headers (for nokogiri gem). | Dockerfile | @@ -13,6 +13,7 @@ RUN apt-get update \
fonts-dejavu-core \
g++ \
git \
+ libz-dev \
locales \
make \
openssh-client \ | false |
Other | Homebrew | brew | aff57599205212b348d3cd0504b53d9d58163b39.json | diagnostic: check cask git origin | Library/Homebrew/diagnostic.rb | @@ -562,6 +562,9 @@ def check_coretap_git_origin
examine_git_origin(CoreTap.instance.path, CoreTap.instance.full_name)
end
+ def check_casktap_git_origin
+ cask = Tap.default_cask_tap
+ examine_git_origin(cask.path, cask.full_name) if cask.installed?
end
def check_coretap_git_branch | false |
Other | Homebrew | brew | 19f6915868cf6c34c822e2f0383a058690e8bf2c.json | .editorconfig: extend rules to non-homebrew taps | .editorconfig | @@ -12,7 +12,7 @@ insert_final_newline = true
[{Library/Homebrew/**.rb,.simplecov}]
trim_trailing_whitespace = true
-[Library/Taps/homebrew/**.rb]
+[Library/Taps/**.rb]
# trailing whitespace is crucial for patches
trim_trailing_whitespace = false
| false |
Other | Homebrew | brew | eeed04fdad87c62efb87079406741a56cf316945.json | diagnostic: Fix check_xdg_data_dirs for Linux
Fix Error: undefined method prepend_variable_in_profile'
for Utils::Shell:Module Did you mean? prepend_path_in_profile | Library/Homebrew/extend/os/linux/diagnostic.rb | @@ -54,7 +54,7 @@ def check_xdg_data_dirs
this variable set to include other locations.
Some programs like `vapigen` may not work correctly.
Consider adding Homebrew's share directory to XDG_DATA_DIRS like so:
- #{Utils::Shell.prepend_variable_in_profile("XDG_DATA_DIRS", HOMEBREW_PREFIX/"share")}
+ echo 'export XDG_DATA_DIRS="#{HOMEBREW_PREFIX}/share:$XDG_DATA_DIRS"' >> #{shell_profile}
EOS
end
| false |
Other | Homebrew | brew | b3c33d6d5172e6538f1e6388c09bf0cf437cf9c7.json | brew.*: run Bundler immediately when needed.
This is needed to avoid gem conflicts when `global.rb` is loaded for some commands. | Library/Homebrew/brew.rb | @@ -8,6 +8,12 @@
raise "Homebrew must be run under Ruby 2.3! You're running #{RUBY_VERSION}."
end
+# Load Bundler first of all if it's needed to avoid Gem version conflicts.
+if ENV["HOMEBREW_INSTALL_BUNDLER_GEMS_FIRST"]
+ require_relative "utils/gems"
+ Homebrew.install_bundler_gems!
+end
+
# Also define here so we can rescue regardless of location.
class MissingEnvironmentVariables < RuntimeError; end
| true |
Other | Homebrew | brew | b3c33d6d5172e6538f1e6388c09bf0cf437cf9c7.json | brew.*: run Bundler immediately when needed.
This is needed to avoid gem conflicts when `global.rb` is loaded for some commands. | Library/Homebrew/brew.sh | @@ -309,6 +309,11 @@ then
esac
fi
+if [[ "$HOMEBREW_COMMAND" = "audit" || "$HOMEBREW_COMMAND" = "style" ]]
+then
+ export HOMEBREW_INSTALL_BUNDLER_GEMS_FIRST="1"
+fi
+
# Set HOMEBREW_DEV_CMD_RUN for users who have run a development command.
# This makes them behave like HOMEBREW_DEVELOPERs for brew update.
if [[ -z "$HOMEBREW_DEVELOPER" ]] | true |
Other | Homebrew | brew | c16e60ef1eb2d43286300224b4aab5c9a0c4c4f1.json | gitignore: ignore 2.6.0 backports. | .gitignore | @@ -61,6 +61,7 @@
**/vendor/bundle-standalone/ruby/*/gems/backports-*/lib/backports/2.1*
**/vendor/bundle-standalone/ruby/*/gems/backports-*/lib/backports/2.2*
**/vendor/bundle-standalone/ruby/*/gems/backports-*/lib/backports/2.3*
+**/vendor/bundle-standalone/ruby/*/gems/backports-*/lib/backports/2.6*
**/vendor/bundle-standalone/ruby/*/gems/backports-*/lib/backports/2.*.rb
**/vendor/bundle-standalone/ruby/*/gems/backports-*/lib/backports/force/
**/vendor/bundle-standalone/ruby/*/gems/backports-*/lib/backports/rails/ | false |
Other | Homebrew | brew | bcc92258bda50fad565aa58c8629804acfe25861.json | gitignore: ignore psych gem. | .gitignore | @@ -109,6 +109,7 @@
**/vendor/bundle-standalone/ruby/*/gems/parallel-*/
**/vendor/bundle-standalone/ruby/*/gems/parser-*/
**/vendor/bundle-standalone/ruby/*/gems/powerpack-*/
+**/vendor/bundle-standalone/ruby/*/gems/psych-*/
**/vendor/bundle-standalone/ruby/*/gems/rainbow-*/
**/vendor/bundle-standalone/ruby/*/gems/rubocop-0*/
**/vendor/bundle-standalone/ruby/*/gems/ruby-progressbar-*/ | false |
Other | Homebrew | brew | f9fda0ffcccccd40dce72f01be8239e2b66266c4.json | Formula.installed: handle more exceptions.
Regardless of the exception we don't want this method to blow up.
Fixes #5770. | Library/Homebrew/formula.rb | @@ -1430,7 +1430,7 @@ def self.installed
@installed ||= racks.flat_map do |rack|
begin
Formulary.from_rack(rack)
- rescue FormulaUnavailableError, TapFormulaAmbiguityError, TapFormulaWithOldnameAmbiguityError
+ rescue
[]
end
end.uniq(&:name) | false |
Other | Homebrew | brew | 50ba2ad93f7b09a653492bcd1c09fb96f5802dfd.json | Support different shells for `brew shellenv` | Library/Homebrew/cmd/shellenv.sh | @@ -7,10 +7,30 @@
#: Consider adding evaluating the output in your dotfiles (e.g. `~/.profile`) with `eval $(brew shellenv)`
homebrew-shellenv() {
- echo "export HOMEBREW_PREFIX=\"$HOMEBREW_PREFIX\""
- echo "export HOMEBREW_CELLAR=\"$HOMEBREW_CELLAR\""
- echo "export HOMEBREW_REPOSITORY=\"$HOMEBREW_REPOSITORY\""
- echo "export PATH=\"$HOMEBREW_PREFIX/bin:$HOMEBREW_PREFIX/sbin:\$PATH\""
- echo "export MANPATH=\"$HOMEBREW_PREFIX/share/man:\$MANPATH\""
- echo "export INFOPATH=\"$HOMEBREW_PREFIX/share/info:\$INFOPATH\""
+ case "$SHELL" in
+ */fish)
+ echo "set -gx HOMEBREW_PREFIX \"$HOMEBREW_PREFIX\";"
+ echo "set -gx HOMEBREW_CELLAR \"$HOMEBREW_CELLAR\";"
+ echo "set -gx HOMEBREW_REPOSITORY \"$HOMEBREW_REPOSITORY\";"
+ echo "set -g fish_user_paths \"$HOMEBREW_PREFIX/bin\" \"$HOMEBREW_PREFIX/sbin\" \$fish_user_paths;"
+ echo "set -q MANPATH || set MANPATH ''; set -gx MANPATH \"$HOMEBREW_PREFIX/share/man\" \$MANPATH;"
+ echo "set -q INFOPATH || set INFOPATH ''; set -gx INFOPATH \"$HOMEBREW_PREFIX/share/info\" \$INFOPATH;"
+ ;;
+ */csh|*/tcsh)
+ echo "setenv HOMEBREW_PREFIX $HOMEBREW_PREFIX;"
+ echo "setenv HOMEBREW_CELLAR $HOMEBREW_CELLAR;"
+ echo "setenv HOMEBREW_REPOSITORY $HOMEBREW_REPOSITORY;"
+ echo "setenv PATH $HOMEBREW_PREFIX/bin:$HOMEBREW_PREFIX/sbin:\$PATH;"
+ echo "setenv MANPATH $HOMEBREW_PREFIX/share/man:\$MANPATH;"
+ echo "setenv INFOPATH $HOMEBREW_PREFIX/share/info:\$INFOPATH;"
+ ;;
+ *)
+ echo "export HOMEBREW_PREFIX=\"$HOMEBREW_PREFIX\""
+ echo "export HOMEBREW_CELLAR=\"$HOMEBREW_CELLAR\""
+ echo "export HOMEBREW_REPOSITORY=\"$HOMEBREW_REPOSITORY\""
+ echo "export PATH=\"$HOMEBREW_PREFIX/bin:$HOMEBREW_PREFIX/sbin:\$PATH\""
+ echo "export MANPATH=\"$HOMEBREW_PREFIX/share/man:\$MANPATH\""
+ echo "export INFOPATH=\"$HOMEBREW_PREFIX/share/info:\$INFOPATH\""
+ ;;
+ esac
} | false |
Other | Homebrew | brew | d4e3fb45cbcab862fa8fd023a9955d5be5058d75.json | missing_formula.rb: add help message for uconv | Library/Homebrew/missing_formula.rb | @@ -95,6 +95,10 @@ def blacklisted_reason(name)
cargo is part of the rust formula:
brew install rust
EOS
+ when "uconv" then <<~EOS
+ uconv is part of the icu4c formula:
+ brew install icu4c
+ EOS
end
end
alias generic_blacklisted_reason blacklisted_reason | false |
Other | Homebrew | brew | 67cbb129ffa5b6519be668fe0e61508b1b2d721c.json | diagnostic: warn people about tapped, deprecated taps. | Library/Homebrew/diagnostic.rb | @@ -604,6 +604,18 @@ def check_coretap_git_branch
EOS
end
+ def check_deprecated_official_taps
+ tapped_deprecated_taps =
+ Tap.select(&:official?).map(&:repo) & DEPRECATED_OFFICIAL_TAPS
+ return if tapped_deprecated_taps.empty?
+
+ <<~EOS
+ You have the following deprecated, official taps tapped:
+ Homebrew/homebrew-#{tapped_deprecated_taps.join("\n ")}
+ Untap them with `brew untap`.
+ EOS
+ end
+
def __check_linked_brew(f)
f.installed_prefixes.each do |prefix|
prefix.find do |src| | false |
Other | Homebrew | brew | c7831a457d738d9723231cae77b30b1b22b39dbc.json | Get brew style to pass | Library/Homebrew/test/cli_parser_spec.rb | @@ -183,8 +183,8 @@
allow(ENV).to receive(:[]).with("HOMEBREW_SWITCH_B").and_return("0")
allow(ENV).to receive(:[])
parser.parse(["--switch-b"])
- expect(Homebrew.args.switch_a?).to be_falsy
- expect(Homebrew.args.switch_b?).to be true
+ expect(Homebrew.args.switch_a).to be_falsy
+ expect(Homebrew.args).to be_switch_b
end
it "raises an exception on constraint violation when both are env vars" do | false |
Other | Homebrew | brew | e9c45ff17b406bed50677b5b5eb04d9422343f27.json | Pass additional options to `GitHub.pull_requests`. | Library/Homebrew/utils/github.rb | @@ -287,8 +287,8 @@ def write_access?(repo, user = nil)
["admin", "write"].include?(permission(repo, user)["permission"])
end
- def pull_requests(repo, base:, state: :open, **_options)
- url = "#{API_URL}/repos/#{repo}/pulls?#{URI.encode_www_form(base: base, state: state)}"
+ def pull_requests(repo, **options)
+ url = "#{API_URL}/repos/#{repo}/pulls?#{URI.encode_www_form(options)}"
open_api(url)
end
| false |
Other | Homebrew | brew | d5f6e4cd34ba2550499876ed4c8988e183b3465c.json | Add info on env variables for Formula Cookbook
This explains the levels of environment variable filtering present in Homebrew, explaining how and why variables without a `HOMEBREW_` prefix or those which contain `TOKEN` etc are made unavailable to a Formula. | docs/Formula-Cookbook.md | @@ -696,6 +696,16 @@ Homebrew provides two formula DSL methods for launchd plist files:
* [`plist_name`](https://www.rubydoc.info/github/Homebrew/brew/master/Formula#plist_name-instance_method) will return e.g. `homebrew.mxcl.<formula>`
* [`plist_path`](https://www.rubydoc.info/github/Homebrew/brew/master/Formula#plist_path-instance_method) will return e.g. `/usr/local/Cellar/foo/0.1/homebrew.mxcl.foo.plist`
+### Using environment variables
+
+Homebrew has multiple levels of environment variable filtering which affects variables available to formulae.
+
+Firstly, the overall environment in which Homebrew runs is filtered to avoid environment contamination breaking from-source builds ([ref](https://github.com/Homebrew/brew/issues/932)). In particular, this process filters all but the given whitelisted variables, but allows environment variables prefixed with `HOMEBREW_`. The specific implementation can be seen in the [`brew`](https://github.com/Homebrew/brew/blob/master/bin/brew) script.
+
+The second level of filtering removes sensitive environment variables (such as credentials like keys, passwords or tokens) to avoid malicious subprocesses obtaining them ([ref](https://github.com/Homebrew/brew/pull/2524)). This has the effect of preventing any such variables from reaching a formula's Ruby code as they are filtered before it is called. The specific implementation can be seen in the [`clear_sensitive_environment` method](https://github.com/Homebrew/brew/blob/master/Library/Homebrew/extend/ENV.rb).
+
+In summary, environment variables used by a formula need to conform to these filtering rules in order to be available.
+
## Updating formulae
Eventually a new version of the software will be released. In this case you should update the [`url`](https://www.rubydoc.info/github/Homebrew/brew/master/Formula#url-class_method) and [`sha256`](https://www.rubydoc.info/github/Homebrew/brew/master/Formula#sha256%3D-class_method). If a [`revision`](https://www.rubydoc.info/github/Homebrew/brew/master/Formula#revision%3D-class_method) line exists outside any `bottle do` block *and* the new release is stable rather than devel, it should be removed. | false |
Other | Homebrew | brew | b39c5a4e84ce9efa08d19a711d20d72fb5e97acc.json | Dockerfile: Remove environment variable USER | Dockerfile | @@ -34,8 +34,7 @@ RUN cd /home/linuxbrew/.linuxbrew \
WORKDIR /home/linuxbrew
ENV PATH=/home/linuxbrew/.linuxbrew/bin:/home/linuxbrew/.linuxbrew/sbin:$PATH \
- SHELL=/bin/bash \
- USER=linuxbrew
+ SHELL=/bin/bash
# Install portable-ruby and tap homebrew/core.
RUN HOMEBREW_NO_ANALYTICS=1 HOMEBREW_NO_AUTO_UPDATE=1 brew tap homebrew/core \ | false |
Other | Homebrew | brew | 1e1ce1c471dfaf83c8b3349a29bcb61d20ec8920.json | Save config file for casks. | Library/Homebrew/cask/cask.rb | @@ -11,7 +11,7 @@ class Cask
extend Searchable
include Metadata
- attr_reader :token, :sourcefile_path, :config
+ attr_reader :token, :sourcefile_path
def self.each
return to_enum unless block_given?
@@ -31,7 +31,7 @@ def tap
@tap
end
- def initialize(token, sourcefile_path: nil, tap: nil, config: Config.global, &block)
+ def initialize(token, sourcefile_path: nil, tap: nil, config: nil, &block)
@token = token
@sourcefile_path = sourcefile_path
@tap = tap
@@ -77,6 +77,14 @@ def installed_caskfile
metadata_master_container_path.join(*installed_version, "Casks", "#{token}.rb")
end
+ def config
+ @config ||= Config.for_cask(self)
+ end
+
+ def config_path
+ metadata_master_container_path/"dirs.json"
+ end
+
def outdated?(greedy = false)
!outdated_versions(greedy).empty?
end | true |
Other | Homebrew | brew | 1e1ce1c471dfaf83c8b3349a29bcb61d20ec8920.json | Save config file for casks. | Library/Homebrew/cask/config.rb | @@ -1,12 +1,8 @@
-module Cask
- class Config
- def self.global
- @global ||= new
- end
-
- attr_reader :binarydir
+require "json"
- def initialize(
+module Cask
+ class Config < DelegateClass(Hash)
+ DEFAULT_DIRS = {
appdir: "/Applications",
prefpanedir: "~/Library/PreferencePanes",
qlplugindir: "~/Library/QuickLook",
@@ -19,47 +15,51 @@ def initialize(
audio_unit_plugindir: "~/Library/Audio/Plug-Ins/Components",
vst_plugindir: "~/Library/Audio/Plug-Ins/VST",
vst3_plugindir: "~/Library/Audio/Plug-Ins/VST3",
- screen_saverdir: "~/Library/Screen Savers"
- )
+ screen_saverdir: "~/Library/Screen Savers",
+ }.freeze
- self.appdir = appdir
- self.prefpanedir = prefpanedir
- self.qlplugindir = qlplugindir
- self.dictionarydir = dictionarydir
- self.fontdir = fontdir
- self.colorpickerdir = colorpickerdir
- self.servicedir = servicedir
- self.input_methoddir = input_methoddir
- self.internet_plugindir = internet_plugindir
- self.audio_unit_plugindir = audio_unit_plugindir
- self.vst_plugindir = vst_plugindir
- self.vst3_plugindir = vst3_plugindir
- self.screen_saverdir = screen_saverdir
+ def self.global
+ @global ||= new
+ end
- # `binarydir` is not customisable.
- @binarydir = HOMEBREW_PREFIX/"bin"
+ def self.for_cask(cask)
+ if cask.config_path.exist?
+ from_file(cask.config_path)
+ else
+ global
+ end
end
- [
- :appdir,
- :prefpanedir,
- :qlplugindir,
- :dictionarydir,
- :fontdir,
- :colorpickerdir,
- :servicedir,
- :input_methoddir,
- :internet_plugindir,
- :audio_unit_plugindir,
- :vst_plugindir,
- :vst3_plugindir,
- :screen_saverdir,
- ].each do |dir|
- attr_reader dir
+ def self.from_file(path)
+ config = begin
+ JSON.parse(File.read(path))
+ rescue JSON::ParserError => e
+ raise e, "Cannot parse #{path}: #{e}", e.backtrace
+ end
+
+ new(Hash[config.map { |k, v| [k.to_sym, v] }])
+ end
+
+ def initialize(**dirs)
+ super(Hash[DEFAULT_DIRS.map { |(k, v)| [k, Pathname(dirs.fetch(k, v)).expand_path] }])
+ end
+
+ def binarydir
+ @binarydir ||= HOMEBREW_PREFIX/"bin"
+ end
+
+ DEFAULT_DIRS.keys.each do |dir|
+ define_method(dir) do
+ self[dir]
+ end
define_method(:"#{dir}=") do |path|
- instance_variable_set(:"@#{dir}", Pathname(path).expand_path)
+ self[dir] = Pathname(path).expand_path
end
end
+
+ def write(path)
+ path.atomic_write(to_json)
+ end
end
end | true |
Other | Homebrew | brew | 1e1ce1c471dfaf83c8b3349a29bcb61d20ec8920.json | Save config file for casks. | Library/Homebrew/cask/installer.rb | @@ -39,7 +39,7 @@ def initialize(cask, command: SystemCommand, force: false,
end
attr_predicate :binaries?, :force?, :skip_cask_deps?, :require_sha?,
- :upgrade?, :verbose?, :installed_as_dependency?,
+ :reinstall?, :upgrade?, :verbose?, :installed_as_dependency?,
:quarantine?
def self.print_caveats(cask)
@@ -79,15 +79,15 @@ def stage
def install
odebug "Cask::Installer#install"
- if @cask.installed? && !force? && !@reinstall && !upgrade?
+ if @cask.installed? && !force? && !reinstall? && !upgrade?
raise CaskAlreadyInstalledError, @cask
end
check_conflicts
print_caveats
fetch
- uninstall_existing_cask if @reinstall
+ uninstall_existing_cask if reinstall?
oh1 "Installing Cask #{Formatter.identifier(@cask)}"
opoo "macOS's Gatekeeper has been disabled for this Cask" unless quarantine?
@@ -209,6 +209,8 @@ def install_artifacts
artifact.install_phase(command: @command, verbose: verbose?, force: force?)
already_installed_artifacts.unshift(artifact)
end
+
+ save_config_file
rescue => e
begin
already_installed_artifacts.each do |artifact|
@@ -382,13 +384,23 @@ def save_caskfile
old_savedir&.rmtree
end
+ def save_config_file
+ @cask.config.write(@cask.config_path)
+ end
+
def uninstall
oh1 "Uninstalling Cask #{Formatter.identifier(@cask)}"
uninstall_artifacts(clear: true)
+ remove_config_file unless reinstall? || upgrade?
purge_versioned_files
purge_caskroom_path if force?
end
+ def remove_config_file
+ FileUtils.rm_f @cask.config_path
+ @cask.config_path.parent.rmdir_if_possible
+ end
+
def start_upgrade
oh1 "Starting upgrade for Cask #{Formatter.identifier(@cask)}"
| true |
Other | Homebrew | brew | 1e1ce1c471dfaf83c8b3349a29bcb61d20ec8920.json | Save config file for casks. | Library/Homebrew/test/cask/artifact/alt_target_spec.rb | @@ -11,7 +11,7 @@
}
let(:source_path) { cask.staged_path.join("Caffeine.app") }
- let(:target_path) { Cask::Config.global.appdir.join("AnotherName.app") }
+ let(:target_path) { cask.config.appdir.join("AnotherName.app") }
before do
InstallHelper.install_without_artifacts(cask)
@@ -58,7 +58,7 @@
expect(target_path).to be_a_directory
expect(source_path).not_to exist
- expect(Cask::Config.global.appdir.join("Caffeine Deluxe.app")).not_to exist
+ expect(cask.config.appdir.join("Caffeine Deluxe.app")).not_to exist
expect(cask.staged_path.join("Caffeine Deluxe.app")).to be_a_directory
end
| true |
Other | Homebrew | brew | 1e1ce1c471dfaf83c8b3349a29bcb61d20ec8920.json | Save config file for casks. | Library/Homebrew/test/cask/artifact/app_spec.rb | @@ -5,7 +5,7 @@
let(:app) { cask.artifacts.find { |a| a.is_a?(described_class) } }
let(:source_path) { cask.staged_path.join("Caffeine.app") }
- let(:target_path) { Cask::Config.global.appdir.join("Caffeine.app") }
+ let(:target_path) { cask.config.appdir.join("Caffeine.app") }
let(:install_phase) { app.install_phase(command: command, force: force) }
let(:uninstall_phase) { app.uninstall_phase(command: command, force: force) }
@@ -53,7 +53,7 @@
expect(target_path).to be_a_directory
expect(source_path).not_to exist
- expect(Cask::Config.global.appdir.join("Caffeine Deluxe.app")).not_to exist
+ expect(cask.config.appdir.join("Caffeine Deluxe.app")).not_to exist
expect(cask.staged_path.join("Caffeine Deluxe.app")).to exist
end
| true |
Other | Homebrew | brew | 1e1ce1c471dfaf83c8b3349a29bcb61d20ec8920.json | Save config file for casks. | Library/Homebrew/test/cask/artifact/binary_spec.rb | @@ -5,7 +5,7 @@
end
}
let(:artifacts) { cask.artifacts.select { |a| a.is_a?(described_class) } }
- let(:expected_path) { Cask::Config.global.binarydir.join("binary") }
+ let(:expected_path) { cask.config.binarydir.join("binary") }
after do
FileUtils.rm expected_path if expected_path.exist?
@@ -38,7 +38,7 @@
end
}
- let(:expected_path) { Cask::Config.global.binarydir.join("naked_non_executable") }
+ let(:expected_path) { cask.config.binarydir.join("naked_non_executable") }
it "makes the binary executable" do
expect(FileUtils).to receive(:chmod) | true |
Other | Homebrew | brew | 1e1ce1c471dfaf83c8b3349a29bcb61d20ec8920.json | Save config file for casks. | Library/Homebrew/test/cask/artifact/generic_artifact_spec.rb | @@ -10,7 +10,7 @@
}
let(:source_path) { cask.staged_path.join("Caffeine.app") }
- let(:target_path) { Cask::Config.global.appdir.join("Caffeine.app") }
+ let(:target_path) { cask.config.appdir.join("Caffeine.app") }
before do
InstallHelper.install_without_artifacts(cask) | true |
Other | Homebrew | brew | 1e1ce1c471dfaf83c8b3349a29bcb61d20ec8920.json | Save config file for casks. | Library/Homebrew/test/cask/artifact/suite_spec.rb | @@ -9,7 +9,7 @@
end
}
- let(:target_path) { Cask::Config.global.appdir.join("Caffeine") }
+ let(:target_path) { cask.config.appdir.join("Caffeine") }
let(:source_path) { cask.staged_path.join("Caffeine") }
before do | true |
Other | Homebrew | brew | 1e1ce1c471dfaf83c8b3349a29bcb61d20ec8920.json | Save config file for casks. | Library/Homebrew/test/cask/artifact/two_apps_correct_spec.rb | @@ -11,10 +11,10 @@
}
let(:source_path_mini) { cask.staged_path.join("Caffeine Mini.app") }
- let(:target_path_mini) { Cask::Config.global.appdir.join("Caffeine Mini.app") }
+ let(:target_path_mini) { cask.config.appdir.join("Caffeine Mini.app") }
let(:source_path_pro) { cask.staged_path.join("Caffeine Pro.app") }
- let(:target_path_pro) { Cask::Config.global.appdir.join("Caffeine Pro.app") }
+ let(:target_path_pro) { cask.config.appdir.join("Caffeine Pro.app") }
before do
InstallHelper.install_without_artifacts(cask)
@@ -52,7 +52,7 @@
expect(target_path_mini).to be_a_directory
expect(source_path_mini).not_to exist
- expect(Cask::Config.global.appdir.join("Caffeine Deluxe.app")).not_to exist
+ expect(cask.config.appdir.join("Caffeine Deluxe.app")).not_to exist
expect(cask.staged_path.join("Caffeine Deluxe.app")).to exist
end
| true |
Other | Homebrew | brew | 1e1ce1c471dfaf83c8b3349a29bcb61d20ec8920.json | Save config file for casks. | Library/Homebrew/test/cask/cmd/install_spec.rb | @@ -21,11 +21,12 @@
it "allows staging and activation of multiple Casks at once" do
described_class.run("local-transmission", "local-caffeine")
-
- expect(Cask::CaskLoader.load(cask_path("local-transmission"))).to be_installed
- expect(Cask::Config.global.appdir.join("Transmission.app")).to be_a_directory
- expect(Cask::CaskLoader.load(cask_path("local-caffeine"))).to be_installed
- expect(Cask::Config.global.appdir.join("Caffeine.app")).to be_a_directory
+ transmission = Cask::CaskLoader.load(cask_path("local-transmission"))
+ caffeine = Cask::CaskLoader.load(cask_path("local-caffeine"))
+ expect(transmission).to be_installed
+ expect(transmission.config.appdir.join("Transmission.app")).to be_a_directory
+ expect(caffeine).to be_installed
+ expect(caffeine.config.appdir.join("Caffeine.app")).to be_a_directory
end
it "skips double install (without nuking existing installation)" do | true |
Other | Homebrew | brew | 1e1ce1c471dfaf83c8b3349a29bcb61d20ec8920.json | Save config file for casks. | Library/Homebrew/test/cask/cmd/list_spec.rb | @@ -80,9 +80,9 @@
described_class.run("local-transmission", "local-caffeine")
}.to output(<<~EOS).to_stdout
==> Apps
- #{Cask::Config.global.appdir.join("Transmission.app")} (#{Cask::Config.global.appdir.join("Transmission.app").abv})
+ #{transmission.config.appdir.join("Transmission.app")} (#{transmission.config.appdir.join("Transmission.app").abv})
==> Apps
- Missing App: #{Cask::Config.global.appdir.join("Caffeine.app")}
+ Missing App: #{caffeine.config.appdir.join("Caffeine.app")}
EOS
end
end | true |
Other | Homebrew | brew | 1e1ce1c471dfaf83c8b3349a29bcb61d20ec8920.json | Save config file for casks. | Library/Homebrew/test/cask/cmd/uninstall_spec.rb | @@ -51,9 +51,9 @@
described_class.run("local-caffeine", "local-transmission")
expect(caffeine).not_to be_installed
- expect(Cask::Config.global.appdir.join("Transmission.app")).not_to exist
+ expect(caffeine.config.appdir.join("Transmission.app")).not_to exist
expect(transmission).not_to be_installed
- expect(Cask::Config.global.appdir.join("Caffeine.app")).not_to exist
+ expect(transmission.config.appdir.join("Caffeine.app")).not_to exist
end
it "calls `uninstall` before removing artifacts" do
@@ -69,7 +69,7 @@
}.not_to raise_error
expect(cask).not_to be_installed
- expect(Cask::Config.global.appdir.join("MyFancyApp.app")).not_to exist
+ expect(cask.config.appdir.join("MyFancyApp.app")).not_to exist
end
it "can uninstall Casks when the uninstall script is missing, but only when using `--force`" do
@@ -79,7 +79,7 @@
expect(cask).to be_installed
- Cask::Config.global.appdir.join("MyFancyApp.app").rmtree
+ cask.config.appdir.join("MyFancyApp.app").rmtree
expect { described_class.run("with-uninstall-script-app") }
.to raise_error(Cask::CaskError, /uninstall script .* does not exist/) | true |
Other | Homebrew | brew | 1e1ce1c471dfaf83c8b3349a29bcb61d20ec8920.json | Save config file for casks. | Library/Homebrew/test/cask/cmd/upgrade_spec.rb | @@ -147,7 +147,7 @@
it 'does not include the Casks with "auto_updates true" when the version did not change' do
cask = Cask::CaskLoader.load("auto-updates")
- cask_path = Cask::Config.global.appdir.join("MyFancyApp.app")
+ cask_path = cask.config.appdir.join("MyFancyApp.app")
expect(cask).to be_installed
expect(cask_path).to be_a_directory
@@ -188,7 +188,7 @@
it "restores the old Cask if the upgrade failed" do
will_fail_if_upgraded = Cask::CaskLoader.load("will-fail-if-upgraded")
- will_fail_if_upgraded_path = Cask::Config.global.appdir.join("container")
+ will_fail_if_upgraded_path = will_fail_if_upgraded.config.appdir.join("container")
expect(will_fail_if_upgraded).to be_installed
expect(will_fail_if_upgraded_path).to be_a_file
@@ -206,7 +206,7 @@
it "does not restore the old Cask if the upgrade failed pre-install" do
bad_checksum = Cask::CaskLoader.load("bad-checksum")
- bad_checksum_path = Cask::Config.global.appdir.join("Caffeine.app")
+ bad_checksum_path = bad_checksum.config.appdir.join("Caffeine.app")
expect(bad_checksum).to be_installed
expect(bad_checksum_path).to be_a_directory | true |
Other | Homebrew | brew | 1e1ce1c471dfaf83c8b3349a29bcb61d20ec8920.json | Save config file for casks. | Library/Homebrew/test/cask/cmd/zap_spec.rb | @@ -23,8 +23,8 @@
described_class.run("local-caffeine", "local-transmission")
expect(caffeine).not_to be_installed
- expect(Cask::Config.global.appdir.join("Caffeine.app")).not_to be_a_symlink
+ expect(caffeine.config.appdir.join("Caffeine.app")).not_to be_a_symlink
expect(transmission).not_to be_installed
- expect(Cask::Config.global.appdir.join("Transmission.app")).not_to be_a_symlink
+ expect(transmission.config.appdir.join("Transmission.app")).not_to be_a_symlink
end
end | true |
Other | Homebrew | brew | 1e1ce1c471dfaf83c8b3349a29bcb61d20ec8920.json | Save config file for casks. | Library/Homebrew/test/cask/dsl_spec.rb | @@ -468,7 +468,7 @@ def caveats
let(:token) { "appdir-interpolation" }
it "is allowed" do
- expect(cask.artifacts.first.source).to eq(Cask::Config.global.appdir/"some/path")
+ expect(cask.artifacts.first.source).to eq(cask.config.appdir/"some/path")
end
end
| true |
Other | Homebrew | brew | 1e1ce1c471dfaf83c8b3349a29bcb61d20ec8920.json | Save config file for casks. | Library/Homebrew/test/cask/installer_spec.rb | @@ -10,7 +10,7 @@
Cask::Installer.new(caffeine).install
expect(Cask::Caskroom.path.join("local-caffeine", caffeine.version)).to be_a_directory
- expect(Cask::Config.global.appdir.join("Caffeine.app")).to be_a_directory
+ expect(caffeine.config.appdir.join("Caffeine.app")).to be_a_directory
end
it "works with dmg-based Casks" do
@@ -19,7 +19,7 @@
Cask::Installer.new(asset).install
expect(Cask::Caskroom.path.join("container-dmg", asset.version)).to be_a_directory
- expect(Cask::Config.global.appdir.join("container")).to be_a_file
+ expect(asset.config.appdir.join("container")).to be_a_file
end
it "works with tar-gz-based Casks" do
@@ -28,7 +28,7 @@
Cask::Installer.new(asset).install
expect(Cask::Caskroom.path.join("container-tar-gz", asset.version)).to be_a_directory
- expect(Cask::Config.global.appdir.join("container")).to be_a_file
+ expect(asset.config.appdir.join("container")).to be_a_file
end
it "works with xar-based Casks" do
@@ -37,7 +37,7 @@
Cask::Installer.new(asset).install
expect(Cask::Caskroom.path.join("container-xar", asset.version)).to be_a_directory
- expect(Cask::Config.global.appdir.join("container")).to be_a_file
+ expect(asset.config.appdir.join("container")).to be_a_file
end
it "works with pure bzip2-based Casks" do
@@ -46,7 +46,7 @@
Cask::Installer.new(asset).install
expect(Cask::Caskroom.path.join("container-bzip2", asset.version)).to be_a_directory
- expect(Cask::Config.global.appdir.join("container")).to be_a_file
+ expect(asset.config.appdir.join("container")).to be_a_file
end
it "works with pure gzip-based Casks" do
@@ -55,7 +55,7 @@
Cask::Installer.new(asset).install
expect(Cask::Caskroom.path.join("container-gzip", asset.version)).to be_a_directory
- expect(Cask::Config.global.appdir.join("container")).to be_a_file
+ expect(asset.config.appdir.join("container")).to be_a_file
end
it "blows up on a bad checksum" do | true |
Other | Homebrew | brew | 1e1ce1c471dfaf83c8b3349a29bcb61d20ec8920.json | Save config file for casks. | Library/Homebrew/test/cask/quarantine_spec.rb | @@ -11,13 +11,11 @@
it "quarantines a nice fresh Cask" do
Cask::Cmd::Install.run("local-transmission")
- expect(
- Cask::CaskLoader.load(cask_path("local-transmission")),
- ).to be_installed
+ cask = Cask::CaskLoader.load(cask_path("local-transmission"))
- expect(
- Cask::Config.global.appdir.join("Transmission.app"),
- ).to be_quarantined
+ expect(cask).to be_installed
+
+ expect(cask.config.appdir.join("Transmission.app")).to be_quarantined
end
it "quarantines Cask fetches" do
@@ -42,95 +40,93 @@
Cask::Cmd::Install.run("local-transmission")
- expect(
- Cask::CaskLoader.load(cask_path("local-transmission")),
- ).to be_installed
+ cask = Cask::CaskLoader.load(cask_path("local-transmission"))
+
+ expect(cask).to be_installed
- expect(Cask::Config.global.appdir.join("Transmission.app")).to be_quarantined
+ expect(cask.config.appdir.join("Transmission.app")).to be_quarantined
end
it "quarantines dmg-based Casks" do
Cask::Cmd::Install.run("container-dmg")
- expect(
- Cask::CaskLoader.load(cask_path("container-dmg")),
- ).to be_installed
+ cask = Cask::CaskLoader.load(cask_path("container-dmg"))
+
+ expect(cask).to be_installed
- expect(Cask::Config.global.appdir.join("container")).to be_quarantined
+ expect(cask.config.appdir.join("container")).to be_quarantined
end
it "quarantines tar-gz-based Casks" do
Cask::Cmd::Install.run("container-tar-gz")
- expect(
- Cask::CaskLoader.load(cask_path("container-tar-gz")),
- ).to be_installed
+ cask = Cask::CaskLoader.load(cask_path("container-tar-gz"))
- expect(Cask::Config.global.appdir.join("container")).to be_quarantined
+ expect(cask).to be_installed
+
+ expect(cask.config.appdir.join("container")).to be_quarantined
end
it "quarantines xar-based Casks" do
Cask::Cmd::Install.run("container-xar")
- expect(
- Cask::CaskLoader.load(cask_path("container-xar")),
- ).to be_installed
+ cask = Cask::CaskLoader.load(cask_path("container-xar"))
- expect(Cask::Config.global.appdir.join("container")).to be_quarantined
+ expect(cask).to be_installed
+
+ expect(cask.config.appdir.join("container")).to be_quarantined
end
it "quarantines pure bzip2-based Casks" do
Cask::Cmd::Install.run("container-bzip2")
- expect(
- Cask::CaskLoader.load(cask_path("container-bzip2")),
- ).to be_installed
+ cask = Cask::CaskLoader.load(cask_path("container-bzip2"))
+
+ expect(cask).to be_installed
- expect(Cask::Config.global.appdir.join("container")).to be_quarantined
+ expect(cask.config.appdir.join("container")).to be_quarantined
end
it "quarantines pure gzip-based Casks" do
Cask::Cmd::Install.run("container-gzip")
- expect(
- Cask::CaskLoader.load(cask_path("container-gzip")),
- ).to be_installed
+ cask = Cask::CaskLoader.load(cask_path("container-gzip"))
+
+ expect(cask).to be_installed
- expect(Cask::Config.global.appdir.join("container")).to be_quarantined
+ expect(cask.config.appdir.join("container")).to be_quarantined
end
it "quarantines the pkg in naked-pkg-based Casks" do
Cask::Cmd::Install.run("container-pkg")
- naked_pkg = Cask::CaskLoader.load(cask_path("container-pkg"))
+ cask = Cask::CaskLoader.load(cask_path("container-pkg"))
- expect(naked_pkg).to be_installed
+ expect(cask).to be_installed
- expect(
- Cask::Caskroom.path.join("container-pkg", naked_pkg.version, "container.pkg"),
- ).to be_quarantined
+ expect(cask.staged_path/"container.pkg").to be_quarantined
end
it "quarantines a nested container" do
Cask::Cmd::Install.run("nested-app")
- expect(
- Cask::CaskLoader.load(cask_path("nested-app")),
- ).to be_installed
+ cask = Cask::CaskLoader.load(cask_path("nested-app"))
+
+ expect(cask).to be_installed
- expect(Cask::Config.global.appdir.join("MyNestedApp.app")).to be_quarantined
+ expect(cask.config.appdir.join("MyNestedApp.app")).to be_quarantined
end
end
describe "when disabled" do
it "does not quarantine even a nice, fresh Cask" do
Cask::Cmd::Install.run("local-transmission", "--no-quarantine")
- expect(
- Cask::CaskLoader.load(cask_path("local-transmission")),
- ).to be_installed
+ cask = Cask::CaskLoader.load(cask_path("local-transmission"))
- expect(Cask::Config.global.appdir.join("Transmission.app")).not_to be_quarantined
+ expect(cask).to be_installed
+
+ expect(cask.config.appdir.join("Transmission.app")).not_to be_quarantined
end
it "does not quarantine Cask fetches" do
@@ -155,61 +151,61 @@
Cask::Cmd::Install.run("local-transmission", "--no-quarantine")
- expect(
- Cask::CaskLoader.load(cask_path("local-transmission")),
- ).to be_installed
+ cask = Cask::CaskLoader.load(cask_path("local-transmission"))
- expect(Cask::Config.global.appdir.join("Transmission.app")).not_to be_quarantined
+ expect(cask).to be_installed
+
+ expect(cask.config.appdir.join("Transmission.app")).not_to be_quarantined
end
it "does not quarantine dmg-based Casks" do
Cask::Cmd::Install.run("container-dmg", "--no-quarantine")
- expect(
- Cask::CaskLoader.load(cask_path("container-dmg")),
- ).to be_installed
+ cask = Cask::CaskLoader.load(cask_path("container-dmg"))
- expect(Cask::Config.global.appdir.join("container")).not_to be_quarantined
+ expect(cask).to be_installed
+
+ expect(cask.config.appdir.join("container")).not_to be_quarantined
end
it "does not quarantine tar-gz-based Casks" do
Cask::Cmd::Install.run("container-tar-gz", "--no-quarantine")
- expect(
- Cask::CaskLoader.load(cask_path("container-tar-gz")),
- ).to be_installed
+ cask = Cask::CaskLoader.load(cask_path("container-tar-gz"))
- expect(Cask::Config.global.appdir.join("container")).not_to be_quarantined
+ expect(cask).to be_installed
+
+ expect(cask.config.appdir.join("container")).not_to be_quarantined
end
it "does not quarantine xar-based Casks" do
Cask::Cmd::Install.run("container-xar", "--no-quarantine")
- expect(
- Cask::CaskLoader.load(cask_path("container-xar")),
- ).to be_installed
+ cask = Cask::CaskLoader.load(cask_path("container-xar"))
+
+ expect(cask).to be_installed
- expect(Cask::Config.global.appdir.join("container")).not_to be_quarantined
+ expect(cask.config.appdir.join("container")).not_to be_quarantined
end
it "does not quarantine pure bzip2-based Casks" do
Cask::Cmd::Install.run("container-bzip2", "--no-quarantine")
- expect(
- Cask::CaskLoader.load(cask_path("container-bzip2")),
- ).to be_installed
+ cask = Cask::CaskLoader.load(cask_path("container-bzip2"))
+
+ expect(cask).to be_installed
- expect(Cask::Config.global.appdir.join("container")).not_to be_quarantined
+ expect(cask.config.appdir.join("container")).not_to be_quarantined
end
it "does not quarantine pure gzip-based Casks" do
Cask::Cmd::Install.run("container-gzip", "--no-quarantine")
- expect(
- Cask::CaskLoader.load(cask_path("container-gzip")),
- ).to be_installed
+ cask = Cask::CaskLoader.load(cask_path("container-gzip"))
+
+ expect(cask).to be_installed
- expect(Cask::Config.global.appdir.join("container")).not_to be_quarantined
+ expect(cask.config.appdir.join("container")).not_to be_quarantined
end
it "does not quarantine the pkg in naked-pkg-based Casks" do
@@ -227,11 +223,11 @@
it "does not quarantine a nested container" do
Cask::Cmd::Install.run("nested-app", "--no-quarantine")
- expect(
- Cask::CaskLoader.load(cask_path("nested-app")),
- ).to be_installed
+ cask = Cask::CaskLoader.load(cask_path("nested-app"))
+
+ expect(cask).to be_installed
- expect(Cask::Config.global.appdir.join("MyNestedApp.app")).not_to be_quarantined
+ expect(cask.config.appdir.join("MyNestedApp.app")).not_to be_quarantined
end
end
end | true |
Other | Homebrew | brew | 1e1ce1c471dfaf83c8b3349a29bcb61d20ec8920.json | Save config file for casks. | Library/Homebrew/test/support/helper/spec/shared_context/homebrew_cask.rb | @@ -14,7 +14,7 @@
RSpec.shared_context "Homebrew Cask", :needs_macos do
before do
HOMEBREW_CASK_DIRS.each do |method, path|
- allow(Cask::Config.global).to receive(method).and_return(path)
+ Cask::Config.global.send("#{method}=", path)
end
end
| true |
Other | Homebrew | brew | bf873783d20bfe170d442157c08d615c42fa80af.json | Apply suggestions from code review
Co-Authored-By: MikeMcQuaid <mike@mikemcquaid.com> | docs/New-Maintainer-Checklist.md | @@ -17,7 +17,7 @@ changes (e.g. version updates), triaging, fixing and debugging user-reported
issues, or reviewing user pull requests. You should also be making contributions
to Homebrew at least once per quarter.
-You will should watch or regularly check Homebrew/brew and/or
+You should watch or regularly check Homebrew/brew and/or
Homebrew/homebrew-core. Let us know which (or both) so we can grant you commit
access appropriately.
@@ -68,7 +68,7 @@ If they are interested in doing system administration work or Homebrew/brew rele
- Invite them to the [`homebrew-ops` private operations mailing list](https://lists.sfconservancy.org/mailman/admin/homebrew-ops/members/add).
- Invite them to the [`homebrew` private 1Password](https://homebrew.1password.com/people).
-If they are elected to of the Homebrew's [Software Freedom Conservancy](https://sfconservancy.org) Project Leadership Committee:
+If they are elected to the Homebrew's [Software Freedom Conservancy](https://sfconservancy.org) Project Leadership Committee:
- Email their name, email and employer to homebrew@sfconservancy.org
- Make them [owners on the Homebrew GitHub organisation](https://github.com/orgs/Homebrew/people) | true |
Other | Homebrew | brew | bf873783d20bfe170d442157c08d615c42fa80af.json | Apply suggestions from code review
Co-Authored-By: MikeMcQuaid <mike@mikemcquaid.com> | docs/Releases.md | @@ -14,7 +14,7 @@ Homebrew release:
branch you can create a new Git tag. Ideally this should be signed with your
GPG key. This can then be pushed to GitHub.
3. Use `brew release-notes --markdown $PREVIOUS_TAG` to generate the release
- notes for the release. [Create a new release on GitHub](https://github.com/Homebrew/brew/releases)
+ notes for the release. [Create a new release on GitHub](https://github.com/Homebrew/brew/releases/new)
based on the new tag.
If this is a major or minor release (e.g. X.0.0 or X.Y.0) then there are a few more steps: | true |
Other | Homebrew | brew | 1b609ceeb344512319edc50ff72e0d0026f702a7.json | Update maintainer documentation.
- Fix Markdown format
- Note Linux in the mission statement
- Update the maintainer guidelines based on current state
- Loosen the new maintainer expectations
- Clarify what things the PLC should be added to
- Add documentation for making a new Homebrew release | docs/Maintainer-Guidelines.md | @@ -11,7 +11,7 @@ This document is current practice. If you wish to change or discuss any of the b
## Mission
-Homebrew aims to be the missing package manager for macOS. Its primary goal is to be useful to as many people as possible, while remaining maintainable to a professional, high standard by a small group of volunteers. Where possible and sensible, it should seek to use features of macOS to blend in with the macOS and Apple ecosystems.
+Homebrew aims to be the missing package manager for macOS (and Linux). Its primary goal is to be useful to as many people as possible, while remaining maintainable to a professional, high standard by a small group of volunteers. Where possible and sensible, it should seek to use features of macOS to blend in with the macOS and Apple ecosystems. On Linux and Windows, it should seek to be as self-contained as possible.
## Quick checklist
@@ -34,13 +34,14 @@ Checking dependencies is important, because they will probably stick around
forever. Nobody really checks if they are necessary or not. Use the
`:optional` and `:recommended` modifiers as appropriate.
-Depend on as little stuff as possible. Disable X11 functionality by default.
-For example, we build Wireshark, but not the heavy GTK/Qt GUI by default.
+Depend on as little stuff as possible. Disable X11 functionality if possible.
+For example, we build Wireshark, but not the heavy GUI.
Homebrew is about Unix software. Stuff that builds to an `.app` should
-probably be in Homebrew Cask instead.
+be in Homebrew Cask instead.
### Naming
+
The name is the strictest item, because avoiding a later name change is
desirable.
@@ -55,6 +56,7 @@ underscores and hyphens and so on.
We now accept versioned formulae as long as they [meet the requirements](Versions.md).
### Merging, rebasing, cherry-picking
+
Merging should be done in the `Homebrew/brew` repository to preserve history & GPG commit signing,
and squash/merge via GitHub should be used for formulae where those formulae
don't need bottles or the change does not require new bottles to be pulled.
@@ -71,6 +73,7 @@ the commits. Our main branch history should be useful to other people,
not confusing.
### Testing
+
We need to at least check that it builds. Use the [Brew Test Bot](Brew-Test-Bot.md) for this.
Verify the formula works if possible. If you can’t tell (e.g. if it’s a
@@ -94,23 +97,24 @@ that bug must be fixed, or worked around in the formula to yield a passing test,
before the PR can be merged.
## Common “gotchas”
-1. [Ensure you have set your username and email address
- properly](https://help.github.com/articles/setting-your-email-in-git/)
-2. Sign off cherry-picks if you amended them ([GitX-dev](https://github.com/rowanj/gitx)
- can do this, otherwise there is a command-line flag for it)
-3. If the commit fixes a bug, use “Fixes \#104” syntax to close the bug
- report and link to the commit
+
+1. [Ensure you have set your username and email address properly](https://help.github.com/articles/setting-your-email-in-git/)
+2. Sign off cherry-picks if you amended them (use `git -s`)
+3. If the commit fixes a bug, use “Fixes \#104” syntax to close the bug report and link to the commit
### Duplicates
+
We now accept stuff that comes with macOS as long as it uses `keg_only :provided_by_macos` to be keg-only by default.
### Add comments
+
It may be enough to refer to an issue ticket, but make sure changes are clear so that
if you came to them unaware of the surrounding issues they would make sense
to you. Many times on other projects I’ve seen code removed because the
new guy didn’t know why it was there. Regressions suck.
### Don’t allow bloated diffs
+
Amend a cherry-pick to remove commits that are only changes in
whitespace. They are not acceptable because our history is important and
`git blame` should be useful.
@@ -121,9 +125,11 @@ of modification that is not whitespace in it. But be careful about
making changes to inline patches—make sure they still apply.
### Adding or updating formulae
-Any one maintainer is necessary to approve and merge the addition of a new or updated formula which passes CI. However, if the formula addition or update proves controversial the maintainer who adds it will be expected to answer requests and fix problems that arise with it in future.
+
+Only one maintainer is necessary to approve and merge the addition of a new or updated formula which passes CI. However, if the formula addition or update proves controversial the maintainer who adds it will be expected to answer requests and fix problems that arise with it in future.
### Removing formulae
+
Formulae that:
- work on at least 2/3 of our supported macOS versions in the default Homebrew prefix
@@ -134,14 +140,17 @@ Formulae that:
should not be removed from Homebrew. The exception to this rule are [versioned formulae](Versions.md) for which there are higher standards of usage and a maximum number of versions for a given formula.
### Closing issues/PRs
+
Maintainers (including the lead maintainer) should not close issues or pull requests (note a merge is not considered a close in this case) opened by other maintainers unless they are stale (i.e. have seen no updates for 28 days) in which case they can be closed by any maintainer. Any maintainer is encouraged to reopen a closed issue when they wish to do additional work on the issue.
Any maintainer can merge any PR they have carefully reviewed and is passing CI that has been opened by any other maintainer. If you do not wish to have other maintainers merge your PRs: please use the `do not merge` label to indicate that until you're ready to merge it yourself.
## Reverting PRs
+
Any maintainer can revert a PR created by another maintainer after a user submitted issue or CI failure that results. The maintainer who created the original PR should be given no less than an hour to fix the issue themselves or decide to revert the PR themselves if they would rather.
## Communication
+
Maintainers have a variety of ways to communicate with each other:
- Homebrew's public repositories on GitHub
@@ -157,6 +166,7 @@ All maintainers (and lead maintainer) communication through any medium is bound
Maintainers should feel free to pleasantly disagree with the work and decisions of other maintainers. Healthy, friendly, technical disagreement between maintainers is actively encouraged and should occur in public on the issue tracker to make the project better. Interpersonal issues should be handled privately in Slack, ideally with moderation. If work or decisions are insufficiently documented or explained any maintainer or contributor should feel free to ask for clarification. No maintainer may ever justify a decision with e.g. "because I say so" or "it was I who did X" alone. Off-topic discussions on the issue tracker, [bike-shedding](https://en.wikipedia.org/wiki/Law_of_triviality) and personal attacks are forbidden.
## Project lead guidelines
+
There should be one project lead for Homebrew. On February 4, 2019, coinciding with the Homebrew maintainers' conference, Mike McQuaid stepped down as lead maintainer of Homebrew. He was elected by a supermajority of Homebrew maintainers into the new project lead role.
Additional documentation for the project lead and governance are to follow. | true |
Other | Homebrew | brew | 1b609ceeb344512319edc50ff72e0d0026f702a7.json | Update maintainer documentation.
- Fix Markdown format
- Note Linux in the mission statement
- Update the maintainer guidelines based on current state
- Loosen the new maintainer expectations
- Clarify what things the PLC should be added to
- Add documentation for making a new Homebrew release | docs/New-Maintainer-Checklist.md | @@ -2,24 +2,24 @@
**This is a guide used by existing maintainers to invite new maintainers. You might find it interesting but there's nothing here users should have to know.**
-There's someone who has been making consistently high-quality contributions to Homebrew for a long time and shown themselves able to make slightly more advanced contributions than just e.g. formula updates? Let's invite them to be a maintainer!
+There's someone who has been making consistently high-quality contributions to Homebrew and shown themselves able to make slightly more advanced contributions than just e.g. formula updates? Let's invite them to be a maintainer!
First, send them the invitation email:
-```
+```markdown
The Homebrew team and I really appreciate your help on issues, pull requests and
your contributions to Homebrew.
We would like to invite you to have commit access and be a Homebrew maintainer.
If you agree to be a maintainer, you should spend a significant proportion of
-the time you are working on Homebrew fixing user-reported issues, resolving any
-issues that arise from your code in a timely fashion and reviewing user
-contributions. You should also be making contributions to Homebrew every month
-unless you are ill or on vacation (and please let another maintainer know if
-that's the case so we're aware you won't be able to help while you are out).
+the time you are working on Homebrew applying and self-merging widely used
+changes (e.g. version updates), triaging, fixing and debugging user-reported
+issues, or reviewing user pull requests. You should also be making contributions
+to Homebrew at least once per quarter.
-You will need to watch Homebrew/brew and/or Homebrew/homebrew-core. Let us know
-which (or both) so we can grant you commit access appropriately.
+You will should watch or regularly check Homebrew/brew and/or
+Homebrew/homebrew-core. Let us know which (or both) so we can grant you commit
+access appropriately.
If you're no longer able to perform all of these tasks, please continue to
contribute to Homebrew, but we will ask you to step down as a maintainer.
@@ -34,8 +34,8 @@ A few requests:
multiple formulae and let it auto-close issues wherever possible (it may
take ~5m). When this isn't necessary use GitHub's "Merge pull request"
button in "create a merge commit" mode for Homebrew/brew or "squash and
- merge" for a single formulae change. If in doubt, check with e.g. GitX that
- you've not accidentally added merge commits.
+ merge" for a single formulae change. If in doubt, check with e.g. Fork.app
+ that you've not accidentally added merge commits.
- Still create your branches on your fork rather than in the main repository.
Note GitHub's UI will create edits and reverts on the main repository if you
make edits or click "Revert" on the Homebrew/brew repository rather than your
@@ -63,18 +63,19 @@ If they accept, follow a few steps to get them set up:
- Ask them to (regularly) review remove any unneeded [GitHub personal access tokens](https://github.com/settings/tokens).
- Add them to [Homebrew/brew's README](https://github.com/Homebrew/brew/edit/master/README.md).
-If they are also interested in doing system administration work:
+If they are interested in doing system administration work or Homebrew/brew releases:
- Invite them to the [`homebrew-ops` private operations mailing list](https://lists.sfconservancy.org/mailman/admin/homebrew-ops/members/add).
- Invite them to the [`homebrew` private 1Password](https://homebrew.1password.com/people).
-If they want to consume raw anonymous aggregate analytics data (rather than use `brew formula-analytics`):
-
-- Invite them to [Google Analytics](https://analytics.google.com/analytics/web/?authuser=1#management/Settings/a76679469w115400090p120682403/%3Fm.page%3DAccountUsers/).
+If they are elected to of the Homebrew's [Software Freedom Conservancy](https://sfconservancy.org) Project Leadership Committee:
-Once they have been active maintainers for at least a year and had some activity on more than one Homebrew organisation repository (or one repository and helped with system administration work):
-
-- Homebrew's [Software Freedom Conservancy](https://sfconservancy.org) Project Leadership Committee can take a vote on whether to extend an offer to the maintainer to join the committee. If they accept, email their name, email and employer to homebrew@sfconservancy.org, make them [owners on the Homebrew GitHub organisation](https://github.com/orgs/Homebrew/people) and add them to the relevant section of the [Homebrew/brew's README](https://github.com/Homebrew/brew/edit/master/README.md).
+- Email their name, email and employer to homebrew@sfconservancy.org
+- Make them [owners on the Homebrew GitHub organisation](https://github.com/orgs/Homebrew/people)
+- Invite them to the [**@Homebrew/plc** team](https://github.com/orgs/Homebrew/teams/plc/members)
+- Invite them to [Google Analytics](https://analytics.google.com/analytics/web/#management/Settings/a76679469w115400090p120682403/%3Fm.page%3DAccountUsers/) and add them to the relevant section of the [Homebrew/brew's README](https://github.com/Homebrew/brew/edit/master/README.md).
+- Invite them to the [`homebrew` private 1Password](https://homebrew.1password.com/people).
+- Make them owners on the [`machomebrew` private maintainers Slack](https://machomebrew.slack.com/admin)).
If there are problems, ask them to step down as a maintainer and revoke their access to all of the above.
| true |
Other | Homebrew | brew | 1b609ceeb344512319edc50ff72e0d0026f702a7.json | Update maintainer documentation.
- Fix Markdown format
- Note Linux in the mission statement
- Update the maintainer guidelines based on current state
- Loosen the new maintainer expectations
- Clarify what things the PLC should be added to
- Add documentation for making a new Homebrew release | docs/README.md | @@ -1,6 +1,7 @@
# Documentation
## Users
+
- [`brew` man-page (command documentation)](Manpage.md)
- [Troubleshooting](Troubleshooting.md)
- [Installation](Installation.md)
@@ -27,6 +28,7 @@
- [Kickstarter Supporters](Kickstarter-Supporters.md)
## Contributors
+
- [How To Open A Pull Request (and get it merged)](How-To-Open-a-Homebrew-Pull-Request.md)
- [Formula Cookbook](Formula-Cookbook.md)
- [Acceptable Formulae](Acceptable-Formulae.md)
@@ -41,8 +43,10 @@
- [Prose Style Guidelines](Prose-Style-Guidelines.md)
## Maintainers
+
- [New Maintainer Checklist](New-Maintainer-Checklist.md)
- [Maintainers: Avoiding Burnout](Maintainers-Avoiding-Burnout.md)
- [Maintainer Guidelines](Maintainer-Guidelines.md)
- [Brew Test Bot For Maintainers](Brew-Test-Bot-For-Core-Contributors.md)
- [Common Issues for Maintainers](Common-Issues-for-Core-Contributors.md)
+- [Releases](Releases.md) | true |
Other | Homebrew | brew | 1b609ceeb344512319edc50ff72e0d0026f702a7.json | Update maintainer documentation.
- Fix Markdown format
- Note Linux in the mission statement
- Update the maintainer guidelines based on current state
- Loosen the new maintainer expectations
- Clarify what things the PLC should be added to
- Add documentation for making a new Homebrew release | docs/Releases.md | @@ -0,0 +1,39 @@
+# Releases
+
+Since Homebrew 1.0.0 most Homebrew users (those who haven't run a `dev-cmd` or
+set `HOMEBREW_DEVELOPER=1`) require tags on the [Homebrew/brew repository](https://github.com/homebrew/brew)
+in order to get new versions of Homebrew. There are a few steps in making a new
+Homebrew release:
+
+1. Check the [Homebrew/brew pull requests](https://github.com/homebrew/brew/pulls)
+ and [issues](https://github.com/homebrew/brew/issues) to see if there is
+ anything pressing that needs to be fixed or merged before the next release.
+ If so, fix and merge these changes.
+2. After no code changes have happened for at least a few hours (ideally 24 hours)
+ and you are confident there's no major regressions on the current `master`
+ branch you can create a new Git tag. Ideally this should be signed with your
+ GPG key. This can then be pushed to GitHub.
+3. Use `brew release-notes --markdown $PREVIOUS_TAG` to generate the release
+ notes for the release. [Create a new release on GitHub](https://github.com/Homebrew/brew/releases)
+ based on the new tag.
+
+If this is a major or minor release (e.g. X.0.0 or X.Y.0) then there are a few more steps:
+
+1. Before creating the tag you should delete any `odisabled` code, make any
+ `odeprecated` code `odisabled` and add any new `odeprecations` that are
+ desired.
+2. Write up a release notes blog post to https://brew.sh
+ e.g. https://github.com/Homebrew/brew.sh/pull/319.
+ This should use `brew release-notes` as input but have the wording adjusted
+ to be more human readable and explain not just what has changed but why.
+3. When the release has shipped and the blog post has been merged, tweet the
+ blog post as the @MacHomebrew Twitter account or tweet it yourself and
+ retweet it with the @MacHomebrew Twitter account (credentials are in
+ 1Password).
+4. Send the email to the Homebrew TinyLetter email list (credentials are in
+ 1Password).
+5. Consider whether to submit it to other sources e.g. Hacker News, Reddit.
+
+ - Pros: gets a wider reach and user feedback
+ - Cons: negative comments are common and people take this as a chance to
+ complain about Homebrew (regardless of their usage) | true |
Other | Homebrew | brew | ea9977f3c3ee45925debd032fdd373440a2c92d1.json | formula_installer: handle attempts to load invalid casks
Certain casks in the main cask repository may be invalid, for whatever
reason. Without handling this exception, the user will get a cask-related
exception while the formula of the same name is installed, and their
installation will abort half-completed.
Fixes #5709. | Library/Homebrew/formula_installer.rb | @@ -790,7 +790,7 @@ def link(keg)
cask_installed_with_formula_name = begin
Cask::CaskLoader.load(formula.name).installed?
- rescue Cask::CaskUnavailableError
+ rescue Cask::CaskUnavailableError, Cask::CaskInvalidError
false
end
| false |
Other | Homebrew | brew | c44c8da5e0becf02ef6d6180fadb8efa8df69714.json | exceptions.rb: remove unnecessary chomps
remove `chomp!` from method 'initialize' in class 'BuildFlagsError' | Library/Homebrew/exceptions.rb | @@ -463,15 +463,15 @@ def initialize(flags, bottled: true)
require_text = "requires"
end
- message = <<~EOS.chomp!
+ message = <<~EOS
The following #{flag_text}:
#{flags.join(", ")}
#{require_text} building tools, but none are installed.
#{DevelopmentTools.installation_instructions}
EOS
- message << <<~EOS.chomp! if bottled
- \nAlternatively, remove the #{flag_text} to attempt bottle installation.
+ message << <<~EOS if bottled
+ Alternatively, remove the #{flag_text} to attempt bottle installation.
EOS
super message | false |
Other | Homebrew | brew | db7997e1a0acde9f11ee9ae0b91833f493eff2ef.json | exceptions.rb: move alternative solution to a new line | Library/Homebrew/exceptions.rb | @@ -471,7 +471,7 @@ def initialize(flags, bottled: true)
EOS
message << <<~EOS.chomp! if bottled
- Alternatively, remove the #{flag_text} to attempt bottle installation.
+ \nAlternatively, remove the #{flag_text} to attempt bottle installation.
EOS
super message | false |
Other | Homebrew | brew | 6cac67bcd0850f3c1ec26008ba54c24c1d26d762.json | python_virtualenv_constants: upgrade virtualenv to 16.4.0 | Library/Homebrew/language/python_virtualenv_constants.rb | @@ -1,6 +1,6 @@
PYTHON_VIRTUALENV_URL =
- "https://files.pythonhosted.org/packages/8b/f4" \
- "/360aa656ddb0f4168aeaa1057d8784b95d1ce12f34332c1cf52420b6db4e" \
- "/virtualenv-16.3.0.tar.gz".freeze
+ "https://files.pythonhosted.org/packages/51/aa" \
+ "/c395a6e6eaaedfa5a04723b6446a1df783b16cca6fec66e671cede514688" \
+ "/virtualenv-16.4.0.tar.gz".freeze
PYTHON_VIRTUALENV_SHA256 =
- "729f0bcab430e4ef137646805b5b1d8efbb43fe53d4a0f33328624a84a5121f7".freeze
+ "cceab52aa7d4df1e1871a70236eb2b89fcfe29b6b43510d9738689787c513261".freeze | false |
Other | Homebrew | brew | f20319a516befac13947a3e6384f699dc87b97d8.json | cmd/repository: Fix man pages and help | Library/Homebrew/cmd/--repository.rb | @@ -6,7 +6,7 @@ module Homebrew
def __repository_args
Homebrew::CLI::Parser.new do
usage_banner <<~EOS
- `--repository` [<formula>]
+ `--repository` [<user>`/`<repo>]
Display where Homebrew's `.git` directory is located.
| true |
Other | Homebrew | brew | f20319a516befac13947a3e6384f699dc87b97d8.json | cmd/repository: Fix man pages and help | docs/Manpage.md | @@ -624,7 +624,7 @@ Display Homebrew's install path. *Default:* `/usr/local` on macOS and
If *`formula`* is provided, display the location in the cellar where *`formula`*
is or would be installed.
-### `--repository` [*`formula`*]
+### `--repository` [*`user`*`/`*`repo`*]
Display where Homebrew's `.git` directory is located.
| true |
Other | Homebrew | brew | f20319a516befac13947a3e6384f699dc87b97d8.json | cmd/repository: Fix man pages and help | manpages/brew.1 | @@ -766,7 +766,7 @@ Display Homebrew\'s install path\. \fIDefault:\fR \fB/usr/local\fR on macOS and
.P
If \fIformula\fR is provided, display the location in the cellar where \fIformula\fR is or would be installed\.
.
-.SS "\fB\-\-repository\fR [\fIformula\fR]"
+.SS "\fB\-\-repository\fR [\fIuser\fR\fB/\fR\fIrepo\fR]"
Display where Homebrew\'s \fB\.git\fR directory is located\.
.
.P | true |
Other | Homebrew | brew | 8a6a46da36a1bd2b4e4d6d5527a0d657a7cb0495.json | Add additional support for java minor versions > 9. | Library/Homebrew/requirements/java_requirement.rb | @@ -129,7 +129,7 @@ def oracle_java_os
end
def satisfies_version(java)
- java_version_s = system_command(java, args: ["-version"], print_stderr: false).stderr[/\d+(\.\d)?/]
+ java_version_s = system_command(java, args: ["-version"], print_stderr: false).stderr[/\d+(\.\d+)?/]
return false unless java_version_s
java_version = Version.create(java_version_s) | false |
Other | Homebrew | brew | 9abd7d31bd1db07e572a5f2dbc864ab538e811bc.json | Fix dry run | Library/Homebrew/cleanup.rb | @@ -316,12 +316,13 @@ def cleanup_path(path)
if dry_run?
puts "Would remove: #{path} (#{path.abv})"
+ @disk_cleanup_size += disk_usage
else
puts "Removing: #{path}... (#{path.abv})"
yield
+ @disk_cleanup_size += disk_usage - path.disk_usage
end
- @disk_cleanup_size += disk_usage - path.disk_usage
end
def cleanup_lockfiles(*lockfiles) | false |
Other | Homebrew | brew | b9b1b24e4e0c607bd27137f3a1928e1b6ee97908.json | Calculate actual delta in usage | Library/Homebrew/cleanup.rb | @@ -321,7 +321,7 @@ def cleanup_path(path)
yield
end
- @disk_cleanup_size += disk_usage
+ @disk_cleanup_size += disk_usage - path.disk_usage
end
def cleanup_lockfiles(*lockfiles) | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.