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
d94636cde921288aa7a33a0f368a3101fd8f3df3.json
Allow overriding MacOS.version.
Library/Homebrew/os/mac.rb
@@ -27,6 +27,11 @@ def full_version @full_version ||= Version.new((ENV["HOMEBREW_MACOS_VERSION"] || ENV["HOMEBREW_OSX_VERSION"]).chomp) end + def full_version=(version) + @full_version = Version.new(version.chomp) + @version = nil + end + def prerelease? # TODO: bump version when new OS is released version >= "10.13"
true
Other
Homebrew
brew
5480a84114243fcd0aedda3a650b23b59ae91b2c.json
tests: give `e` helper in UtilTests a better name
Library/Homebrew/test/utils_test.rb
@@ -9,14 +9,10 @@ def setup @dir = Pathname.new(mktmpdir) end - # Helper for matching escape sequences. - def e(code) + def esc(code) /(\e\[\d+m)*\e\[#{code}m/ end - # Helper for matching that style is reset at the end of a string. - Z = /(\e\[\d+m)*\e\[0m\Z/ - def test_ofail shutup { ofail "foo" } assert Homebrew.failed? @@ -32,10 +28,12 @@ def test_odie def test_pretty_installed $stdout.stubs(:tty?).returns true ENV.delete("HOMEBREW_NO_EMOJI") - assert_match(/\A#{e 1}foo #{e 32}βœ”#{Z}/, pretty_installed("foo")) + tty_with_emoji_output = /\A#{esc 1}foo #{esc 32}βœ”#{esc 0}\Z/ + assert_match tty_with_emoji_output, pretty_installed("foo") ENV["HOMEBREW_NO_EMOJI"] = "1" - assert_match(/\A#{e 1}foo \(installed\)#{Z}/, pretty_installed("foo")) + tty_no_emoji_output = /\A#{esc 1}foo \(installed\)#{esc 0}\Z/ + assert_match tty_no_emoji_output, pretty_installed("foo") $stdout.stubs(:tty?).returns false assert_equal "foo", pretty_installed("foo") @@ -44,10 +42,12 @@ def test_pretty_installed def test_pretty_uninstalled $stdout.stubs(:tty?).returns true ENV.delete("HOMEBREW_NO_EMOJI") - assert_match(/\A#{e 1}foo #{e 31}✘#{Z}/, pretty_uninstalled("foo")) + tty_with_emoji_output = /\A#{esc 1}foo #{esc 31}✘#{esc 0}\Z/ + assert_match tty_with_emoji_output, pretty_uninstalled("foo") ENV["HOMEBREW_NO_EMOJI"] = "1" - assert_match(/\A#{e 1}foo \(uninstalled\)#{Z}/, pretty_uninstalled("foo")) + tty_no_emoji_output = /\A#{esc 1}foo \(uninstalled\)#{esc 0}\Z/ + assert_match tty_no_emoji_output, pretty_uninstalled("foo") $stdout.stubs(:tty?).returns false assert_equal "foo", pretty_uninstalled("foo")
false
Other
Homebrew
brew
65dde58057029d473be9175444b333525fe82850.json
tests: add some emoji tests πŸ’―
Library/Homebrew/test/emoji_test.rb
@@ -0,0 +1,11 @@ +require "testing_env" +require "emoji" + +class EmojiTest < Homebrew::TestCase + def test_install_badge + assert_equal "🍺", Emoji.install_badge + + ENV["HOMEBREW_INSTALL_BADGE"] = "foo" + assert_equal "foo", Emoji.install_badge + end +end
true
Other
Homebrew
brew
65dde58057029d473be9175444b333525fe82850.json
tests: add some emoji tests πŸ’―
Library/Homebrew/test/utils_test.rb
@@ -9,6 +9,14 @@ def setup @dir = Pathname.new(mktmpdir) end + # Helper for matching escape sequences. + def e(code) + /(\e\[\d+m)*\e\[#{code}m/ + end + + # Helper for matching that style is reset at the end of a string. + Z = /(\e\[\d+m)*\e\[0m\Z/ + def test_ofail shutup { ofail "foo" } assert Homebrew.failed? @@ -22,11 +30,25 @@ def test_odie end def test_pretty_installed + $stdout.stubs(:tty?).returns true + ENV.delete("HOMEBREW_NO_EMOJI") + assert_match(/\A#{e 1}foo #{e 32}βœ”#{Z}/, pretty_installed("foo")) + + ENV["HOMEBREW_NO_EMOJI"] = "1" + assert_match(/\A#{e 1}foo \(installed\)#{Z}/, pretty_installed("foo")) + $stdout.stubs(:tty?).returns false assert_equal "foo", pretty_installed("foo") end def test_pretty_uninstalled + $stdout.stubs(:tty?).returns true + ENV.delete("HOMEBREW_NO_EMOJI") + assert_match(/\A#{e 1}foo #{e 31}✘#{Z}/, pretty_uninstalled("foo")) + + ENV["HOMEBREW_NO_EMOJI"] = "1" + assert_match(/\A#{e 1}foo \(uninstalled\)#{Z}/, pretty_uninstalled("foo")) + $stdout.stubs(:tty?).returns false assert_equal "foo", pretty_uninstalled("foo") end
true
Other
Homebrew
brew
50c1fea4ea9ca8067e194db5918fbf5a7f5c3ca1.json
xcode: reduce minimum CLT version. This should be 1.0.0 to be nicer to 10.7 users. Fixes #1893.
Library/Homebrew/os/mac/xcode.rb
@@ -226,7 +226,7 @@ def latest_version def minimum_version case MacOS.version when "10.12" then "8.0.0" - else "4.0.0" + else "1.0.0" end end
false
Other
Homebrew
brew
b0fea9eb6c7dfc39bbd8083180a7156b9b859571.json
fileutils: update Ruby documentation URL
Library/Homebrew/extend/fileutils.rb
@@ -3,7 +3,7 @@ require "etc" # Homebrew extends Ruby's `FileUtils` to make our code more readable. -# @see http://ruby-doc.org/stdlib-1.8.7/libdoc/fileutils/rdoc/FileUtils.html Ruby's FileUtils API +# @see http://ruby-doc.org/stdlib-2.0.0/libdoc/fileutils/rdoc/FileUtils.html Ruby's FileUtils API module FileUtils # Create a temporary directory then yield. When the block returns, # recursively delete the temporary directory. Passing opts[:retain]
false
Other
Homebrew
brew
13488183bd3fe9d0f8e84d66075c9c7d4cdc931d.json
emoji: remove hack required for Ruby 1.8.7 Since this hack is no longer required, and `Emoji.tick` and `.cross` are only called in one place, I think it's better to just inline them there rather than having methods on `Emoji` that just return a one-character String.
Library/Homebrew/emoji.rb
@@ -1,17 +1,7 @@ module Emoji class << self - def tick - # necessary for 1.8.7 unicode handling since many installs are on 1.8.7 - @tick ||= ["2714".hex].pack("U*") - end - - def cross - # necessary for 1.8.7 unicode handling since many installs are on 1.8.7 - @cross ||= ["2718".hex].pack("U*") - end - def install_badge - ENV["HOMEBREW_INSTALL_BADGE"] || "\xf0\x9f\x8d\xba" + ENV["HOMEBREW_INSTALL_BADGE"] || "🍺" end def enabled?
true
Other
Homebrew
brew
13488183bd3fe9d0f8e84d66075c9c7d4cdc931d.json
emoji: remove hack required for Ruby 1.8.7 Since this hack is no longer required, and `Emoji.tick` and `.cross` are only called in one place, I think it's better to just inline them there rather than having methods on `Emoji` that just return a one-character String.
Library/Homebrew/utils.rb
@@ -106,7 +106,7 @@ def pretty_installed(f) if !$stdout.tty? f.to_s elsif Emoji.enabled? - "#{Tty.bold}#{f} #{Formatter.success(Emoji.tick)}#{Tty.reset}" + "#{Tty.bold}#{f} #{Formatter.success("βœ”")}#{Tty.reset}" else Formatter.success("#{Tty.bold}#{f} (installed)#{Tty.reset}") end @@ -116,7 +116,7 @@ def pretty_uninstalled(f) if !$stdout.tty? f.to_s elsif Emoji.enabled? - "#{Tty.bold}#{f} #{Formatter.error(Emoji.cross)}#{Tty.reset}" + "#{Tty.bold}#{f} #{Formatter.error("✘")}#{Tty.reset}" else Formatter.error("#{Tty.bold}#{f} (uninstalled)#{Tty.reset}") end
true
Other
Homebrew
brew
2076b494a6233630025acd45d9a5766bd6bb785d.json
Add manpage entry for _appcast_checkpoint.
Library/Homebrew/cask/lib/hbc/cli/internal_appcast_checkpoint.rb
@@ -50,7 +50,7 @@ def self.appcask_checkpoint(cask_tokens, calculate) end def self.help - "prints (no flag) or calculates ('--calculate') a given Cask's (or URL's) appcast checkpoint" + "prints or calculates a given Cask's or URL's appcast checkpoint" end def self.needs_init?
true
Other
Homebrew
brew
2076b494a6233630025acd45d9a5766bd6bb785d.json
Add manpage entry for _appcast_checkpoint.
Library/Homebrew/manpages/brew-cask.1.md
@@ -120,6 +120,13 @@ names, and other aspects of this manual are still subject to change. **`zap` may remove files which are shared between applications.** +## INTERNAL COMMANDS + + * `_appcast_checkpoint` [--calculate] [ <token> ... | <URL> ... ]: + Given a `token`, returns the current appcast checkpoint, or calculates + the appcast checkpoint if the `--calculate` flag is specified. + Given a `URL`, calculates the appcast checkpoint for it. + ## OPTIONS To make these options persistent, see the ENVIRONMENT section, below.
true
Other
Homebrew
brew
2076b494a6233630025acd45d9a5766bd6bb785d.json
Add manpage entry for _appcast_checkpoint.
manpages/brew-cask.1
@@ -105,6 +105,15 @@ If the Cask definition contains a \fBzap\fR stanza, performs additional \fBzap\f . .IP "" 0 . +.SH "INTERNAL COMMANDS" +. +.TP +\fB_appcast_checkpoint\fR [\-\-calculate] [ \fItoken\fR \.\.\. | \fIURL\fR \.\.\. ] +Given a \fBtoken\fR, returns the current appcast checkpoint, or calculates the appcast checkpoint if the \fB\-\-calculate\fR flag is specified\. +. +.br +Given a \fBURL\fR, calculates the appcast checkpoint for it\. +. .SH "OPTIONS" To make these options persistent, see the ENVIRONMENT section, below\. .
true
Other
Homebrew
brew
62a0c3a6f5cd6577cf9e628524b88b91b9419df7.json
tests: remove env helper
Library/Homebrew/cask/spec/spec_helper.rb
@@ -15,7 +15,6 @@ # add Homebrew-Cask to load path $LOAD_PATH.push(HOMEBREW_LIBRARY_PATH.join("cask", "lib").to_s) -require "test/support/helper/env" require "test/support/helper/shutup" Pathname.glob(HOMEBREW_LIBRARY_PATH.join("cask", "spec", "support", "*.rb")).each(&method(:require)) @@ -38,6 +37,5 @@ class TestCask < Cask; end RSpec.configure do |config| config.order = :random - config.include(Test::Helper::Env) config.include(Test::Helper::Shutup) end
true
Other
Homebrew
brew
62a0c3a6f5cd6577cf9e628524b88b91b9419df7.json
tests: remove env helper
Library/Homebrew/test/gpg2_requirement_test.rb
@@ -19,8 +19,7 @@ def teardown end def test_satisfied - with_environment("PATH" => @dir/"bin") do - assert_predicate GPG2Requirement.new, :satisfied? - end + ENV["PATH"] = @dir/"bin" + assert_predicate GPG2Requirement.new, :satisfied? end end
true
Other
Homebrew
brew
62a0c3a6f5cd6577cf9e628524b88b91b9419df7.json
tests: remove env helper
Library/Homebrew/test/gpg_test.rb
@@ -10,10 +10,9 @@ def setup def test_create_test_key Dir.chdir(@dir) do - with_environment("HOME" => @dir) do - shutup { Gpg.create_test_key(@dir) } - assert_predicate @dir/".gnupg/secring.gpg", :exist? - end + ENV["HOME"] = @dir + shutup { Gpg.create_test_key(@dir) } + assert_predicate @dir/".gnupg/secring.gpg", :exist? end end end
true
Other
Homebrew
brew
62a0c3a6f5cd6577cf9e628524b88b91b9419df7.json
tests: remove env helper
Library/Homebrew/test/support/helper/env.rb
@@ -1,21 +0,0 @@ -module Test - module Helper - module Env - def copy_env - ENV.to_hash - end - - def restore_env(env) - ENV.replace(env) - end - - def with_environment(partial_env) - old = copy_env - ENV.update partial_env - yield - ensure - restore_env old - end - end - end -end
true
Other
Homebrew
brew
62a0c3a6f5cd6577cf9e628524b88b91b9419df7.json
tests: remove env helper
Library/Homebrew/test/support/helper/test_case.rb
@@ -1,11 +1,9 @@ module Homebrew class TestCase < ::Minitest::Test - require "test/support/helper/env" require "test/support/helper/fs_leak_logger" require "test/support/helper/lifecycle_enforcer" require "test/support/helper/shutup" require "test/support/helper/version_assertions" - include Test::Helper::Env include Test::Helper::FSLeakLogger include Test::Helper::LifecycleEnforcer include Test::Helper::Shutup @@ -18,12 +16,12 @@ def setup super @__argv = ARGV.dup - @__env = copy_env + @__env = ENV.to_hash # dup doesn't work on ENV end def teardown ARGV.replace(@__argv) - restore_env @__env + ENV.replace(@__env) Tab.clear_cache
true
Other
Homebrew
brew
f7c6fc058f5eff55281fd7559b4217184162edcf.json
Remove legacy cask cache instead of migrating.
Library/Homebrew/cask/lib/hbc.rb
@@ -46,7 +46,7 @@ module Hbc def self.init Cache.ensure_cache_exists - Cache.migrate_legacy_cache + Cache.delete_legacy_cache Caskroom.migrate_caskroom_from_repo_to_prefix Caskroom.ensure_caskroom_exists
true
Other
Homebrew
brew
f7c6fc058f5eff55281fd7559b4217184162edcf.json
Remove legacy cask cache instead of migrating.
Library/Homebrew/cask/lib/hbc/cache.rb
@@ -9,27 +9,10 @@ def ensure_cache_exists Hbc.cache.mkpath end - def migrate_legacy_cache + def delete_legacy_cache return unless Hbc.legacy_cache.exist? - ohai "Migrating cached files to #{Hbc.cache}..." - Hbc.legacy_cache.children.select(&:symlink?).each do |symlink| - file = symlink.readlink - - new_name = file.basename - .sub(/\-((?:(\d|#{DSL::Version::DIVIDER_REGEX})*\-\2*)*[^\-]+)$/x, - '--\1') - - renamed_file = Hbc.cache.join(new_name) - - if file.exist? - puts "#{file} -> #{renamed_file}" - FileUtils.mv(file, renamed_file) - end - - FileUtils.rm(symlink) - end - + ohai "Deleting legacy cache at #{Hbc.legacy_cache}..." FileUtils.remove_entry_secure(Hbc.legacy_cache) end end
true
Other
Homebrew
brew
2de6d96a10f00f6dc828711166a53b768f97bbab.json
Change regex to catch multi-line `pubDate` tags.
Library/Homebrew/cask/lib/hbc/dsl/appcast.rb
@@ -15,11 +15,7 @@ def calculate_checkpoint result = SystemCommand.run("/usr/bin/curl", args: ["--compressed", "--location", "--user-agent", URL::FAKE_USER_AGENT, @uri], print_stderr: false) checkpoint = if result.success? - processed_appcast_text = result.stdout.gsub(%r{<pubDate>[^<]*</pubDate>}, "") - - # This step is necessary to replicate running `sed` from the command line - processed_appcast_text << "\n" unless processed_appcast_text.end_with?("\n") - + processed_appcast_text = result.stdout.gsub(%r{<pubDate>[^<]*</pubDate>}m, "") Digest::SHA2.hexdigest(processed_appcast_text) end
false
Other
Homebrew
brew
19e61355b38b8ba96db0ca71849bb536af0490bf.json
tests: remove with_git_env method A common git environment is now used in all tests, so this is no longer required.
Library/Homebrew/dev-cmd/tests.rb
@@ -34,6 +34,7 @@ def tests %w[AUTHOR COMMITTER].each do |role| ENV["GIT_#{role}_NAME"] = "brew tests" ENV["GIT_#{role}_EMAIL"] = "brew-tests@localhost" + ENV["GIT_#{role}_DATE"] = "Sun Jan 22 19:59:13 2017 +0000" end Homebrew.install_gem_setup_path! "bundler"
true
Other
Homebrew
brew
19e61355b38b8ba96db0ca71849bb536af0490bf.json
tests: remove with_git_env method A common git environment is now used in all tests, so this is no longer required.
Library/Homebrew/test/download_strategies_test.rb
@@ -158,15 +158,13 @@ def git_commit_all end def setup_git_repo - using_git_env do - @cached_location.cd do - shutup do - system "git", "init" - system "git", "remote", "add", "origin", "https://github.com/Homebrew/homebrew-foo" - end - touch "README" - git_commit_all + @cached_location.cd do + shutup do + system "git", "init" + system "git", "remote", "add", "origin", "https://github.com/Homebrew/homebrew-foo" end + touch "README" + git_commit_all end end @@ -185,11 +183,9 @@ def test_source_modified_time def test_last_commit setup_git_repo - using_git_env do - @cached_location.cd do - touch "LICENSE" - git_commit_all - end + @cached_location.cd do + touch "LICENSE" + git_commit_all end assert_equal "f68266e", @strategy.last_commit end @@ -202,17 +198,15 @@ def test_fetch_last_commit resource.instance_variable_set(:@version, Version.create("HEAD")) @strategy = GitDownloadStrategy.new("baz", resource) - using_git_env do - remote_repo.cd do - shutup do - system "git", "init" - system "git", "remote", "add", "origin", "https://github.com/Homebrew/homebrew-foo" - end - touch "README" - git_commit_all - touch "LICENSE" - git_commit_all + remote_repo.cd do + shutup do + system "git", "init" + system "git", "remote", "add", "origin", "https://github.com/Homebrew/homebrew-foo" end + touch "README" + git_commit_all + touch "LICENSE" + git_commit_all end @strategy.shutup!
true
Other
Homebrew
brew
19e61355b38b8ba96db0ca71849bb536af0490bf.json
tests: remove with_git_env method A common git environment is now used in all tests, so this is no longer required.
Library/Homebrew/test/formula_test.rb
@@ -533,14 +533,12 @@ def test_update_head_version cached_location = f.head.downloader.cached_location cached_location.mkpath - using_git_env do - cached_location.cd do - FileUtils.touch "LICENSE" - shutup do - system "git", "init" - system "git", "add", "--all" - system "git", "commit", "-m", "Initial commit" - end + cached_location.cd do + FileUtils.touch "LICENSE" + shutup do + system "git", "init" + system "git", "add", "--all" + system "git", "commit", "-m", "Initial commit" end end @@ -1105,14 +1103,12 @@ def test_outdated_fetch_head head "file://#{testball_repo}", using: :git end - using_git_env do - testball_repo.cd do - FileUtils.touch "LICENSE" - shutup do - system "git", "init" - system "git", "add", "--all" - system "git", "commit", "-m", "Initial commit" - end + testball_repo.cd do + FileUtils.touch "LICENSE" + shutup do + system "git", "init" + system "git", "add", "--all" + system "git", "commit", "-m", "Initial commit" end end
true
Other
Homebrew
brew
19e61355b38b8ba96db0ca71849bb536af0490bf.json
tests: remove with_git_env method A common git environment is now used in all tests, so this is no longer required.
Library/Homebrew/test/install_test.rb
@@ -76,16 +76,14 @@ def test_install_head_installed repo_path = HOMEBREW_CACHE.join("repo") repo_path.join("bin").mkpath - using_git_env do - repo_path.cd do - shutup do - system "git", "init" - system "git", "remote", "add", "origin", "https://github.com/Homebrew/homebrew-foo" - FileUtils.touch "bin/something.bin" - FileUtils.touch "README" - system "git", "add", "--all" - system "git", "commit", "-m", "Initial repo commit" - end + repo_path.cd do + shutup do + system "git", "init" + system "git", "remote", "add", "origin", "https://github.com/Homebrew/homebrew-foo" + FileUtils.touch "bin/something.bin" + FileUtils.touch "README" + system "git", "add", "--all" + system "git", "commit", "-m", "Initial repo commit" end end
true
Other
Homebrew
brew
19e61355b38b8ba96db0ca71849bb536af0490bf.json
tests: remove with_git_env method A common git environment is now used in all tests, so this is no longer required.
Library/Homebrew/test/support/helper/env.rb
@@ -16,18 +16,6 @@ def with_environment(partial_env) ensure restore_env old end - - def using_git_env - git_env = ["AUTHOR", "COMMITTER"].each_with_object({}) do |role, env| - env["GIT_#{role}_NAME"] = "brew tests" - env["GIT_#{role}_EMAIL"] = "brew-tests@localhost" - env["GIT_#{role}_DATE"] = "Sun Jan 22 19:59:13 2017 +0000" - end - - with_environment(git_env) do - yield - end - end end end end
true
Other
Homebrew
brew
19e61355b38b8ba96db0ca71849bb536af0490bf.json
tests: remove with_git_env method A common git environment is now used in all tests, so this is no longer required.
Library/Homebrew/test/tap_test.rb
@@ -66,14 +66,12 @@ class Foo < Formula end def setup_git_repo - using_git_env do - @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 + @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 end end
true
Other
Homebrew
brew
9c3d01c682056367f59d557720c7a08ca67f48c4.json
tests: remove unnecessary comment See https://github.com/Homebrew/brew/pull/1890#discussion_r97229473.
Library/Homebrew/test/support/helper/test_case.rb
@@ -18,7 +18,7 @@ def setup super @__argv = ARGV.dup - @__env = copy_env # Call #to_hash to duplicate ENV + @__env = copy_env end def teardown
false
Other
Homebrew
brew
1e1de8c111b5c3a36e4bdf886d6f2e736890ba56.json
tests: remove remainder of ARGV stubs I was waiting for confirmation that there wasn't a good reason for these to be stubbed before I removed them.
Library/Homebrew/test/sandbox_test.rb
@@ -15,19 +15,19 @@ def test_formula? f2 = formula { url "bar-1.0" } f2.stubs(:tap).returns(Tap.fetch("test/tap")) - ARGV.stubs(:sandbox?).returns true + ENV["HOMEBREW_SANDBOX"] = "1" assert Sandbox.formula?(f), "Formulae should be sandboxed if --sandbox was passed." - ARGV.stubs(:sandbox?).returns false + ENV.delete("HOMEBREW_SANDBOX") assert Sandbox.formula?(f), "Formulae should be sandboxed if in a sandboxed tap." refute Sandbox.formula?(f2), "Formulae should not be sandboxed if not in a sandboxed tap." end def test_test? - ARGV.stubs(:no_sandbox?).returns false + ENV.delete("HOMEBREW_NO_SANDBOX") assert Sandbox.test?, "Tests should be sandboxed unless --no-sandbox was passed." end
false
Other
Homebrew
brew
0c1d665568875ffccb660a65ff248b7ab98ec77c.json
tests: set developer in ENV rather than stubbing
Library/Homebrew/test/audit_test.rb
@@ -243,7 +243,7 @@ def test_audit_class_github_gist_formula needs_compat require "compat/formula_specialties" - ARGV.stubs(:homebrew_developer?).returns false + ENV.delete("HOMEBREW_DEVELOPER") fa = shutup do formula_auditor "foo", <<-EOS.undent class Foo < GithubGistFormula @@ -260,7 +260,7 @@ def test_audit_class_script_file_formula needs_compat require "compat/formula_specialties" - ARGV.stubs(:homebrew_developer?).returns false + ENV.delete("HOMEBREW_DEVELOPER") fa = formula_auditor "foo", <<-EOS.undent class Foo < ScriptFileFormula url "http://example.com/foo-1.0.tgz" @@ -275,7 +275,7 @@ def test_audit_class_aws_formula needs_compat require "compat/formula_specialties" - ARGV.stubs(:homebrew_developer?).returns false + ENV.delete("HOMEBREW_DEVELOPER") fa = formula_auditor "foo", <<-EOS.undent class Foo < AmazonWebServicesFormula url "http://example.com/foo-1.0.tgz"
true
Other
Homebrew
brew
0c1d665568875ffccb660a65ff248b7ab98ec77c.json
tests: set developer in ENV rather than stubbing
Library/Homebrew/test/os/mac/diagnostic_test.rb
@@ -16,7 +16,7 @@ def test_check_for_other_package_managers end def test_check_for_unsupported_macos - ARGV.stubs(:homebrew_developer?).returns false + ENV.delete("HOMEBREW_DEVELOPER") OS::Mac.stubs(:prerelease?).returns true assert_match "We do not provide support for this pre-release version.", @checks.check_for_unsupported_macos
true
Other
Homebrew
brew
0c1d665568875ffccb660a65ff248b7ab98ec77c.json
tests: set developer in ENV rather than stubbing
Library/Homebrew/test/utils_test.rb
@@ -207,7 +207,7 @@ def test_truncate_text_to_approximate_size end def test_odeprecated - ARGV.stubs(:homebrew_developer?).returns false + ENV.delete("HOMEBREW_DEVELOPER") e = assert_raises(MethodDeprecatedError) do odeprecated("method", "replacement", caller: ["#{HOMEBREW_LIBRARY}/Taps/homebrew/homebrew-core/"],
true
Other
Homebrew
brew
1aee7c6945c3cbbbbfa2830bb1cf6bf39d4702be.json
tests: remove explicit tmpdir deletions These are no longer necessary.
Library/Homebrew/test/audit_test.rb
@@ -10,11 +10,6 @@ def setup @dir = mktmpdir end - def teardown - FileUtils.rm_rf @dir - super - end - def formula_text(name, body = nil, options = {}) path = Pathname.new "#{@dir}/#{name}.rb" path.open("w") do |f| @@ -64,11 +59,6 @@ def setup @dir = mktmpdir end - def teardown - FileUtils.rm_rf @dir - super - end - def formula_auditor(name, text, options = {}) path = Pathname.new "#{@dir}/#{name}.rb" path.open("w") do |f|
true
Other
Homebrew
brew
1aee7c6945c3cbbbbfa2830bb1cf6bf39d4702be.json
tests: remove explicit tmpdir deletions These are no longer necessary.
Library/Homebrew/test/language_python_test.rb
@@ -15,11 +15,6 @@ def setup @venv = Language::Python::Virtualenv::Virtualenv.new(@formula, @dir, "python") end - def teardown - FileUtils.rm_rf @dir - super - end - def test_virtualenv_creation @formula.expects(:resource).with("homebrew-virtualenv").returns( mock("resource", stage: true)
true
Other
Homebrew
brew
1aee7c6945c3cbbbbfa2830bb1cf6bf39d4702be.json
tests: remove explicit tmpdir deletions These are no longer necessary.
Library/Homebrew/test/pathname_test.rb
@@ -13,12 +13,6 @@ def setup @file = @src/"foo" @dir = @src/"bar" end - - def teardown - rmtree(@src) - rmtree(@dst) - super - end end class PathnameTests < Homebrew::TestCase
true
Other
Homebrew
brew
1aee7c6945c3cbbbbfa2830bb1cf6bf39d4702be.json
tests: remove explicit tmpdir deletions These are no longer necessary.
Library/Homebrew/test/sandbox_test.rb
@@ -10,11 +10,6 @@ def setup @file = @dir/"foo" end - def teardown - @dir.rmtree - super - end - def test_formula? f = formula { url "foo-1.0" } f2 = formula { url "bar-1.0" }
true
Other
Homebrew
brew
1aee7c6945c3cbbbbfa2830bb1cf6bf39d4702be.json
tests: remove explicit tmpdir deletions These are no longer necessary.
Library/Homebrew/test/utils_test.rb
@@ -11,7 +11,6 @@ def setup end def teardown - @dir.rmtree ENV.replace @env super end
true
Other
Homebrew
brew
d86342a2519b6bdc5393302e3e81e5b72aa26e7f.json
tests: reset ARGV in teardown
Library/Homebrew/test/cleanup_test.rb
@@ -21,8 +21,6 @@ def setup def teardown FileUtils.rm_f @ds_store - ARGV.delete "--dry-run" - ARGV.delete "--prune=all" super end
true
Other
Homebrew
brew
d86342a2519b6bdc5393302e3e81e5b72aa26e7f.json
tests: reset ARGV in teardown
Library/Homebrew/test/formula_installer_test.rb
@@ -61,8 +61,6 @@ def test_a_basic_install assert_equal 3, bin.children.length assert_predicate f.prefix/".brew/testball.rb", :readable? end - ensure - ARGV.reject! { |a| a == "--with-invalid_flag" } end def test_bottle_unneeded_formula_install @@ -86,13 +84,10 @@ def test_not_poured_from_bottle_when_compiler_specified cc_arg = "--cc=clang" ARGV << cc_arg - begin - temporary_install(TestballBottle.new) do |f| - tab = Tab.for_formula(f) - assert_equal "clang", tab.compiler - end - ensure - ARGV.delete_if { |x| x == cc_arg } + + temporary_install(TestballBottle.new) do |f| + tab = Tab.for_formula(f) + assert_equal "clang", tab.compiler end end end
true
Other
Homebrew
brew
d86342a2519b6bdc5393302e3e81e5b72aa26e7f.json
tests: reset ARGV in teardown
Library/Homebrew/test/support/helper/test_case.rb
@@ -14,8 +14,14 @@ class TestCase < ::Minitest::Test TEST_SHA1 = "deadbeefdeadbeefdeadbeefdeadbeefdeadbeef".freeze TEST_SHA256 = "deadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeef".freeze + def setup + super + @__argv = ARGV.dup + end + def teardown Tab.clear_cache + ARGV.replace(@__argv) super end
true
Other
Homebrew
brew
d86342a2519b6bdc5393302e3e81e5b72aa26e7f.json
tests: reset ARGV in teardown
Library/Homebrew/test/uninstall_test.rb
@@ -62,8 +62,6 @@ def test_check_for_dependents_when_ignore_dependencies assert_empty handle_unsatisfied_dependents refute_predicate Homebrew, :failed? end - ensure - ARGV.delete("--ignore-dependencies") end end
true
Other
Homebrew
brew
245944d359f366aaf511f133e11c98ec14cd50b1.json
keg: use Forwardable to methods delegated to #path
Library/Homebrew/keg.rb
@@ -174,6 +174,12 @@ def self.all attr_reader :path, :name, :linked_keg_record, :opt_record protected :path + extend Forwardable + + def_delegators :path, + :to_s, :hash, :abv, :disk_usage, :file_count, :directory?, :exist?, :/, + :join, :rename, :find + def initialize(path) path = path.resolved_path if path.to_s.start_with?("#{HOMEBREW_PREFIX}/opt/") raise "#{path} is not a valid keg" unless path.parent.parent.realpath == HOMEBREW_CELLAR.realpath @@ -184,10 +190,6 @@ def initialize(path) @opt_record = HOMEBREW_PREFIX/"opt/#{name}" end - def to_s - path.to_s - end - def rack path.parent end @@ -203,30 +205,6 @@ def ==(other) end alias eql? == - def hash - path.hash - end - - def abv - path.abv - end - - def disk_usage - path.disk_usage - end - - def file_count - path.file_count - end - - def directory? - path.directory? - end - - def exist? - path.exist? - end - def empty_installation? Pathname.glob("#{path}/**/*") do |file| next if file.directory? @@ -239,18 +217,6 @@ def empty_installation? true end - def /(other) - path / other - end - - def join(*args) - path.join(*args) - end - - def rename(*args) - path.rename(*args) - end - def linked? linked_keg_record.symlink? && linked_keg_record.directory? && @@ -396,10 +362,6 @@ def installed_dependents end end - def find(*args, &block) - path.find(*args, &block) - end - def oldname_opt_record @oldname_opt_record ||= if (opt_dir = HOMEBREW_PREFIX/"opt").directory? opt_dir.subdirs.detect do |dir|
false
Other
Homebrew
brew
6fc1747e0550545b4fe80f5a1854d16dd2b08afe.json
tests: add a missing Tab cache clear This was responsible for the sporadic failures I encountered in #1878.
Library/Homebrew/test/formulary_test.rb
@@ -110,6 +110,7 @@ def test_factory_from_rack_and_from_keg keg.uninstall formula.clear_cache formula.bottle.clear_cache + Tab.clear_cache end def test_load_from_contents
false
Other
Homebrew
brew
f0249643d47f1dee4a0d08c440eb3afd6da3558a.json
formula_installer: use attr_accessor for installed_*
Library/Homebrew/cmd/upgrade.rb
@@ -110,7 +110,7 @@ def upgrade_formula(f) fi.installed_on_request = !ARGV.named.empty? if tab fi.installed_as_dependency = tab.installed_as_dependency - #fi.installed_on_request ||= tab.installed_on_request + fi.installed_on_request ||= tab.installed_on_request end fi.prelude
true
Other
Homebrew
brew
f0249643d47f1dee4a0d08c440eb3afd6da3558a.json
formula_installer: use attr_accessor for installed_*
Library/Homebrew/formula_installer.rb
@@ -32,11 +32,11 @@ def self.mode_attr_accessor(*names) attr_reader :formula attr_accessor :options, :build_bottle, :invalid_option_names + attr_accessor :installed_as_dependency, :installed_on_request mode_attr_accessor :show_summary_heading, :show_header mode_attr_accessor :build_from_source, :force_bottle mode_attr_accessor :ignore_deps, :only_deps, :interactive, :git mode_attr_accessor :verbose, :debug, :quieter - mode_attr_accessor :installed_as_dependency, :installed_on_request def initialize(formula) @formula = formula
true
Other
Homebrew
brew
4d2201b8beabf99a1f4bf062a5aef12b19475caa.json
integration_command_test_case: improve fail output Instead of `puts`ing when the failure occurs save it until the error message and print a prose description of what the failure was and the output from the command. This makes the output from failing tests significantly easier to read.
Library/Homebrew/test/support/helper/integration_command_test_case.rb
@@ -106,16 +106,20 @@ def cmd_output(*args) def cmd(*args) output = cmd_output(*args) status = $?.exitstatus - puts "\n'brew #{args.join " "}' output: #{output}" if status.nonzero? - assert_equal 0, status + assert_equal 0, status, <<-EOS.undent + `brew #{args.join " "}` exited with non-zero status! + #{output} + EOS output end def cmd_fail(*args) output = cmd_output(*args) status = $?.exitstatus - $stderr.puts "\n'brew #{args.join " "}'" if status.zero? - refute_equal 0, status + refute_equal 0, status, <<-EOS.undent + `brew #{args.join " "}` exited with zero status! + #{output} + EOS output end
false
Other
Homebrew
brew
42486c1181bdf4ed85f334ccb1edbb6632cfc4b2.json
bottle: add: improve regexp to recognize comments This would have eliminated the need for Homebrew/homebrew-core#9000, for instance.
Library/Homebrew/dev-cmd/bottle.rb
@@ -435,6 +435,7 @@ def merge else string = s.sub!( /( + (\ {2}\#[^\n]*\n)* # comments \ {2}( # two spaces at the beginning (url|head)\ ['"][\S\ ]+['"] # url or head with a string (
false
Other
Homebrew
brew
36c1c8e9b0e5919a5165ffb5eaeddb54db1238b0.json
uses: fix recursive requirement resolution Fixes #1848 by sharing recursive dependency resolution between dependencies and requirements. Coincidentally, this also fixes the errors introduced by #1784 that necessitated it being reverted in #1797.
Library/Homebrew/cmd/uses.rb
@@ -58,15 +58,29 @@ def uses Dependency.prune unless includes.include?("build?") end end - reqs = f.recursive_requirements do |dependent, req| + + dep_formulae = deps.map do |dep| + begin + dep.to_formula + rescue + end + end.compact + + reqs_by_formula = ([f] + dep_formulae).flat_map do |formula| + formula.requirements.map { |req| [formula, req] } + end + + reqs_by_formula.reject! do |dependent, req| if req.recommended? - Requirement.prune if ignores.include?("recommended?") || dependent.build.without?(req) + ignores.include?("recommended?") || dependent.build.without?(req) elsif req.optional? - Requirement.prune if !includes.include?("optional?") && !dependent.build.with?(req) + !includes.include?("optional?") && !dependent.build.with?(req) elsif req.build? - Requirement.prune unless includes.include?("build?") + !includes.include?("build?") end end + + reqs = reqs_by_formula.map(&:last) else deps = f.deps.reject do |dep| ignores.any? { |ignore| dep.send(ignore) } && !includes.any? { |include| dep.send(include) }
false
Other
Homebrew
brew
33b955a3f24d835f45d439f97ecabb7d6d51b7ad.json
tests: fix style of recursive_requirements tests
Library/Homebrew/test/formula_test.rb
@@ -694,8 +694,8 @@ def test_requirements url "f1-1" depends_on :python - depends_on :x11 => :recommended - depends_on :xcode => ['1.0', :optional] + depends_on x11: :recommended + depends_on xcode: ["1.0", :optional] end stub_formula_loader f1 @@ -721,7 +721,7 @@ def test_requirements assert_equal Set[python, x11, xcode], Set.new(f2.recursive_requirements {}) # Requirements can be pruned - requirements = f2.recursive_requirements do |dependent, requirement| + requirements = f2.recursive_requirements do |_dependent, requirement| Requirement.prune if requirement.is_a?(PythonRequirement) end assert_equal Set[x11, xcode], Set.new(requirements)
false
Other
Homebrew
brew
feea90c0ddee280193182d8cce2ce56bc8e4aa6f.json
create: handle null versions. Fixes #1821
Library/Homebrew/dev-cmd/create.rb
@@ -142,12 +142,10 @@ def head? def generate! raise "#{path} already exists" if path.exist? - if version.nil? + if version.nil? || version.null? opoo "Version cannot be determined from URL." puts "You'll need to add an explicit 'version' to the formula." - end - - if fetch? && version + elsif fetch? r = Resource.new r.url(url) r.version(version)
false
Other
Homebrew
brew
feddacf829fe59ac8cf1f739db903423cf9111b0.json
formula_installer: set specified_path on pour. This means that a `brew install $ALIAS` records the path accordingly so e.g. `Formula#full_installed_specified_name` returns the correct path.
Library/Homebrew/formula_installer.rb
@@ -808,6 +808,7 @@ def pour tab.poured_from_bottle = true tab.time = Time.now.to_i tab.head = HOMEBREW_REPOSITORY.git_head + tab.source["path"] = formula.specified_path.to_s tab.write end
false
Other
Homebrew
brew
7c159449910d5c6fe2f4fea7416fed8a8ba2d4db.json
Fix documentation for HEAD upgrades. These can now be done with just `brew upgrade`, like other upgrades. Fixes #1818.
Library/Homebrew/cmd/install.rb
@@ -44,9 +44,6 @@ #: If `--keep-tmp` is passed, the temporary files created during installation #: are not deleted. #: -#: To install a newer version of HEAD use -#: `brew rm <foo> && brew install --HEAD <foo>`. -#: #: * `install` `--interactive` [`--git`] <formula>: #: Download and patch <formula>, then open a shell. This allows the user to #: run `./configure --help` and otherwise determine how to turn the software
true
Other
Homebrew
brew
7c159449910d5c6fe2f4fea7416fed8a8ba2d4db.json
Fix documentation for HEAD upgrades. These can now be done with just `brew upgrade`, like other upgrades. Fixes #1818.
docs/brew.1.html
@@ -196,10 +196,7 @@ <h2 id="COMMANDS">COMMANDS</h2> aka master, trunk, unstable.</p> <p>If <code>--keep-tmp</code> is passed, the temporary files created during installation -are not deleted.</p> - -<p>To install a newer version of HEAD use -<code>brew rm &lt;foo> &amp;&amp; brew install --HEAD &lt;foo></code>.</p></dd> +are not deleted.</p></dd> <dt><code>install</code> <code>--interactive</code> [<code>--git</code>] <var>formula</var></dt><dd><p>Download and patch <var>formula</var>, then open a shell. This allows the user to run <code>./configure --help</code> and otherwise determine how to turn the software package into a Homebrew formula.</p>
true
Other
Homebrew
brew
7c159449910d5c6fe2f4fea7416fed8a8ba2d4db.json
Fix documentation for HEAD upgrades. These can now be done with just `brew upgrade`, like other upgrades. Fixes #1818.
manpages/brew.1
@@ -258,9 +258,6 @@ If \fB\-\-HEAD\fR is passed, and \fIformula\fR defines it, install the HEAD vers .IP If \fB\-\-keep\-tmp\fR is passed, the temporary files created during installation are not deleted\. . -.IP -To install a newer version of HEAD use \fBbrew rm <foo> && brew install \-\-HEAD <foo>\fR\. -. .TP \fBinstall\fR \fB\-\-interactive\fR [\fB\-\-git\fR] \fIformula\fR 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
653f900e59b5841bc864008583ce02b2e5c0fc1f.json
Add docs on persisting settings across upgrades There are some formulas in which Homebrew symlinks configuration files into /usr/local/etc/ instead of copying them, resulting in custom settings being overwritten on package upgrades. This addition to the documentation illustrates one way to avoid this behavior by ensuring the configure script is told where to copy the configuration file(s). Refs https://github.com/Homebrew/homebrew-core/issues/8711
docs/Formula-Cookbook.md
@@ -783,6 +783,8 @@ The symlinks created by `install_symlink` are guaranteed to be relative. `ln_s` For example, Ruby 1.9’s gems should be installed to `var/lib/ruby/` so that gems don’t need to be reinstalled when upgrading Ruby. You can usually do this with symlink trickery, or *better* a configure option. +Another example would be configuration files that should not be overwritten on package upgrades. If after installation you find that to-be-persisted configuration files are not copied but instead *symlinked* into `/usr/local/etc/` from the Cellar, this can often be rectified by passing an appropriate argument to the package’s configure script. That argument will vary depending on a given package’s configure script and/or Makefile, but one example might be: `--sysconfdir=#{etc}` + ### launchd plist files Homebrew provides two Formula methods for launchd plist files. [`plist_name`](http://www.rubydoc.info/github/Homebrew/brew/master/Formula#plist_name-instance_method) will return e.g. `homebrew.mxcl.<formula>` and [`plist_path`](http://www.rubydoc.info/github/Homebrew/brew/master/Formula#plist_path-instance_method) will return e.g. `/usr/local/Cellar/foo/0.1/homebrew.mxcl.foo.plist`.
false
Other
Homebrew
brew
62d48b4f9d5d0b11db514e5b5245b9f4fb1d2f66.json
brew deps --tree: fix gap in line between reqs and deps
Library/Homebrew/cmd/deps.rb
@@ -143,15 +143,23 @@ def puts_deps_tree(formulae) def recursive_deps_tree(f, prefix) reqs = f.requirements.select(&:default_formula?) + deps = f.deps.default max = reqs.length - 1 reqs.each_with_index do |req, i| - chr = i == max ? "└──" : "β”œβ”€β”€" + chr = if i == max && deps.empty? + "└──" + else + "β”œβ”€β”€" + end puts prefix + "#{chr} :#{dep_display_name(req.to_dependency)}" end - deps = f.deps.default max = deps.length - 1 deps.each_with_index do |dep, i| - chr = i == max ? "└──" : "β”œβ”€β”€" + chr = if i == max + "└──" + else + "β”œβ”€β”€" + end prefix_ext = i == max ? " " : "β”‚ " puts prefix + "#{chr} #{dep_display_name(dep)}" recursive_deps_tree(Formulary.factory(dep.name), prefix + prefix_ext)
false
Other
Homebrew
brew
ac7a59373087e9d49097ab7f0ddb691e64159959.json
InreplaceError: fix undefined method crash When the first parameter to inreplace was an array, and the replacement failed, InreplaceError would end up crashing with an undefined method exception because the order of operations resulted in super not being passed the value of the entire inject block.
Library/Homebrew/utils/inreplace.rb
@@ -1,9 +1,10 @@ module Utils class InreplaceError < RuntimeError def initialize(errors) - super errors.inject("inreplace failed\n") do |s, (path, errs)| + formatted_errors = errors.inject("inreplace failed\n") do |s, (path, errs)| s << "#{path}:\n" << errs.map { |e| " #{e}\n" }.join end + super formatted_errors end end
false
Other
Homebrew
brew
3ccbfa72a2be56037375ee413b66c96d14384373.json
brew.1: use uninstall instead of remove. Fixes #1817.
Library/Homebrew/manpages/brew.1.md.erb
@@ -31,7 +31,7 @@ With `--verbose` or `-v`, many commands print extra debugging information. Note * `install` <formula>: Install <formula>. - * `remove` <formula>: + * `uninstall` <formula>: Uninstall <formula>. * `update`:
true
Other
Homebrew
brew
3ccbfa72a2be56037375ee413b66c96d14384373.json
brew.1: use uninstall instead of remove. Fixes #1817.
docs/brew.1.html
@@ -22,7 +22,7 @@ <h2 id="ESSENTIAL-COMMANDS">ESSENTIAL COMMANDS</h2> <dl> <dt><code>install</code> <var>formula</var></dt><dd><p>Install <var>formula</var>.</p></dd> -<dt><code>remove</code> <var>formula</var></dt><dd><p>Uninstall <var>formula</var>.</p></dd> +<dt><code>uninstall</code> <var>formula</var></dt><dd><p>Uninstall <var>formula</var>.</p></dd> <dt class="flush"><code>update</code></dt><dd><p>Fetch the newest version of Homebrew from GitHub using <code>git</code>(1).</p></dd> <dt class="flush"><code>list</code></dt><dd><p>List all installed formulae.</p></dd> <dt><code>search</code> <var>text</var>|<code>/</code><var>text</var><code>/</code></dt><dd><p>Perform a substring search of formula names for <var>text</var>. If <var>text</var> is
true
Other
Homebrew
brew
3ccbfa72a2be56037375ee413b66c96d14384373.json
brew.1: use uninstall instead of remove. Fixes #1817.
manpages/brew.1
@@ -26,7 +26,7 @@ With \fB\-\-verbose\fR or \fB\-v\fR, many commands print extra debugging informa Install \fIformula\fR\. . .TP -\fBremove\fR \fIformula\fR +\fBuninstall\fR \fIformula\fR Uninstall \fIformula\fR\. . .TP
true
Other
Homebrew
brew
fe117bf79b244c42b7e4049d353c3c003eae4880.json
requirement: get formula from satisfy. If satisfy returns a `Pathname` from `which` then we can use that to infer a formula dependency from that `Requirement`.
Library/Homebrew/requirement.rb
@@ -15,6 +15,7 @@ def initialize(tags = []) @default_formula = self.class.default_formula @cask ||= self.class.cask @download ||= self.class.download + @formula = nil tags.each do |tag| next unless tag.is_a? Hash @cask ||= tag[:cask] @@ -56,7 +57,14 @@ def message def satisfied? result = self.class.satisfy.yielder { |p| instance_eval(&p) } @satisfied_result = result - result ? true : false + return false unless result + + if parent = satisfied_result_parent + parent.to_s =~ %r{(#{Regexp.escape(HOMEBREW_CELLAR)}|#{Regexp.escape(HOMEBREW_PREFIX)}/opt)/([\w+-.@]+)} + @formula = $2 + end + + true end # Overriding #fatal? is deprecated. @@ -69,6 +77,11 @@ def default_formula? self.class.default_formula || false end + def satisfied_result_parent + return unless @satisfied_result.is_a?(Pathname) + @satisfied_result.resolved_path.parent + end + # Overriding #modify_build_environment is deprecated. # Pass a block to the env DSL method instead. # Note: #satisfied? should be called before invoking this method @@ -81,11 +94,8 @@ def modify_build_environment # satisfy { which("executable") } # work, even under superenv where "executable" wouldn't normally be on the # PATH. - # This is undocumented magic and it should be removed, but we need to add - # a way to declare path-based requirements that work with superenv first. - return unless @satisfied_result.is_a?(Pathname) - parent = @satisfied_result.parent - + parent = satisfied_result_parent + return unless parent return if ENV["PATH"].split(File::PATH_SEPARATOR).include?(parent.to_s) ENV.append_path("PATH", parent) end @@ -111,13 +121,15 @@ def inspect "#<#{self.class.name}: #{name.inspect} #{tags.inspect}>" end + def formula + @formula || self.class.default_formula + end + def to_dependency - f = self.class.default_formula - raise "No default formula defined for #{inspect}" if f.nil? - if f =~ HOMEBREW_TAP_FORMULA_REGEX - TapDependency.new(f, tags, method(:modify_build_environment), name) - else - Dependency.new(f, tags, method(:modify_build_environment), name) + if formula =~ HOMEBREW_TAP_FORMULA_REGEX + TapDependency.new(formula, tags, method(:modify_build_environment), name) + elsif formula + Dependency.new(formula, tags, method(:modify_build_environment), name) end end
false
Other
Homebrew
brew
a17f38dd364af67d5965aaa58438cb768c6d057a.json
xcode: use default location when possible. Xcode can be installed anywhere but for most people it's in `/Applications/Xcode.app` so just look there if `xcode-select` isn't helpful before looking at Spotlight which can return weird results on e.g. backup disks. Fixes #1587.
Library/Homebrew/os/mac/xcode.rb
@@ -3,6 +3,7 @@ module Mac module Xcode module_function + DEFAULT_BUNDLE_PATH = Pathname.new("/Applications/Xcode.app").freeze BUNDLE_ID = "com.apple.dt.Xcode".freeze OLD_BUNDLE_ID = "com.apple.Xcode".freeze @@ -67,11 +68,14 @@ def toolchain_path Pathname.new("#{prefix}/Toolchains/XcodeDefault.xctoolchain") end - # Ask Spotlight where Xcode is. If the user didn't install the - # helper tools and installed Xcode in a non-conventional place, this - # is our only option. See: https://superuser.com/questions/390757 def bundle_path - MacOS.app_with_bundle_id(V4_BUNDLE_ID, V3_BUNDLE_ID) + # Use the default location if it exists. + return DEFAULT_BUNDLE_PATH if DEFAULT_BUNDLE_PATH.exist? + + # Ask Spotlight where Xcode is. If the user didn't install the + # helper tools and installed Xcode in a non-conventional place, this + # is our only option. See: https://superuser.com/questions/390757 + MacOS.app_with_bundle_id(BUNDLE_ID, OLD_BUNDLE_ID) end def installed?
false
Other
Homebrew
brew
4a39070c268b6dba063b938d8663c70f60311230.json
xquartz: use default location when possible. Xcode can be installed anywhere but for most people it's in `/Applications/Xcode.app` so just look there by default before looking at Spotlight which can return weird results on e.g. backup disks.
Library/Homebrew/os/mac/xquartz.rb
@@ -5,6 +5,8 @@ module Mac module XQuartz module_function + # TODO: confirm this path when you have internet + DEFAULT_BUNDLE_PATH = Pathname.new("Applications/Utilities/XQuartz.app").freeze FORGE_BUNDLE_ID = "org.macosforge.xquartz.X11".freeze APPLE_BUNDLE_ID = "org.x.X11".freeze FORGE_PKG_ID = "org.macosforge.xquartz.pkg".freeze @@ -56,6 +58,11 @@ def latest_version end def bundle_path + # Use the default location if it exists. + return DEFAULT_BUNDLE_PATH if DEFAULT_BUNDLE_PATH.exist? + + # Ask Spotlight where XQuartz is. If the user didn't install XQuartz + # in the conventional place, this is our only option. MacOS.app_with_bundle_id(FORGE_BUNDLE_ID, APPLE_BUNDLE_ID) end
false
Other
Homebrew
brew
28ad8a06cc24d2d71400e9c860a52ef046022cf1.json
formula: return runtime_dependencies in to_hash. Which, in turn, provides it for `brew info --json=v1` so other tools such as e.g. `brew bundle` can make use of this information.
Library/Homebrew/formula.rb
@@ -1618,6 +1618,7 @@ def to_hash "used_options" => tab.used_options.as_flags, "built_as_bottle" => tab.built_as_bottle, "poured_from_bottle" => tab.poured_from_bottle, + "runtime_dependencies" => tab.runtime_dependencies, } end
false
Other
Homebrew
brew
c0a29d664420bb568036f8e92654cf5e0b73da3e.json
caveats, keg: remove linkapps caveats code.
Library/Homebrew/caveats.rb
@@ -23,7 +23,6 @@ def caveats caveats << fish_function_caveats caveats << plist_caveats caveats << python_caveats - caveats << app_caveats caveats << elisp_caveats caveats.compact.join("\n") end @@ -169,16 +168,6 @@ def python_caveats s end - def app_caveats - return unless keg - return unless keg.app_installed? - - <<-EOS.undent - .app bundles were installed. - Run `brew linkapps #{keg.name}` to symlink these to /Applications. - EOS - end - def elisp_caveats return if f.keg_only? return unless keg
true
Other
Homebrew
brew
c0a29d664420bb568036f8e92654cf5e0b73da3e.json
caveats, keg: remove linkapps caveats code.
Library/Homebrew/keg.rb
@@ -367,10 +367,6 @@ def apps Pathname.glob("#{app_prefix}/{,libexec/}*.app") end - def app_installed? - !apps.empty? - end - def elisp_installed? return false unless (path/"share/emacs/site-lisp"/name).exist? (path/"share/emacs/site-lisp"/name).children.any? { |f| %w[.el .elc].include? f.extname }
true
Other
Homebrew
brew
346d68eb04013d2322796ed1a0edd7de007a156d.json
audit: check virtualenv and setuptools resource. `virtualenv_install_with_resources` will automatically define and install a `setuptools` resource so this is unnecessary. References https://github.com/Homebrew/homebrew-core/pull/8570
Library/Homebrew/dev-cmd/audit.rb
@@ -819,6 +819,11 @@ def audit_text problem "Formulae should not depend on both OpenSSL and LibreSSL (even optionally)." end + if text =~ /virtualenv_(create|install_with_resources)/ && + text =~ /resource\s+['"]setuptools['"]\s+do/ + problem "Formulae using virtualenvs do not need a `setuptools` resource." + end + return unless text.include?('require "language/go"') && !text.include?("go_resource") problem "require \"language/go\" is unnecessary unless using `go_resource`s" end
false
Other
Homebrew
brew
9a6cd9b83fc8596727df0157e89faee302907cda.json
docs: fix titles on docs.brew.sh
docs/Acceptable-Formulae.md
@@ -1,4 +1,5 @@ # Acceptable Formulae + Some formulae should not go in [homebrew/core](https://github.com/Homebrew/homebrew-core). But there are additional [Interesting Taps & Forks](Interesting-Taps-&-Forks.md) and anyone can start their
true
Other
Homebrew
brew
9a6cd9b83fc8596727df0157e89faee302907cda.json
docs: fix titles on docs.brew.sh
docs/Analytics.md
@@ -1,4 +1,5 @@ # Anonymous Aggregate User Behaviour Analytics + Homebrew has begun gathering anonymous aggregate user behaviour analytics and reporting these to Google Analytics. You will be notified the first time you run `brew update` or install Homebrew. ## Why?
true
Other
Homebrew
brew
9a6cd9b83fc8596727df0157e89faee302907cda.json
docs: fix titles on docs.brew.sh
docs/Bottles.md
@@ -1,4 +1,5 @@ # Bottles (binary packages) + Bottles are produced by installing a formula with `brew install --build-bottle $FORMULA` and then bottling it with `brew bottle $FORMULA`. This outputs the bottle DSL which should be inserted into the formula file. ## Usage
true
Other
Homebrew
brew
9a6cd9b83fc8596727df0157e89faee302907cda.json
docs: fix titles on docs.brew.sh
docs/Brew-Test-Bot-For-Core-Contributors.md
@@ -1,4 +1,5 @@ # Brew Test Bot For Core Contributors + If a build has run and passed on `brew test-bot` then it can be used to quickly bottle formulae. There are two types of Jenkins jobs you will interact with:
true
Other
Homebrew
brew
9a6cd9b83fc8596727df0157e89faee302907cda.json
docs: fix titles on docs.brew.sh
docs/Brew-Test-Bot.md
@@ -1,4 +1,5 @@ # Brew Test Bot + `brew test-bot` is the name for the automated review and testing system funded by [our Kickstarter in 2013](https://www.kickstarter.com/projects/homebrew/brew-test-bot).
true
Other
Homebrew
brew
9a6cd9b83fc8596727df0157e89faee302907cda.json
docs: fix titles on docs.brew.sh
docs/C++-Standard-Libraries.md
@@ -1,4 +1,5 @@ # C++ Standard Libraries + There are two C++ standard libraries supported by Apple compilers. The default for 10.8 and earlier is **libstdc++**, supported by Apple GCC
true
Other
Homebrew
brew
9a6cd9b83fc8596727df0157e89faee302907cda.json
docs: fix titles on docs.brew.sh
docs/Checksum_Deprecation.md
@@ -1,4 +1,5 @@ # MD5 and SHA-1 Deprecation + During early 2015 Homebrew started the process of deprecating _SHA1_ for package integrity verification. Since then every formulae under the Homebrew organisation has been moved onto _SHA256_ verification; this includes both source packages
true
Other
Homebrew
brew
9a6cd9b83fc8596727df0157e89faee302907cda.json
docs: fix titles on docs.brew.sh
docs/Common-Issues.md
@@ -1,4 +1,5 @@ # Common Issues + This is a list of commonly encountered problems, known issues, and their solutions. ### `brew` complains about absence of "Command Line Tools"
true
Other
Homebrew
brew
9a6cd9b83fc8596727df0157e89faee302907cda.json
docs: fix titles on docs.brew.sh
docs/Custom-GCC-and-cross-compilers.md
@@ -1,4 +1,5 @@ # Custom GCC and Cross Compilers + Homebrew depends on having an up-to-date version of Xcode because it comes with specific versions of build tools e.g. `clang`.
true
Other
Homebrew
brew
9a6cd9b83fc8596727df0157e89faee302907cda.json
docs: fix titles on docs.brew.sh
docs/External-Commands.md
@@ -1,4 +1,5 @@ # External Commands + Homebrew, like Git, supports *external commands*. This lets you create new commands that can be run like: ```shell
true
Other
Homebrew
brew
9a6cd9b83fc8596727df0157e89faee302907cda.json
docs: fix titles on docs.brew.sh
docs/Formula-Cookbook.md
@@ -1,4 +1,5 @@ # Formula Cookbook + A formula is a package definition written in Ruby. It can be created with `brew create $URL`, installed with `brew install $FORMULA`, and debugged with `brew install --debug --verbose $FORMULA`. Formulae use the [Formula API](http://www.rubydoc.info/github/Homebrew/brew/master/Formula) which provides various Homebrew-specific helpers. ## Homebrew Terminology
true
Other
Homebrew
brew
9a6cd9b83fc8596727df0157e89faee302907cda.json
docs: fix titles on docs.brew.sh
docs/Gems,-Eggs-and-Perl-Modules.md
@@ -1,4 +1,5 @@ # Gems, Eggs and Perl Modules + On a fresh macOS installation there are three empty directories for add-ons available to all users:
true
Other
Homebrew
brew
9a6cd9b83fc8596727df0157e89faee302907cda.json
docs: fix titles on docs.brew.sh
docs/Homebrew-and-Python.md
@@ -1,4 +1,5 @@ # Python + This page describes how Python is handled in Homebrew for users. See [Python for Formula Authors](Python-for-Formula-Authors.md) for advice on writing formulae to install packages written in Python. Homebrew should work with any [CPython](https://stackoverflow.com/questions/2324208/is-there-any-difference-between-cpython-and-python) and defaults to the macOS system Python.
true
Other
Homebrew
brew
9a6cd9b83fc8596727df0157e89faee302907cda.json
docs: fix titles on docs.brew.sh
docs/How-to-Create-and-Maintain-a-Tap.md
@@ -1,4 +1,5 @@ # How to Create and Maintain a Tap + Taps are external sources of Homebrew formulae and/or external commands. They can be created by anyone to provide their own formulae and/or external commands to any Homebrew user.
true
Other
Homebrew
brew
9a6cd9b83fc8596727df0157e89faee302907cda.json
docs: fix titles on docs.brew.sh
docs/Installation.md
@@ -1,4 +1,5 @@ # Installation + The suggested and easiest way to install Homebrew is on the [homepage](http://brew.sh).
true
Other
Homebrew
brew
9a6cd9b83fc8596727df0157e89faee302907cda.json
docs: fix titles on docs.brew.sh
docs/Interesting-Taps-&-Forks.md
@@ -1,4 +1,5 @@ # Interesting Taps & Forks + A Tap is homebrew-speak for a git repository containing extra formulae. Homebrew has the capability to add (and remove) multiple taps to your local installation with the `brew tap` and `brew untap` command. Type `man brew` in your Terminal. The main repository https://github.com/Homebrew/homebrew-core, often called `homebrew/core`, is always built-in.
true
Other
Homebrew
brew
9a6cd9b83fc8596727df0157e89faee302907cda.json
docs: fix titles on docs.brew.sh
docs/Kickstarter-Supporters.md
@@ -1,4 +1,5 @@ # Kickstarter Supporters + This file contains a list of the awesome people who gave Β£5 or more to [our Kickstarter](https://www.kickstarter.com/projects/homebrew/brew-test-bot).
true
Other
Homebrew
brew
9a6cd9b83fc8596727df0157e89faee302907cda.json
docs: fix titles on docs.brew.sh
docs/Maintainer-Guidelines.md
@@ -1,4 +1,5 @@ # Maintainer Guidelines + **This guide is for maintainers.** These special people have **write access** to Homebrew’s repository and help merge the contributions of others. You may find what is written here interesting, but it’s
true
Other
Homebrew
brew
9a6cd9b83fc8596727df0157e89faee302907cda.json
docs: fix titles on docs.brew.sh
docs/Maintainers-Avoiding-Burnout.md
@@ -1,4 +1,5 @@ # Maintainers: Avoiding Burnout + **This guide is for maintainers.** These special people have **write access** to Homebrew’s repository and help merge the contributions of others. You may find what is written here interesting, but it’s
true
Other
Homebrew
brew
9a6cd9b83fc8596727df0157e89faee302907cda.json
docs: fix titles on docs.brew.sh
docs/Migrating-A-Formula-To-A-Tap.md
@@ -1,4 +1,5 @@ # Migrating A Formula To A Tap + There are times when we may wish to migrate a formula from one tap into another tap. To do this: 1. Create a pull request to the new tap adding the formula file as-is from the original tap. Fix any test failures that may occur due to the stricter requirements for new formulae than existing formula (e.g. `brew audit --strict` must pass for that formula).
true
Other
Homebrew
brew
9a6cd9b83fc8596727df0157e89faee302907cda.json
docs: fix titles on docs.brew.sh
docs/New-Maintainer-Checklist.md
@@ -1,4 +1,5 @@ # New Maintainer Checklist + **This is a guide used by existing maintainers to invite new maintainers. You might find it interesting but there's nothing here users should have to know.** So, there's someone who has been making consistently high-quality contributions to Homebrew for a long time and shown themselves able to make slightly more advanced contributions than just e.g. formula updates? Let's invite them to be a maintainer!
true
Other
Homebrew
brew
9a6cd9b83fc8596727df0157e89faee302907cda.json
docs: fix titles on docs.brew.sh
docs/Querying-Brew.md
@@ -1,4 +1,5 @@ # Querying `brew` + _In this document we will be using [jq](https://stedolan.github.io/jq/) to parse JSON, available from Homebrew using `brew install jq`._ ## Overview
true
Other
Homebrew
brew
9a6cd9b83fc8596727df0157e89faee302907cda.json
docs: fix titles on docs.brew.sh
docs/Versions.md
@@ -1,4 +1,5 @@ # Versions + Now that [Homebrew/versions](https://github.com/homebrew/homebrew-versions) has been deprecated [Homebrew/core](https://github.com/homebrew/homebrew-core) supports multiple versions of formulae with a new naming format. In [Homebrew/versions](https://github.com/homebrew/homebrew-versions) the formula for GCC 6 was named `gcc6.rb` and began `class Gcc6 < Formula`. In [Homebrew/core](https://github.com/homebrew/homebrew-core) this same formula is named `gcc@6.rb` and begins `class GccAT6 < Formula`.
true
Other
Homebrew
brew
9a6cd9b83fc8596727df0157e89faee302907cda.json
docs: fix titles on docs.brew.sh
docs/brew-tap.md
@@ -1,4 +1,5 @@ # Taps (third-party repositories) + `brew tap` adds more repos to the list of formulae that `brew` tracks, updates, and installs from. By default, `tap` assumes that the repos come from GitHub, but the command isn't limited to any one location.
true
Other
Homebrew
brew
a3bffe70bcf33e6051140b1a93c9f48714605af6.json
Use docs.brew.sh links.
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](https://github.com/Homebrew/brew/blob/master/docs/Troubleshooting.md#troubleshooting) +* read [the Troubleshooting Checklist](http://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
a3bffe70bcf33e6051140b1a93c9f48714605af6.json
Use docs.brew.sh links.
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](https://github.com/Homebrew/brew/blob/master/docs/Formula-Cookbook.md) and [Ruby Style Guide](https://github.com/styleguide/ruby) helpful in creating formulae. +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. Good luck!
true
Other
Homebrew
brew
a3bffe70bcf33e6051140b1a93c9f48714605af6.json
Use docs.brew.sh links.
Library/Homebrew/cmd/analytics.rb
@@ -1,6 +1,6 @@ #: * `analytics` [`state`]: #: Display anonymous user behaviour analytics state. -#: Read more at <https://git.io/brew-analytics>. +#: Read more at <http://docs.brew.sh/Analytics.html>. #: #: * `analytics` (`on`|`off`): #: Turn on/off Homebrew's analytics.
true
Other
Homebrew
brew
a3bffe70bcf33e6051140b1a93c9f48714605af6.json
Use docs.brew.sh links.
Library/Homebrew/cmd/help.rb
@@ -16,7 +16,7 @@ Developers: brew create [URL [--no-fetch]] brew edit [FORMULA...] - https://github.com/Homebrew/brew/blob/master/docs/Formula-Cookbook.md + http://docs.brew.sh/Formula-Cookbook.html Further help: man brew
true
Other
Homebrew
brew
a3bffe70bcf33e6051140b1a93c9f48714605af6.json
Use docs.brew.sh links.
Library/Homebrew/cmd/info.rb
@@ -14,7 +14,7 @@ #: information on all installed formulae. #: #: See the docs for examples of using the JSON: -#: <https://github.com/Homebrew/brew/blob/master/docs/Querying-Brew.md> +#: <http://docs.brew.sh/Querying-Brew.html> require "blacklist" require "caveats"
true
Other
Homebrew
brew
a3bffe70bcf33e6051140b1a93c9f48714605af6.json
Use docs.brew.sh links.
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: -#: <https://github.com/Homebrew/brew/blob/master/docs/Querying-Brew.md> +#: <http://docs.brew.sh/Querying-Brew.html> require "tap"
true
Other
Homebrew
brew
a3bffe70bcf33e6051140b1a93c9f48714605af6.json
Use docs.brew.sh links.
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("https://git.io/brew-analytics")}#{Tty.reset} + #{Formatter.url("http://docs.brew.sh/Analytics.html")}#{Tty.reset} EOS
true
Other
Homebrew
brew
a3bffe70bcf33e6051140b1a93c9f48714605af6.json
Use docs.brew.sh links.
Library/Homebrew/dev-cmd/create.rb
@@ -159,7 +159,7 @@ def generate! end def template; <<-EOS.undent - # Documentation: https://github.com/Homebrew/brew/blob/master/docs/Formula-Cookbook.md + # Documentation: http://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
a3bffe70bcf33e6051140b1a93c9f48714605af6.json
Use docs.brew.sh links.
Library/Homebrew/formula.rb
@@ -26,7 +26,7 @@ # @see SharedEnvExtension # @see FileUtils # @see Pathname -# @see https://github.com/Homebrew/brew/blob/master/docs/Formula-Cookbook.md Formula Cookbook +# @see http://docs.brew.sh/Formula-Cookbook.html Formula Cookbook # @see https://github.com/styleguide/ruby Ruby Style Guide # # <pre>class Wget < Formula @@ -2059,7 +2059,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. - # https://github.com/Homebrew/brew/blob/master/docs/Bottles.md + # http://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
a3bffe70bcf33e6051140b1a93c9f48714605af6.json
Use docs.brew.sh links.
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: -<https://github.com/Homebrew/brew/blob/master/docs/External-Commands.md> +<http://docs.brew.sh/External-Commands.html> ## SPECIFYING FORMULAE @@ -197,7 +197,7 @@ can take several different forms: *Default:* the number of available CPU cores. * `HOMEBREW_NO_ANALYTICS`: - If set, Homebrew will not send analytics. See: <https://github.com/Homebrew/brew/blob/master/docs/Analytics.md#analytics> + If set, Homebrew will not send analytics. See: <http://docs.brew.sh/Analytics.html> * `HOMEBREW_NO_AUTO_UPDATE`: If set, Homebrew will not auto-update before running `brew install`,
true
Other
Homebrew
brew
a3bffe70bcf33e6051140b1a93c9f48714605af6.json
Use docs.brew.sh links.
Library/Homebrew/os.rb
@@ -15,7 +15,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 = "https://git.io/brew-troubleshooting".freeze + ISSUES_URL = "http://docs.brew.sh/Troubleshooting.html".freeze end PATH_OPEN = "/usr/bin/open".freeze # compatibility
true