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
2ad3a87045246f89aa267251315d660f663c42f2.json
Silence all specs by default.
Library/Homebrew/test/support/helper/cask/install_helper.rb
@@ -1,42 +1,29 @@ module InstallHelper module_function - require "test/support/helper/shutup" - extend Test::Helper::Shutup - def self.install_without_artifacts(cask) Hbc::Installer.new(cask).tap do |i| - shutup do - i.download - i.extract_primary_container - end + i.download + i.extract_primary_container end end def self.install_without_artifacts_with_caskfile(cask) Hbc::Installer.new(cask).tap do |i| - shutup do - i.download - i.extract_primary_container - i.save_caskfile - end + i.download + i.extract_primary_container + i.save_caskfile end end def install_without_artifacts(cask) Hbc::Installer.new(cask).tap do |i| - shutup do - i.download - i.extract_primary_container - end + i.download + i.extract_primary_container end end def install_with_caskfile(cask) - Hbc::Installer.new(cask).tap do |i| - shutup do - i.save_caskfile - end - end + Hbc::Installer.new(cask).tap(&:save_caskfile) end end
true
Other
Homebrew
brew
2ad3a87045246f89aa267251315d660f663c42f2.json
Silence all specs by default.
Library/Homebrew/test/support/helper/shutup.rb
@@ -1,24 +0,0 @@ -module Test - module Helper - module Shutup - def shutup - if ENV.key?("VERBOSE_TESTS") - yield - else - begin - tmperr = $stderr.clone - tmpout = $stdout.clone - $stderr.reopen("/dev/null") - $stdout.reopen("/dev/null") - yield - ensure - $stderr.reopen(tmperr) - $stdout.reopen(tmpout) - tmperr.close - tmpout.close - end - end - end - end - end -end
true
Other
Homebrew
brew
2ad3a87045246f89aa267251315d660f663c42f2.json
Silence all specs by default.
Library/Homebrew/test/support/helper/spec/shared_context/integration_test.rb
@@ -171,22 +171,20 @@ def setup_remote_tap(name) end def install_and_rename_coretap_formula(old_name, new_name) - shutup do - CoreTap.instance.path.cd do |tap_path| - system "git", "init" - system "git", "add", "--all" - system "git", "commit", "-m", - "#{old_name.capitalize} has not yet been renamed" + CoreTap.instance.path.cd do |tap_path| + system "git", "init" + system "git", "add", "--all" + system "git", "commit", "-m", + "#{old_name.capitalize} has not yet been renamed" - brew "install", old_name + brew "install", old_name - (tap_path/"Formula/#{old_name}.rb").unlink - (tap_path/"formula_renames.json").write JSON.generate(old_name => new_name) + (tap_path/"Formula/#{old_name}.rb").unlink + (tap_path/"formula_renames.json").write JSON.generate(old_name => new_name) - system "git", "add", "--all" - system "git", "commit", "-m", - "#{old_name.capitalize} has been renamed to #{new_name.capitalize}" - end + system "git", "add", "--all" + system "git", "commit", "-m", + "#{old_name.capitalize} has been renamed to #{new_name.capitalize}" end end
true
Other
Homebrew
brew
2ad3a87045246f89aa267251315d660f663c42f2.json
Silence all specs by default.
Library/Homebrew/test/support/helper/spec/shared_examples/hbc_staged.rb
@@ -18,9 +18,7 @@ ["echo", "homebrew-cask", "rocks!"], ) - shutup do - staged.system_command("echo", args: ["homebrew-cask", "rocks!"]) - end + staged.system_command("echo", args: ["homebrew-cask", "rocks!"]) end it "can get the Info.plist file for the primary app" do @@ -34,9 +32,7 @@ ["/usr/libexec/PlistBuddy", "-c", "Print CFBundleIdentifier", staged.info_plist_file], ) - shutup do - staged.plist_exec("Print CFBundleIdentifier") - end + staged.plist_exec("Print CFBundleIdentifier") end it "can set a key in the Info.plist file" do @@ -46,9 +42,7 @@ ["/usr/libexec/PlistBuddy", "-c", "Set :JVMOptions:JVMVersion 1.6+", staged.info_plist_file], ) - shutup do - staged.plist_set(":JVMOptions:JVMVersion", "1.6+") - end + staged.plist_set(":JVMOptions:JVMVersion", "1.6+") end it "can set the permissions of a file" do @@ -59,9 +53,7 @@ ["/bin/chmod", "-R", "--", "777", fake_pathname], ) - shutup do - staged.set_permissions(fake_pathname.to_s, "777") - end + staged.set_permissions(fake_pathname.to_s, "777") end it "can set the permissions of multiple files" do @@ -72,9 +64,7 @@ ["/bin/chmod", "-R", "--", "777", fake_pathname, fake_pathname], ) - shutup do - staged.set_permissions([fake_pathname.to_s, fake_pathname.to_s], "777") - end + staged.set_permissions([fake_pathname.to_s, fake_pathname.to_s], "777") end it "cannot set the permissions of a file that does not exist" do @@ -93,9 +83,7 @@ ["/usr/bin/sudo", "-E", "--", "/usr/sbin/chown", "-R", "--", "fake_user:staff", fake_pathname], ) - shutup do - staged.set_ownership(fake_pathname.to_s) - end + staged.set_ownership(fake_pathname.to_s) end it "can set the ownership of multiple files" do @@ -108,9 +96,7 @@ ["/usr/bin/sudo", "-E", "--", "/usr/sbin/chown", "-R", "--", "fake_user:staff", fake_pathname, fake_pathname], ) - shutup do - staged.set_ownership([fake_pathname.to_s, fake_pathname.to_s]) - end + staged.set_ownership([fake_pathname.to_s, fake_pathname.to_s]) end it "can set the ownership of a file with a different user and group" do @@ -122,18 +108,14 @@ ["/usr/bin/sudo", "-E", "--", "/usr/sbin/chown", "-R", "--", "other_user:other_group", fake_pathname], ) - shutup do - staged.set_ownership(fake_pathname.to_s, user: "other_user", group: "other_group") - end + staged.set_ownership(fake_pathname.to_s, user: "other_user", group: "other_group") end it "cannot set the ownership of a file that does not exist" do allow(staged).to receive(:current_user).and_return("fake_user") fake_pathname = non_existent_path allow(staged).to receive(:Pathname).and_return(fake_pathname) - shutup do - staged.set_ownership(fake_pathname.to_s) - end + staged.set_ownership(fake_pathname.to_s) end end
true
Other
Homebrew
brew
2ad3a87045246f89aa267251315d660f663c42f2.json
Silence all specs by default.
Library/Homebrew/test/tap_spec.rb
@@ -52,12 +52,10 @@ class Foo < Formula def setup_git_repo path.cd do - shutup do - system "git", "init" - system "git", "remote", "add", "origin", "https://github.com/Homebrew/homebrew-foo" - system "git", "add", "--all" - system "git", "commit", "-m", "init" - end + system "git", "init" + system "git", "remote", "add", "origin", "https://github.com/Homebrew/homebrew-foo" + system "git", "add", "--all" + system "git", "commit", "-m", "init" end end @@ -104,7 +102,7 @@ def setup_git_repo path = Tap::TAP_DIRECTORY/"someone/homebrew-foo" path.mkpath cd path do - shutup { system "git", "init" } + system "git", "init" system "git", "remote", "add", "origin", "https://github.com/someone/homebrew-foo" end @@ -148,10 +146,8 @@ def setup_git_repo services_tap = described_class.new("Homebrew", "services") services_tap.path.mkpath services_tap.path.cd do - shutup do - system "git", "init" - system "git", "remote", "add", "origin", "https://github.com/Homebrew/homebrew-services" - end + system "git", "init" + system "git", "remote", "add", "origin", "https://github.com/Homebrew/homebrew-services" end expect(services_tap).not_to be_private end @@ -217,7 +213,7 @@ def setup_git_repo tap = described_class.new("user", "repo") expect { - shutup { tap.install clone_target: "file:///not/existed/remote/url" } + tap.install clone_target: "file:///not/existed/remote/url" }.to raise_error(ErrorDuringExecution) expect(tap).not_to be_installed @@ -238,17 +234,16 @@ def setup_git_repo setup_git_repo tap = Tap.new("Homebrew", "bar") - shutup do - tap.install clone_target: subject.path/".git" - end + + tap.install clone_target: subject.path/".git" + expect(tap).to be_installed expect(HOMEBREW_PREFIX/"share/man/man1/brew-tap-cmd.1").to be_a_file expect(HOMEBREW_PREFIX/"etc/bash_completion.d/brew-tap-cmd").to be_a_file expect(HOMEBREW_PREFIX/"share/zsh/site-functions/_brew-tap-cmd").to be_a_file expect(HOMEBREW_PREFIX/"share/fish/vendor_completions.d/brew-tap-cmd.fish").to be_a_file - shutup do - tap.uninstall - end + tap.uninstall + expect(tap).not_to be_installed expect(HOMEBREW_PREFIX/"share/man/man1/brew-tap-cmd.1").not_to exist expect(HOMEBREW_PREFIX/"share/man/man1").not_to exist @@ -266,17 +261,17 @@ def setup_git_repo setup_tap_files setup_git_repo tap = Tap.new("Homebrew", "baz") - shutup { tap.install clone_target: subject.path/".git" } + tap.install clone_target: subject.path/".git" (HOMEBREW_PREFIX/"share/man/man1/brew-tap-cmd.1").delete (HOMEBREW_PREFIX/"etc/bash_completion.d/brew-tap-cmd").delete (HOMEBREW_PREFIX/"share/zsh/site-functions/_brew-tap-cmd").delete (HOMEBREW_PREFIX/"share/fish/vendor_completions.d/brew-tap-cmd.fish").delete - shutup { tap.link_completions_and_manpages } + tap.link_completions_and_manpages expect(HOMEBREW_PREFIX/"share/man/man1/brew-tap-cmd.1").to be_a_file expect(HOMEBREW_PREFIX/"etc/bash_completion.d/brew-tap-cmd").to be_a_file expect(HOMEBREW_PREFIX/"share/zsh/site-functions/_brew-tap-cmd").to be_a_file expect(HOMEBREW_PREFIX/"share/fish/vendor_completions.d/brew-tap-cmd.fish").to be_a_file - shutup { tap.uninstall } + tap.uninstall ensure (HOMEBREW_PREFIX/"etc").rmtree if (HOMEBREW_PREFIX/"etc").exist? (HOMEBREW_PREFIX/"share").rmtree if (HOMEBREW_PREFIX/"share").exist?
true
Other
Homebrew
brew
dd4609a3e3fba59dea7f3c8d7684e0e9a38917e6.json
Put the five executables in a list
docs/Homebrew-and-Python.md
@@ -9,7 +9,12 @@ Homebrew provides formulae to brew a more up-to-date Python 2.7.x and 3.x. **Important:** If you choose to install a Python which isn't either of these two (system Python or brewed Python), the Homebrew team can only provide limited support. ## Python 2.x or Python 3.x -Homebrew provides a formula for Python 2.7.x and one for Python 3.x. They don't conflict, so they can both be installed. The executable `python2` will always point to the 2.x and `python3` to the 3.x version. The executable `python` will always point to the macOS system Python. +Homebrew provides one formula for Python 2.7.x and another for Python 3.x. The executables are organized as follows so that Python 2 and Python 3 can both be installed without conflict: +* `python` by default points to the macOS system Python +* `python2` will point to the brew-installed Python 2.7.x +* `python3` will point to the brew-installed Python 3.x +* `pip2` will point to the pip associated with the brew-installed Python 2.7.x +* `pip3` will point to the pip associated with the brew-installed Python 3.x ([Wondering which one to choose?](https://wiki.python.org/moin/Python2orPython3))
false
Other
Homebrew
brew
baa61f5a6e105b9b89f5bef465848c72499cb960.json
Use https for all docs.brew.sh links. May as well use the more secure link when possible.
CONTRIBUTING.md
@@ -5,7 +5,7 @@ First time contributing to Homebrew? Read our [Code of Conduct](https://github.c * run `brew update` (twice) * run and read `brew doctor` -* read [the Troubleshooting Checklist](http://docs.brew.sh/Troubleshooting.html) +* read [the Troubleshooting Checklist](https://docs.brew.sh/Troubleshooting.html) * open an issue on the formula's repository or on Homebrew/brew if it's not a formula-specific issue ### Propose a feature
true
Other
Homebrew
brew
baa61f5a6e105b9b89f5bef465848c72499cb960.json
Use https for all docs.brew.sh links. May as well use the more secure link when possible.
Library/Homebrew/README.md
@@ -3,6 +3,6 @@ This is the (partially) documented public API for Homebrew. The main class you should look at is the {Formula} class (and classes linked from there). That's the class that's used to create Homebrew formulae (i.e. package descriptions). Assume anything else you stumble upon is private. -You may also find the [Formula Cookbook](http://docs.brew.sh/Formula-Cookbook.html) and [Ruby Style Guide](https://github.com/styleguide/ruby) helpful in creating formulae. +You may also find the [Formula Cookbook](https://docs.brew.sh/Formula-Cookbook.html) and [Ruby Style Guide](https://github.com/styleguide/ruby) helpful in creating formulae. Good luck!
true
Other
Homebrew
brew
baa61f5a6e105b9b89f5bef465848c72499cb960.json
Use https for all docs.brew.sh links. May as well use the more secure link when possible.
Library/Homebrew/cmd/analytics.rb
@@ -1,6 +1,6 @@ #: * `analytics` [`state`]: #: Display anonymous user behaviour analytics state. -#: Read more at <http://docs.brew.sh/Analytics.html>. +#: Read more at <https://docs.brew.sh/Analytics.html>. #: #: * `analytics` (`on`|`off`): #: Turn on/off Homebrew's analytics.
true
Other
Homebrew
brew
baa61f5a6e105b9b89f5bef465848c72499cb960.json
Use https for all docs.brew.sh links. May as well use the more secure link when possible.
Library/Homebrew/cmd/help.rb
@@ -16,7 +16,7 @@ Developers: brew create [URL [--no-fetch]] brew edit [FORMULA...] - http://docs.brew.sh/Formula-Cookbook.html + https://docs.brew.sh/Formula-Cookbook.html Further help: man brew
true
Other
Homebrew
brew
baa61f5a6e105b9b89f5bef465848c72499cb960.json
Use https for all docs.brew.sh links. May as well use the more secure link when possible.
Library/Homebrew/cmd/info.rb
@@ -14,7 +14,7 @@ #: information on all installed formulae. #: #: See the docs for examples of using the JSON output: -#: <http://docs.brew.sh/Querying-Brew.html> +#: <https://docs.brew.sh/Querying-Brew.html> require "missing_formula" require "caveats"
true
Other
Homebrew
brew
baa61f5a6e105b9b89f5bef465848c72499cb960.json
Use https for all docs.brew.sh links. May as well use the more secure link when possible.
Library/Homebrew/cmd/tap-info.rb
@@ -13,7 +13,7 @@ #: Pass `--installed` to get information on installed taps. #: #: See the docs for examples of using the JSON output: -#: <http://docs.brew.sh/Querying-Brew.html> +#: <https://docs.brew.sh/Querying-Brew.html> require "tap"
true
Other
Homebrew
brew
baa61f5a6e105b9b89f5bef465848c72499cb960.json
Use https for all docs.brew.sh links. May as well use the more secure link when possible.
Library/Homebrew/cmd/update-report.rb
@@ -35,7 +35,7 @@ def update_report ohai "Homebrew has enabled anonymous aggregate user behaviour analytics." puts <<-EOS.undent #{Tty.bold}Read the analytics documentation (and how to opt-out) here: - #{Formatter.url("http://docs.brew.sh/Analytics.html")}#{Tty.reset} + #{Formatter.url("https://docs.brew.sh/Analytics.html")}#{Tty.reset} EOS
true
Other
Homebrew
brew
baa61f5a6e105b9b89f5bef465848c72499cb960.json
Use https for all docs.brew.sh links. May as well use the more secure link when possible.
Library/Homebrew/dev-cmd/create.rb
@@ -166,7 +166,7 @@ def generate! end def template; <<-EOS.undent - # Documentation: http://docs.brew.sh/Formula-Cookbook.html + # Documentation: https://docs.brew.sh/Formula-Cookbook.html # http://www.rubydoc.info/github/Homebrew/brew/master/Formula # PLEASE REMOVE ALL GENERATED COMMENTS BEFORE SUBMITTING YOUR PULL REQUEST!
true
Other
Homebrew
brew
baa61f5a6e105b9b89f5bef465848c72499cb960.json
Use https for all docs.brew.sh links. May as well use the more secure link when possible.
Library/Homebrew/dev-cmd/tap-new.rb
@@ -39,7 +39,7 @@ def tap_new ``` ## Documentation - `brew help`, `man brew` or check [Homebrew's documentation](https://github.com/Homebrew/brew/tree/master/docs#readme). + `brew help`, `man brew` or check [Homebrew's documentation](https://docs.brew.sh). EOS write_path(tap, "README.md", readme)
true
Other
Homebrew
brew
baa61f5a6e105b9b89f5bef465848c72499cb960.json
Use https for all docs.brew.sh links. May as well use the more secure link when possible.
Library/Homebrew/formula.rb
@@ -27,7 +27,7 @@ # @see SharedEnvExtension # @see FileUtils # @see Pathname -# @see http://docs.brew.sh/Formula-Cookbook.html Formula Cookbook +# @see https://docs.brew.sh/Formula-Cookbook.html Formula Cookbook # @see https://github.com/styleguide/ruby Ruby Style Guide # # <pre>class Wget < Formula @@ -2069,7 +2069,7 @@ def mirror(val) # and you haven't passed or previously used any options on this formula. # # If you maintain your own repository, you can add your own bottle links. - # http://docs.brew.sh/Bottles.html + # https://docs.brew.sh/Bottles.html # You can ignore this block entirely if submitting to Homebrew/Homebrew, It'll be # handled for you by the Brew Test Bot. #
true
Other
Homebrew
brew
baa61f5a6e105b9b89f5bef465848c72499cb960.json
Use https for all docs.brew.sh links. May as well use the more secure link when possible.
Library/Homebrew/manpages/brew.1.md.erb
@@ -76,7 +76,7 @@ scripts that reside somewhere in the `PATH`, named `brew-`<cmdname> or to create your own commands without modifying Homebrew's internals. Instructions for creating your own commands can be found in the docs: -<http://docs.brew.sh/External-Commands.html> +<https://docs.brew.sh/External-Commands.html> ## SPECIFYING FORMULAE @@ -189,7 +189,7 @@ can take several different forms: *Default:* the number of available CPU cores. * `HOMEBREW_NO_ANALYTICS`: - If set, Homebrew will not send analytics. See: <http://docs.brew.sh/Analytics.html> + If set, Homebrew will not send analytics. See: <https://docs.brew.sh/Analytics.html> * `HOMEBREW_NO_AUTO_UPDATE`: If set, Homebrew will not auto-update before running `brew install`, @@ -252,7 +252,7 @@ If your proxy requires authentication: ## SEE ALSO -Homebrew Documentation: <https://github.com/Homebrew/brew/blob/master/docs/> +Homebrew Documentation: <https://docs.brew.sh> `brew-cask`(1), `git`(1), `git-log`(1)
true
Other
Homebrew
brew
baa61f5a6e105b9b89f5bef465848c72499cb960.json
Use https for all docs.brew.sh links. May as well use the more secure link when possible.
Library/Homebrew/missing_formula.rb
@@ -164,7 +164,7 @@ def deleted_reason(name, silent: false) git -C "$(brew --repo #{tap})" show #{short_hash}^:#{relative_path} If you still use this formula consider creating your own tap: - http://docs.brew.sh/How-to-Create-and-Maintain-a-Tap.html + https://docs.brew.sh/How-to-Create-and-Maintain-a-Tap.html EOS end end
true
Other
Homebrew
brew
baa61f5a6e105b9b89f5bef465848c72499cb960.json
Use https for all docs.brew.sh links. May as well use the more secure link when possible.
Library/Homebrew/os.rb
@@ -17,7 +17,7 @@ def self.linux? require "os/mac" # Don't tell people to report issues on unsupported versions of macOS. if !OS::Mac.prerelease? && !OS::Mac.outdated_release? - ISSUES_URL = "http://docs.brew.sh/Troubleshooting.html".freeze + ISSUES_URL = "https://docs.brew.sh/Troubleshooting.html".freeze end PATH_OPEN = "/usr/bin/open".freeze # compatibility
true
Other
Homebrew
brew
baa61f5a6e105b9b89f5bef465848c72499cb960.json
Use https for all docs.brew.sh links. May as well use the more secure link when possible.
Library/Homebrew/utils/analytics.rb
@@ -35,7 +35,7 @@ def report(type, metadata = {}) end # Send analytics. Don't send or store any personally identifiable information. - # http://docs.brew.sh/Analytics.html + # https://docs.brew.sh/Analytics.html # https://developers.google.com/analytics/devguides/collection/protocol/v1/devguide # https://developers.google.com/analytics/devguides/collection/protocol/v1/parameters if ENV["HOMEBREW_ANALYTICS_DEBUG"]
true
Other
Homebrew
brew
baa61f5a6e105b9b89f5bef465848c72499cb960.json
Use https for all docs.brew.sh links. May as well use the more secure link when possible.
README.md
@@ -9,12 +9,12 @@ Features, usage and installation instructions are [summarised on the homepage](h 3. Or use `brew search --desc <keyword>` to browse packages from the command line. ## More Documentation -`brew help`, `man brew` or check [our documentation](http://docs.brew.sh/). +`brew help`, `man brew` or check [our documentation](https://docs.brew.sh/). ## Troubleshooting First, please run `brew update` and `brew doctor`. -Second, read the [Troubleshooting Checklist](http://docs.brew.sh/Troubleshooting.html). +Second, read the [Troubleshooting Checklist](https://docs.brew.sh/Troubleshooting.html). **If you don't read these it will take us far longer to help you with your problem.** @@ -26,7 +26,7 @@ We'd love you to contribute to Homebrew. First, please read our [Contribution Gu We explicitly welcome contributions from people who have never contributed to open-source before: we were all beginners once! We can help build on a partially working pull request with the aim of getting it merged. We are also actively seeking to diversify our contributors and especially welcome contributions from women from all backgrounds and people of colour. -A good starting point for contributing is running `brew audit --strict` with some of the packages you use (e.g. `brew audit --strict wget` if you use `wget`) and then read through the warnings, try to fix them until `brew audit --strict` shows no results and [submit a pull request](http://docs.brew.sh/How-To-Open-a-Homebrew-Pull-Request.html). If no formulae you use have warnings you can run `brew audit --strict` without arguments to have it run on all packages and pick one. Good luck! +A good starting point for contributing is running `brew audit --strict` with some of the packages you use (e.g. `brew audit --strict wget` if you use `wget`) and then read through the warnings, try to fix them until `brew audit --strict` shows no results and [submit a pull request](https://docs.brew.sh/How-To-Open-a-Homebrew-Pull-Request.html). If no formulae you use have warnings you can run `brew audit --strict` without arguments to have it run on all packages and pick one. Good luck! ## Security Please report security issues to our [HackerOne](https://hackerone.com/homebrew/).
true
Other
Homebrew
brew
baa61f5a6e105b9b89f5bef465848c72499cb960.json
Use https for all docs.brew.sh links. May as well use the more secure link when possible.
docs/Common-Issues.md
@@ -80,7 +80,7 @@ When running `brew upgrade`, you see something like this: $ brew upgrade Error: undefined method `include?' for nil:NilClass Please report this bug: - https://github.com/Homebrew/brew/blob/master/docs/Troubleshooting.md + https://docs.brew.sh/Troubleshooting.html /usr/local/Library/Homebrew/formula.rb:393:in `canonical_name' /usr/local/Library/Homebrew/formula.rb:425:in `factory' /usr/local/Library/Contributions/examples/brew-upgrade.rb:7
true
Other
Homebrew
brew
baa61f5a6e105b9b89f5bef465848c72499cb960.json
Use https for all docs.brew.sh links. May as well use the more secure link when possible.
docs/Formula-Cookbook.md
@@ -358,7 +358,7 @@ If you have already forked Homebrew on GitHub, then you can manually push (just git push https://github.com/myname/homebrew-core/ <what-you-called-your-branch> ``` -Now, [open a pull request](http://docs.brew.sh/How-To-Open-a-Homebrew-Pull-Request.html) for your changes. +Now, [open a pull request](https://docs.brew.sh/How-To-Open-a-Homebrew-Pull-Request.html) for your changes. * One formula per commit; one commit per formula * Keep merge commits out of the pull request
true
Other
Homebrew
brew
baa61f5a6e105b9b89f5bef465848c72499cb960.json
Use https for all docs.brew.sh links. May as well use the more secure link when possible.
docs/Manpage.md
@@ -39,7 +39,7 @@ With `--verbose` or `-v`, many commands print extra debugging information. Note * `analytics` [`state`]: Display anonymous user behaviour analytics state. - Read more at <http://docs.brew.sh/Analytics.html>. + Read more at <https://docs.brew.sh/Analytics.html>. * `analytics` (`on`|`off`): Turn on/off Homebrew's analytics. @@ -196,7 +196,7 @@ With `--verbose` or `-v`, many commands print extra debugging information. Note information on all installed formulae. See the docs for examples of using the JSON output: - <http://docs.brew.sh/Querying-Brew.html> + <https://docs.brew.sh/Querying-Brew.html> * `install` [`--debug`] [`--env=`(`std`|`super`)] [`--ignore-dependencies`|`--only-dependencies`] [`--cc=``compiler`] [`--build-from-source`|`--force-bottle`] [`--devel`|`--HEAD`] [`--keep-tmp`] [`--build-bottle`] `formula` [`options` ...]: Install `formula`. @@ -475,7 +475,7 @@ With `--verbose` or `-v`, many commands print extra debugging information. Note Pass `--installed` to get information on installed taps. See the docs for examples of using the JSON output: - <http://docs.brew.sh/Querying-Brew.html> + <https://docs.brew.sh/Querying-Brew.html> * `tap-pin` `tap`: Pin `tap`, prioritizing its formulae over core when formula names are supplied @@ -888,7 +888,7 @@ scripts that reside somewhere in the `PATH`, named `brew-``cmdname` or to create your own commands without modifying Homebrew's internals. Instructions for creating your own commands can be found in the docs: -<http://docs.brew.sh/External-Commands.html> +<https://docs.brew.sh/External-Commands.html> ## SPECIFYING FORMULAE @@ -1001,7 +1001,7 @@ can take several different forms: *Default:* the number of available CPU cores. * `HOMEBREW_NO_ANALYTICS`: - If set, Homebrew will not send analytics. See: <http://docs.brew.sh/Analytics.html> + If set, Homebrew will not send analytics. See: <https://docs.brew.sh/Analytics.html> * `HOMEBREW_NO_AUTO_UPDATE`: If set, Homebrew will not auto-update before running `brew install`, @@ -1064,7 +1064,7 @@ If your proxy requires authentication: ## SEE ALSO -Homebrew Documentation: <https://github.com/Homebrew/brew/blob/master/docs/> +Homebrew Documentation: <https://docs.brew.sh> `brew-cask`(1), `git`(1), `git-log`(1)
true
Other
Homebrew
brew
baa61f5a6e105b9b89f5bef465848c72499cb960.json
Use https for all docs.brew.sh links. May as well use the more secure link when possible.
docs/New-Maintainer-Checklist.md
@@ -34,9 +34,9 @@ A few requests: own fork. - if still in doubt please ask for help and we'll help you out - please read: - - http://docs.brew.sh/Brew-Test-Bot-For-Core-Contributors.html - - http://docs.brew.sh/Maintainer-Guidelines.html - - possibly everything else on http://docs.brew.sh + - https://docs.brew.sh/Brew-Test-Bot-For-Core-Contributors.html + - https://docs.brew.sh/Maintainer-Guidelines.html + - possibly everything else on https://docs.brew.sh How does that sound?
true
Other
Homebrew
brew
baa61f5a6e105b9b89f5bef465848c72499cb960.json
Use https for all docs.brew.sh links. May as well use the more secure link when possible.
docs/_layouts/index.html
@@ -115,7 +115,7 @@ <h2 id="question">{{ page.pagecontent.question }}</h2> <div class="group row"> <h2 id="further-doc">{{ page.pagecontent.doc.further }}</h2> <div class="button"> - <p><a href="http://docs.brew.sh/">docs.brew.sh</a></p> + <p><a href="https://docs.brew.sh/">docs.brew.sh</a></p> </div> </div> </li>
true
Other
Homebrew
brew
baa61f5a6e105b9b89f5bef465848c72499cb960.json
Use https for all docs.brew.sh links. May as well use the more secure link when possible.
manpages/brew.1
@@ -45,7 +45,7 @@ Perform a substring search of formula names for \fItext\fR\. If \fItext\fR is su . .TP \fBanalytics\fR [\fBstate\fR] -Display anonymous user behaviour analytics state\. Read more at \fIhttp://docs\.brew\.sh/Analytics\.html\fR\. +Display anonymous user behaviour analytics state\. Read more at \fIhttps://docs\.brew\.sh/Analytics\.html\fR\. . .TP \fBanalytics\fR (\fBon\fR|\fBoff\fR) @@ -213,7 +213,7 @@ Print a JSON representation of \fIformulae\fR\. Currently the only accepted valu Pass \fB\-\-all\fR to get information on all formulae, or \fB\-\-installed\fR to get information on all installed formulae\. . .IP -See the docs for examples of using the JSON output: \fIhttp://docs\.brew\.sh/Querying\-Brew\.html\fR +See the docs for examples of using the JSON output: \fIhttps://docs\.brew\.sh/Querying\-Brew\.html\fR . .TP \fBinstall\fR [\fB\-\-debug\fR] [\fB\-\-env=\fR(\fBstd\fR|\fBsuper\fR)] [\fB\-\-ignore\-dependencies\fR|\fB\-\-only\-dependencies\fR] [\fB\-\-cc=\fR\fIcompiler\fR] [\fB\-\-build\-from\-source\fR|\fB\-\-force\-bottle\fR] [\fB\-\-devel\fR|\fB\-\-HEAD\fR] [\fB\-\-keep\-tmp\fR] [\fB\-\-build\-bottle\fR] \fIformula\fR [\fIoptions\fR \.\.\.] @@ -494,7 +494,7 @@ Print a JSON representation of \fItaps\fR\. Currently the only accepted value fo Pass \fB\-\-installed\fR to get information on installed taps\. . .IP -See the docs for examples of using the JSON output: \fIhttp://docs\.brew\.sh/Querying\-Brew\.html\fR +See the docs for examples of using the JSON output: \fIhttps://docs\.brew\.sh/Querying\-Brew\.html\fR . .TP \fBtap\-pin\fR \fItap\fR @@ -921,7 +921,7 @@ Integrates Homebrew formulae with macOS\'s \fBlaunchctl\fR(1) manager: \fIhttps: Homebrew, like \fBgit\fR(1), supports external commands\. These are executable scripts that reside somewhere in the \fBPATH\fR, named \fBbrew\-\fR\fIcmdname\fR or \fBbrew\-\fR\fIcmdname\fR\fB\.rb\fR, which can be invoked like \fBbrew\fR \fIcmdname\fR\. This allows you to create your own commands without modifying Homebrew\'s internals\. . .P -Instructions for creating your own commands can be found in the docs: \fIhttp://docs\.brew\.sh/External\-Commands\.html\fR +Instructions for creating your own commands can be found in the docs: \fIhttps://docs\.brew\.sh/External\-Commands\.html\fR . .SH "SPECIFYING FORMULAE" Many Homebrew commands accept one or more \fIformula\fR arguments\. These arguments can take several different forms: @@ -1032,7 +1032,7 @@ If set, instructs Homebrew to use the value of \fBHOMEBREW_MAKE_JOBS\fR as the n . .TP \fBHOMEBREW_NO_ANALYTICS\fR -If set, Homebrew will not send analytics\. See: \fIhttp://docs\.brew\.sh/Analytics\.html\fR +If set, Homebrew will not send analytics\. See: \fIhttps://docs\.brew\.sh/Analytics\.html\fR . .TP \fBHOMEBREW_NO_AUTO_UPDATE\fR @@ -1108,7 +1108,7 @@ http_proxy=http://<user>:<password>@<host>:<port> brew install foo .IP "" 0 . .SH "SEE ALSO" -Homebrew Documentation: \fIhttps://github\.com/Homebrew/brew/blob/master/docs/\fR +Homebrew Documentation: \fIhttps://docs\.brew\.sh\fR . .P \fBbrew\-cask\fR(1), \fBgit\fR(1), \fBgit\-log\fR(1)
true
Other
Homebrew
brew
d6dd63d1a04cad16d2a6faa17a6d71e4baa8f95f.json
OS: use RbConfig instead of RUBY_PLATFORM `RUBY_PLATFORM` is always `"java"` when running JRuby, no matter what is the underlying platform. See also https://github.com/pry/pry/issues/386.
Library/Homebrew/os.rb
@@ -1,12 +1,14 @@ +require "rbconfig" + module OS def self.mac? return false if ENV["HOMEBREW_TEST_GENERIC_OS"] - RUBY_PLATFORM.to_s.downcase.include? "darwin" + RbConfig::CONFIG["host_os"].include? "darwin" end def self.linux? return false if ENV["HOMEBREW_TEST_GENERIC_OS"] - RUBY_PLATFORM.to_s.downcase.include? "linux" + RbConfig::CONFIG["host_os"].include? "linux" end ::OS_VERSION = ENV["HOMEBREW_OS_VERSION"]
false
Other
Homebrew
brew
a5fff4547f460642728c88dbad76267f83afa170.json
verion_spec: add test coverage for devel spec version style also expand coverage for improved dash version style
Library/Homebrew/test/version_spec.rb
@@ -453,6 +453,17 @@ .to be_detected_from("https://example.com/dada-v2017-04-17.tar.gz") end + specify "devel spec version style" do + expect(Version.create("1.3.0-beta.1")) + .to be_detected_from("https://registry.npmjs.org/@angular/cli/-/cli-1.3.0-beta.1.tgz") + expect(Version.create("2.074.0-beta1")) + .to be_detected_from("https://github.com/dlang/dmd/archive/v2.074.0-beta1.tar.gz") + expect(Version.create("2.074.0-rc1")) + .to be_detected_from("https://github.com/dlang/dmd/archive/v2.074.0-rc1.tar.gz") + expect(Version.create("5.0.0-alpha10")) + .to be_detected_from("https://github.com/premake/premake-core/releases/download/v5.0.0-alpha10/premake-5.0.0-alpha10-src.zip") + end + specify "jenkins version style" do expect(Version.create("1.486")) .to be_detected_from("http://mirrors.jenkins-ci.org/war/1.486/jenkins.war") @@ -479,6 +490,12 @@ specify "dash version style" do expect(Version.create("3.4")) .to be_detected_from("http://www.antlr.org/download/antlr-3.4-complete.jar") + expect(Version.create("9.2")) + .to be_detected_from("https://cdn.nuxeo.com/nuxeo-9.2/nuxeo-server-9.2-tomcat.zip") + expect(Version.create("0.181")) + .to be_detected_from("https://search.maven.org/remotecontent?filepath=com/facebook/presto/presto-cli/0.181/presto-cli-0.181-executable.jar") + expect(Version.create("1.2.3")) + .to be_detected_from("https://search.maven.org/remotecontent?filepath=org/apache/orc/orc-tools/1.2.3/orc-tools-1.2.3-uber.jar") end specify "apache version style" do
false
Other
Homebrew
brew
1502e5b89780629bd5fc9d4d0e49a621c3be02fa.json
version: improve devel spec version parsing term this 'devel spec version style'; also improve dash version style parsing
Library/Homebrew/version.rb
@@ -406,6 +406,14 @@ def self._parse(spec) m = /[-_](\d+\.\d+(?:\.\d+)?(?:-\d+)?)[-_.](?:i[36]86|x86|x64(?:[-_](?:32|64))?)$/.match(stem) return m.captures.first unless m.nil? + # devel spec + # e.g. https://registry.npmjs.org/@angular/cli/-/cli-1.3.0-beta.1.tgz + # e.g. https://github.com/dlang/dmd/archive/v2.074.0-beta1.tar.gz + # e.g. https://github.com/dlang/dmd/archive/v2.074.0-rc1.tar.gz + # e.g. https://github.com/premake/premake-core/releases/download/v5.0.0-alpha10/premake-5.0.0-alpha10-src.zip + m = /[-.vV]?((?:\d+\.)+\d+[-_.]?(?i:alpha|beta|pre|rc)\.?\d{,2})/.match(stem) + return m.captures.first unless m.nil? + # e.g. foobar4.5.1 m = /((?:\d+\.)*\d+)$/.match(stem) return m.captures.first unless m.nil? @@ -414,6 +422,15 @@ def self._parse(spec) m = /-((?:\d+\.)+\d+[abc]?)[-._](?:bin|dist|stable|src|sources?)$/.match(stem) return m.captures.first unless m.nil? + # dash version style + # e.g. http://www.antlr.org/download/antlr-3.4-complete.jar + # e.g. https://cdn.nuxeo.com/nuxeo-9.2/nuxeo-server-9.2-tomcat.zip + # e.g. https://search.maven.org/remotecontent?filepath=com/facebook/presto/presto-cli/0.181/presto-cli-0.181-executable.jar + # e.g. https://search.maven.org/remotecontent?filepath=org/fusesource/fuse-extra/fusemq-apollo-mqtt/1.3/fusemq-apollo-mqtt-1.3-uber.jar + # e.g. https://search.maven.org/remotecontent?filepath=org/apache/orc/orc-tools/1.2.3/orc-tools-1.2.3-uber.jar + m = /-((?:\d+\.)+\d+)-/.match(stem) + return m.captures.first unless m.nil? + # e.g. dash_0.5.5.1.orig.tar.gz (Debian style) m = /_((?:\d+\.)+\d+[abc]?)[.]orig$/.match(stem) return m.captures.first unless m.nil?
false
Other
Homebrew
brew
5198e80724fa1ff5a95d2da3a111ad5e5d4e395d.json
cpu: fix SSE4 detection on Linux
Library/Homebrew/extend/os/linux/hardware/cpu.rb
@@ -84,14 +84,18 @@ def features @features ||= flags[1..-1].map(&:intern) end - %w[aes altivec avx avx2 lm ssse3 sse4 sse4_2].each do |flag| + %w[aes altivec avx avx2 lm ssse3 sse4_2].each do |flag| define_method(flag + "?") { flags.include? flag } end def sse3? flags.include?("pni") || flags.include?("sse3") end + def sse4? + flags.include? "sse4_1" + end + alias is_64_bit? lm? def bits
false
Other
Homebrew
brew
2d18ba586b3250062cd58c8f5af81fc30a35bb5f.json
Enable more deprecations. It's been long enough that these have been commented out so let's enable them globally.
Library/Homebrew/cask/lib/hbc/dsl.rb
@@ -204,9 +204,7 @@ def sha256(arg = nil) end def license(*) - # TODO: Uncomment after `license` has been - # removed from all official taps. - # odeprecated "Hbc::DSL#license" + odeprecated "Hbc::DSL#license" end # depends_on uses a load method so that multiple stanzas can be merged
true
Other
Homebrew
brew
2d18ba586b3250062cd58c8f5af81fc30a35bb5f.json
Enable more deprecations. It's been long enough that these have been commented out so let's enable them globally.
Library/Homebrew/compat/software_spec.rb
@@ -1,6 +1,6 @@ class BottleSpecification def revision(*args) - # odeprecated "BottleSpecification.revision", "BottleSpecification.rebuild" + odeprecated "BottleSpecification.revision", "BottleSpecification.rebuild" rebuild(*args) end end
true
Other
Homebrew
brew
2d18ba586b3250062cd58c8f5af81fc30a35bb5f.json
Enable more deprecations. It's been long enough that these have been commented out so let's enable them globally.
Library/Homebrew/compat/utils.rb
@@ -1,8 +1,3 @@ -def shell_profile - # odeprecated "shell_profile", "Utils::Shell.profile" - Utils::Shell.profile -end - module Tty module_function
true
Other
Homebrew
brew
2d18ba586b3250062cd58c8f5af81fc30a35bb5f.json
Enable more deprecations. It's been long enough that these have been commented out so let's enable them globally.
Library/Homebrew/formula.rb
@@ -2368,7 +2368,7 @@ def cxxstdlib_check(check_type) # version '4.8.1' # end</pre> def fails_with(compiler, &block) - # odeprecated "fails_with :llvm" if compiler == :llvm + odeprecated "fails_with :llvm" if compiler == :llvm specs.each { |spec| spec.fails_with(compiler, &block) } end
true
Other
Homebrew
brew
2d18ba586b3250062cd58c8f5af81fc30a35bb5f.json
Enable more deprecations. It's been long enough that these have been commented out so let's enable them globally.
Library/Homebrew/software_spec.rb
@@ -194,7 +194,7 @@ def patch(strip = :p1, src = nil, &block) end def fails_with(compiler, &block) - # odeprecated "fails_with :llvm" if compiler == :llvm + odeprecated "fails_with :llvm" if compiler == :llvm compiler_failures << CompilerFailure.create(compiler, &block) end
true
Other
Homebrew
brew
2d18ba586b3250062cd58c8f5af81fc30a35bb5f.json
Enable more deprecations. It's been long enough that these have been commented out so let's enable them globally.
Library/Homebrew/utils.rb
@@ -556,3 +556,7 @@ def with_env(hash) ENV.update(old_values) end end + +def shell_profile + Utils::Shell.profile +end
true
Other
Homebrew
brew
7a8c674cebc6c05e4132d6656db3ae415e60f3f7.json
docs: fix fallback fonts
docs/css/screen.scss
@@ -111,7 +111,7 @@ html { margin: 0; padding: 0; font-size: 62.5%; - font-family: "-apple-system", "BlinkMacSystemFont", "Helvetica Neue", "Roboto", "sans-serif"; + font-family: "-apple-system", "BlinkMacSystemFont", "Helvetica Neue", "Roboto", sans-serif; height: 100%; } @@ -176,7 +176,7 @@ pre { @include border-radius(0.4em); overflow-x: auto; code { - font-family: "Monaco", "Menlo", "monospace"; + font-family: "Monaco", "Menlo", monospace; font-size: 11px; line-height: 1.6; }
false
Other
Homebrew
brew
c6f8887deb892f9ad34cb70a97aa195d40b040e0.json
New-Maintainer-Checklist: use new mailing list.
docs/New-Maintainer-Checklist.md
@@ -49,7 +49,7 @@ If they accept, follow a few steps to get them set up: - Ask them to sign in to [Bintray](https://bintray.com) using their GitHub account and they should auto-sync to [Bintray's Homebrew organisation](https://bintray.com/homebrew/organization/edit/members) as a member so they can publish new bottles - Add them to the [Jenkins' GitHub Authorization Settings admin user names](https://jenkins.brew.sh/configureSecurity/) so they can adjust settings and restart jobs - Add them to the [Jenkins' GitHub Pull Request Builder admin list](https://jenkins.brew.sh/configure) to enable `@BrewTestBot test this please` for them -- Invite them to the [`homebrew-dev` private maintainers mailing list](https://groups.google.com/forum/#!managemembers/homebrew-dev/invite) +- Invite them to the [`homebrew-maintainers` private maintainers mailing list](https://lists.sfconservancy.org/mailman/admin/homebrew-maintainers/members/add) - Invite them to the [`machomebrew` private maintainers Slack](https://machomebrew.slack.com/admin/invites) - Invite them to the [`homebrew` private maintainers 1Password](https://homebrew.1password.com/signin) - Invite them to [Google Analytics](https://analytics.google.com/analytics/web/?authuser=1#management/Settings/a76679469w115400090p120682403/%3Fm.page%3DAccountUsers/)
false
Other
Homebrew
brew
32b7e32856e61f256f2703faa17cdbcee26e17b7.json
formula: use env helper
Library/Homebrew/formula.rb
@@ -955,30 +955,27 @@ def run_post_install build = self.build self.build = Tab.for_formula(self) - old_tmpdir = ENV["TMPDIR"] - old_temp = ENV["TEMP"] - old_tmp = ENV["TMP"] - old_path = ENV["HOMEBREW_PATH"] - - ENV["TMPDIR"] = ENV["TEMP"] = ENV["TMP"] = HOMEBREW_TEMP - ENV["HOMEBREW_PATH"] = nil + new_env = { + "TMPDIR" => HOMEBREW_TEMP, + "TEMP" => HOMEBREW_TEMP, + "TMP" => HOMEBREW_TEMP, + "HOMEBREW_PATH" => nil, + } - ENV.clear_sensitive_environment! + with_env(new_env) do + ENV.clear_sensitive_environment! - Pathname.glob("#{bottle_prefix}/{etc,var}/**/*") do |path| - path.extend(InstallRenamed) - path.cp_path_sub(bottle_prefix, HOMEBREW_PREFIX) - end + Pathname.glob("#{bottle_prefix}/{etc,var}/**/*") do |path| + path.extend(InstallRenamed) + path.cp_path_sub(bottle_prefix, HOMEBREW_PREFIX) + end - with_logging("post_install") do - post_install + with_logging("post_install") do + post_install + end end ensure self.build = build - ENV["TMPDIR"] = old_tmpdir - ENV["TEMP"] = old_temp - ENV["TMP"] = old_tmp - ENV["HOMEBREW_PATH"] = old_path @prefix_returns_versioned_prefix = false end
false
Other
Homebrew
brew
f08b5184816fdc99db8cd0dac1e4debbb2a8c14a.json
python_requirement: add libexec/bin to PATH. This avoids having to fix formulae that use `python` to make them use `python2`.
Library/Homebrew/requirements/python_requirement.rb
@@ -21,6 +21,7 @@ class PythonRequirement < Requirement # Homebrew Python should take precedence over older Pythons in the PATH elsif short_version != Version.create("2.7") ENV.prepend_path "PATH", Formula["python"].opt_bin + ENV.prepend_path "PATH", Formula["python"].opt_libexec/"bin" end ENV["PYTHONPATH"] = "#{HOMEBREW_PREFIX}/lib/python#{short_version}/site-packages"
false
Other
Homebrew
brew
8b63214c2e7493903f40511a59aba4dd60419349.json
integration_test: try tests on Gem load failure. This should help with debugging `Gem::LoadError`s (e.g. for https://github.com/Homebrew/homebrew-test-bot/pull/111).
Library/Homebrew/test/support/helper/spec/shared_context/integration_test.rb
@@ -89,8 +89,14 @@ def brew(*args) ] if ENV["HOMEBREW_TESTS_COVERAGE"] simplecov_spec = Gem.loaded_specs["simplecov"] - specs = simplecov_spec.runtime_dependencies.flat_map(&:to_specs) - specs << simplecov_spec + specs = [simplecov_spec] + simplecov_spec.runtime_dependencies.each do |dep| + begin + specs += dep.to_specs + rescue Gem::LoadError => e + onoe e + end + end libs = specs.flat_map do |spec| full_gem_path = spec.full_gem_path # full_require_paths isn't available in RubyGems < 2.2.
false
Other
Homebrew
brew
7957e1a7215464486bf559d66438e79df6e766ce.json
Add a suitable explanatory line
Library/Homebrew/cmd/install.rb
@@ -1,4 +1,4 @@ -#: * `install` [`--debug`] [`--env=`(`std`|`super`)] [`--ignore-dependencies`|`--only-dependencies`] [`--cc=`<compiler>] [`--build-from-source`|`--force-bottle`] [`--devel`|`--HEAD`] [`--keep-tmp`] [`--build-bottle`] <formula> [`install-options`]: +#: * `install` [`--debug`] [`--env=`(`std`|`super`)] [`--ignore-dependencies`|`--only-dependencies`] [`--cc=`<compiler>] [`--build-from-source`|`--force-bottle`] [`--devel`|`--HEAD`] [`--keep-tmp`] [`--build-bottle`] <formula> [<options> ...]: #: Install <formula>. #: #: <formula> is usually the name of the formula to install, but it can be specified @@ -47,6 +47,9 @@ #: If `--build-bottle` is passed, prepare the formula for eventual bottling #: during installation. #: +#: Installation options specific to <formula> may be appended to the command, +#: and can be listed with `brew options` <formula>. +#: #: * `install` `--interactive` [`--git`] <formula>: #: If `--interactive` (or `-i`) is passed, download and patch <formula>, then #: open a shell. This allows the user to run `./configure --help` and
true
Other
Homebrew
brew
7957e1a7215464486bf559d66438e79df6e766ce.json
Add a suitable explanatory line
docs/Manpage.md
@@ -198,7 +198,7 @@ With `--verbose` or `-v`, many commands print extra debugging information. Note See the docs for examples of using the JSON output: <http://docs.brew.sh/Querying-Brew.html> - * `install` [`--debug`] [`--env=`(`std`|`super`)] [`--ignore-dependencies`|`--only-dependencies`] [`--cc=``compiler`] [`--build-from-source`|`--force-bottle`] [`--devel`|`--HEAD`] [`--keep-tmp`] [`--build-bottle`] `formula` [`install-options`]: + * `install` [`--debug`] [`--env=`(`std`|`super`)] [`--ignore-dependencies`|`--only-dependencies`] [`--cc=``compiler`] [`--build-from-source`|`--force-bottle`] [`--devel`|`--HEAD`] [`--keep-tmp`] [`--build-bottle`] `formula` : [<`options`> ...] Install `formula`. `formula` is usually the name of the formula to install, but it can be specified @@ -247,6 +247,9 @@ With `--verbose` or `-v`, many commands print extra debugging information. Note If `--build-bottle` is passed, prepare the formula for eventual bottling during installation. + Installation options specific to <formula> may be appended to the command, + and can be listed with `brew options` <formula>. + * `install` `--interactive` [`--git`] `formula`: If `--interactive` (or `-i`) is passed, download and patch `formula`, then open a shell. This allows the user to run `./configure --help` and
true
Other
Homebrew
brew
7957e1a7215464486bf559d66438e79df6e766ce.json
Add a suitable explanatory line
manpages/brew.1
@@ -216,7 +216,7 @@ Pass \fB\-\-all\fR to get information on all formulae, or \fB\-\-installed\fR to See the docs for examples of using the JSON output: \fIhttp://docs\.brew\.sh/Querying\-Brew\.html\fR . .TP -\fBinstall\fR [\fB\-\-debug\fR] [\fB\-\-env=\fR(\fBstd\fR|\fBsuper\fR)] [\fB\-\-ignore\-dependencies\fR|\fB\-\-only\-dependencies\fR] [\fB\-\-cc=\fR\fIcompiler\fR] [\fB\-\-build\-from\-source\fR|\fB\-\-force\-bottle\fR] [\fB\-\-devel\fR|\fB\-\-HEAD\fR] [\fB\-\-keep\-tmp\fR] [\fB\-\-build\-bottle\fR] \fIformula\fR [\fIinstall\-options\fR] +\fBinstall\fR [\fB\-\-debug\fR] [\fB\-\-env=\fR(\fBstd\fR|\fBsuper\fR)] [\fB\-\-ignore\-dependencies\fR|\fB\-\-only\-dependencies\fR] [\fB\-\-cc=\fR\fIcompiler\fR] [\fB\-\-build\-from\-source\fR|\fB\-\-force\-bottle\fR] [\fB\-\-devel\fR|\fB\-\-HEAD\fR] [\fB\-\-keep\-tmp\fR] [\fB\-\-build\-bottle\fR] \fIformula\fR [\fIoptions\fR \.\.\.] Install \fIformula\fR\. . .IP @@ -261,6 +261,9 @@ If \fB\-\-keep\-tmp\fR is passed, the temporary files created during installatio .IP If \fB\-\-build\-bottle\fR is passed, prepare the formula for eventual bottling during installation\. . +.IP +Installation \fIoptions\fR specific to \fIformula\fR may be appended to the command, and can be listed with \fBbrew options <formula>\fR. +. .TP \fBinstall\fR \fB\-\-interactive\fR [\fB\-\-git\fR] \fIformula\fR If \fB\-\-interactive\fR (or \fB\-i\fR) is passed, download and patch \fIformula\fR, then open a shell\. This allows the user to run \fB\./configure \-\-help\fR and otherwise determine how to turn the software package into a Homebrew formula\.
true
Other
Homebrew
brew
66f1b179427335a103d9aafdacee8f577cc66d4f.json
python_virtualenv_constants: update virtualenv to 15.1.0 This release adds support for Python 3.6, the current python3 version in homebrew/core.
Library/Homebrew/language/python_virtualenv_constants.rb
@@ -1,2 +1,2 @@ -PYTHON_VIRTUALENV_URL = "https://files.pythonhosted.org/packages/5c/79/5dae7494b9f5ed061cff9a8ab8d6e1f02db352f3facf907d9eb614fb80e9/virtualenv-15.0.2.tar.gz".freeze -PYTHON_VIRTUALENV_SHA256 = "fab40f32d9ad298fba04a260f3073505a16d52539a84843cf8c8369d4fd17167".freeze +PYTHON_VIRTUALENV_URL = "https://files.pythonhosted.org/packages/d4/0c/9840c08189e030873387a73b90ada981885010dd9aea134d6de30cd24cb8/virtualenv-15.1.0.tar.gz".freeze +PYTHON_VIRTUALENV_SHA256 = "02f8102c2436bb03b3ee6dede1919d1dac8a427541652e5ec95171ec8adbc93a".freeze
false
Other
Homebrew
brew
53a677aba6f28a148c9950cfde7f73fda5cdf81f.json
sandbox: allow write access to /dev/random This avoids build failure for `root6`. MacPorts currently avoids the failure with a patch, as their sandbox doesn't yet allow write access to `/dev/random` either: https://github.com/macports/macports-ports/blob/7792b2c5655f9d2adb979434a242cc3ac60fea40/science/root6/Portfile#L73-L75 https://github.com/macports/macports-ports/blob/7792b2c5655f9d2adb979434a242cc3ac60fea40/science/root6/files/patch-disable-hsimple-macro.diff The relevant code where `/dev/random` is opened with `O_WRONLY` is here: https://github.com/root-project/root/blob/15673deba5a0cb73d90ae8f36d7b010f65b5e96e/interpreter/cling/lib/Utils/PlatformPosix.cpp#L63-L82
Library/Homebrew/sandbox.rb
@@ -156,6 +156,7 @@ class SandboxProfile (literal "/dev/ptmx") (literal "/dev/dtracehelper") (literal "/dev/null") + (literal "/dev/random") (literal "/dev/zero") (regex #"^/dev/fd/[0-9]+$") (regex #"^/dev/ttys?[0-9]*$")
false
Other
Homebrew
brew
cabb7e898aaf56404bc692b4cfae5ede7914f78c.json
integration_test: add simplecov libs when needed. Don't add these unconditionally or with Bundler to speed things up a bit. Also, to speed things up further cache these arguments so we don't have to do the same generation every time.
Library/Homebrew/test/support/helper/spec/shared_context/integration_test.rb
@@ -80,18 +80,34 @@ def brew(*args) "GEM_HOME" => nil, ) - ruby_args = [ - "-W0", - "-I", "#{HOMEBREW_LIBRARY_PATH}/test/support/lib", - "-I", HOMEBREW_LIBRARY_PATH.to_s, - "-rconfig" - ] - ruby_args << "-rsimplecov" if ENV["HOMEBREW_TESTS_COVERAGE"] - ruby_args << "-rtest/support/helper/integration_mocks" - ruby_args << (HOMEBREW_LIBRARY_PATH/"brew.rb").resolved_path.to_s + @ruby_args ||= begin + ruby_args = [ + "-W0", + "-I", "#{HOMEBREW_LIBRARY_PATH}/test/support/lib", + "-I", HOMEBREW_LIBRARY_PATH.to_s, + "-rconfig" + ] + if ENV["HOMEBREW_TESTS_COVERAGE"] + simplecov_spec = Gem.loaded_specs["simplecov"] + specs = simplecov_spec.runtime_dependencies.flat_map(&:to_specs) + specs << simplecov_spec + libs = specs.flat_map do |spec| + full_gem_path = spec.full_gem_path + # full_require_paths isn't available in RubyGems < 2.2. + spec.require_paths.map do |lib| + next lib if lib.include?(full_gem_path) + "#{full_gem_path}/#{lib}" + end + end + libs.each { |lib| ruby_args << "-I" << lib } + ruby_args << "-rsimplecov" + end + ruby_args << "-rtest/support/helper/integration_mocks" + ruby_args << (HOMEBREW_LIBRARY_PATH/"brew.rb").resolved_path.to_s + end Bundler.with_clean_env do - stdout, stderr, status = Open3.capture3(env, RUBY_PATH, *ruby_args, *args) + stdout, stderr, status = Open3.capture3(env, RUBY_PATH, *@ruby_args, *args) $stdout.print stdout $stderr.print stderr status
false
Other
Homebrew
brew
4e26fdfcf6922dca9a82b15697b4c76c6bf9212b.json
Add test for non-TTY `brew cask search`.
Library/Homebrew/test/cask/cli/search_spec.rb
@@ -13,6 +13,15 @@ EOS end + it "outputs a plain list when stdout is not a TTY" do + expect { + Hbc::CLI::Search.run("local") + }.to output(<<-EOS.undent).to_stdout + local-caffeine + local-transmission + EOS + end + it "shows that there are no Casks matching a search term that did not result in anything" do expect { Hbc::CLI::Search.run("foo-bar-baz")
true
Other
Homebrew
brew
4e26fdfcf6922dca9a82b15697b4c76c6bf9212b.json
Add test for non-TTY `brew cask search`.
Library/Homebrew/test/support/helper/output_as_tty.rb
@@ -3,14 +3,6 @@ module Test module Helper module OutputAsTTY - module TTYTrue - def tty? - true - end - - alias isatty tty? - end - # This is a custom wrapper for the `output` matcher, # used for testing output to a TTY: # @@ -26,41 +18,33 @@ class Output < SimpleDelegator def matches?(block) return super(block) unless @tty - colored_tty_block = if @output == :stdout - lambda do - $stdout.extend(TTYTrue) - block.call - end - elsif @output == :stderr - lambda do - $stderr.extend(TTYTrue) - block.call - end - else - raise "`as_tty` can only be chained to `stdout` or `stderr`." + colored_tty_block = lambda do + instance_eval("$#{@output}").extend(Module.new do + def tty? + true + end + + alias_method :isatty, :tty? + end) + block.call end return super(colored_tty_block) if @colors uncolored_tty_block = lambda do - begin - out_stream = StringIO.new - err_stream = StringIO.new - - old_stdout = $stdout - old_stderr = $stderr - - $stdout = out_stream - $stderr = err_stream - - colored_tty_block.call - ensure - $stdout = old_stdout - $stderr = old_stderr - - $stdout.print Tty.strip_ansi(out_stream.string) - $stderr.print Tty.strip_ansi(err_stream.string) - end + instance_eval <<-EOS + begin + captured_stream = StringIO.new + + original_stream = $#{@output} + $#{@output} = captured_stream + + colored_tty_block.call + ensure + $#{@output} = original_stream + $#{@output}.print Tty.strip_ansi(captured_stream.string) + end + EOS end super(uncolored_tty_block) @@ -80,7 +64,8 @@ def to_stderr def as_tty @tty = true - self + return self if [:stdout, :stderr].include?(@output) + raise "`as_tty` can only be chained to `stdout` or `stderr`." end def with_color
true
Other
Homebrew
brew
491bb469e75c772d897c29645453a0988a1c7a4a.json
Add example links in Python for Formula Authors
docs/Python-for-Formula-Authors.md
@@ -2,13 +2,13 @@ This document explains how to successfully use Python in a Homebrew formula. -Homebrew draws a distinction between Python **applications** and Python **libraries**. The difference is that users generally do not care that applications are written in Python; it is unusual that a user would expect to be able to `import foo` after installing an application. Examples of applications are `ansible` and `jrnl`. +Homebrew draws a distinction between Python **applications** and Python **libraries**. The difference is that users generally do not care that applications are written in Python; it is unusual that a user would expect to be able to `import foo` after installing an application. Examples of applications are [`ansible`](https://github.com/Homebrew/homebrew-core/blob/master/Formula/ansible.rb) and [`jrnl`](https://github.com/Homebrew/homebrew-core/blob/master/Formula/jrnl.rb). -Python libraries exist to be imported by other Python modules; they are often dependencies of Python applications. They are usually no more than incidentally useful from a Terminal.app command line. Examples of libraries are `py2cairo` and the bindings that are installed by `protobuf --with-python`. +Python libraries exist to be imported by other Python modules; they are often dependencies of Python applications. They are usually no more than incidentally useful from a Terminal.app command line. Examples of libraries are [`py2cairo`](https://github.com/Homebrew/homebrew-core/blob/master/Formula/py2cairo.rb) and the bindings that are installed by [`protobuf --with-python`](https://github.com/Homebrew/homebrew-core/blob/master/Formula/protobuf.rb). Bindings are a special case of libraries that allow Python code to interact with a library or application implemented in another language. -Homebrew is happy to accept applications that are built in Python, whether the apps are available from PyPI or not. Homebrew generally won't accept libraries that can be installed correctly with `pip install foo`. Libraries that can be `pip`-installed but have several Homebrew dependencies may be appropriate for the [homebrew/python](https://github.com/Homebrew/homebrew-python) tap. Bindings may be installed for packages that provide them, especially if equivalent functionality isn't available through pip. +Homebrew is happy to accept applications that are built in Python, whether the apps are available from PyPI or not. Homebrew generally won't accept libraries that can be installed correctly with `pip install foo`. Bindings may be installed for packages that provide them, especially if equivalent functionality isn't available through pip. ## Running `setup.py` @@ -40,8 +40,6 @@ If you submit a formula with this syntax to core, you may be asked to rewrite it ## Applications -`ansible.rb` and `jrnl.rb` are good examples of applications that follow this advice. - ### Python declarations Applications that are compatible with Python 2 **should** use the Apple-provided system Python in `/usr/bin` on systems that provide Python 2.7. To do this, declare:
false
Other
Homebrew
brew
dccdac55a835a22d46c36fe915e6e8cdf43a4adc.json
Add helper for testing TTY output.
Library/Homebrew/test/cask/cli/search_spec.rb
@@ -1,12 +1,12 @@ describe Hbc::CLI::Search, :cask do before(:each) do - allow($stdout).to receive(:tty?).and_return(true) + allow(Tty).to receive(:width).and_return(0) end it "lists the available Casks that match the search term" do expect { Hbc::CLI::Search.run("local") - }.to output(<<-EOS.undent).to_stdout + }.to output(<<-EOS.undent).to_stdout.as_tty ==> Partial Matches local-caffeine local-transmission @@ -16,49 +16,49 @@ it "shows that there are no Casks matching a search term that did not result in anything" do expect { Hbc::CLI::Search.run("foo-bar-baz") - }.to output("No Cask found for \"foo-bar-baz\".\n").to_stdout + }.to output("No Cask found for \"foo-bar-baz\".\n").to_stdout.as_tty end it "lists all available Casks with no search term" do expect { Hbc::CLI::Search.run - }.to output(/local-caffeine/).to_stdout + }.to output(/local-caffeine/).to_stdout.as_tty end it "ignores hyphens in search terms" do expect { Hbc::CLI::Search.run("lo-cal-caffeine") - }.to output(/local-caffeine/).to_stdout + }.to output(/local-caffeine/).to_stdout.as_tty end it "ignores hyphens in Cask tokens" do expect { Hbc::CLI::Search.run("localcaffeine") - }.to output(/local-caffeine/).to_stdout + }.to output(/local-caffeine/).to_stdout.as_tty end it "accepts multiple arguments" do expect { Hbc::CLI::Search.run("local caffeine") - }.to output(/local-caffeine/).to_stdout + }.to output(/local-caffeine/).to_stdout.as_tty end it "accepts a regexp argument" do expect { Hbc::CLI::Search.run("/^local-c[a-z]ffeine$/") - }.to output("==> Regexp Matches\nlocal-caffeine\n").to_stdout + }.to output("==> Regexp Matches\nlocal-caffeine\n").to_stdout.as_tty end it "Returns both exact and partial matches" do expect { Hbc::CLI::Search.run("test-opera") - }.to output(/^==> Exact Match\ntest-opera\n==> Partial Matches\ntest-opera-mail/).to_stdout + }.to output(/^==> Exact Match\ntest-opera\n==> Partial Matches\ntest-opera-mail/).to_stdout.as_tty end it "does not search the Tap name" do expect { Hbc::CLI::Search.run("caskroom") - }.to output(/^No Cask found for "caskroom"\.\n/).to_stdout + }.to output(/^No Cask found for "caskroom"\.\n/).to_stdout.as_tty end it "doesn't highlight packages that aren't installed" do
true
Other
Homebrew
brew
dccdac55a835a22d46c36fe915e6e8cdf43a4adc.json
Add helper for testing TTY output.
Library/Homebrew/test/spec_helper.rb
@@ -23,6 +23,7 @@ require "test/support/helper/fixtures" require "test/support/helper/formula" require "test/support/helper/mktmpdir" +require "test/support/helper/output_as_tty" require "test/support/helper/rubocop" require "test/support/helper/spec/shared_context/homebrew_cask" if OS.mac? @@ -45,6 +46,7 @@ config.include(Test::Helper::Fixtures) config.include(Test::Helper::Formula) config.include(Test::Helper::MkTmpDir) + config.include(Test::Helper::OutputAsTTY) config.include(Test::Helper::RuboCop) config.before(:each, :needs_compat) do
true
Other
Homebrew
brew
dccdac55a835a22d46c36fe915e6e8cdf43a4adc.json
Add helper for testing TTY output.
Library/Homebrew/test/support/helper/output_as_tty.rb
@@ -0,0 +1,99 @@ +require "delegate" + +module Test + module Helper + module OutputAsTTY + module TTYTrue + def tty? + true + end + + alias isatty tty? + end + + # This is a custom wrapper for the `output` matcher, + # used for testing output to a TTY: + # + # expect { + # print "test" if $stdout.tty? + # }.to output("test").to_stdout.as_tty + # + # expect { + # # command + # }.to output(...).to_stderr.as_tty.with_color + # + class Output < SimpleDelegator + def matches?(block) + return super(block) unless @tty + + colored_tty_block = if @output == :stdout + lambda do + $stdout.extend(TTYTrue) + block.call + end + elsif @output == :stderr + lambda do + $stderr.extend(TTYTrue) + block.call + end + else + raise "`as_tty` can only be chained to `stdout` or `stderr`." + end + + return super(colored_tty_block) if @colors + + uncolored_tty_block = lambda do + begin + out_stream = StringIO.new + err_stream = StringIO.new + + old_stdout = $stdout + old_stderr = $stderr + + $stdout = out_stream + $stderr = err_stream + + colored_tty_block.call + ensure + $stdout = old_stdout + $stderr = old_stderr + + $stdout.print Tty.strip_ansi(out_stream.string) + $stderr.print Tty.strip_ansi(err_stream.string) + end + end + + super(uncolored_tty_block) + end + + def to_stdout + @output = :stdout + super + self + end + + def to_stderr + @output = :stderr + super + self + end + + def as_tty + @tty = true + self + end + + def with_color + @colors = true + return self if @tty + raise "`with_color` can only be chained to `as_tty`." + end + end + + def output(*args) + core_matcher = super(*args) + Output.new(core_matcher) + end + end + end +end
true
Other
Homebrew
brew
0b69ca85f763bb0db210384ba2c4a93049bb7b35.json
spec_helper: add focus support. When adding `, :focus` as a trailing argument to a `describe` or `it` this allows you to only run that single test.
Library/Homebrew/test/spec_helper.rb
@@ -41,6 +41,8 @@ RSpec.configure do |config| config.order = :random + config.filter_run_when_matching :focus + config.include(Test::Helper::Shutup) config.include(Test::Helper::Fixtures) config.include(Test::Helper::Formula)
false
Other
Homebrew
brew
d9e0a0bce6f76f4c52286b70d39131b8351a7c5e.json
rubocop.yml: remove doublenegation disable.
Library/Homebrew/.rubocop.yml
@@ -33,10 +33,6 @@ Style/BlockDelimiters: Exclude: - '**/*_spec.rb' -# used idiomatically to return boolean values -Style/DoubleNegation: - Enabled: false - # so many of these in formulae but none in here Style/GuardClause: Enabled: true
false
Other
Homebrew
brew
04d0d384357331877c2cb78132be066233ea7046.json
Fix a broken link
docs/Installation.md
@@ -44,7 +44,7 @@ Uninstallation is documented in the [FAQ](FAQ.md). <a name="1"><sup>1</sup></a> Not all formulae have CPU or OS requirements, but you can assume you will have trouble if you don’t conform. Also, you can find PowerPC and Tiger branches from other users in the fork network. See -[Interesting Taps & Forks](Interesting-Taps-&-Forks.md). +[Interesting Taps and Forks](Interesting-Taps-and-Forks.md). <a name="2"><sup>2</sup></a> 10.10 or higher is recommended. 10.5–10.9 are supported on a best-effort basis. For 10.4 and 10.5, see
false
Other
Homebrew
brew
5ab745574cd951e5e3be018f7872004f78ef624f.json
cpu: fix SSE3 detection on Linux
Library/Homebrew/extend/os/linux/hardware/cpu.rb
@@ -84,9 +84,14 @@ def features @features ||= flags[1..-1].map(&:intern) end - %w[aes altivec avx avx2 lm sse3 ssse3 sse4 sse4_2].each do |flag| + %w[aes altivec avx avx2 lm ssse3 sse4 sse4_2].each do |flag| define_method(flag + "?") { flags.include? flag } end + + def sse3? + flags.include?("pni") || flags.include?("sse3") + end + alias is_64_bit? lm? def bits
false
Other
Homebrew
brew
31ca5c9aed3bd3254b8152385c5baf2e95160930.json
docs/config: add missing feed plugin.
docs/_config.yml
@@ -12,5 +12,6 @@ lsi: false highlighter: rouge gems: + - jekyll-feed - jekyll-sitemap - jekyll-seo-tag
false
Other
Homebrew
brew
f87fadd4ee7a5f157df6813c233b9e8684a66a4b.json
version: improve parsing of url-only, non-filename versions add support for styles prefixed with a r,v,V and an optional _ , and styles with four groups of digits, seperated by periods; combinations of the two are also supported
Library/Homebrew/version.rb
@@ -407,8 +407,13 @@ def self._parse(spec) # e.g. http://mirrors.jenkins-ci.org/war/1.486/jenkins.war # e.g. https://github.com/foo/bar/releases/download/0.10.11/bar.phar - m = %r{/(\d\.\d+(\.\d+)?)}.match(spec_s) - return m.captures.first unless m.nil? + # e.g. https://github.com/clojure/clojurescript/releases/download/r1.9.293/cljs.jar + # e.g. https://github.com/fibjs/fibjs/releases/download/v0.6.1/fullsrc.zip + # e.g. https://wwwlehre.dhbw-stuttgart.de/~sschulz/WORK/E_DOWNLOAD/V_1.9/E.tgz + # e.g. https://github.com/JustArchi/ArchiSteamFarm/releases/download/2.3.2.0/ASF.zip + # e.g. https://people.gnome.org/~newren/eg/download/1.7.5.2/eg + m = %r{/([rvV]_?)?(\d\.\d+(\.\d+){,2})}.match(spec_s) + return m.captures[1] unless m.nil? # e.g. http://www.ijg.org/files/jpegsrc.v8d.tar.gz m = /\.v(\d+[a-z]?)/.match(stem)
false
Other
Homebrew
brew
02113e2714aae818ee2c43e203137b3cd0b61ced.json
language/node: build native addons from source By telling node-pre-gyp and prebuild to don't pull prebuild binaries and instead build them from source. This still may not work for some custom third party scripts for pulling prebuild binaries.
Library/Homebrew/language/node.rb
@@ -44,6 +44,7 @@ def self.std_npm_install_args(libexec) %W[ -ddd --global + --build-from-source --prefix=#{libexec} #{Dir.pwd}/#{pack} ] @@ -52,7 +53,10 @@ def self.std_npm_install_args(libexec) def self.local_npm_install_args setup_npm_environment # npm install args for local style module format - ["-ddd"] + %w[ + -ddd + --build-from-source + ] end end end
true
Other
Homebrew
brew
02113e2714aae818ee2c43e203137b3cd0b61ced.json
language/node: build native addons from source By telling node-pre-gyp and prebuild to don't pull prebuild binaries and instead build them from source. This still may not work for some custom third party scripts for pulling prebuild binaries.
Library/Homebrew/test/language/node_spec.rb
@@ -41,6 +41,6 @@ specify "#local_npm_install_args" do resp = subject.local_npm_install_args - expect(resp).to include("-ddd") + expect(resp).to include("-ddd", "--build-from-source") end end
true
Other
Homebrew
brew
7013f9dee3ea3e05e0fd51ee6ef0f19e5656176a.json
formula_desc_cop: allow formula name in desc except at the very beginning, as the audit originally intended. See https://github.com/Homebrew/legacy-homebrew/pull/45493.
Library/Homebrew/rubocops/formula_desc_cop.rb
@@ -72,9 +72,9 @@ def audit_formula(_node, _class_node, _parent_class_node, body_node) problem "Description should start with a capital letter" end - # Check if formula's name is used in formula's desc - return unless regex_match_group(desc, /(^|[^a-z])#{@formula_name}([^a-z]|$)/i) - problem "Description shouldn't include the formula name" + # Check if formula's desc starts with formula's name + return unless regex_match_group(desc, /^#{@formula_name} /i) + problem "Description shouldn't start with the formula name" end private
true
Other
Homebrew
brew
7013f9dee3ea3e05e0fd51ee6ef0f19e5656176a.json
formula_desc_cop: allow formula name in desc except at the very beginning, as the audit originally intended. See https://github.com/Homebrew/legacy-homebrew/pull/45493.
Library/Homebrew/test/rubocops/formula_desc_cop_spec.rb
@@ -146,11 +146,11 @@ class Foo < Formula source = <<-EOS.undent class Foo < Formula url 'http://example.com/foo-1.0.tgz' - desc 'Foo: foobar' + desc 'Foo is a foobar' end EOS - expected_offenses = [{ message: "Description shouldn't include the formula name", + expected_offenses = [{ message: "Description shouldn't start with the formula name", severity: :convention, line: 3, column: 8,
true
Other
Homebrew
brew
3701b11e42a93ee9c1bb94f326ee186d4416501c.json
Fix unshallowing taps in `bump-formula-pr` Never try to unhshallow full clones.
Library/Homebrew/dev-cmd/bump-formula-pr.rb
@@ -286,8 +286,11 @@ def bump_formula_pr formula.path.parent.cd do branch = "#{formula.name}-#{new_formula_version}" + git_dir = Utils.popen_read("git rev-parse --git-dir") + shallow = !git_dir.empty? && File.exist?("#{git_dir}/shallow") + if ARGV.dry_run? - ohai "git fetch --unshallow origin" + ohai "git fetch --unshallow origin" if shallow ohai "git checkout --no-track -b #{branch} origin/master" ohai "git commit --no-edit --verbose --message='#{formula.name} #{new_formula_version}#{devel_message}' -- #{formula.path}" ohai "hub fork --no-remote" @@ -297,7 +300,7 @@ def bump_formula_pr ohai "hub pull-request --browse -m '#{formula.name} #{new_formula_version}#{devel_message}'" ohai "git checkout -" else - safe_system "git", "fetch", "--unshallow", "origin" + safe_system "git", "fetch", "--unshallow", "origin" if shallow safe_system "git", "checkout", "--no-track", "-b", branch, "origin/master" safe_system "git", "commit", "--no-edit", "--verbose", "--message=#{formula.name} #{new_formula_version}#{devel_message}",
false
Other
Homebrew
brew
700b5e2738fad9aa576df25d494e1d7e69962326.json
Add PreToken composite
Library/Homebrew/test/version_spec.rb
@@ -93,6 +93,21 @@ expect(Version.create("1.2.3beta2")).to be < Version.create("1.2.3-p34") end + specify "comparing pre versions" do + expect(Version.create("1.2.3pre9")).to be == Version.create("1.2.3PRE9") + expect(Version.create("1.2.3pre9")).to be > Version.create("1.2.3pre8") + expect(Version.create("1.2.3pre8")).to be < Version.create("1.2.3pre9") + expect(Version.create("1.2.3pre9")).to be < Version.create("1.2.3pre10") + + expect(Version.create("1.2.3pre3")).to be > Version.create("1.2.3alpha2") + expect(Version.create("1.2.3pre3")).to be > Version.create("1.2.3alpha4") + expect(Version.create("1.2.3pre3")).to be > Version.create("1.2.3beta3") + expect(Version.create("1.2.3pre3")).to be > Version.create("1.2.3beta5") + expect(Version.create("1.2.3pre3")).to be < Version.create("1.2.3rc2") + expect(Version.create("1.2.3pre3")).to be < Version.create("1.2.3") + expect(Version.create("1.2.3pre3")).to be < Version.create("1.2.3-p2") + end + specify "comparing RC versions" do expect(Version.create("1.2.3rc3")).to be == Version.create("1.2.3RC3") expect(Version.create("1.2.3rc3")).to be > Version.create("1.2.3rc2")
true
Other
Homebrew
brew
700b5e2738fad9aa576df25d494e1d7e69962326.json
Add PreToken composite
Library/Homebrew/version.rb
@@ -36,7 +36,7 @@ def <=>(other) 0 when NumericToken other.value.zero? ? 0 : -1 - when AlphaToken, BetaToken, RCToken + when AlphaToken, BetaToken, PreToken, RCToken 1 else -1 @@ -103,6 +103,8 @@ def <=>(other) case other when AlphaToken rev <=> other.rev + when BetaToken, RCToken, PreToken, PatchToken + -1 else super end @@ -118,6 +120,23 @@ def <=>(other) rev <=> other.rev when AlphaToken 1 + when PreToken, RCToken, PatchToken + -1 + else + super + end + end + end + + class PreToken < CompositeToken + PATTERN = /pre[0-9]*/i + + def <=>(other) + case other + when PreToken + rev <=> other.rev + when AlphaToken, BetaToken + 1 when RCToken, PatchToken -1 else @@ -133,7 +152,7 @@ def <=>(other) case other when RCToken rev <=> other.rev - when AlphaToken, BetaToken + when AlphaToken, BetaToken, PreToken 1 when PatchToken -1 @@ -150,7 +169,7 @@ def <=>(other) case other when PatchToken rev <=> other.rev - when AlphaToken, BetaToken, RCToken + when AlphaToken, BetaToken, RCToken, PreToken 1 else super @@ -161,6 +180,7 @@ def <=>(other) SCAN_PATTERN = Regexp.union( AlphaToken::PATTERN, BetaToken::PATTERN, + PreToken::PATTERN, RCToken::PATTERN, PatchToken::PATTERN, NumericToken::PATTERN, @@ -289,6 +309,7 @@ def tokenize when /\A#{AlphaToken::PATTERN}\z/o then AlphaToken when /\A#{BetaToken::PATTERN}\z/o then BetaToken when /\A#{RCToken::PATTERN}\z/o then RCToken + when /\A#{PreToken::PATTERN}\z/o then PreToken when /\A#{PatchToken::PATTERN}\z/o then PatchToken when /\A#{NumericToken::PATTERN}\z/o then NumericToken when /\A#{StringToken::PATTERN}\z/o then StringToken
true
Other
Homebrew
brew
c45cca8e36401f6d95d851befef35879a5629182.json
test: simplify minitest inclusion. The previous version seems needlessly complicated given we only support a single Ruby version. It was also blowing up on Bundler 1.15.X.
Library/Homebrew/dev-cmd/test.rb
@@ -83,7 +83,7 @@ def test exec(*args) end end - rescue Assertions::FailedAssertion => e + rescue MiniTest::Assertion => e ofail "#{f.full_name}: failed" puts e.message rescue Exception => e
true
Other
Homebrew
brew
c45cca8e36401f6d95d851befef35879a5629182.json
test: simplify minitest inclusion. The previous version seems needlessly complicated given we only support a single Ruby version. It was also blowing up on Bundler 1.15.X.
Library/Homebrew/formula_assertions.rb
@@ -1,26 +1,6 @@ module Homebrew module Assertions - if defined?(Gem) - begin - gem "minitest", "< 5.0.0" - rescue Gem::LoadError - require "test/unit/assertions" - else - require "minitest/unit" - require "test/unit/assertions" - end - else - require "test/unit/assertions" - end - - if defined?(MiniTest::Assertion) - FailedAssertion = MiniTest::Assertion - elsif defined?(Minitest::Assertion) - FailedAssertion = Minitest::Assertion - else - FailedAssertion = Test::Unit::AssertionFailedError - end - + require "test/unit/assertions" include ::Test::Unit::Assertions # Returns the output of running cmd, and asserts the exit status
true
Other
Homebrew
brew
cbf89e50bb948989f3f19ed92f3251283a918e4b.json
software_spec: define recursive deps and reqs
Library/Homebrew/software_spec.rb
@@ -161,10 +161,24 @@ def deps dependency_collector.deps end + def recursive_dependencies + recursive_dependencies = deps + deps.map(&:to_formula).compact.uniq.each do |f| + f.recursive_dependencies.each do |dep| + recursive_dependencies << dep unless recursive_dependencies.include?(dep) + end + end + recursive_dependencies + end + def requirements dependency_collector.requirements end + def recursive_requirements + Requirement.expand(self) + end + def patch(strip = :p1, src = nil, &block) p = Patch.create(strip, src, &block) dependency_collector.add(p.resource) if p.is_a? ExternalPatch
false
Other
Homebrew
brew
fc739bf82e263b54dca30713388f3ffd712aba6a.json
Add `trash` util.
Library/Homebrew/test/utils/trash_spec.rb
@@ -0,0 +1,32 @@ +require "open3" + +describe "trash", :needs_macos do + let(:executable) { HOMEBREW_LIBRARY_PATH/"utils/trash.swift" } + let(:dir) { mktmpdir } + let(:file) { dir/"new_file" } + + it "moves existing files to the trash" do + FileUtils.touch file + + expect(file).to exist + + out, err, status = Open3.capture3(executable, file) + + expect(out).to match %r{moved #{file} to .*/\.Trash/\.*} + expect(err).to be_empty + expect(status).to be_a_success + + expect(file).not_to exist + + trashed_path = out.sub(/^moved #{Regexp.escape(file.to_s)} to (.*)\n$/, '\1') + FileUtils.rm_f trashed_path + end + + it "fails when files don't exist" do + out, err, status = Open3.capture3(executable, file) + + expect(out).to be_empty + expect(err).to eq "could not move #{file} to trash\n" + expect(status).to be_a_failure + end +end
true
Other
Homebrew
brew
fc739bf82e263b54dca30713388f3ffd712aba6a.json
Add `trash` util.
Library/Homebrew/utils/trash.swift
@@ -0,0 +1,43 @@ +#!/usr/bin/swift + +import Cocoa + +DispatchQueue.main.async { + let arguments = CommandLine.arguments.dropFirst().filter { !$0.isEmpty } + let URLs = arguments.map { URL(fileURLWithPath: $0) } + + #if swift(>=4.0) + let workspace = NSWorkspace.shared + #else + let workspace = NSWorkspace.shared() + #endif + + workspace.recycle(URLs) { (dict, error) in + dict.forEach { + #if swift(>=4.0) + let originalPath = $0.0.path + let trashPath = $0.1.path + #else + let originalPath = $0.path + let trashPath = $1.path + #endif + + print("moved \(originalPath) to \(trashPath)") + } + + if error == nil { + exit(0) + } + + let trashedURLs = dict.keys + let untrashedURLs = URLs.filter { !trashedURLs.contains($0) } + + untrashedURLs.forEach { + fputs("could not move \($0.path) to trash\n", stderr) + } + + exit(1) + } +} + +RunLoop.main.run()
true
Other
Homebrew
brew
b5a0cfd86180790b0071becc744a2da2fda3703e.json
rubocops: use consistent (_)body_node parameter name
Library/Homebrew/rubocops/bottle_block_cop.rb
@@ -10,8 +10,8 @@ module FormulaAuditStrict class BottleBlock < FormulaCop MSG = "Use rebuild instead of revision in bottle block".freeze - def audit_formula(_node, _class_node, _parent_class_node, formula_class_body_node) - bottle = find_block(formula_class_body_node, :bottle) + def audit_formula(_node, _class_node, _parent_class_node, body_node) + bottle = find_block(body_node, :bottle) return if bottle.nil? || block_size(bottle).zero? problem "Use rebuild instead of revision in bottle block" if method_called_in_block?(bottle, :revision) end
true
Other
Homebrew
brew
b5a0cfd86180790b0071becc744a2da2fda3703e.json
rubocops: use consistent (_)body_node parameter name
Library/Homebrew/rubocops/components_order_cop.rb
@@ -8,7 +8,7 @@ module FormulaAuditStrict # - component_precedence_list has component hierarchy in a nested list # where each sub array contains components' details which are at same precedence level class ComponentsOrder < FormulaCop - def audit_formula(_node, _class_node, _parent_class_node, formula_class_body_node) + def audit_formula(_node, _class_node, _parent_class_node, body_node) component_precedence_list = [ [{ name: :include, type: :method_call }], [{ name: :desc, type: :method_call }], @@ -41,11 +41,11 @@ def audit_formula(_node, _class_node, _parent_class_node, formula_class_body_nod components.each do |component| case component[:type] when :method_call - relevant_components += find_method_calls_by_name(formula_class_body_node, component[:name]).to_a + relevant_components += find_method_calls_by_name(body_node, component[:name]).to_a when :block_call - relevant_components += find_blocks(formula_class_body_node, component[:name]).to_a + relevant_components += find_blocks(body_node, component[:name]).to_a when :method_definition - relevant_components << find_method_def(formula_class_body_node, component[:name]) + relevant_components << find_method_def(body_node, component[:name]) end end relevant_components.delete_if(&:nil?)
true
Other
Homebrew
brew
b5a0cfd86180790b0071becc744a2da2fda3703e.json
rubocops: use consistent (_)body_node parameter name
Library/Homebrew/rubocops/components_redundancy_cop.rb
@@ -13,19 +13,19 @@ class ComponentsRedundancy < FormulaCop HEAD_MSG = "`head` and `head do` should not be simultaneously present".freeze BOTTLE_MSG = "`bottle :modifier` and `bottle do` should not be simultaneously present".freeze - def audit_formula(_node, _class_node, _parent_class_node, formula_class_body_node) - stable_block = find_block(formula_class_body_node, :stable) + def audit_formula(_node, _class_node, _parent_class_node, body_node) + stable_block = find_block(body_node, :stable) if stable_block [:url, :sha256, :mirror].each do |method_name| - problem "`#{method_name}` should be put inside `stable` block" if method_called?(formula_class_body_node, method_name) + problem "`#{method_name}` should be put inside `stable` block" if method_called?(body_node, method_name) end end - problem HEAD_MSG if method_called?(formula_class_body_node, :head) && - find_block(formula_class_body_node, :head) + problem HEAD_MSG if method_called?(body_node, :head) && + find_block(body_node, :head) - problem BOTTLE_MSG if method_called?(formula_class_body_node, :bottle) && - find_block(formula_class_body_node, :bottle) + problem BOTTLE_MSG if method_called?(body_node, :bottle) && + find_block(body_node, :bottle) end end end
true
Other
Homebrew
brew
b5a0cfd86180790b0071becc744a2da2fda3703e.json
rubocops: use consistent (_)body_node parameter name
Library/Homebrew/rubocops/formula_desc_cop.rb
@@ -9,8 +9,8 @@ module FormulaAuditStrict # - Checks for existence of `desc` # - Checks if size of `desc` > 80 class DescLength < FormulaCop - def audit_formula(_node, _class_node, _parent_class_node, body) - desc_call = find_node_method_by_name(body, :desc) + def audit_formula(_node, _class_node, _parent_class_node, body_node) + desc_call = find_node_method_by_name(body_node, :desc) # Check if a formula's desc is present if desc_call.nil? @@ -48,8 +48,8 @@ class Desc < FormulaCop xUnit ].freeze - def audit_formula(_node, _class_node, _parent_class_node, body) - desc_call = find_node_method_by_name(body, :desc) + def audit_formula(_node, _class_node, _parent_class_node, body_node) + desc_call = find_node_method_by_name(body_node, :desc) return if desc_call.nil? desc = parameters(desc_call).first
true
Other
Homebrew
brew
b5a0cfd86180790b0071becc744a2da2fda3703e.json
rubocops: use consistent (_)body_node parameter name
Library/Homebrew/rubocops/homepage_cop.rb
@@ -5,8 +5,8 @@ module Cop module FormulaAudit # This cop audits `homepage` url in Formulae class Homepage < FormulaCop - def audit_formula(_node, _class_node, _parent_class_node, formula_class_body_node) - homepage_node = find_node_method_by_name(formula_class_body_node, :homepage) + def audit_formula(_node, _class_node, _parent_class_node, body_node) + homepage_node = find_node_method_by_name(body_node, :homepage) homepage = if homepage_node string_content(parameters(homepage_node).first) else
true
Other
Homebrew
brew
47fe2149638a85bc956593c12abd5aa5bb15452c.json
linkage_checker: Add harmless dylibs check. While the linkage checker should normally report all broken links, there are a few cases where broken links are harmless. One case is when a the PPC slice of a program links to a PPC-only library that no longer exists on x86_64 OS X. Since the PPC slice is never loaded on modern OS X, inconsistencies within it do not need to be reported.
Library/Homebrew/os/mac/linkage_checker.rb
@@ -36,6 +36,7 @@ def check_dylibs rescue NotAKegError @system_dylibs << dylib rescue Errno::ENOENT + next if harmless_broken_link?(dylib) @broken_dylibs << dylib else tap = Tab.for_keg(owner).tap @@ -114,6 +115,14 @@ def undeclared_deps? private + # Whether or not dylib is a harmless broken link, meaning that it's + # okay to skip (and not report) as broken. + def harmless_broken_link?(dylib) + # libgcc_s_ppc64 is referenced by programs that use the Java Service Wrapper, + # and is harmless on x86(_64) machines + ["/usr/lib/libgcc_s_ppc64.1.dylib"].include?(dylib) + end + # Display a list of things. # Things may either be an array, or a hash of (label -> array) def display_items(label, things)
false
Other
Homebrew
brew
77da75e7d6ecc2ca749eb939d8e24ad9e3dfc5e1.json
Simplify Checksum cop by auditing all checksums
Library/Homebrew/rubocops/checksum_cop.rb
@@ -5,55 +5,48 @@ module Cop module FormulaAudit class Checksum < FormulaCop def audit_formula(_node, _class_node, _parent_class_node, body_node) - %w[stable devel head].each do |name| - next unless spec_node = find_block(body_node, name.to_sym) - _, _, spec_body = *spec_node - audit_checksums(spec_body, name) - if name == "stable" - resource_blocks = find_blocks(body_node, :resource) + - find_all_blocks(spec_body, :resource) - else - resource_blocks = find_all_blocks(spec_body, :resource) - end - resource_blocks.each do |rb| - _, _, resource_body = *rb - audit_checksums(resource_body, name, string_content(parameters(rb).first)) - end + return if body_node.nil? + if method_called_ever?(body_node, :md5) + problem "MD5 checksums are deprecated, please use SHA256" end - end - def audit_checksums(node, spec, resource_name = nil) - msg_prefix = if resource_name - "#{spec} resource \"#{resource_name}\": " - else - "#{spec}: " + if method_called_ever?(body_node, :sha1) + problem "SHA1 checksums are deprecated, please use SHA256" end - if find_node_method_by_name(node, :md5) - problem "#{msg_prefix}MD5 checksums are deprecated, please use SHA256" + + sha256_calls = find_every_method_call_by_name(body_node, :sha256) + sha256_calls.each do |sha256_call| + sha256_node = get_checksum_node(sha256_call) + audit_sha256(sha256_node) end + end - if find_node_method_by_name(node, :sha1) - problem "#{msg_prefix}SHA1 checksums are deprecated, please use SHA256" + def get_checksum_node(call) + return if parameters(call).empty? || parameters(call).nil? + if parameters(call).first.str_type? + parameters(call).first + elsif parameters(call).first.hash_type? + parameters(call).first.keys.first end + end - checksum_node = find_node_method_by_name(node, :sha256) - return if checksum_node.nil? - checksum = parameters(checksum_node).first - if string_content(checksum).size.zero? - problem "#{msg_prefix}sha256 is empty" + def audit_sha256(checksum) + return if checksum.nil? + if regex_match_group(checksum, /^$/) + problem "sha256 is empty" return end if string_content(checksum).size != 64 && regex_match_group(checksum, /^\w*$/) - problem "#{msg_prefix}sha256 should be 64 characters" + problem "sha256 should be 64 characters" end - unless regex_match_group(checksum, /^[a-f0-9]+$/i) - problem "#{msg_prefix}sha256 contains invalid characters" + if regex_match_group(checksum, /[^a-f0-9]+/i) + problem "sha256 contains invalid characters" end return unless regex_match_group(checksum, /[A-F]+/) - problem "#{msg_prefix}sha256 should be lowercase" + problem "sha256 should be lowercase" end end end
true
Other
Homebrew
brew
77da75e7d6ecc2ca749eb939d8e24ad9e3dfc5e1.json
Simplify Checksum cop by auditing all checksums
Library/Homebrew/test/rubocops/checksum_cop_spec.rb
@@ -23,15 +23,15 @@ class Foo < Formula end EOS - expected_offenses = [{ message: "stable: sha256 is empty", + expected_offenses = [{ message: "sha256 is empty", severity: :convention, line: 5, - column: 4, + column: 12, source: source }, - { message: "stable resource \"foo-package\": sha256 is empty", + { message: "sha256 is empty", severity: :convention, line: 9, - column: 6, + column: 14, source: source }] inspect_source(cop, source) @@ -57,12 +57,12 @@ class Foo < Formula end EOS - expected_offenses = [{ message: "stable: sha256 should be 64 characters", + expected_offenses = [{ message: "sha256 should be 64 characters", severity: :convention, line: 5, column: 12, source: source }, - { message: "stable resource \"foo-package\": sha256 should be 64 characters", + { message: "sha256 should be 64 characters", severity: :convention, line: 9, column: 14, @@ -91,15 +91,15 @@ class Foo < Formula end EOS - expected_offenses = [{ message: "stable: sha256 contains invalid characters", + expected_offenses = [{ message: "sha256 contains invalid characters", severity: :convention, line: 5, - column: 4, + column: 31, source: source }, - { message: "stable resource \"foo-package\": sha256 contains invalid characters", + { message: "sha256 contains invalid characters", severity: :convention, line: 9, - column: 6, + column: 31, source: source }] inspect_source(cop, source) @@ -125,12 +125,12 @@ class Foo < Formula end EOS - expected_offenses = [{ message: "stable: sha256 should be lowercase", + expected_offenses = [{ message: "sha256 should be lowercase", severity: :convention, line: 5, column: 21, source: source }, - { message: "stable resource \"foo-package\": sha256 should be lowercase", + { message: "sha256 should be lowercase", severity: :convention, line: 9, column: 20, @@ -163,7 +163,7 @@ class Foo < Formula end EOS - expected_offenses = [{ message: "stable resource \"foo-outside\": sha256 should be lowercase", + expected_offenses = [{ message: "sha256 should be lowercase", severity: :convention, line: 5, column: 12,
true
Other
Homebrew
brew
1e7bff808180a35da545630ad75a6fab31cf7da5.json
Remove reference to link_scripts. Closes #2740.
docs/Python-for-Formula-Authors.md
@@ -98,14 +98,12 @@ def install venv = virtualenv_create(libexec) # Install all of the resources declared on the formula into the virtualenv. venv.pip_install resources - # `link_scripts` takes a look at the virtualenv's bin directory before and - # after executing the block which is passed into it. If the block caused any - # new scripts to be written to the virtualenv's bin directory, link_scripts - # will symlink those scripts into the path given as its argument (here, the - # formula's `bin` directory in the Cellar.) - # `pip_install buildpath` will install the package that the formula points to, - # because buildpath is the location where the formula's tarball was unpacked. - venv.link_scripts(bin) { venv.pip_install buildpath } + # `pip_install_and_link` takes a look at the virtualenv's bin directory + # before and after installing its argument. New scripts will be symlinked + # into `bin`. `pip_install_and_link buildpath` will install the package + # that the formula points to, because buildpath is the location where the + # formula's tarball was unpacked. + venv.pip_install_and_link buildpath end ```
false
Other
Homebrew
brew
dcb85571ca468a573c5ac4f76752ec7e732d9e82.json
Add test for `--language` option.
Library/Homebrew/test/cask/cli_spec.rb
@@ -1,10 +1,10 @@ describe Hbc::CLI, :cask do it "lists the taps for Casks that show up in two taps" do - listing = Hbc::CLI.nice_listing(%w[ - caskroom/cask/adium - caskroom/cask/google-chrome - passcod/homebrew-cask/adium - ]) + listing = described_class.nice_listing(%w[ + caskroom/cask/adium + caskroom/cask/google-chrome + passcod/homebrew-cask/adium + ]) expect(listing).to eq(%w[ caskroom/cask/adium @@ -13,6 +13,13 @@ ]) end + it "ignores the `--language` option, which is handled in `OS::Mac`" do + cli = described_class.new("--language=en") + expect(cli).to receive(:detect_command_and_arguments).with(no_args) + expect(cli).to receive(:exit).with(1) + shutup { cli.run } + end + context "when no option is specified" do it "--binaries is true by default" do command = Hbc::CLI::Install.new("some-cask") @@ -41,7 +48,7 @@ end it "prints help output when subcommand receives `--help` flag" do - command = Hbc::CLI.new("noop", "--help") + command = described_class.new("noop", "--help") expect(described_class).to receive(:run_command).with("help", "noop") command.run expect(command.help?).to eq(true) @@ -56,7 +63,7 @@ it "exits with a status of 1 when something goes wrong" do allow(described_class).to receive(:lookup_command).and_raise(Hbc::CaskError) - command = Hbc::CLI.new("noop") + command = described_class.new("noop") expect(command).to receive(:exit).with(1) command.run end
false
Other
Homebrew
brew
9c8f7138f35625878e017559c896441fda6f357c.json
Add `casks` method to iterate through arguments.
Library/Homebrew/cask/lib/hbc/cli/abstract_command.rb
@@ -41,6 +41,43 @@ def self.run(*args) def initialize(*args) @args = process_arguments(*args) end + + def self.warn_unavailable_with_suggestion(cask_token, e) + exact_match, partial_matches = Search.search(cask_token) + error_message = e.message + if exact_match + error_message.concat(" Did you mean:\n#{exact_match}") + elsif !partial_matches.empty? + error_message.concat(" Did you mean one of:\n") + .concat(Formatter.columns(partial_matches.take(20))) + end + onoe error_message + end + + private + + def casks(alternative: -> { [] }) + return to_enum(:casks, alternative: alternative) unless block_given? + + count = 0 + + casks = args.empty? ? alternative.call : args + + casks.each do |cask_or_token| + begin + yield cask_or_token.respond_to?(:token) ? cask_or_token : CaskLoader.load(cask_or_token) + count += 1 + rescue CaskUnavailableError => e + cask_token = cask_or_token + self.class.warn_unavailable_with_suggestion cask_token, e + rescue CaskError => e + onoe e.message + end + end + + return :empty if casks.length.zero? + (count == casks.length) ? :complete : :incomplete + end end end end
true
Other
Homebrew
brew
9c8f7138f35625878e017559c896441fda6f357c.json
Add `casks` method to iterate through arguments.
Library/Homebrew/cask/lib/hbc/cli/audit.rb
@@ -9,11 +9,8 @@ def self.help end def run - casks_to_audit = args.empty? ? Hbc.all : args.map(&CaskLoader.public_method(:load)) - - failed_casks = casks_to_audit.reject do |cask| - audit(cask) - end + failed_casks = casks(alternative: -> { Hbc.all }) + .reject { |cask| audit(cask) } return if failed_casks.empty? raise CaskError, "audit failed for casks: #{failed_casks.join(" ")}"
true
Other
Homebrew
brew
9c8f7138f35625878e017559c896441fda6f357c.json
Add `casks` method to iterate through arguments.
Library/Homebrew/cask/lib/hbc/cli/cat.rb
@@ -7,10 +7,12 @@ def initialize(*) end def run - args.each do |cask_token| - cask_path = CaskLoader.path(cask_token) - raise CaskUnavailableError, cask_token.to_s unless cask_path.exist? - puts File.open(cask_path, &:read) + raise CaskError, "Cat incomplete." if cat_casks == :incomplete + end + + def cat_casks + casks.each do |cask| + puts File.open(cask.sourcefile_path, &:read) end end
true
Other
Homebrew
brew
9c8f7138f35625878e017559c896441fda6f357c.json
Add `casks` method to iterate through arguments.
Library/Homebrew/cask/lib/hbc/cli/cleanup.rb
@@ -20,7 +20,7 @@ def initialize(*args, cache_location: Hbc.cache) end def run - remove_cache_files(*@args) + remove_cache_files(*args) end def cache_files
true
Other
Homebrew
brew
9c8f7138f35625878e017559c896441fda6f357c.json
Add `casks` method to iterate through arguments.
Library/Homebrew/cask/lib/hbc/cli/edit.rb
@@ -9,10 +9,12 @@ def initialize(*) def run cask_token = args.first - cask_path = CaskLoader.path(cask_token) - - unless cask_path.exist? - raise CaskUnavailableError.new(cask_token, "Run #{Formatter.identifier("brew cask create #{cask_token}")} to create a new Cask.") + cask_path = begin + CaskLoader.load(cask_token).sourcefile_path + rescue CaskUnavailableError => e + reason = e.reason.empty? ? "" : "#{e.reason} " + reason.concat("Run #{Formatter.identifier("brew cask create #{e.token}")} to create a new Cask.") + raise e.class.new(e.token, reason) end odebug "Opening editor for Cask #{cask_token}"
true
Other
Homebrew
brew
9c8f7138f35625878e017559c896441fda6f357c.json
Add `casks` method to iterate through arguments.
Library/Homebrew/cask/lib/hbc/cli/fetch.rb
@@ -9,9 +9,12 @@ def initialize(*) end def run - args.each do |cask_token| - ohai "Downloading external files for Cask #{cask_token}" - cask = CaskLoader.load(cask_token) + raise CaskError, "Fetch incomplete." if fetch_casks == :incomplete + end + + def fetch_casks + casks.each do |cask| + ohai "Downloading external files for Cask #{cask}" downloaded_path = Download.new(cask, force: force?).perform Verify.all(cask, downloaded_path) ohai "Success! Downloaded to -> #{downloaded_path}"
true
Other
Homebrew
brew
9c8f7138f35625878e017559c896441fda6f357c.json
Add `casks` method to iterate through arguments.
Library/Homebrew/cask/lib/hbc/cli/home.rb
@@ -2,9 +2,7 @@ module Hbc class CLI class Home < AbstractCommand def run - casks = args.map(&CaskLoader.public_method(:load)) - - if casks.empty? + if casks.none? odebug "Opening project homepage" self.class.open_url "https://caskroom.github.io/" else
true
Other
Homebrew
brew
9c8f7138f35625878e017559c896441fda6f357c.json
Add `casks` method to iterate through arguments.
Library/Homebrew/cask/lib/hbc/cli/info.rb
@@ -7,10 +7,8 @@ def initialize(*) end def run - args.each do |cask_token| - odebug "Getting info for Cask #{cask_token}" - cask = CaskLoader.load(cask_token) - + casks.each do |cask| + odebug "Getting info for Cask #{cask}" self.class.info(cask) end end
true
Other
Homebrew
brew
9c8f7138f35625878e017559c896441fda6f357c.json
Add `casks` method to iterate through arguments.
Library/Homebrew/cask/lib/hbc/cli/install.rb
@@ -10,47 +10,21 @@ def initialize(*) end def run - retval = install_casks - # retval is ternary: true/false/nil - - raise CaskError, "nothing to install" if retval.nil? - raise CaskError, "install incomplete" unless retval + raise CaskError, "Install incomplete." if install_casks == :incomplete end def install_casks - count = 0 - args.each do |cask_token| + casks.each do |cask| begin - cask = CaskLoader.load(cask_token) Installer.new(cask, binaries: binaries?, - verbose: verbose?, + verbose: verbose?, force: force?, skip_cask_deps: skip_cask_deps?, require_sha: require_sha?).install - count += 1 rescue CaskAlreadyInstalledError => e opoo e.message - count += 1 - rescue CaskUnavailableError => e - self.class.warn_unavailable_with_suggestion cask_token, e - rescue CaskError => e - onoe e.message end end - - count.zero? ? nil : count == args.length - end - - def self.warn_unavailable_with_suggestion(cask_token, e) - exact_match, partial_matches = Search.search(cask_token) - error_message = e.message - if exact_match - error_message.concat(" Did you mean:\n#{exact_match}") - elsif !partial_matches.empty? - error_message.concat(" Did you mean one of:\n") - .concat(Formatter.columns(partial_matches.take(20))) - end - onoe error_message end def self.help
true
Other
Homebrew
brew
9c8f7138f35625878e017559c896441fda6f357c.json
Add `casks` method to iterate through arguments.
Library/Homebrew/cask/lib/hbc/cli/internal_dump.rb
@@ -7,25 +7,11 @@ def initialize(*) end def run - retval = dump_casks - # retval is ternary: true/false/nil - - raise CaskError, "nothing to dump" if retval.nil? - raise CaskError, "dump incomplete" unless retval + raise CaskError, "Dump incomplete." if dump_casks == :incomplet end def dump_casks - count = 0 - args.each do |cask_token| - begin - cask = CaskLoader.load(cask_token) - count += 1 - cask.dumpcask - rescue StandardError => e - opoo "#{cask_token} was not found or would not load: #{e}" - end - end - count.zero? ? nil : count == args.length + casks.each(&:dumpcask) end def self.help
true
Other
Homebrew
brew
9c8f7138f35625878e017559c896441fda6f357c.json
Add `casks` method to iterate through arguments.
Library/Homebrew/cask/lib/hbc/cli/internal_stanza.rb
@@ -72,52 +72,36 @@ def initialize(*) end def run - retval = print_stanzas - # retval is ternary: true/false/nil - if retval.nil? - exit 1 if quiet? - raise CaskError, "nothing to print" - elsif !retval - exit 1 if quiet? - raise CaskError, "print incomplete" - end + return unless print_stanzas == :incomplete + exit 1 if quiet? + raise CaskError, "Print incomplete." end def print_stanzas - count = 0 if ARTIFACTS.include?(stanza) artifact_name = stanza @stanza = :artifacts end - cask_tokens = args.empty? ? Hbc.all_tokens : args - cask_tokens.each do |cask_token| - print "#{cask_token}\t" if table? - - begin - cask = CaskLoader.load(cask_token) - rescue StandardError - opoo "Cask '#{cask_token}' was not found" unless quiet? - puts "" - next - end + casks(alternative: -> { Hbc.all }).each do |cask| + print "#{cask}\t" if table? unless cask.respond_to?(stanza) - opoo "no such stanza '#{stanza}' on Cask '#{cask_token}'" unless quiet? + opoo "no such stanza '#{stanza}' on Cask '#{cask}'" unless quiet? puts "" next end begin value = cask.send(@stanza) rescue StandardError - opoo "failure calling '#{stanza}' on Cask '#{cask_token}'" unless quiet? + opoo "failure calling '#{stanza}' on Cask '#{cask}'" unless quiet? puts "" next end if artifact_name && !value.key?(artifact_name) - opoo "no such stanza '#{artifact_name}' on Cask '#{cask_token}'" unless quiet? + opoo "no such stanza '#{artifact_name}' on Cask '#{cask}'" unless quiet? puts "" next end @@ -131,10 +115,7 @@ def print_stanzas else puts value.to_s end - - count += 1 end - count.zero? ? nil : count == cask_tokens.length end def self.help
true
Other
Homebrew
brew
9c8f7138f35625878e017559c896441fda6f357c.json
Add `casks` method to iterate through arguments.
Library/Homebrew/cask/lib/hbc/cli/list.rb
@@ -11,44 +11,22 @@ class List < AbstractCommand def run retval = args.any? ? list : list_installed - # retval is ternary: true/false/nil - if retval.nil? && args.none? - opoo "nothing to list" # special case: avoid exit code - elsif retval.nil? - raise CaskError, "nothing to list" - elsif !retval - raise CaskError, "listing incomplete" - end + raise CaskError, "Listing incomplete." if retval == :incomplete end def list - count = 0 - - args.each do |cask_token| - odebug "Listing files for Cask #{cask_token}" - begin - cask = CaskLoader.load(cask_token) + casks.each do |cask| + raise CaskNotInstalledError, cask unless cask.installed? - if cask.installed? - if one? - puts cask.token - elsif versions? - puts self.class.format_versioned(cask) - else - cask = CaskLoader.load_from_file(cask.installed_caskfile) - self.class.list_artifacts(cask) - end - - count += 1 - else - opoo "#{cask} is not installed" - end - rescue CaskUnavailableError => e - onoe e + if one? + puts cask.token + elsif versions? + puts self.class.format_versioned(cask) + else + cask = CaskLoader.load_from_file(cask.installed_caskfile) + self.class.list_artifacts(cask) end end - - count.zero? ? nil : count == args.length end def self.list_artifacts(cask) @@ -69,7 +47,7 @@ def list_installed puts Formatter.columns(installed_casks.map(&:to_s)) end - installed_casks.empty? ? nil : true + installed_casks.empty? ? :empty : :complete end def self.format_versioned(cask)
true
Other
Homebrew
brew
9c8f7138f35625878e017559c896441fda6f357c.json
Add `casks` method to iterate through arguments.
Library/Homebrew/cask/lib/hbc/cli/outdated.rb
@@ -10,9 +10,7 @@ def initialize(*) end def run - casks_to_check = args.empty? ? Hbc.installed : args.map(&CaskLoader.public_method(:load)) - - casks_to_check.each do |cask| + casks(alternative: -> { Hbc.installed }).each do |cask| odebug "Checking update info of Cask #{cask}" self.class.list_if_outdated(cask, greedy?, verbose?) end
true
Other
Homebrew
brew
9c8f7138f35625878e017559c896441fda6f357c.json
Add `casks` method to iterate through arguments.
Library/Homebrew/cask/lib/hbc/cli/reinstall.rb
@@ -2,27 +2,13 @@ module Hbc class CLI class Reinstall < Install def install_casks - count = 0 - args.each do |cask_token| - begin - cask = CaskLoader.load(cask_token) - - Installer.new(cask, - binaries: binaries?, - verbose: verbose?, - force: force?, - skip_cask_deps: skip_cask_deps?, - require_sha: require_sha?).reinstall - - count += 1 - rescue CaskUnavailableError => e - self.class.warn_unavailable_with_suggestion cask_token, e - rescue CaskError => e - onoe e.message - end + casks.each do |cask| + Installer.new(cask, binaries: binaries?, + verbose: verbose?, + force: force?, + skip_cask_deps: skip_cask_deps?, + require_sha: require_sha?).reinstall end - - count.zero? ? nil : count == args.length end def self.help
true
Other
Homebrew
brew
9c8f7138f35625878e017559c896441fda6f357c.json
Add `casks` method to iterate through arguments.
Library/Homebrew/cask/lib/hbc/cli/style.rb
@@ -31,7 +31,7 @@ def cask_paths elsif args.any? { |file| File.exist?(file) } args else - args.map { |token| CaskLoader.path(token) } + casks.map(&:sourcefile_path) end end
true
Other
Homebrew
brew
9c8f7138f35625878e017559c896441fda6f357c.json
Add `casks` method to iterate through arguments.
Library/Homebrew/cask/lib/hbc/cli/uninstall.rb
@@ -9,9 +9,12 @@ def initialize(*) end def run - args.each do |cask_token| - odebug "Uninstalling Cask #{cask_token}" - cask = CaskLoader.load(cask_token) + raise CaskError, "Uninstall incomplete." if uninstall_casks == :incomplete + end + + def uninstall_casks + casks.each do |cask| + odebug "Uninstalling Cask #{cask}" raise CaskNotInstalledError, cask unless cask.installed? || force? @@ -27,8 +30,8 @@ def run single = versions.count == 1 puts <<-EOS.undent - #{cask_token} #{versions.join(", ")} #{single ? "is" : "are"} still installed. - Remove #{single ? "it" : "them all"} with `brew cask uninstall --force #{cask_token}`. + #{cask} #{versions.join(", ")} #{single ? "is" : "are"} still installed. + Remove #{single ? "it" : "them all"} with `brew cask uninstall --force #{cask}`. EOS end end
true
Other
Homebrew
brew
9c8f7138f35625878e017559c896441fda6f357c.json
Add `casks` method to iterate through arguments.
Library/Homebrew/cask/lib/hbc/cli/zap.rb
@@ -7,9 +7,12 @@ def initialize(*) end def run - args.each do |cask_token| - odebug "Zapping Cask #{cask_token}" - cask = CaskLoader.load(cask_token) + raise CaskError, "Zap incomplete." if zap_casks == :incomplete + end + + def zap_casks + casks.each do |cask| + odebug "Zapping Cask #{cask}" Installer.new(cask, verbose: verbose?).zap end end
true
Other
Homebrew
brew
9c8f7138f35625878e017559c896441fda6f357c.json
Add `casks` method to iterate through arguments.
Library/Homebrew/test/cask/cli/audit_spec.rb
@@ -1,5 +1,5 @@ describe Hbc::CLI::Audit, :cask do - let(:cask) { double } + let(:cask) { double("cask", token: nil) } describe "selection of Casks to audit" do it "audits all Casks if no tokens are given" do
true