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
20167e5f1b45c486a05d3be4c0b5209d5d1a838d.json
Adjust comments to tidy API docs output.
Library/Homebrew/utils/inreplace.rb
@@ -13,8 +13,9 @@ module Inreplace # prefer a patch but if you need the `prefix` of this formula in the # patch you have to resort to `inreplace`, because in the patch # you don't have access to any var defined by the formula. Only - # HOMEBREW_PREFIX is available in the embedded patch. - # inreplace supports regular expressions. + # `HOMEBREW_PREFIX` is available in the embedded patch. + # + # `inreplace` supports regular expressions: # <pre>inreplace "somefile.cfg", /look[for]what?/, "replace by #{bin}/tool"</pre> def inreplace(paths, before = nil, after = nil, audit_result = true) errors = {}
true
Other
Homebrew
brew
20167e5f1b45c486a05d3be4c0b5209d5d1a838d.json
Adjust comments to tidy API docs output.
Library/Homebrew/utils/shell.rb
@@ -35,7 +35,7 @@ def export_value(key, value, shell = preferred) end end - # return the shell profile file based on users' preferred shell + # return the shell profile file based on user's preferred shell def profile SHELL_PROFILE_MAP.fetch(preferred, "~/.bash_profile") end
true
Other
Homebrew
brew
b7ea9e18306ec0e34b8f3d9bdffba68ee0b3ee7c.json
Allow access to lock directory inside tests.
Library/Homebrew/dev-cmd/test.rb
@@ -87,6 +87,7 @@ def test sandbox.allow_write_log(f) sandbox.allow_write_xcode sandbox.allow_write_path(HOMEBREW_PREFIX/"var/cache") + sandbox.allow_write_path(HOMEBREW_PREFIX/"var/homebrew/locks") sandbox.allow_write_path(HOMEBREW_PREFIX/"var/log") sandbox.allow_write_path(HOMEBREW_PREFIX/"var/run") sandbox.exec(*args)
false
Other
Homebrew
brew
96e5b8d9b156f9538eab34f5281d0f44f9f188bf.json
fix rubocop offences
Library/Homebrew/test/.rubocop_todo.yml
@@ -121,17 +121,6 @@ RSpec/RepeatedDescription: - 'rubocops/lines_cop_spec.rb' - 'tab_spec.rb' -# Offense count: 10 -RSpec/RepeatedExample: - Exclude: - - 'compiler_selector_spec.rb' - - 'utils/shell_spec.rb' - -# Offense count: 2 -RSpec/ScatteredLet: - Exclude: - - 'cask/artifact/uninstall_zap_shared_examples.rb' - # Offense count: 31 RSpec/SubjectStub: Exclude:
true
Other
Homebrew
brew
96e5b8d9b156f9538eab34f5281d0f44f9f188bf.json
fix rubocop offences
Library/Homebrew/test/cask/artifact/uninstall_zap_shared_examples.rb
@@ -158,6 +158,8 @@ let(:glob_path1) { Pathname.new("#{dir}/glob_path1") } let(:glob_path2) { Pathname.new("#{dir}/glob_path2") } let(:paths) { [absolute_path, path_with_tilde, glob_path1, glob_path2] } + let(:fake_system_command) { NeverSudoSystemCommand } + let(:cask) { Cask::CaskLoader.load(cask_path("with-#{artifact_dsl_key}-#{directive}")) } around(:each) do |example| begin @@ -171,9 +173,6 @@ end end - let(:fake_system_command) { NeverSudoSystemCommand } - let(:cask) { Cask::CaskLoader.load(cask_path("with-#{artifact_dsl_key}-#{directive}")) } - before(:each) do allow_any_instance_of(Cask::Artifact::AbstractUninstall).to receive(:trash_paths) .and_wrap_original do |method, *args|
true
Other
Homebrew
brew
96e5b8d9b156f9538eab34f5281d0f44f9f188bf.json
fix rubocop offences
Library/Homebrew/test/compiler_selector_spec.rb
@@ -27,29 +27,10 @@ end describe "#compiler" do - it "raises an error if no matching compiler can be found" do - software_spec.fails_with(:clang) - software_spec.fails_with(:gcc_4_2) - software_spec.fails_with(gcc: "4.8") - software_spec.fails_with(gcc: "4.7") - - expect { subject.compiler }.to raise_error(CompilerSelectionError) - end - it "defaults to cc" do expect(subject.compiler).to eq(cc) end - it "returns gcc if it fails with clang" do - software_spec.fails_with(:clang) - expect(subject.compiler).to eq(:gcc_4_2) - end - - it "returns clang if it fails with gcc" do - software_spec.fails_with(:gcc_4_2) - expect(subject.compiler).to eq(:clang) - end - it "returns clang if it fails with non-Apple gcc" do software_spec.fails_with(gcc: "4.8") expect(subject.compiler).to eq(:clang) @@ -84,23 +65,7 @@ expect(subject.compiler).to eq("gcc-4.7") end - it "prefers gcc" do - software_spec.fails_with(:clang) - software_spec.fails_with(:gcc_4_2) - expect(subject.compiler).to eq("gcc-4.8") - end - - it "raises an error when gcc is missing" do - allow(versions).to receive(:gcc_4_2_build_version).and_return(Version::NULL) - - software_spec.fails_with(:clang) - software_spec.fails_with(gcc: "4.8") - software_spec.fails_with(gcc: "4.7") - - expect { subject.compiler }.to raise_error(CompilerSelectionError) - end - - it "raises an error when llvm and gcc are missing" do + it "raises an error when gcc or llvm is missing" do allow(versions).to receive(:gcc_4_2_build_version).and_return(Version::NULL) software_spec.fails_with(:clang)
true
Other
Homebrew
brew
96e5b8d9b156f9538eab34f5281d0f44f9f188bf.json
fix rubocop offences
Library/Homebrew/test/utils/shell_spec.rb
@@ -7,11 +7,6 @@ expect(subject.profile).to eq("~/.bash_profile") end - it "returns ~/.bash_profile for Sh" do - ENV["SHELL"] = "/bin/another_shell" - expect(subject.profile).to eq("~/.bash_profile") - end - it "returns ~/.bash_profile for Bash" do ENV["SHELL"] = "/bin/bash" expect(subject.profile).to eq("~/.bash_profile")
true
Other
Homebrew
brew
1621eb0b9d296a80fb5190e28c1d2e8721fed030.json
description_cache_store: handle empty database. Don't perform an incremental update from a report or list of formulae if the cache is currently empty. Also, remove some accidentally remaining debugging output.
Library/Homebrew/description_cache_store.rb
@@ -31,6 +31,7 @@ def delete!(formula_name) # @return [nil] def populate_if_empty! return unless database.empty? + Formula.each { |f| update!(f.full_name, f.desc) } end @@ -39,6 +40,7 @@ def populate_if_empty! # @param [Report] report: an update report generated by cmd/update.rb # @return [nil] def update_from_report!(report) + return populate_if_empty! if database.empty? return if report.empty? renamings = report.select_formula(:R) @@ -56,11 +58,12 @@ def update_from_report!(report) # @param [Array] formula_names: the formulae to update. # @return [nil] def update_from_formula_names!(formula_names) + return populate_if_empty! if database.empty? + formula_names.each do |name| begin update!(name, Formula[name].desc) - rescue FormulaUnavailableError, *FormulaVersions::IGNORED_EXCEPTIONS => e - p e + rescue FormulaUnavailableError, *FormulaVersions::IGNORED_EXCEPTIONS delete!(name) end end @@ -71,6 +74,8 @@ def update_from_formula_names!(formula_names) # @param [Array] formula_names: the formulae to delete. # @return [nil] def delete_from_formula_names!(formula_names) + return if database.empty? + formula_names.each(&method(:delete!)) end
true
Other
Homebrew
brew
1621eb0b9d296a80fb5190e28c1d2e8721fed030.json
description_cache_store: handle empty database. Don't perform an incremental update from a report or list of formulae if the cache is currently empty. Also, remove some accidentally remaining debugging output.
Library/Homebrew/test/description_cache_store_spec.rb
@@ -25,6 +25,7 @@ let(:report) { double(select_formula: [], empty?: false) } it "reads from the report" do + expect(database).to receive(:empty?).at_least(:once).and_return(false) cache_store.update_from_report!(report) end end @@ -36,13 +37,15 @@ desc "desc" end expect(Formulary).to receive(:factory).with(f.name).and_return(f) + expect(database).to receive(:empty?).and_return(false) expect(database).to receive(:set).with(f.name, f.desc) cache_store.update_from_formula_names!([f.name]) end end describe "#delete_from_formula_names!" do it "deletes the formulae descriptions" do + expect(database).to receive(:empty?).and_return(false) expect(database).to receive(:delete).with(formula_name) cache_store.delete_from_formula_names!([formula_name]) end
true
Other
Homebrew
brew
4def45f499a327864ff38e81b8959e88db7cea28.json
utils/github_spec: use author that exists.
Library/Homebrew/test/utils/github_spec.rb
@@ -31,9 +31,12 @@ describe "::search_issues", :needs_network do it "queries GitHub issues with the passed parameters" do - results = subject.search_issues("brew search", repo: "Homebrew/brew", author: "avetamine", is: "closed") + results = subject.search_issues("brew search", + repo: "Homebrew/legacy-homebrew", + author: "MikeMcQuaid", + is: "closed") expect(results).not_to be_empty - expect(results.last["title"]).to eq("brew search : 422 Unprocessable Entity") + expect(results.first["title"]).to eq("Shall we run `brew update` automatically?") end end end
false
Other
Homebrew
brew
47dc086129d305fc6e6ef25d8eaf567298a76591.json
README: add moisan to maintainers.
README.md
@@ -44,7 +44,7 @@ Homebrew/brew's other current maintainers are [Claudia](https://github.com/claui Homebrew/brew's Linux support (and Linuxbrew) maintainers are [Michka Popoff](https://github.com/imichka) and [Shaun Jackman](https://github.com/sjackman). -Homebrew/homebrew-core's other current maintainers are [Claudia](https://github.com/claui), [Michka Popoff](https://github.com/imichka), [Shaun Jackman](https://github.com/sjackman), [Chongyu Zhu](https://github.com/lembacon), [commitay](https://github.com/commitay), [Izaak Beekman](https://github.com/zbeekman), [Sean Molenaar](https://github.com/SMillerDev), [Jan Viljanen](https://github.com/javian), [Viktor Szakats](https://github.com/vszakats), [FX Coudert](https://github.com/fxcoudert), [Steven Peters](https://github.com/scpeters), [JCount](https://github.com/jcount), [Misty De Meo](https://github.com/mistydemeo) and [Tom Schoonjans](https://github.com/tschoonj). +Homebrew/homebrew-core's other current maintainers are [Claudia](https://github.com/claui), [Michka Popoff](https://github.com/imichka), [Shaun Jackman](https://github.com/sjackman), [Chongyu Zhu](https://github.com/lembacon), [commitay](https://github.com/commitay), [Izaak Beekman](https://github.com/zbeekman), [Sean Molenaar](https://github.com/SMillerDev), [Jan Viljanen](https://github.com/javian), [Viktor Szakats](https://github.com/vszakats), [FX Coudert](https://github.com/fxcoudert), [Thierry Moisan](https://github.com/moisan), [Steven Peters](https://github.com/scpeters), [JCount](https://github.com/jcount), [Misty De Meo](https://github.com/mistydemeo) and [Tom Schoonjans](https://github.com/tschoonj). Former maintainers with significant contributions include [Dominyk Tiller](https://github.com/DomT4), [Tim Smith](https://github.com/tdsmith), [Baptiste Fontaine](https://github.com/bfontaine), [Xu Cheng](https://github.com/xu-cheng), [Martin Afanasjew](https://github.com/UniqMartin), [Brett Koonce](https://github.com/asparagui), [Charlie Sharpsteen](https://github.com/Sharpie), [Jack Nagel](https://github.com/jacknagel), [Adam Vandenberg](https://github.com/adamv), [Andrew Janke](https://github.com/apjanke), [Alex Dunn](https://github.com/dunn), [neutric](https://github.com/neutric), [Tomasz Pajor](https://github.com/nijikon), [Uladzislau Shablinski](https://github.com/vladshablinsky), [Alyssa Ross](https://github.com/alyssais), [ilovezfs](https://github.com/ilovezfs) and Homebrew's creator: [Max Howell](https://github.com/mxcl).
true
Other
Homebrew
brew
47dc086129d305fc6e6ef25d8eaf567298a76591.json
README: add moisan to maintainers.
docs/Manpage.md
@@ -1298,7 +1298,7 @@ Homebrew/brew's other current maintainers are Claudia, Michka Popoff, Shaun Jack Homebrew/brew's Linux support (and Linuxbrew) maintainers are Michka Popoff and Shaun Jackman. -Homebrew/homebrew-core's other current maintainers are Claudia, Michka Popoff, Shaun Jackman, Chongyu Zhu, commitay, Izaak Beekman, Sean Molenaar, Jan Viljanen, Viktor Szakats, FX Coudert, Steven Peters, JCount, Misty De Meo and Tom Schoonjans. +Homebrew/homebrew-core's other current maintainers are Claudia, Michka Popoff, Shaun Jackman, Chongyu Zhu, commitay, Izaak Beekman, Sean Molenaar, Jan Viljanen, Viktor Szakats, FX Coudert, Thierry Moisan, Steven Peters, JCount, Misty De Meo and Tom Schoonjans. Former maintainers with significant contributions include Dominyk Tiller, Tim Smith, Baptiste Fontaine, Xu Cheng, Martin Afanasjew, Brett Koonce, Charlie Sharpsteen, Jack Nagel, Adam Vandenberg, Andrew Janke, Alex Dunn, neutric, Tomasz Pajor, Uladzislau Shablinski, Alyssa Ross, ilovezfs and Homebrew's creator: Max Howell.
true
Other
Homebrew
brew
47dc086129d305fc6e6ef25d8eaf567298a76591.json
README: add moisan to maintainers.
manpages/brew.1
@@ -1436,7 +1436,7 @@ Homebrew/brew\'s other current maintainers are Claudia, Michka Popoff, Shaun Jac Homebrew/brew\'s Linux support (and Linuxbrew) maintainers are Michka Popoff and Shaun Jackman\. . .P -Homebrew/homebrew\-core\'s other current maintainers are Claudia, Michka Popoff, Shaun Jackman, Chongyu Zhu, commitay, Izaak Beekman, Sean Molenaar, Jan Viljanen, Viktor Szakats, FX Coudert, Steven Peters, JCount, Misty De Meo and Tom Schoonjans\. +Homebrew/homebrew\-core\'s other current maintainers are Claudia, Michka Popoff, Shaun Jackman, Chongyu Zhu, commitay, Izaak Beekman, Sean Molenaar, Jan Viljanen, Viktor Szakats, FX Coudert, Thierry Moisan, Steven Peters, JCount, Misty De Meo and Tom Schoonjans\. . .P Former maintainers with significant contributions include Dominyk Tiller, Tim Smith, Baptiste Fontaine, Xu Cheng, Martin Afanasjew, Brett Koonce, Charlie Sharpsteen, Jack Nagel, Adam Vandenberg, Andrew Janke, Alex Dunn, neutric, Tomasz Pajor, Uladzislau Shablinski, Alyssa Ross, ilovezfs and Homebrew\'s creator: Max Howell\.
true
Other
Homebrew
brew
2a1b936f7697f355f76603ef1984ccbdf4abea9e.json
Clarify HOMEBREW_GITHUB_API_TOKEN in gist-logs err
Library/Homebrew/cmd/gist-logs.rb
@@ -43,7 +43,7 @@ def gistify_logs(f) puts <<~EOS You can create a new personal access token: #{GitHub::ALL_SCOPES_URL} - and then set the new HOMEBREW_GITHUB_API_TOKEN as the authentication method. + #{Utils::Shell.set_variable_in_profile("HOMEBREW_GITHUB_API_TOKEN", "your_token_here")} EOS login!
true
Other
Homebrew
brew
2a1b936f7697f355f76603ef1984ccbdf4abea9e.json
Clarify HOMEBREW_GITHUB_API_TOKEN in gist-logs err
Library/Homebrew/utils/github.rb
@@ -33,7 +33,7 @@ def initialize(reset, github_message) GitHub API Error: #{github_message} Try again in #{pretty_ratelimit_reset(reset)}, or create a personal access token: #{ALL_SCOPES_URL} - and then set the token as: export HOMEBREW_GITHUB_API_TOKEN="your_new_token" + #{Utils::Shell.set_variable_in_profile("HOMEBREW_GITHUB_API_TOKEN", "your_token_here")} EOS end @@ -58,7 +58,7 @@ def initialize(github_message) printf "protocol=https\\nhost=github.com\\n" | git credential-osxkeychain erase Or create a personal access token: #{ALL_SCOPES_URL} - and then set the token as: export HOMEBREW_GITHUB_API_TOKEN="your_new_token" + #{Utils::Shell.set_variable_in_profile("HOMEBREW_GITHUB_API_TOKEN", "your_token_here")} EOS end super message @@ -124,15 +124,15 @@ def api_credentials_error_message(response_headers, needed_scopes) Scopes they need: #{needed_human_scopes} Scopes they have: #{credentials_scopes} Create a personal access token: #{ALL_SCOPES_URL} - and then set HOMEBREW_GITHUB_API_TOKEN as the authentication method instead. + #{Utils::Shell.set_variable_in_profile("HOMEBREW_GITHUB_API_TOKEN", "your_token_here")} EOS when :environment onoe <<~EOS Your HOMEBREW_GITHUB_API_TOKEN does not have sufficient scope! Scopes they need: #{needed_human_scopes} Scopes it has: #{credentials_scopes} Create a new personal access token: #{ALL_SCOPES_URL} - and then set the new HOMEBREW_GITHUB_API_TOKEN as the authentication method instead. + #{Utils::Shell.set_variable_in_profile("HOMEBREW_GITHUB_API_TOKEN", "your_token_here")} EOS end end
true
Other
Homebrew
brew
c2d23838d087b06487c4735f8b4183f0ba1a05f7.json
analytics: fix display of build error options. Currently these are all like `wget #<Options:0x0000000101171658>`.
Library/Homebrew/utils/analytics.rb
@@ -83,7 +83,7 @@ def report_build_error(exception) return if exception.formula.tap.private? action = exception.formula.full_name - if (options = exception.options) + if (options = exception.options&.to_a&.join(" ")) action = "#{action} #{options}".strip end report_event("BuildError", action)
false
Other
Homebrew
brew
fe6b78a3f390a72073b35d164d601bbd84db09a9.json
Use cache_store for descriptions This makes use of both the existing interfaces and could use the existing cache file but we'll create a new one and cleanup the old one to avoid issues and use a more consistent name.
Library/Homebrew/cache_store.rb
@@ -49,6 +49,28 @@ def created? cache_path.exist? end + # Returns the modification time of the cache file (if it already exists). + # + # @return [Time] + def mtime + return unless created? + cache_path.mtime + end + + # Performs a `select` on the underlying database. + # + # @return [Array] + def select(&block) + db.select(&block) + end + + # Returns `true` if the cache is empty. + # + # @return [Boolean] + def empty? + db.empty? + end + private # Lazily loaded database in read/write mode. If this method is called, a @@ -105,14 +127,14 @@ def update!(*) # stored # # @abstract - def fetch_type(*) + def fetch(*) raise NotImplementedError end # Deletes data from the cache based on a condition defined in a concrete class # # @abstract - def flush_cache! + def delete!(*) raise NotImplementedError end
true
Other
Homebrew
brew
fe6b78a3f390a72073b35d164d601bbd84db09a9.json
Use cache_store for descriptions This makes use of both the existing interfaces and could use the existing cache file but we'll create a new one and cleanup the old one to avoid issues and use a more consistent name.
Library/Homebrew/cleanup.rb
@@ -161,7 +161,7 @@ def clean! cleanup_portable_ruby return if dry_run? - cleanup_linkage_db + cleanup_old_cache_db rm_ds_store else args.each do |arg| @@ -325,8 +325,12 @@ def cleanup_portable_ruby end end - def cleanup_linkage_db - FileUtils.rm_rf [cache/"linkage.db", cache/"linkage.db.db"] + def cleanup_old_cache_db + FileUtils.rm_rf [ + cache/"desc_cache.json", + cache/"linkage.db", + cache/"linkage.db.db", + ] end def rm_ds_store(dirs = nil)
true
Other
Homebrew
brew
fe6b78a3f390a72073b35d164d601bbd84db09a9.json
Use cache_store for descriptions This makes use of both the existing interfaces and could use the existing cache file but we'll create a new one and cleanup the old one to avoid issues and use a more consistent name.
Library/Homebrew/cmd/desc.rb
@@ -10,6 +10,7 @@ require "descriptions" require "search" +require "description_cache_store" module Homebrew module_function @@ -21,23 +22,27 @@ def desc search_type << :either if ARGV.flag? "--search" search_type << :name if ARGV.flag? "--name" search_type << :desc if ARGV.flag? "--description" + if search_type.size > 1 + odie "Pick one, and only one, of -s/--search, -n/--name, or -d/--description." + elsif search_type.present? && ARGV.named.empty? + odie "You must provide a search term." + end - if search_type.empty? + results = if search_type.empty? raise FormulaUnspecifiedError if ARGV.named.empty? desc = {} ARGV.formulae.each { |f| desc[f.full_name] = f.desc } - results = Descriptions.new(desc) - results.print - elsif search_type.size > 1 - odie "Pick one, and only one, of -s/--search, -n/--name, or -d/--description." - elsif !ARGV.named.empty? + Descriptions.new(desc) + else arg = ARGV.named.join(" ") string_or_regex = query_regexp(arg) - results = Descriptions.search(string_or_regex, search_type.first) - results.print - else - odie "You must provide a search term." + CacheStoreDatabase.use(:descriptions) do |db| + cache_store = DescriptionCacheStore.new(db) + Descriptions.search(string_or_regex, search_type.first, cache_store) + end end + + results.print end end
true
Other
Homebrew
brew
fe6b78a3f390a72073b35d164d601bbd84db09a9.json
Use cache_store for descriptions This makes use of both the existing interfaces and could use the existing cache file but we'll create a new one and cleanup the old one to avoid issues and use a more consistent name.
Library/Homebrew/cmd/update-report.rb
@@ -8,6 +8,7 @@ require "descriptions" require "cleanup" require "update_migrator" +require "description_cache_store" module Homebrew module_function @@ -127,7 +128,10 @@ def update_report hub.dump hub.reporters.each(&:migrate_tap_migration) hub.reporters.each(&:migrate_formula_rename) - Descriptions.update_cache(hub) + CacheStoreDatabase.use(:descriptions) do |db| + DescriptionCacheStore.new(db) + .update_from_report!(hub) + end end puts if ARGV.include?("--preinstall") end
true
Other
Homebrew
brew
fe6b78a3f390a72073b35d164d601bbd84db09a9.json
Use cache_store for descriptions This makes use of both the existing interfaces and could use the existing cache file but we'll create a new one and cleanup the old one to avoid issues and use a more consistent name.
Library/Homebrew/description_cache_store.rb
@@ -0,0 +1,88 @@ +require "set" +require "cache_store" +require "searchable" + +# +# `DescriptionCacheStore` provides methods to fetch and mutate linkage-specific data used +# by the `brew linkage` command +# +class DescriptionCacheStore < CacheStore + include Searchable + + # Inserts a formula description into the cache if it does not exist or + # updates the formula description if it does exist + # + # @param [String] formula_name: the name of the formula to set + # @param [String] description: the description from the formula to set + # @return [nil] + def update!(formula_name, description) + database.set(formula_name, description) + end + + # Delete the formula description from the `DescriptionCacheStore` + # + # @param [String] formula_name: the name of the formula to delete + # @return [nil] + def delete!(formula_name) + database.delete(formula_name) + end + + # If the database is empty `update!` it with all known formulae. + # @return [nil] + def populate_if_empty! + return unless database.empty? + Formula.each { |f| update!(f.full_name, f.desc) } + end + + # Use an update report to update the `DescriptionCacheStore`. + # + # @param [Report] report: an update report generated by cmd/update.rb + # @return [nil] + def update_from_report!(report) + return if report.empty? + + renamings = report.select_formula(:R) + alterations = report.select_formula(:A) + + report.select_formula(:M) + + renamings.map(&:last) + + update_from_formula_names!(alterations) + delete_from_formula_names!(report.select_formula(:D) + + renamings.map(&:first)) + end + + # Use an array of formulae names to update the `DescriptionCacheStore`. + # + # @param [Array] formula_names: the formulae to update. + # @return [nil] + def update_from_formula_names!(formula_names) + formula_names.each do |name| + begin + update!(name, Formula[name].desc) + rescue FormulaUnavailableError, *FormulaVersions::IGNORED_EXCEPTIONS => e + p e + delete!(name) + end + end + end + + # Use an array of formulae names to delete them from the `DescriptionCacheStore`. + # + # @param [Array] formula_names: the formulae to delete. + # @return [nil] + def delete_from_formula_names!(formula_names) + formula_names.each(&method(:delete!)) + end + + private + + # Not implemented; access is through `Searchable`. + def fetch + super + end + + # `select` from the underlying database. + def select(&block) + database.select(&block) + end +end
true
Other
Homebrew
brew
fe6b78a3f390a72073b35d164d601bbd84db09a9.json
Use cache_store for descriptions This makes use of both the existing interfaces and could use the existing cache file but we'll create a new one and cleanup the old one to avoid issues and use a more consistent name.
Library/Homebrew/descriptions.rb
@@ -6,113 +6,17 @@ class Descriptions extend Homebrew::Search - CACHE_FILE = HOMEBREW_CACHE + "desc_cache.json" - - def self.cache - @cache || load_cache - end - - # If the cache file exists, load it into, and return, a hash; otherwise, - # return nil. - def self.load_cache - @cache = JSON.parse(CACHE_FILE.read) if CACHE_FILE.exist? - end - - # Write the cache to disk after ensuring the existence of the containing - # directory. - def self.save_cache - HOMEBREW_CACHE.mkpath - CACHE_FILE.atomic_write JSON.dump(@cache) - end - - # Create a hash mapping all formulae to their descriptions; - # save it for future use. - def self.generate_cache - @cache = {} - Formula.each do |f| - @cache[f.full_name] = f.desc - end - save_cache - end - - # Return true if the cache exists, and none of the Taps - # repos were updated more recently than it was. - def self.cache_fresh? - return false unless CACHE_FILE.exist? - - cache_mtime = File.mtime(CACHE_FILE) - - Tap.each do |tap| - next unless tap.git? - - repo_mtime = File.mtime(tap.path/".git/refs/heads/master") - return false if repo_mtime > cache_mtime - end - - true - end - - # Create the cache if it doesn't already exist. - def self.ensure_cache - generate_cache unless cache_fresh? && cache - end - - # Take a {Report}, as generated by cmd/update.rb. - # Unless the cache file exists, do nothing. - # If it does exist, but the Report is empty, just touch the cache file. - # Otherwise, use the report to update the cache. - def self.update_cache(report) - return unless CACHE_FILE.exist? - - if report.empty? - FileUtils.touch CACHE_FILE - else - renamings = report.select_formula(:R) - alterations = report.select_formula(:A) + report.select_formula(:M) + - renamings.map(&:last) - cache_formulae(alterations, save: false) - uncache_formulae(report.select_formula(:D) + - renamings.map(&:first)) - end - end - - # Given an array of formula names, add them and their descriptions to the - # cache. Save the updated cache to disk, unless explicitly told not to. - def self.cache_formulae(formula_names, options = { save: true }) - return unless cache - - formula_names.each do |name| - begin - @cache[name] = Formulary.factory(name).desc - rescue FormulaUnavailableError, *FormulaVersions::IGNORED_EXCEPTIONS - @cache.delete(name) - end - end - save_cache if options[:save] - end - - # Given an array of formula names, remove them and their descriptions from - # the cache. Save the updated cache to disk, unless explicitly told not to. - def self.uncache_formulae(formula_names, options = { save: true }) - return unless cache - - formula_names.each { |name| @cache.delete(name) } - save_cache if options[:save] - end - # Given a regex, find all formulae whose specified fields contain a match. - def self.search(string_or_regex, field = :either) - ensure_cache - - @cache.extend(Searchable) + def self.search(string_or_regex, field, cache_store) + cache_store.populate_if_empty! results = case field when :name - @cache.search(string_or_regex) { |name, _| name } + cache_store.search(string_or_regex) { |name, _| name } when :desc - @cache.search(string_or_regex) { |_, desc| desc } + cache_store.search(string_or_regex) { |_, desc| desc } when :either - @cache.search(string_or_regex) + cache_store.search(string_or_regex) end new(results) @@ -129,7 +33,11 @@ def print blank = Formatter.warning("[no description]") @descriptions.keys.sort.each do |full_name| short_name = short_names[full_name] - printed_name = (short_name_counts[short_name] == 1) ? short_name : full_name + printed_name = if short_name_counts[short_name] == 1 + short_name + else + full_name + end description = @descriptions[full_name] || blank puts "#{Tty.bold}#{printed_name}:#{Tty.reset} #{description}" end @@ -143,6 +51,9 @@ def short_names def short_name_counts @short_name_counts ||= - short_names.values.each_with_object(Hash.new(0)) { |name, counts| counts[name] += 1 } + short_names.values + .each_with_object(Hash.new(0)) do |name, counts| + counts[name] += 1 + end end end
true
Other
Homebrew
brew
fe6b78a3f390a72073b35d164d601bbd84db09a9.json
Use cache_store for descriptions This makes use of both the existing interfaces and could use the existing cache file but we'll create a new one and cleanup the old one to avoid issues and use a more consistent name.
Library/Homebrew/keg.rb
@@ -303,7 +303,7 @@ def uninstall CacheStoreDatabase.use(:linkage) do |db| break unless db.created? - LinkageCacheStore.new(path, db).flush_cache! + LinkageCacheStore.new(path, db).delete! end path.rmtree
true
Other
Homebrew
brew
fe6b78a3f390a72073b35d164d601bbd84db09a9.json
Use cache_store for descriptions This makes use of both the existing interfaces and could use the existing cache file but we'll create a new one and cleanup the old one to avoid issues and use a more consistent name.
Library/Homebrew/linkage_cache_store.rb
@@ -41,7 +41,7 @@ def update!(hash_values) # @param [Symbol] the type to fetch from the `LinkageCacheStore` # @raise [TypeError] error if the type is not in `HASH_LINKAGE_TYPES` # @return [Hash] - def fetch_type(type) + def fetch(type) unless HASH_LINKAGE_TYPES.include?(type) raise TypeError, <<~EOS Can't fetch types that are not defined for the linkage store @@ -53,8 +53,10 @@ def fetch_type(type) fetch_hash_values(type) end + # Delete the keg from the `LinkageCacheStore` + # # @return [nil] - def flush_cache! + def delete! database.delete(@keg_path) end
true
Other
Homebrew
brew
fe6b78a3f390a72073b35d164d601bbd84db09a9.json
Use cache_store for descriptions This makes use of both the existing interfaces and could use the existing cache file but we'll create a new one and cleanup the old one to avoid issues and use a more consistent name.
Library/Homebrew/linkage_checker.rb
@@ -79,9 +79,9 @@ def check_dylibs(rebuild_cache:) keg_files_dylibs = nil if rebuild_cache - store&.flush_cache! + store&.delete! else - keg_files_dylibs = store&.fetch_type(:keg_files_dylibs) + keg_files_dylibs = store&.fetch(:keg_files_dylibs) end keg_files_dylibs_was_empty = false
true
Other
Homebrew
brew
fe6b78a3f390a72073b35d164d601bbd84db09a9.json
Use cache_store for descriptions This makes use of both the existing interfaces and could use the existing cache file but we'll create a new one and cleanup the old one to avoid issues and use a more consistent name.
Library/Homebrew/search.rb
@@ -1,4 +1,5 @@ require "searchable" +require "description_cache_store" module Homebrew module Search @@ -14,7 +15,10 @@ def query_regexp(query) def search_descriptions(string_or_regex) ohai "Formulae" - Descriptions.search(string_or_regex, :desc).print + CacheStoreDatabase.use(:descriptions) do |db| + cache_store = DescriptionCacheStore.new(db) + Descriptions.search(string_or_regex, :desc, cache_store).print + end end def search_taps(query, silent: false)
true
Other
Homebrew
brew
fe6b78a3f390a72073b35d164d601bbd84db09a9.json
Use cache_store for descriptions This makes use of both the existing interfaces and could use the existing cache file but we'll create a new one and cleanup the old one to avoid issues and use a more consistent name.
Library/Homebrew/tap.rb
@@ -1,5 +1,6 @@ require "extend/cachable" require "readall" +require "description_cache_store" # a {Tap} is used to extend the formulae provided by Homebrew core. # Usually, it's synced with a remote git repository. And it's likely @@ -299,7 +300,10 @@ def install(options = {}) formatted_contents = contents.presence&.to_sentence&.dup&.prepend(" ") puts "Tapped#{formatted_contents} (#{path.abv})." unless quiet - Descriptions.cache_formulae(formula_names) + CacheStoreDatabase.use(:descriptions) do |db| + DescriptionCacheStore.new(db) + .update_from_formula_names!(formula_names) + end return if options[:clone_target] return unless private? @@ -331,7 +335,10 @@ def uninstall formatted_contents = contents.presence&.to_sentence&.dup&.prepend(" ") unpin if pinned? - Descriptions.uncache_formulae(formula_names) + CacheStoreDatabase.use(:descriptions) do |db| + DescriptionCacheStore.new(db) + .delete_from_formula_names!(formula_names) + end Utils::Link.unlink_manpages(path) Utils::Link.unlink_completions(path) path.rmtree
true
Other
Homebrew
brew
fe6b78a3f390a72073b35d164d601bbd84db09a9.json
Use cache_store for descriptions This makes use of both the existing interfaces and could use the existing cache file but we'll create a new one and cleanup the old one to avoid issues and use a more consistent name.
Library/Homebrew/test/cmd/desc_spec.rb
@@ -1,6 +1,4 @@ describe "brew desc", :integration_test do - let(:desc_cache) { HOMEBREW_CACHE/"desc_cache.json" } - it "shows a given Formula's description" do setup_test_formula "testball" @@ -9,14 +7,4 @@ .and not_to_output.to_stderr .and be_a_success end - - describe "--description" do - it "creates a description cache" do - expect(desc_cache).not_to exist - - expect { brew "desc", "--description", "testball" }.to be_a_success - - expect(desc_cache).to exist - end - end end
true
Other
Homebrew
brew
fe6b78a3f390a72073b35d164d601bbd84db09a9.json
Use cache_store for descriptions This makes use of both the existing interfaces and could use the existing cache file but we'll create a new one and cleanup the old one to avoid issues and use a more consistent name.
Library/Homebrew/test/cmd/search_spec.rb
@@ -34,7 +34,7 @@ end describe "--desc" do - let(:desc_cache) { HOMEBREW_CACHE/"desc_cache.json" } + let(:desc_cache) { HOMEBREW_CACHE/"descriptions.json" } it "supports searching in descriptions and creates a description cache" do expect(desc_cache).not_to exist
true
Other
Homebrew
brew
fe6b78a3f390a72073b35d164d601bbd84db09a9.json
Use cache_store for descriptions This makes use of both the existing interfaces and could use the existing cache file but we'll create a new one and cleanup the old one to avoid issues and use a more consistent name.
Library/Homebrew/test/description_cache_store_spec.rb
@@ -0,0 +1,50 @@ +require "description_cache_store" + +describe DescriptionCacheStore do + subject(:cache_store) { described_class.new(database) } + + let(:database) { double("database") } + let(:formula_name) { "test_name" } + let(:description) { "test_description" } + + describe "#update!" do + it "sets the formula description" do + expect(database).to receive(:set).with(formula_name, description) + cache_store.update!(formula_name, description) + end + end + + describe "#delete!" do + it "deletes the formula description" do + expect(database).to receive(:delete).with(formula_name) + cache_store.delete!(formula_name) + end + end + + describe "#update_from_report!" do + let(:report) { double(select_formula: [], empty?: false) } + + it "reads from the report" do + cache_store.update_from_report!(report) + end + end + + describe "#update_from_formula_names!" do + it "sets the formulae descriptions" do + f = formula do + url "url-1" + desc "desc" + end + expect(Formulary).to receive(:factory).with(f.name).and_return(f) + expect(database).to receive(:set).with(f.name, f.desc) + cache_store.update_from_formula_names!([f.name]) + end + end + + describe "#delete_from_formula_names!" do + it "deletes the formulae descriptions" do + expect(database).to receive(:delete).with(formula_name) + cache_store.delete_from_formula_names!([formula_name]) + end + end +end
true
Other
Homebrew
brew
fe6b78a3f390a72073b35d164d601bbd84db09a9.json
Use cache_store for descriptions This makes use of both the existing interfaces and could use the existing cache file but we'll create a new one and cleanup the old one to avoid issues and use a more consistent name.
Library/Homebrew/test/linkage_cache_store_spec.rb
@@ -43,27 +43,27 @@ end end - describe "#flush_cache!" do + describe "#delete!" do it "calls `delete` on the `database` with `keg_name` as parameter" do expect(database).to receive(:delete).with(keg_name) - subject.flush_cache! + subject.delete! end end - describe "#fetch_type" do + describe "#fetch" do context "`HASH_LINKAGE_TYPES.include?(type)`" do before do expect(database).to receive(:get).with(keg_name).and_return(nil) end it "returns a `Hash` of values" do - expect(subject.fetch_type(:keg_files_dylibs)).to be_an_instance_of(Hash) + expect(subject.fetch(:keg_files_dylibs)).to be_an_instance_of(Hash) end end context "`type` not in `HASH_LINKAGE_TYPES`" do it "raises a `TypeError` if the `type` is not supported" do - expect { subject.fetch_type(:bad_type) }.to raise_error(TypeError) + expect { subject.fetch(:bad_type) }.to raise_error(TypeError) end end end
true
Other
Homebrew
brew
6b8724431fb73b75f003064cb4b70c20e9e665e0.json
cli_parser: improve help text formatting - reduce desc_line_length so `brew help` output fits in 80 columns - support special formatting across line breaks - support emphasis using asterisks - add missing depends_on: tests
Library/Homebrew/cli_parser.rb
@@ -28,13 +28,13 @@ def initialize(&block) @constraints = [] @conflicts = [] @processed_options = [] - @desc_line_length = 48 + @desc_line_length = 43 instance_eval(&block) post_initialize end def post_initialize - @parser.on_tail("-h", "--help", "Show this message") do + @parser.on_tail("-h", "--help", "Show this message.") do puts generate_help_text exit 0 end @@ -127,9 +127,10 @@ def global_option?(name) def generate_help_text @parser.to_s.sub(/^/, "#{Tty.bold}Usage: brew#{Tty.reset} ") - .gsub(/`(.*?)`/, "#{Tty.bold}\\1#{Tty.reset}") + .gsub(/`(.*?)`/m, "#{Tty.bold}\\1#{Tty.reset}") .gsub(%r{<([^\s]+?://[^\s]+?)>}) { |url| Formatter.url(url) } - .gsub(/<(.*?)>/, "#{Tty.underline}\\1#{Tty.reset}") + .gsub(/<(.*?)>/m, "#{Tty.underline}\\1#{Tty.reset}") + .gsub(/\*(.*?)\*/m, "#{Tty.underline}\\1#{Tty.reset}") end private
true
Other
Homebrew
brew
6b8724431fb73b75f003064cb4b70c20e9e665e0.json
cli_parser: improve help text formatting - reduce desc_line_length so `brew help` output fits in 80 columns - support special formatting across line breaks - support emphasis using asterisks - add missing depends_on: tests
Library/Homebrew/help.rb
@@ -93,6 +93,7 @@ def command_help(path) .gsub(/`(.*?)`/, "#{Tty.bold}\\1#{Tty.reset}") .gsub(%r{<([^\s]+?://[^\s]+?)>}) { |url| Formatter.url(url) } .gsub(/<(.*?)>/, "#{Tty.underline}\\1#{Tty.reset}") + .gsub(/\*(.*?)\*/, "#{Tty.underline}\\1#{Tty.reset}") .gsub("@hide_from_man_page", "") end.join.strip end
true
Other
Homebrew
brew
6b8724431fb73b75f003064cb4b70c20e9e665e0.json
cli_parser: improve help text formatting - reduce desc_line_length so `brew help` output fits in 80 columns - support special formatting across line breaks - support emphasis using asterisks - add missing depends_on: tests
Library/Homebrew/test/cli_parser_spec.rb
@@ -89,6 +89,7 @@ it "raises exception on depends_on constraint violation" do expect { parser.parse(["--flag2=flag2"]) }.to raise_error(Homebrew::CLI::OptionConstraintError) + expect { parser.parse(["--flag4=flag4"]) }.to raise_error(Homebrew::CLI::OptionConstraintError) end it "raises exception for conflict violation" do @@ -139,6 +140,7 @@ it "raises exception on depends_on constraint violation" do expect { parser.parse(["--switch-c"]) }.to raise_error(Homebrew::CLI::OptionConstraintError) + expect { parser.parse(["--switch-d"]) }.to raise_error(Homebrew::CLI::OptionConstraintError) end it "raises exception for conflict violation" do
true
Other
Homebrew
brew
ab851640a48f9863d339552a3995bb4285ad72fe.json
azure-pipelines.yml: use xcode 10
azure-pipelines.yml
@@ -4,6 +4,7 @@ jobs: vmImage: xcode9-macos10.13 steps: - bash: | + sudo xcode-select --switch /Applications/Xcode_10.app/Contents/Developer HOMEBREW_REPOSITORY="$(brew --repo)" mv "$HOMEBREW_REPOSITORY/Library/Taps" "$PWD/Library" sudo rm -rf "$HOMEBREW_REPOSITORY"
false
Other
Homebrew
brew
70fc2af6470acd116d24882bb1cbb922b40e2d73.json
Cask: fix all homepages now that they are audited
Library/Homebrew/test/cask/cmd/home_spec.rb
@@ -8,13 +8,13 @@ it_behaves_like "a command that handles invalid options" it "opens the homepage for the specified Cask" do - expect(described_class).to receive(:open_url).with("https://example.com/local-caffeine") + expect(described_class).to receive(:open_url).with("https://example.com") described_class.run("local-caffeine") end it "works for multiple Casks" do - expect(described_class).to receive(:open_url).with("https://example.com/local-caffeine") - expect(described_class).to receive(:open_url).with("https://example.com/local-transmission") + expect(described_class).to receive(:open_url).with("https://example.com") + expect(described_class).to receive(:open_url).with("https://example.com") described_class.run("local-caffeine", "local-transmission") end
true
Other
Homebrew
brew
70fc2af6470acd116d24882bb1cbb922b40e2d73.json
Cask: fix all homepages now that they are audited
Library/Homebrew/test/cask/cmd/info_spec.rb
@@ -10,7 +10,7 @@ described_class.run("local-caffeine") }.to output(<<~EOS).to_stdout local-caffeine: 1.2.3 - https://example.com/local-caffeine + https://example.com Not installed From: https://github.com/Homebrew/homebrew-cask/blob/master/Casks/local-caffeine.rb ==> Name @@ -39,15 +39,15 @@ let(:expected_output) { <<~EOS local-caffeine: 1.2.3 - https://example.com/local-caffeine + https://example.com Not installed From: https://github.com/Homebrew/homebrew-cask/blob/master/Casks/local-caffeine.rb ==> Name None ==> Artifacts Caffeine.app (App) local-transmission: 2.61 - https://example.com/local-transmission + https://example.com Not installed From: https://github.com/Homebrew/homebrew-cask/blob/master/Casks/local-transmission.rb ==> Name @@ -69,7 +69,7 @@ described_class.run("with-caveats") }.to output(<<~EOS).to_stdout with-caveats: 1.2.3 - https://example.com/local-caffeine + https://example.com Not installed From: https://github.com/Homebrew/homebrew-cask/blob/master/Casks/with-caveats.rb ==> Name @@ -95,7 +95,7 @@ described_class.run("with-conditional-caveats") }.to output(<<~EOS).to_stdout with-conditional-caveats: 1.2.3 - https://example.com/local-caffeine + https://example.com Not installed From: https://github.com/Homebrew/homebrew-cask/blob/master/Casks/with-conditional-caveats.rb ==> Name @@ -110,7 +110,7 @@ described_class.run("with-languages") }.to output(<<~EOS).to_stdout with-languages: 1.2.3 - https://example.com/local-caffeine + https://example.com Not installed From: https://github.com/Homebrew/homebrew-cask/blob/master/Casks/with-languages.rb ==> Name @@ -127,7 +127,7 @@ described_class.run("without-languages") }.to output(<<~EOS).to_stdout without-languages: 1.2.3 - https://example.com/local-caffeine + https://example.com Not installed From: https://github.com/Homebrew/homebrew-cask/blob/master/Casks/without-languages.rb ==> Name
true
Other
Homebrew
brew
70fc2af6470acd116d24882bb1cbb922b40e2d73.json
Cask: fix all homepages now that they are audited
Library/Homebrew/test/cask/cmd/internal_stanza_spec.rb
@@ -3,7 +3,7 @@ command = described_class.new("homepage", "local-caffeine") expect { command.run - }.to output("https://example.com/local-caffeine\n").to_stdout + }.to output("https://example.com\n").to_stdout end it "raises an exception when stanza is unknown/unsupported" do
true
Other
Homebrew
brew
70fc2af6470acd116d24882bb1cbb922b40e2d73.json
Cask: fix all homepages now that they are audited
Library/Homebrew/test/support/fixtures/cask/Casks/bad-checksum.rb
@@ -3,7 +3,7 @@ sha256 'badbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadb' url "file://#{TEST_FIXTURE_DIR}/cask/caffeine.zip" - homepage 'https://example.com/local-caffeine' + homepage 'https://example.com' app 'Caffeine.app' end
true
Other
Homebrew
brew
70fc2af6470acd116d24882bb1cbb922b40e2d73.json
Cask: fix all homepages now that they are audited
Library/Homebrew/test/support/fixtures/cask/Casks/installer-with-uninstall.rb
@@ -3,7 +3,7 @@ sha256 '67cdb8a02803ef37fdbf7e0be205863172e41a561ca446cd84f0d7ab35a99d94' url "file://#{TEST_FIXTURE_DIR}/cask/caffeine.zip" - homepage 'https://example.com/local-caffeine' + homepage 'https://example.com' installer manual: 'Caffeine.app'
true
Other
Homebrew
brew
70fc2af6470acd116d24882bb1cbb922b40e2d73.json
Cask: fix all homepages now that they are audited
Library/Homebrew/test/support/fixtures/cask/Casks/invalid/invalid-header-format.rb
@@ -3,7 +3,7 @@ sha256 '67cdb8a02803ef37fdbf7e0be205863172e41a561ca446cd84f0d7ab35a99d94' url "file://#{TEST_FIXTURE_DIR}/cask/caffeine.zip" - homepage 'https://example.com/local-caffeine' + homepage 'https://example.com' app 'Caffeine.app' end
true
Other
Homebrew
brew
70fc2af6470acd116d24882bb1cbb922b40e2d73.json
Cask: fix all homepages now that they are audited
Library/Homebrew/test/support/fixtures/cask/Casks/invalid/invalid-header-token-mismatch.rb
@@ -3,7 +3,7 @@ sha256 '67cdb8a02803ef37fdbf7e0be205863172e41a561ca446cd84f0d7ab35a99d94' url "file://#{TEST_FIXTURE_DIR}/cask/caffeine.zip" - homepage 'https://example.com/local-caffeine' + homepage 'https://example.com' app 'Caffeine.app' end
true
Other
Homebrew
brew
70fc2af6470acd116d24882bb1cbb922b40e2d73.json
Cask: fix all homepages now that they are audited
Library/Homebrew/test/support/fixtures/cask/Casks/invalid/invalid-header-version.rb
@@ -3,7 +3,7 @@ sha256 '67cdb8a02803ef37fdbf7e0be205863172e41a561ca446cd84f0d7ab35a99d94' url "file://#{TEST_FIXTURE_DIR}/cask/caffeine.zip" - homepage 'https://example.com/local-caffeine' + homepage 'https://example.com' app 'Caffeine.app' end
true
Other
Homebrew
brew
70fc2af6470acd116d24882bb1cbb922b40e2d73.json
Cask: fix all homepages now that they are audited
Library/Homebrew/test/support/fixtures/cask/Casks/invalid/invalid-two-homepage.rb
@@ -3,7 +3,7 @@ sha256 '67cdb8a02803ef37fdbf7e0be205863172e41a561ca446cd84f0d7ab35a99d94' url "file://#{TEST_FIXTURE_DIR}/cask/caffeine.zip" - homepage 'https://example.com/local-caffeine' + homepage 'https://example.com' homepage 'https://www.example.com/local-caffeine' app 'Caffeine.app'
true
Other
Homebrew
brew
70fc2af6470acd116d24882bb1cbb922b40e2d73.json
Cask: fix all homepages now that they are audited
Library/Homebrew/test/support/fixtures/cask/Casks/invalid/invalid-two-url.rb
@@ -4,7 +4,7 @@ url "file://#{TEST_FIXTURE_DIR}/cask/caffeine.zip" url 'https://example.com/caffeine.zip' - homepage 'https://example.com/local-caffeine' + homepage 'https://example.com' app 'Caffeine.app' end
true
Other
Homebrew
brew
70fc2af6470acd116d24882bb1cbb922b40e2d73.json
Cask: fix all homepages now that they are audited
Library/Homebrew/test/support/fixtures/cask/Casks/invalid/invalid-two-version.rb
@@ -4,7 +4,7 @@ sha256 '67cdb8a02803ef37fdbf7e0be205863172e41a561ca446cd84f0d7ab35a99d94' url "file://#{TEST_FIXTURE_DIR}/cask/caffeine.zip" - homepage 'https://example.com/local-caffeine' + homepage 'https://example.com' app 'Caffeine.app' end
true
Other
Homebrew
brew
70fc2af6470acd116d24882bb1cbb922b40e2d73.json
Cask: fix all homepages now that they are audited
Library/Homebrew/test/support/fixtures/cask/Casks/local-caffeine.rb
@@ -3,7 +3,7 @@ sha256 '67cdb8a02803ef37fdbf7e0be205863172e41a561ca446cd84f0d7ab35a99d94' url "file://#{TEST_FIXTURE_DIR}/cask/caffeine.zip" - homepage 'https://example.com/local-caffeine' + homepage 'https://example.com' app 'Caffeine.app' end
true
Other
Homebrew
brew
70fc2af6470acd116d24882bb1cbb922b40e2d73.json
Cask: fix all homepages now that they are audited
Library/Homebrew/test/support/fixtures/cask/Casks/local-transmission.rb
@@ -4,7 +4,7 @@ sha256 'e44ffa103fbf83f55c8d0b1bea309a43b2880798dae8620b1ee8da5e1095ec68' url "file://#{TEST_FIXTURE_DIR}/cask/transmission-2.61.dmg" - homepage 'https://example.com/local-transmission' + homepage 'https://example.com' app 'Transmission.app' end
true
Other
Homebrew
brew
70fc2af6470acd116d24882bb1cbb922b40e2d73.json
Cask: fix all homepages now that they are audited
Library/Homebrew/test/support/fixtures/cask/Casks/missing-checksum.rb
@@ -2,7 +2,7 @@ version '1.2.3' url "file://#{TEST_FIXTURE_DIR}/cask/caffeine.zip" - homepage 'https://example.com/local-caffeine' + homepage 'https://example.com' app 'Caffeine.app' end
true
Other
Homebrew
brew
70fc2af6470acd116d24882bb1cbb922b40e2d73.json
Cask: fix all homepages now that they are audited
Library/Homebrew/test/support/fixtures/cask/Casks/no-checksum.rb
@@ -3,7 +3,7 @@ sha256 :no_check url "file://#{TEST_FIXTURE_DIR}/cask/caffeine.zip" - homepage 'https://example.com/local-caffeine' + homepage 'https://example.com' app 'Caffeine.app' end
true
Other
Homebrew
brew
70fc2af6470acd116d24882bb1cbb922b40e2d73.json
Cask: fix all homepages now that they are audited
Library/Homebrew/test/support/fixtures/cask/Casks/outdated/bad-checksum.rb
@@ -3,7 +3,7 @@ sha256 '67cdb8a02803ef37fdbf7e0be205863172e41a561ca446cd84f0d7ab35a99d94' url "file://#{TEST_FIXTURE_DIR}/cask/caffeine.zip" - homepage 'https://example.com/local-caffeine' + homepage 'https://example.com' app 'Caffeine.app' end
true
Other
Homebrew
brew
70fc2af6470acd116d24882bb1cbb922b40e2d73.json
Cask: fix all homepages now that they are audited
Library/Homebrew/test/support/fixtures/cask/Casks/outdated/local-caffeine.rb
@@ -3,7 +3,7 @@ sha256 '67cdb8a02803ef37fdbf7e0be205863172e41a561ca446cd84f0d7ab35a99d94' url "file://#{TEST_FIXTURE_DIR}/cask/caffeine.zip" - homepage 'https://example.com/local-caffeine' + homepage 'https://example.com' app 'Caffeine.app' end
true
Other
Homebrew
brew
70fc2af6470acd116d24882bb1cbb922b40e2d73.json
Cask: fix all homepages now that they are audited
Library/Homebrew/test/support/fixtures/cask/Casks/outdated/local-transmission.rb
@@ -3,7 +3,7 @@ sha256 'e44ffa103fbf83f55c8d0b1bea309a43b2880798dae8620b1ee8da5e1095ec68' url "file://#{TEST_FIXTURE_DIR}/cask/transmission-2.61.dmg" - homepage 'https://example.com/local-transmission' + homepage 'https://example.com' app 'Transmission.app' end
true
Other
Homebrew
brew
70fc2af6470acd116d24882bb1cbb922b40e2d73.json
Cask: fix all homepages now that they are audited
Library/Homebrew/test/support/fixtures/cask/Casks/outdated/version-latest.rb
@@ -3,7 +3,7 @@ sha256 :no_check url "file://#{TEST_FIXTURE_DIR}/cask/caffeines.zip" - homepage 'https://example.com/local-caffeine' + homepage 'https://example.com' app 'Caffeine Mini.app' app 'Caffeine Pro.app'
true
Other
Homebrew
brew
70fc2af6470acd116d24882bb1cbb922b40e2d73.json
Cask: fix all homepages now that they are audited
Library/Homebrew/test/support/fixtures/cask/Casks/version-latest.rb
@@ -3,7 +3,7 @@ sha256 :no_check url "file://#{TEST_FIXTURE_DIR}/cask/caffeines.zip" - homepage 'https://example.com/local-caffeine' + homepage 'https://example.com' app 'Caffeine Mini.app' app 'Caffeine Pro.app'
true
Other
Homebrew
brew
70fc2af6470acd116d24882bb1cbb922b40e2d73.json
Cask: fix all homepages now that they are audited
Library/Homebrew/test/support/fixtures/cask/Casks/will-fail-if-upgraded.rb
@@ -3,7 +3,7 @@ sha256 'e44ffa103fbf83f55c8d0b1bea309a43b2880798dae8620b1ee8da5e1095ec68' url "file://#{TEST_FIXTURE_DIR}/cask/transmission-2.61.dmg" - homepage 'https://example.com/local-transmission' + homepage 'https://example.com' app 'container' end
true
Other
Homebrew
brew
70fc2af6470acd116d24882bb1cbb922b40e2d73.json
Cask: fix all homepages now that they are audited
Library/Homebrew/test/support/fixtures/cask/Casks/with-alt-target.rb
@@ -3,7 +3,7 @@ sha256 '67cdb8a02803ef37fdbf7e0be205863172e41a561ca446cd84f0d7ab35a99d94' url "file://#{TEST_FIXTURE_DIR}/cask/caffeine.zip" - homepage 'https://example.com/local-caffeine' + homepage 'https://example.com' app 'Caffeine.app', target: 'AnotherName.app' end
true
Other
Homebrew
brew
70fc2af6470acd116d24882bb1cbb922b40e2d73.json
Cask: fix all homepages now that they are audited
Library/Homebrew/test/support/fixtures/cask/Casks/with-caveats.rb
@@ -3,7 +3,7 @@ sha256 '67cdb8a02803ef37fdbf7e0be205863172e41a561ca446cd84f0d7ab35a99d94' url "file://#{TEST_FIXTURE_DIR}/cask/caffeine.zip" - homepage 'https://example.com/local-caffeine' + homepage 'https://example.com' app 'Caffeine.app'
true
Other
Homebrew
brew
70fc2af6470acd116d24882bb1cbb922b40e2d73.json
Cask: fix all homepages now that they are audited
Library/Homebrew/test/support/fixtures/cask/Casks/with-conditional-caveats.rb
@@ -3,7 +3,7 @@ sha256 '67cdb8a02803ef37fdbf7e0be205863172e41a561ca446cd84f0d7ab35a99d94' url "file://#{TEST_FIXTURE_DIR}/cask/caffeine.zip" - homepage 'https://example.com/local-caffeine' + homepage 'https://example.com' app 'Caffeine.app'
true
Other
Homebrew
brew
70fc2af6470acd116d24882bb1cbb922b40e2d73.json
Cask: fix all homepages now that they are audited
Library/Homebrew/test/support/fixtures/cask/Casks/with-installer-manual.rb
@@ -3,7 +3,7 @@ sha256 '67cdb8a02803ef37fdbf7e0be205863172e41a561ca446cd84f0d7ab35a99d94' url "file://#{TEST_FIXTURE_DIR}/cask/caffeine.zip" - homepage 'https://example.com/local-caffeine' + homepage 'https://example.com' installer manual: 'Caffeine.app' end
true
Other
Homebrew
brew
70fc2af6470acd116d24882bb1cbb922b40e2d73.json
Cask: fix all homepages now that they are audited
Library/Homebrew/test/support/fixtures/cask/Casks/with-languages.rb
@@ -12,7 +12,7 @@ end url "file://#{TEST_FIXTURE_DIR}/cask/caffeine.zip" - homepage 'https://example.com/local-caffeine' + homepage 'https://example.com' app 'Caffeine.app' end
true
Other
Homebrew
brew
70fc2af6470acd116d24882bb1cbb922b40e2d73.json
Cask: fix all homepages now that they are audited
Library/Homebrew/test/support/fixtures/cask/Casks/with-two-apps-correct.rb
@@ -3,7 +3,7 @@ sha256 '3178fbfd1ea5d87a2a0662a4eb599ebc9a03888e73f37538d9f3f6ee69d2368e' url "file://#{TEST_FIXTURE_DIR}/cask/caffeines.zip" - homepage 'https://example.com/local-caffeine' + homepage 'https://example.com' app 'Caffeine Mini.app' app 'Caffeine Pro.app'
true
Other
Homebrew
brew
70fc2af6470acd116d24882bb1cbb922b40e2d73.json
Cask: fix all homepages now that they are audited
Library/Homebrew/test/support/fixtures/cask/Casks/with-two-apps-subdir.rb
@@ -3,7 +3,7 @@ sha256 'd687c22a21c02bd8f07da9302c8292b93a04df9a929e3f04d09aea6c76f75c65' url "file://#{TEST_FIXTURE_DIR}/cask/caffeines-subdir.zip" - homepage 'https://example.com/local-caffeine' + homepage 'https://example.com' app 'Caffeines/Caffeine Mini.app' app 'Caffeines/Caffeine Pro.app'
true
Other
Homebrew
brew
70fc2af6470acd116d24882bb1cbb922b40e2d73.json
Cask: fix all homepages now that they are audited
Library/Homebrew/test/support/fixtures/cask/Casks/without-languages.rb
@@ -3,7 +3,7 @@ sha256 '67cdb8a02803ef37fdbf7e0be205863172e41a561ca446cd84f0d7ab35a99d94' url "file://#{TEST_FIXTURE_DIR}/cask/caffeine.zip" - homepage 'https://example.com/local-caffeine' + homepage 'https://example.com' app 'Caffeine.app' end
true
Other
Homebrew
brew
0fcdc9ba0726570e29d6ce93956f6a5da4907ba3.json
Create method ruby_file? Both formula_files and cask_files need to check whether a file is a Ruby file. Also, use this method in formula_file? and cask_file?
Library/Homebrew/tap.rb
@@ -382,7 +382,7 @@ def contents # an array of all {Formula} files of this {Tap}. def formula_files @formula_files ||= if formula_dir.directory? - formula_dir.children.select { |file| file.extname == ".rb" } + formula_dir.children.select(&method(:ruby_file?)) else [] end @@ -391,19 +391,25 @@ def formula_files # an array of all {Cask} files of this {Tap}. def cask_files @cask_files ||= if cask_dir.directory? - cask_dir.children.select { |file| file.extname == ".rb" } + cask_dir.children.select(&method(:ruby_file?)) else [] end end + # returns true if the file has a Ruby extension + # @private + def ruby_file?(file) + file.extname == ".rb" + end + # return true if given path would present a {Formula} file in this {Tap}. # accepts both absolute path and relative path (relative to this {Tap}'s path) # @private def formula_file?(file) file = Pathname.new(file) unless file.is_a? Pathname file = file.expand_path(path) - file.extname == ".rb" && file.parent == formula_dir + ruby_file?(file) && file.parent == formula_dir end # return true if given path would present a {Cask} file in this {Tap}. @@ -412,7 +418,7 @@ def formula_file?(file) def cask_file?(file) file = Pathname.new(file) unless file.is_a? Pathname file = file.expand_path(path) - file.extname == ".rb" && file.parent == cask_dir + ruby_file?(file) && file.parent == cask_dir end # an array of all {Formula} names of this {Tap}.
false
Other
Homebrew
brew
ce530fd0f54a4eccf45daffb05bbc08e30e72d73.json
move rspec pattern
Library/.rubocop.yml
@@ -4,9 +4,6 @@ AllCops: - '**/Casks/**/*' - '**/vendor/**/*' DisplayCopNames: false - RSpec: - Patterns: - - Homebrew/test/* require: - ./Homebrew/rubocops.rb
true
Other
Homebrew
brew
ce530fd0f54a4eccf45daffb05bbc08e30e72d73.json
move rspec pattern
Library/Homebrew/test/.rubocop.yml
@@ -2,3 +2,7 @@ inherit_from: - ../.rubocop.yml - .rubocop_todo.yml +AllCops: + RSpec: + Patterns: + - ./*
true
Other
Homebrew
brew
573da9002b246a24f4dcba691568fdf00ed5ad9d.json
docs/Maintainer-Guidelines: change lead maintainer date. I'll step down on February 4th to better coincide with the Homebrew maintainers in-person conference. This will make it easier to resolve any logistical issues that arise.
docs/Maintainer-Guidelines.md
@@ -153,7 +153,7 @@ Individual Homebrew repositories should not have formal lead maintainers (althou Maintainers should feel even more free to pleasantly disagree with the work and decisions of the lead maintainer: with greater authority comes greater responsibility to handle and moderate technical disagreements. -Homebrew's last lead maintainer will be Mike McQuaid. On February 1st, Mike will step down as lead maintainer of Homebrew and his responsibilities will be passed on to the project leadership committee and/or a new, technical steering committee and/or something else. +Homebrew's last lead maintainer will be Mike McQuaid. On February 4th (to coincide with Homebrew maintainers' conference), Mike will step down as lead maintainer of Homebrew and his responsibilities will be passed on to the project leadership committee and/or a new, technical steering committee and/or something else. Some food for thought and discussion before those dates:
false
Other
Homebrew
brew
06a66e254ee519b9dfadf9b52a40c8f22a170b35.json
update-reset: fix Bash syntax. This isn't valid syntax for a Bash array.
Library/Homebrew/cmd/update-reset.sh
@@ -26,7 +26,7 @@ homebrew-update-reset() { set -x fi - if [[ -z "${REPOS[]}" ]] + if [[ -z "${REPOS[*]}" ]] then REPOS+=("$HOMEBREW_REPOSITORY" "$HOMEBREW_LIBRARY"/Taps/*/*) fi
false
Other
Homebrew
brew
3f2803110ad983293c79e1d0a73efd032e514a38.json
audit: Permit HEAD for non-official taps
Library/Homebrew/dev-cmd/audit.rb
@@ -642,7 +642,7 @@ def audit_specs end end - if formula.head || formula.devel + if @official_tap && (formula.head || formula.devel) unstable_spec_message = "Formulae should not have a `HEAD` or `devel` spec" if @new_formula new_formula_problem unstable_spec_message
false
Other
Homebrew
brew
9e438991c82359d184902a13824c407b429bc33e.json
zip: restore extended attributes when under MacOS
Library/Homebrew/extend/os/mac/unpack_strategy/zip.rb
@@ -2,10 +2,21 @@ module UnpackStrategy class Zip prepend Module.new { def extract_to_dir(unpack_dir, basename:, verbose:) - volumes = super.stderr.chomp - .split("\n") - .map { |l| l[/\A skipping: (.+) volume label\Z/, 1] } - .compact + result = super + + volumes = result.stderr.chomp + .split("\n") + .map { |l| l[/\A skipping: (.+) volume label\Z/, 1] } + .compact + + if result.stderr.lines.any? { |line| line.start_with?("._") } + # Merge ._ files back into extended attributes. + # ._ files inside volumes are automatically merged by ditto. + system_command!("dot_clean", + args: ["-mv", "--keep=dotbar", unpack_dir], + verbose: verbose, + print_stderr: false) + end return if volumes.empty?
false
Other
Homebrew
brew
96504ec9dcba438855ebb314f1dd004442453e12.json
style: check Bash style with shellcheck
Library/Homebrew/style.rb
@@ -76,13 +76,15 @@ def check_style_impl(files, output_type, options = {}) cache_env = { "XDG_CACHE_HOME" => "#{HOMEBREW_CACHE}/style" } + rubocop_success = false + case output_type when :print args << "--debug" if ARGV.debug? args << "--display-cop-names" if ARGV.include? "--display-cop-names" args << "--format" << "simple" if files system(cache_env, "rubocop", "_#{HOMEBREW_RUBOCOP_VERSION}_", *args) - !$CHILD_STATUS.success? + rubocop_success = $CHILD_STATUS.success? when :json json, err, status = Open3.capture3(cache_env, "rubocop", "_#{HOMEBREW_RUBOCOP_VERSION}_", @@ -96,10 +98,35 @@ def check_style_impl(files, output_type, options = {}) raise "Error running `rubocop --format json #{args.join " "}`\n#{err}" end - RubocopResults.new(JSON.parse(json)) + return RubocopResults.new(JSON.parse(json)) else raise "Invalid output_type for check_style_impl: #{output_type}" end + + return !rubocop_success if !files.nil? && !has_non_formula + + shellcheck = which("shellcheck") + shellcheck ||= which("shellcheck", ENV["HOMEBREW_PATH"]) + shellcheck ||= begin + ohai "Installing `shellcheck` for shell style checks..." + system HOMEBREW_BREW_FILE, "install", "shellcheck" + which("shellcheck") || which("shellcheck", ENV["HOMEBREW_PATH"]) + end + unless shellcheck + opoo "Could not find or install `shellcheck`! Not checking shell style." + return !rubocop_success + end + + shell_files = [ + HOMEBREW_BREW_FILE, + *Pathname.glob("#{HOMEBREW_LIBRARY}/Homebrew/*.sh"), + *Pathname.glob("#{HOMEBREW_LIBRARY}/Homebrew/cmd/*.sh"), + *Pathname.glob("#{HOMEBREW_LIBRARY}/Homebrew/utils/*.sh"), + ].select(&:exist?) + # TODO: check, fix completions here too. + # TODO: consider using ShellCheck JSON output + shellcheck_success = system shellcheck, "--shell=bash", *shell_files + !rubocop_success || !shellcheck_success end class RubocopResults
false
Other
Homebrew
brew
b7cf925da84cbd5eeb5de4c94b917369d4f072fd.json
Remove unused methods in `Staged` module.
Library/Homebrew/cask/staged.rb
@@ -2,29 +2,6 @@ module Cask module Staged - def info_plist_file(index = 0) - index = 0 if index == :first - index = 1 if index == :second - index = -1 if index == :last - @cask.artifacts.select { |a| a.is_a?(Artifact::App) }.at(index).target.join("Contents", "Info.plist") - end - - def plist_exec(cmd) - @command.run!("/usr/libexec/PlistBuddy", args: ["-c", cmd, info_plist_file]) - end - - def plist_set(key, value) - plist_exec("Set #{key} #{value}") - rescue => e - raise CaskError, "#{@cask.token}: 'plist_set' failed with: #{e}" - end - - def bundle_identifier - plist_exec("Print CFBundleIdentifier").stdout.chomp - rescue => e - raise CaskError, "#{@cask.token}: 'bundle_identifier' failed with: #{e}" - end - def set_permissions(paths, permissions_str) full_paths = remove_nonexistent(paths) return if full_paths.empty?
true
Other
Homebrew
brew
b7cf925da84cbd5eeb5de4c94b917369d4f072fd.json
Remove unused methods in `Staged` module.
Library/Homebrew/test/cask/staged_spec.rb
@@ -1,14 +0,0 @@ -# TODO: this test should be named after the corresponding class, once -# that class is abstracted from installer.rb. It makes little sense -# to be invoking bundle_identifier off of the installer instance. -describe "Operations on staged Casks", :cask do - describe "bundle ID" do - let(:cask) { Cask::CaskLoader.load(cask_path("local-transmission")) } - let(:installer) { Cask::Installer.new(cask) } - - it "fetches the bundle ID from a staged cask" do - installer.install - expect(installer.bundle_identifier).to eq("org.m0k.transmission") - end - end -end
true
Other
Homebrew
brew
b7cf925da84cbd5eeb5de4c94b917369d4f072fd.json
Remove unused methods in `Staged` module.
Library/Homebrew/test/support/helper/spec/shared_examples/cask_staged.rb
@@ -21,30 +21,6 @@ staged.system_command("echo", args: ["homebrew-cask", "rocks!"]) end - it "can get the Info.plist file for the primary app" do - expect(staged.info_plist_file).to eq Cask::Config.global.appdir.join("TestCask.app/Contents/Info.plist") - end - - it "can execute commands on the Info.plist file" do - allow(staged).to receive(:bundle_identifier).and_return("com.example.BasicCask") - - FakeSystemCommand.expects_command( - ["/usr/libexec/PlistBuddy", "-c", "Print CFBundleIdentifier", staged.info_plist_file], - ) - - staged.plist_exec("Print CFBundleIdentifier") - end - - it "can set a key in the Info.plist file" do - allow(staged).to receive(:bundle_identifier).and_return("com.example.BasicCask") - - FakeSystemCommand.expects_command( - ["/usr/libexec/PlistBuddy", "-c", "Set :JVMOptions:JVMVersion 1.6+", staged.info_plist_file], - ) - - staged.plist_set(":JVMOptions:JVMVersion", "1.6+") - end - it "can set the permissions of a file" do fake_pathname = existing_path allow(staged).to receive(:Pathname).and_return(fake_pathname)
true
Other
Homebrew
brew
dbea3cbe90b7d05e046f036d87bdb604362b7bb3.json
restore sorting of options after commands
Library/Homebrew/dev-cmd/man.rb
@@ -82,6 +82,7 @@ def regenerate_man_pages def path_glob_commands(glob) Pathname.glob(glob) + .sort_by { |source_file| sort_key_for_path(source_file) } .map(&:read).map(&:lines) .map { |lines| lines.grep(/^#:/).map { |line| line.slice(2..-1) }.join } .reject { |s| s.strip.empty? || s.include?("@hide_from_man_page") }
false
Other
Homebrew
brew
54fe8e0ec0a0724dd3416565c2733b49c388fbfa.json
docs: fix broken links.
docs/Brew-Test-Bot-For-Core-Contributors.md
@@ -4,7 +4,7 @@ If a build has run and passed on `brew test-bot` then it can be used to quickly There are two types of Jenkins jobs you will interact with: -## [Homebrew Core Pull Requests](https://jenkins.brew.sh/job/Homebrew%20Core/) +## [Homebrew Core Pull Requests](https://jenkins.brew.sh/job/Homebrew%20Core%20Pull%20Requests/) This job automatically builds any pull requests submitted to Homebrew/homebrew-core. On success or failure it updates the pull request status (see more details on the [main Brew Test Bot documentation page](Brew-Test-Bot.md)). On a successful build it automatically uploads bottles. ## [Homebrew Testing](https://jenkins.brew.sh/job/Homebrew%20Testing/)
true
Other
Homebrew
brew
54fe8e0ec0a0724dd3416565c2733b49c388fbfa.json
docs: fix broken links.
docs/Maintainer-Guidelines.md
@@ -140,7 +140,7 @@ All communication should ideally occur in public on GitHub. Where this is not po This makes it easier for other maintainers, contributors and users to follow along with what we're doing (and, more importantly, why we're doing it) and means that decisions have a linkable URL. -All maintainers (and lead maintainer) communication through any medium is bound by [Homebrew's Code of Conduct](CODE_OF_CONDUCT.md#code-of-conduct). Abusive behaviour towards other maintainers, contributors or users will not be tolerated; the maintainer will be given a warning and if their behaviour continues they will be removed as a maintainer. +All maintainers (and lead maintainer) communication through any medium is bound by [Homebrew's Code of Conduct](https://github.com/Homebrew/brew/blob/master/CODE_OF_CONDUCT.md#code-of-conduct). Abusive behaviour towards other maintainers, contributors or users will not be tolerated; the maintainer will be given a warning and if their behaviour continues they will be removed as a maintainer. Maintainers should feel free to pleasantly disagree with the work and decisions of other maintainers. Healthy, friendly, technical disagreement between maintainers is actively encouraged and should occur in public on the issue tracker to make the project better. Interpersonal issues should be handled privately in Slack, ideally with moderation. If work or decisions are insufficiently documented or explained any maintainer or contributor should feel free to ask for clarification. No maintainer may ever justify a decision with e.g. "because I say so" or "it was I who did X" alone. Off-topic discussions on the issue tracker, [bike-shedding](https://en.wikipedia.org/wiki/Law_of_triviality) and personal attacks are forbidden.
true
Other
Homebrew
brew
54fe8e0ec0a0724dd3416565c2733b49c388fbfa.json
docs: fix broken links.
docs/Prose-Style-Guidelines.md
@@ -16,7 +16,7 @@ Homebrew's audience includes users with a wide range of education and experience We strive for "correct" but not "fancy" usage. Think newspaper article, not academic paper. -This is a set of guidelines to be applied using human judgment, not a set of hard and fast rules. It is like [The Economist's Style Guide](https://www.economist.com/styleguide/introduction) or [Garner's Modern American Usage](https://en.wikipedia.org/wiki/Garner's_Modern_American_Usage). It is less like the [Ruby Style Guide](https://github.com/bbatsov/ruby-style-guide). All guidelines here are open to interpretation and discussion. 100% conformance to these guidelines is *not* a goal. +This is a set of guidelines to be applied using human judgment, not a set of hard and fast rules. It is like [The Economist's Style Guide](https://web.archive.org/web/20170830001125/https://www.economist.com/styleguide/introduction) or [Garner's Modern American Usage](https://en.wikipedia.org/wiki/Garner's_Modern_American_Usage). It is less like the [Ruby Style Guide](https://github.com/bbatsov/ruby-style-guide). All guidelines here are open to interpretation and discussion. 100% conformance to these guidelines is *not* a goal. The intent of this document is to help authors make decisions about clarity, style, and consistency. It is not to help settle arguments about who knows English better. Don't use this document to be a jerk.
true
Other
Homebrew
brew
54fe8e0ec0a0724dd3416565c2733b49c388fbfa.json
docs: fix broken links.
docs/Python-for-Formula-Authors.md
@@ -30,7 +30,7 @@ No explicit Python dependency is needed on recent OS versions since `/usr/bin` i Applications should be installed into a Python [virtualenv](https://virtualenv.pypa.io/en/stable/) environment rooted in `libexec`. This prevents the app's Python modules from contaminating the system site-packages and vice versa. -All of the Python module dependencies of the application (and their dependencies, recursively) should be declared as `resource`s in the formula and installed into the virtualenv, as well. Each dependency should be explicitly specified; please do not rely on `setup.py` or `pip` to perform automatic dependency resolution, for the [reasons described here](Acceptable-Formulae.md#we-dont-like-install-scripts-that-download-things). +All of the Python module dependencies of the application (and their dependencies, recursively) should be declared as `resource`s in the formula and installed into the virtualenv, as well. Each dependency should be explicitly specified; please do not rely on `setup.py` or `pip` to perform automatic dependency resolution, for the [reasons described here](Acceptable-Formulae.md#we-dont-like-install-scripts-that-download-unversioned-things). You can use [homebrew-pypi-poet](https://pypi.python.org/pypi/homebrew-pypi-poet) to help you write resource stanzas. To use it, set up a virtualenv and install your package and all its dependencies. Then, `pip install homebrew-pypi-poet` into the same virtualenv. Running `poet some_package` will generate the necessary resource stanzas. You can do this like:
true
Other
Homebrew
brew
8a2490a1d31219dd732cc948d746cb58d8e578f3.json
docs: check links with `html-proofer` This can be done with `bundle exec rake test`.
docs/.ruby-version
@@ -1 +1 @@ -2.4.1 +2.5.1
true
Other
Homebrew
brew
8a2490a1d31219dd732cc948d746cb58d8e578f3.json
docs: check links with `html-proofer` This can be done with `bundle exec rake test`.
docs/Gemfile
@@ -1,3 +1,8 @@ source "https://rubygems.org" gem "github-pages", group: :jekyll_plugins + +group :test do + gem "html-proofer" + gem "rake" +end
true
Other
Homebrew
brew
8a2490a1d31219dd732cc948d746cb58d8e578f3.json
docs: check links with `html-proofer` This can be done with `bundle exec rake test`.
docs/Gemfile.lock
@@ -13,6 +13,7 @@ GEM execjs coffee-script-source (1.11.1) colorator (1.1.0) + colorize (0.8.1) commonmarker (0.17.13) ruby-enum (~> 0.5) concurrent-ruby (1.0.5) @@ -84,6 +85,15 @@ GEM html-pipeline (2.8.4) activesupport (>= 2) nokogiri (>= 1.4) + html-proofer (3.9.2) + activesupport (>= 4.2, < 6.0) + addressable (~> 2.3) + colorize (~> 0.8) + mercenary (~> 0.3.2) + nokogiri (~> 1.8.1) + parallel (~> 1.3) + typhoeus (~> 1.3) + yell (~> 2.0) http_parser.rb (0.6.0) i18n (0.9.5) concurrent-ruby (~> 1.0) @@ -209,9 +219,11 @@ GEM mini_portile2 (~> 2.3.0) octokit (4.12.0) sawyer (~> 0.8.0, >= 0.5.3) + parallel (1.12.1) pathutil (0.16.1) forwardable-extended (~> 2.6) public_suffix (2.0.5) + rake (12.3.1) rb-fsevent (0.10.3) rb-inotify (0.9.10) ffi (>= 0.5.0, < 2) @@ -237,12 +249,15 @@ GEM tzinfo (1.2.5) thread_safe (~> 0.1) unicode-display_width (1.4.0) + yell (2.0.7) PLATFORMS ruby DEPENDENCIES github-pages + html-proofer + rake BUNDLED WITH - 1.16.1 + 1.16.4
true
Other
Homebrew
brew
8a2490a1d31219dd732cc948d746cb58d8e578f3.json
docs: check links with `html-proofer` This can be done with `bundle exec rake test`.
docs/Rakefile
@@ -0,0 +1,31 @@ +require "rake" + +task default: :build + +desc "Build the site." +task :build do + sh "jekyll", "build" +end + +desc "Run html proofer to validate the HTML output." +task test: :build do + require "html-proofer" + HTMLProofer.check_directory( + "./_site", + parallel: { in_threads: 4 }, + favicon: true, + http_status_ignore: [0, 403], + assume_extension: true, + check_favicon: true, + check_opengraph: true, + check_html: true, + check_img_http: true, + file_ignore: [ + %r{Kickstarter-Supporters}, + ], + url_ignore: [ + "http://formulae.brew.sh", + %r{https://github.com/Homebrew/brew/edit/gh-pages//}, + ] + ).run +end
true
Other
Homebrew
brew
13816a56875225b65812817d548aec161d2395d9.json
GNU_GCC_VERSIONS: Remove the compiler gcc-4.3
Library/Homebrew/compilers.rb
@@ -1,7 +1,7 @@ # @private module CompilerConstants - GNU_GCC_VERSIONS = %w[4.3 4.4 4.5 4.6 4.7 4.8 4.9 5 6 7 8].freeze - GNU_GCC_REGEXP = /^gcc-(4\.[3-9]|[5-8])$/ + GNU_GCC_VERSIONS = %w[4.4 4.5 4.6 4.7 4.8 4.9 5 6 7 8].freeze + GNU_GCC_REGEXP = /^gcc-(4\.[4-9]|[5-8])$/ COMPILER_SYMBOL_MAP = { "gcc" => :gcc, "gcc-4.0" => :gcc_4_0, @@ -71,7 +71,6 @@ def inspect create(:gcc_4_0), create(:gcc_4_2), create(:clang) { build 425 }, - create(gcc: "4.3"), create(gcc: "4.4"), create(gcc: "4.5"), create(gcc: "4.6"), @@ -80,7 +79,6 @@ def inspect create(:clang) { build 600 }, create(:gcc_4_0), create(:gcc_4_2), - create(gcc: "4.3"), create(gcc: "4.4"), create(gcc: "4.5"), create(gcc: "4.6"),
false
Other
Homebrew
brew
ad7323bd61b2c2ccd3a5c4ad1478f55fceb17576.json
Hardware::CPU: Add Skylake [Linux]
Library/Homebrew/extend/os/linux/hardware/cpu.rb
@@ -11,8 +11,11 @@ def family return :dunno unless intel? # See https://software.intel.com/en-us/articles/intel-architecture-and-processor-identification-with-cpuid-model-and-family-numbers + # and https://github.com/llvm-mirror/llvm/blob/master/lib/Support/Host.cpp + # and https://en.wikipedia.org/wiki/List_of_Intel_CPU_microarchitectures#Roadmap cpu_family = cpuinfo[/^cpu family\s*: ([0-9]+)/, 1].to_i cpu_model = cpuinfo[/^model\s*: ([0-9]+)/, 1].to_i + unknown = :"unknown_0x#{cpu_family.to_s(16)}_0x#{cpu_model.to_s(16)}" case cpu_family when 0x06 case cpu_model @@ -36,12 +39,10 @@ def family :haswell when 0x3d, 0x47, 0x4f, 0x56 :broadwell - when 0x5e + when 0x4e, 0x55, 0x5e, 0x8e, 0x9e :skylake - when 0x8e - :kabylake else - :dunno + unknown end when 0x0f case cpu_model @@ -50,10 +51,10 @@ def family when 0x03, 0x04 :prescott else - :dunno + unknown end else - :dunno + unknown end end
false
Other
Homebrew
brew
ac2aabf287f177b3113acb6f29964528f1cadefa.json
setup_remote_tap: use system taps. This saves recloning the taps we use multiple times when already done by the user.
Library/Homebrew/test/cmd/cask_spec.rb
@@ -1,7 +1,7 @@ describe "brew cask", :integration_test, :needs_macos, :needs_network do describe "list" do it "returns a list of installed Casks" do - setup_remote_tap("homebrew/cask") + setup_remote_tap "homebrew/cask" expect { brew "cask", "list" }.to be_a_success end
true
Other
Homebrew
brew
ac2aabf287f177b3113acb6f29964528f1cadefa.json
setup_remote_tap: use system taps. This saves recloning the taps we use multiple times when already done by the user.
Library/Homebrew/test/support/helper/spec/shared_context/integration_test.rb
@@ -174,7 +174,16 @@ class #{Formulary.class_s(name)} < Formula def setup_remote_tap(name) Tap.fetch(name).tap do |tap| - tap.install(full_clone: false, quiet: true) unless tap.installed? + next if tap.installed? + full_name = Tap.fetch(name).full_name + # Check to see if the original Homebrew process has taps we can use. + system_tap_path = Pathname("#{ENV["HOMEBREW_LIBRARY"]}/Taps/#{full_name}") + if system_tap_path.exist? + system "git", "clone", "--shared", system_tap_path, tap.path + system "git", "-C", tap.path, "checkout", "master" + else + tap.install(full_clone: false, quiet: true) + end end end
true
Other
Homebrew
brew
38feaf12709d122c49d3d145c07c4d920df42d85.json
extract: Add option descriptions
Library/Homebrew/dev-cmd/extract.rb
@@ -96,12 +96,26 @@ def with_monkey_patch module Homebrew module_function - def extract - Homebrew::CLI::Parser.parse do - flag "--version=" + def extract_args + Homebrew::CLI::Parser.new do + usage_banner <<~EOS + `extract` [<options>] <formula> <tap> + + Looks through repository history to find the <version> of <formula> and + creates a copy in <tap>/Formula/<formula>@<version>.rb. If the tap is + not installed yet, attempts to install/clone the tap before continuing. + EOS + + flag "--version=", + description: "Provided <version> of <formula> will be extracted and placed in the destination "\ + "tap. Otherwise, the most recent version that can be found will be used." switch :debug switch :force end + end + + def extract + extract_args.parse # Expect exactly two named arguments: formula and tap raise UsageError if ARGV.named.length != 2
true
Other
Homebrew
brew
38feaf12709d122c49d3d145c07c4d920df42d85.json
extract: Add option descriptions
Library/Homebrew/dev-cmd/man.rb
@@ -21,6 +21,7 @@ require "dev-cmd/linkage" require "dev-cmd/mirror" require "dev-cmd/pull" +require "dev-cmd/extract" require "dev-cmd/release-notes" require "dev-cmd/tap-new" require "dev-cmd/tests"
true
Other
Homebrew
brew
38feaf12709d122c49d3d145c07c4d920df42d85.json
extract: Add option descriptions
docs/Manpage.md
@@ -794,17 +794,14 @@ Takes a tap [`user``/``repo`] as argument and generates the formula in the speci no `formula` is provided. - * `extract` [`--force`] `formula` `tap` [`--version=``version`]: - Looks through repository history to find the `version` of `formula` and - creates a copy in `tap`/Formula/`formula`@`version`.rb. If the tap is - not installed yet, attempts to install/clone the tap before continuing. +###`extract` [`options`] `formula` `tap` - If `--force` is passed, the file at the destination will be overwritten - if it already exists. Otherwise, existing files will be preserved. +Looks through repository history to find the `version` of `formula` and +creates a copy in `tap`/Formula/`formula`@`version`.rb. If the tap is +not installed yet, attempts to install/clone the tap before continuing. - If an argument is passed through `--version`, `version` of `formula` - will be extracted and placed in the destination tap. Otherwise, the most - recent version that can be found will be used. +* `--version`: +Provided `version` of `formula` will be extracted and placed in the destination tap. Otherwise, the most recent version that can be found will be used. ###`formula` `formula`:
true
Other
Homebrew
brew
38feaf12709d122c49d3d145c07c4d920df42d85.json
extract: Add option descriptions
manpages/brew.1
@@ -794,15 +794,12 @@ Takes a tap [\fIuser\fR\fB/\fR\fIrepo\fR] as argument and generates the formula .SS "\fBedit\fR \fIformula\fR:" Open \fIformula\fR in the editor\. Open all of Homebrew for editing if no \fIformula\fR is provided\. . -.TP -\fBextract\fR [\fB\-\-force\fR] \fIformula\fR \fItap\fR [\fB\-\-version=\fR\fIversion\fR] +.SS "\fBextract\fR [\fIoptions\fR] \fIformula\fR \fItap\fR" Looks through repository history to find the \fIversion\fR of \fIformula\fR and creates a copy in \fItap\fR/Formula/\fIformula\fR@\fIversion\fR\.rb\. If the tap is not installed yet, attempts to install/clone the tap before continuing\. . -.IP -If \fB\-\-force\fR is passed, the file at the destination will be overwritten if it already exists\. Otherwise, existing files will be preserved\. -. -.IP -If an argument is passed through \fB\-\-version\fR, \fIversion\fR of \fIformula\fR will be extracted and placed in the destination tap\. Otherwise, the most recent version that can be found will be used\. +.TP +\fB\-\-version\fR +Provided \fIversion\fR of \fIformula\fR will be extracted and placed in the destination tap\. Otherwise, the most recent version that can be found will be used\. . .SS "\fBformula\fR \fIformula\fR:" Display the path where \fIformula\fR is located\.
true
Other
Homebrew
brew
7b0f27ca3929faeff3deb0fcbbecb314f805884e.json
style: Fix style errors
Library/Homebrew/cli_parser.rb
@@ -125,7 +125,7 @@ def parse(cmdline_args = ARGV) end def global_option?(name) - Homebrew::CLI::Parser.global_options.has_key?(name.to_sym) + Homebrew::CLI::Parser.global_options.key?(name.to_sym) end private
true
Other
Homebrew
brew
7b0f27ca3929faeff3deb0fcbbecb314f805884e.json
style: Fix style errors
Library/Homebrew/dev-cmd/bump-formula-pr.rb
@@ -53,11 +53,11 @@ def bump_formula_pr_args `bump-formula-pr` <options> <formula>: Creates a pull request to update the formula with a new URL or a new tag. - + If a <URL> is specified, the <sha-256> checksum of the new download must also be specified. A best effort to determine the <sha-256> and <formula> name will be made if either or both values are not supplied by the user. - + If a <tag> is specified, the git commit <revision> corresponding to that tag must also be specified. @@ -66,41 +66,43 @@ def bump_formula_pr_args specification, nor vice versa. It must use whichever style specification the preexisting formula already uses. EOS - switch "--devel", + switch "--devel", description: "Bump the development rather than stable version. The development spec must already exist." - switch "-n", "--dry-run", + switch "-n", "--dry-run", description: "Print what would be done rather than doing it." - switch "--write", + switch "--write", description: "When passed along with `--dry-run`, perform a not-so-dry run making the expected "\ "file modifications but not taking any git actions." - switch "--audit", + switch "--audit", description: "Run `brew audit` before opening the PR." - switch "--strict", + switch "--strict", description: "Run `brew audit --strict` before opening the PR." - switch "--no-browse", + switch "--no-browse", description: "Output the pull request URL instead of opening in a browser" - flag "--url=", + flag "--url=", description: "Provide new <URL> for the formula. If a <URL> is specified, the <sha-256> "\ "checksum of the new download must also be specified." - flag "--revision=", + flag "--revision=", description: "Specify the new git commit <revision> corresponding to a specified <tag>." - flag "--tag=", required_for: "--revision=", + flag "--tag=", + required_for: "--revision=", description: "Specify the new git commit <tag> for the formula." - flag "--sha256=", depends_on: "--url=", + flag "--sha256=", + depends_on: "--url=", description: "Specify the <sha-256> checksum of new download." - flag "--mirror=", + flag "--mirror=", description: "Use the provided <URL> as a mirror URL." - flag "--version=", + flag "--version=", description: "Use the provided <version> to override the value parsed from the URL or tag. Note "\ "that `--version=0` can be used to delete an existing `version` override from a "\ "formula if it has become redundant." - flag "--message=", + flag "--message=", description: "Append provided <message> to the default PR message." - switch :quiet - switch :force - switch :verbose - switch :debug + switch :quiet + switch :force + switch :verbose + switch :debug conflicts "--url", "--tag" end end
true
Other
Homebrew
brew
7b0f27ca3929faeff3deb0fcbbecb314f805884e.json
style: Fix style errors
Library/Homebrew/dev-cmd/irb.rb
@@ -31,7 +31,8 @@ def irb_args EOS switch "--examples", description: "Show several examples." - switch "--pry", env: :pry, + switch "--pry", + env: :pry, description: "Pry will be used instead of irb if `--pry` is passed or HOMEBREW_PRY is set." end end
true
Other
Homebrew
brew
7b0f27ca3929faeff3deb0fcbbecb314f805884e.json
style: Fix style errors
Library/Homebrew/dev-cmd/man.rb
@@ -156,8 +156,10 @@ def convert_man_page(markup, target) ronn_output = ronn.read odie "Got no output from ronn!" unless ronn_output ronn_output.gsub!(%r{</var>`(?=[.!?,;:]?\s)}, "").gsub!(%r{</?var>}, "`") if format_flag == "--markdown" - ronn_output = ronn_output.gsub(%r{<code>}, "\\fB").gsub(%r{</code>}, "\\fR") - .gsub(%r{<var>}, "\\fI").gsub(%r{</var>}, "\\fR") unless format_flag == '--markdown' + unless format_flag == "--markdown" + ronn_output = ronn_output.gsub(/<code>/, "\\fB").gsub(%r{</code>}, "\\fR") + .gsub(/<var>/, "\\fI").gsub(%r{</var>}, "\\fR") + end target.atomic_write ronn_output end end @@ -192,11 +194,11 @@ def generate_cmd_manpages(glob) end def cmd_arg_parser(cmd_path) - "#{cmd_path.basename.to_s.gsub('.rb', '').gsub('-', '_')}_args".to_sym + "#{cmd_path.basename.to_s.gsub(".rb", "").tr("-", "_")}_args".to_sym end def cmd_manpage_lines(cmd_parser) - lines = ["#{format_usage_banner(cmd_parser.usage_banner_text)}"] + lines = [format_usage_banner(cmd_parser.usage_banner_text)] lines += cmd_parser.processed_options.map do |short, long, _, desc| next if !long.nil? && cmd_parser.global_option?(cmd_parser.option_to_name(long)) generate_option_doc(short, long, desc)
true
Other
Homebrew
brew
7b0f27ca3929faeff3deb0fcbbecb314f805884e.json
style: Fix style errors
Library/Homebrew/dev-cmd/mirror.rb
@@ -11,7 +11,7 @@ def mirror_args Homebrew::CLI::Parser.new do usage_banner <<~EOS `mirror` <formulae>: - + Reuploads the stable URL for a formula to Bintray to use it as a mirror. EOS switch :debug
true
Other
Homebrew
brew
7b0f27ca3929faeff3deb0fcbbecb314f805884e.json
style: Fix style errors
Library/Homebrew/dev-cmd/prof.rb
@@ -1,7 +1,7 @@ -#: * `prof` [ruby options]: +#: * `prof` [<ruby options>]: #: Run Homebrew with the Ruby profiler. #: For example: -#: brew prof readall +#: brew prof readall module Homebrew module_function
true
Other
Homebrew
brew
7b0f27ca3929faeff3deb0fcbbecb314f805884e.json
style: Fix style errors
Library/Homebrew/dev-cmd/pull.rb
@@ -79,18 +79,18 @@ def pull_args Gets a patch from a GitHub commit or pull request and applies it to Homebrew. Optionally, installs the formulae changed by the patch. - + Each <patch-source> may be one of: - + ~ The ID number of a PR (pull request) in the homebrew/core GitHub repository - + ~ The URL of a PR on GitHub, using either the web page or API URL formats. In this form, the PR may be on Homebrew/brew, Homebrew/homebrew-core or any tap. - + ~ The URL of a commit on GitHub - + ~ A "https://jenkins.brew.sh/job/..." string specifying a testing job ID EOS switch "--bottle",
true
Other
Homebrew
brew
7b0f27ca3929faeff3deb0fcbbecb314f805884e.json
style: Fix style errors
Library/Homebrew/dev-cmd/tap-new.rb
@@ -19,7 +19,7 @@ def tap_new_args Homebrew::CLI::Parser.new do usage_banner <<~EOS `tap-new` <user>/<repo>: - + Generate the template files for a new tap. EOS switch :debug
true