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
7be216fcbec3021df87fb37b17bbbd91202af6f5.json
change function name
Library/Homebrew/dev-cmd/audit.rb
@@ -123,7 +123,7 @@ def audit elsif args.no_named? [Formula, Cask::Cask.to_a] else - args.named.to_formulae_and_casks(only: args.only_path_formula_or_cask) + args.named.to_formulae_and_casks(only: args.only_formula_or_cask) .partition { |formula_or_cask| formula_or_cask.is_a?(Formula) } end style_files = args.named.to_paths unless skip_style
true
Other
Homebrew
brew
7be216fcbec3021df87fb37b17bbbd91202af6f5.json
change function name
Library/Homebrew/dev-cmd/cat.rb
@@ -38,6 +38,6 @@ def cat "cat" end - safe_system pager, args.named.to_paths(only: args.only_path_formula_or_cask).first + safe_system pager, args.named.to_paths(only: args.only_formula_or_cask).first end end
true
Other
Homebrew
brew
7be216fcbec3021df87fb37b17bbbd91202af6f5.json
change function name
Library/Homebrew/dev-cmd/edit.rb
@@ -39,7 +39,7 @@ def edit EOS end - paths = args.named.to_paths(only: args.only_path_formula_or_cask).select do |path| + paths = args.named.to_paths(only: args.only_formula_or_cask).select do |path| next path if path.exist? raise UsageError, "#{path} doesn't exist on disk. " \
true
Other
Homebrew
brew
d7f9bb6247f92b5ce7f4243ec1bee2cd3e1a9bab.json
add function to define path
Library/Homebrew/cli/args.rb
@@ -133,6 +133,11 @@ def context Context::ContextStruct.new(debug: debug?, quiet: quiet?, verbose: verbose?) end + def only_path_formula_or_cask + return :formula if formula? && !cask? + return :cask if cask? && !formula? + end + private def option_to_name(option)
true
Other
Homebrew
brew
d7f9bb6247f92b5ce7f4243ec1bee2cd3e1a9bab.json
add function to define path
Library/Homebrew/cmd/fetch.rb
@@ -69,9 +69,6 @@ def fetch_args def fetch args = fetch_args.parse - only = :formula if args.formula? && !args.cask? - only = :cask if args.cask? && !args.formula? - bucket = if args.deps? args.named.to_formulae_and_casks.flat_map do |formula_or_cask| case formula_or_cask @@ -84,7 +81,7 @@ def fetch end end else - args.named.to_formulae_and_casks(only: only) + args.named.to_formulae_and_casks(only: args.only_path_formula_or_cask) end.uniq puts "Fetching: #{bucket * ", "}" if bucket.size > 1
true
Other
Homebrew
brew
d7f9bb6247f92b5ce7f4243ec1bee2cd3e1a9bab.json
add function to define path
Library/Homebrew/cmd/home.rb
@@ -35,9 +35,7 @@ def home return end - only = :formula if args.formula? && !args.cask? - only = :cask if args.cask? && !args.formula? - homepages = args.named.to_formulae_and_casks(only: only).map do |formula_or_cask| + homepages = args.named.to_formulae_and_casks(only: args.only_path_formula_or_cask).map do |formula_or_cask| puts "Opening homepage for #{name_of(formula_or_cask)}" formula_or_cask.homepage end
true
Other
Homebrew
brew
d7f9bb6247f92b5ce7f4243ec1bee2cd3e1a9bab.json
add function to define path
Library/Homebrew/cmd/info.rb
@@ -75,9 +75,6 @@ def info_args def info args = info_args.parse - only = :formula if args.formula? && !args.cask? - only = :cask if args.cask? && !args.formula? - if args.analytics? if args.days.present? && VALID_DAYS.exclude?(args.days) raise UsageError, "--days must be one of #{VALID_DAYS.join(", ")}" @@ -93,17 +90,17 @@ def info end end - print_analytics(args: args, only: only) + print_analytics(args: args, only: args.only_path_formula_or_cask) elsif args.json - print_json(args: args, only: only) + print_json(args: args, only: args.only_path_formula_or_cask) elsif args.github? raise FormulaOrCaskUnspecifiedError if args.no_named? - exec_browser(*args.named.to_formulae_and_casks(only: only).map { |f| github_info(f) }) + exec_browser(*args.named.to_formulae_and_casks(only: args.only_path_formula_or_cask).map { |f| github_info(f) }) elsif args.no_named? print_statistics else - print_info(args: args, only: only) + print_info(args: args, only: args.only_path_formula_or_cask) end end @@ -122,7 +119,7 @@ def print_analytics(args:, only: nil) return end - args.named.to_formulae_and_casks_and_unavailable(only: only).each_with_index do |obj, i| + args.named.to_formulae_and_casks_and_unavailable(only: args.only_path_formula_or_cask).each_with_index do |obj, i| puts unless i.zero? case obj @@ -140,7 +137,7 @@ def print_analytics(args:, only: nil) sig { params(args: CLI::Args, only: T.nilable(Symbol)).void } def print_info(args:, only: nil) - args.named.to_formulae_and_casks_and_unavailable(only: only).each_with_index do |obj, i| + args.named.to_formulae_and_casks_and_unavailable(only: args.only_path_formula_or_cask).each_with_index do |obj, i| puts unless i.zero? case obj @@ -195,7 +192,7 @@ def print_json(args:, only: nil) elsif args.installed? [Formula.installed.sort, Cask::Caskroom.casks.sort_by(&:full_name)] else - args.named.to_formulae_to_casks(only: only) + args.named.to_formulae_to_casks(only: args.only_path_formula_or_cask) end {
true
Other
Homebrew
brew
d7f9bb6247f92b5ce7f4243ec1bee2cd3e1a9bab.json
add function to define path
Library/Homebrew/cmd/install.rb
@@ -131,9 +131,6 @@ def install_args def install args = install_args.parse - only = :formula if args.formula? && !args.cask? - only = :cask if args.cask? && !args.formula? - args.named.each do |name| next if File.exist?(name) next if name !~ HOMEBREW_TAP_FORMULA_REGEX && name !~ HOMEBREW_CASK_TAP_CASK_REGEX @@ -151,7 +148,7 @@ def install EOS end - formulae, casks = args.named.to_formulae_and_casks(only: only) + formulae, casks = args.named.to_formulae_and_casks(only: args.only_path_formula_or_cask) .partition { |formula_or_cask| formula_or_cask.is_a?(Formula) } if casks.any?
true
Other
Homebrew
brew
d7f9bb6247f92b5ce7f4243ec1bee2cd3e1a9bab.json
add function to define path
Library/Homebrew/cmd/uninstall.rb
@@ -47,10 +47,12 @@ def uninstall_args def uninstall args = uninstall_args.parse - only = :formula if args.formula? && !args.cask? - only = :cask if args.cask? && !args.formula? + all_kegs, casks = args.named.to_kegs_to_casks( + only: args.only_path_formula_or_cask, + ignore_unavailable: args.force?, + all_kegs: args.force?, + ) - all_kegs, casks = args.named.to_kegs_to_casks(only: only, ignore_unavailable: args.force?, all_kegs: args.force?) kegs_by_rack = all_kegs.group_by(&:rack) Uninstall.uninstall_kegs(
true
Other
Homebrew
brew
d7f9bb6247f92b5ce7f4243ec1bee2cd3e1a9bab.json
add function to define path
Library/Homebrew/cmd/upgrade.rb
@@ -95,10 +95,7 @@ def upgrade_args def upgrade args = upgrade_args.parse - only = :formula if args.formula? && !args.cask? - only = :cask if args.cask? && !args.formula? - - formulae, casks = args.named.to_resolved_formulae_to_casks(only: only) + formulae, casks = args.named.to_resolved_formulae_to_casks(only: args.only_path_formula_or_cask) # If one or more formulae are specified, but no casks were # specified, we want to make note of that so we don't # try to upgrade all outdated casks.
true
Other
Homebrew
brew
d7f9bb6247f92b5ce7f4243ec1bee2cd3e1a9bab.json
add function to define path
Library/Homebrew/dev-cmd/audit.rb
@@ -110,9 +110,6 @@ def audit git = args.git? skip_style = args.skip_style? || args.no_named? || args.tap - only = :formula if args.formula? && !args.cask? - only = :cask if args.cask? && !args.formula? - ENV.activate_extensions! ENV.setup_build_environment @@ -126,7 +123,7 @@ def audit elsif args.no_named? [Formula, Cask::Cask.to_a] else - args.named.to_formulae_and_casks(only: only) + args.named.to_formulae_and_casks(only: args.only_path_formula_or_cask) .partition { |formula_or_cask| formula_or_cask.is_a?(Formula) } end style_files = args.named.to_paths unless skip_style
true
Other
Homebrew
brew
d7f9bb6247f92b5ce7f4243ec1bee2cd3e1a9bab.json
add function to define path
Library/Homebrew/dev-cmd/cat.rb
@@ -30,9 +30,6 @@ def cat_args def cat args = cat_args.parse - only = :formula if args.formula? && !args.cask? - only = :cask if args.cask? && !args.formula? - cd HOMEBREW_REPOSITORY pager = if Homebrew::EnvConfig.bat? ENV["BAT_CONFIG_PATH"] = Homebrew::EnvConfig.bat_config_path @@ -41,6 +38,6 @@ def cat "cat" end - safe_system pager, args.named.to_paths(only: only).first + safe_system pager, args.named.to_paths(only: args.only_path_formula_or_cask).first end end
true
Other
Homebrew
brew
d7f9bb6247f92b5ce7f4243ec1bee2cd3e1a9bab.json
add function to define path
Library/Homebrew/dev-cmd/edit.rb
@@ -31,9 +31,6 @@ def edit_args def edit args = edit_args.parse - only = :formula if args.formula? && !args.cask? - only = :cask if args.cask? && !args.formula? - unless (HOMEBREW_REPOSITORY/".git").directory? raise <<~EOS Changes will be lost! @@ -42,7 +39,7 @@ def edit EOS end - paths = args.named.to_paths(only: only).select do |path| + paths = args.named.to_paths(only: args.only_path_formula_or_cask).select do |path| next path if path.exist? raise UsageError, "#{path} doesn't exist on disk. " \
true
Other
Homebrew
brew
797e2c783a2eb51214512bb192960420abed64f4.json
Update RBI files for rubocop.
Library/Homebrew/sorbet/rbi/gems/rubocop@1.5.1.rbi
@@ -22,6 +22,7 @@ class RuboCop::CLI def handle_exiting_options; end def run_command(name); end def set_options_to_config_loader; end + def suggest_extensions; end def validate_options_vs_config; end end @@ -87,9 +88,11 @@ class RuboCop::CLI::Command::ExecuteRunner < ::RuboCop::CLI::Command::Base private def display_error_summary(errors); end + def display_summary(runner); end def display_warning_summary(warnings); end def execute_runner(paths); end def maybe_print_corrected_source; end + def with_redirect; end end RuboCop::CLI::Command::ExecuteRunner::INTEGRATION_FORMATTERS = T.let(T.unsafe(nil), Array) @@ -115,6 +118,24 @@ class RuboCop::CLI::Command::ShowCops < ::RuboCop::CLI::Command::Base def selected_cops_of_department(cops, department); end end +class RuboCop::CLI::Command::SuggestExtensions < ::RuboCop::CLI::Command::Base + def run; end + + private + + def current_formatter; end + def dependent_gems; end + def extensions; end + def puts(*args); end + def skip?; end + + class << self + def dependent_gems; end + end +end + +RuboCop::CLI::Command::SuggestExtensions::INCLUDED_FORMATTERS = T.let(T.unsafe(nil), Array) + class RuboCop::CLI::Command::Version < ::RuboCop::CLI::Command::Base def run; end end @@ -358,6 +379,7 @@ class RuboCop::ConfigLoaderResolver def gem_config_path(gem_name, relative_config_path); end def handle_disabled_by_default(config, new_default_configuration); end def inherited_file(path, inherit_from, file); end + def merge_hashes?(base_hash, derived_hash, key); end def remote_file?(uri); end def should_union?(base_hash, key, inherit_mode); end def transform(config, &block); end @@ -371,6 +393,7 @@ class RuboCop::ConfigObsoletion def initialize(config); end def reject_obsolete_cops_and_parameters; end + def warnings; end private @@ -439,6 +462,7 @@ class RuboCop::ConfigValidator def alert_about_unrecognized_cops(invalid_cop_names); end def check_cop_config_value(hash, parent = T.unsafe(nil)); end + def check_obsoletions; end def check_target_ruby; end def each_invalid_parameter(cop_name); end def msg_not_boolean(parent, key, value); end @@ -554,6 +578,7 @@ module RuboCop::Cop::AutocorrectLogic def max_line_length; end def range_by_lines(range); end def range_of_first_line(range); end + def surrounding_heredoc(offense_range); end end class RuboCop::Cop::Badge @@ -1563,11 +1588,24 @@ end RuboCop::Cop::Heredoc::OPENING_DELIMITER = T.let(T.unsafe(nil), Regexp) module RuboCop::Cop::IgnoredMethods - - private + mixes_in_class_methods(::RuboCop::Cop::IgnoredMethods::Config) def ignored_method?(name); end def ignored_methods; end + + private + + def deprecated_key; end + + class << self + def included(base); end + end +end + +module RuboCop::Cop::IgnoredMethods::Config + def deprecated_key; end + def deprecated_key=(_arg0); end + def ignored_methods(**config); end end module RuboCop::Cop::IgnoredNode @@ -2070,12 +2108,16 @@ class RuboCop::Cop::Layout::EmptyLineBetweenDefs < ::RuboCop::Cop::Base def autocorrect_remove_lines(corrector, newline_pos, count); end def blank_lines_between?(first_def_node, second_def_node); end def blank_lines_count_between(first_def_node, second_def_node); end + def candidate?(node); end + def class_candidate?(node); end def def_end(node); end - def def_node?(node); end def def_start(node); end def lines_between_defs(first_def_node, second_def_node); end def maximum_empty_lines; end + def message(node); end + def method_candidate?(node); end def minimum_empty_lines; end + def module_candidate?(node); end def multiple_blank_lines_groups?(first_def_node, second_def_node); end class << self @@ -2156,6 +2198,7 @@ class RuboCop::Cop::Layout::EmptyLinesAroundArguments < ::RuboCop::Cop::Base def line_numbers(node); end def outer_lines(node); end def processed_lines(node); end + def receiver_and_method_call_on_different_lines?(node); end end RuboCop::Cop::Layout::EmptyLinesAroundArguments::MSG = T.let(T.unsafe(nil), String) @@ -2325,12 +2368,12 @@ class RuboCop::Cop::Layout::EndAlignment < ::RuboCop::Cop::Base def check_other_alignment(node); end end -class RuboCop::Cop::Layout::EndOfLine < ::RuboCop::Cop::Cop +class RuboCop::Cop::Layout::EndOfLine < ::RuboCop::Cop::Base include(::RuboCop::Cop::ConfigurableEnforcedStyle) include(::RuboCop::Cop::RangeHelp) - def investigate(processed_source); end def offense_message(line); end + def on_new_investigation; end def unimportant_missing_cr?(index, last_line, line); end private @@ -4310,6 +4353,7 @@ class RuboCop::Cop::Lint::InterpolationCheck < ::RuboCop::Cop::Base def autocorrect(corrector, node); end def heredoc?(node); end + def string_or_regex?(node); end end RuboCop::Cop::Lint::InterpolationCheck::MSG = T.let(T.unsafe(nil), String) @@ -4418,8 +4462,6 @@ RuboCop::Cop::Lint::MissingSuper::CONSTRUCTOR_MSG = T.let(T.unsafe(nil), String) RuboCop::Cop::Lint::MissingSuper::METHOD_LIFECYCLE_CALLBACKS = T.let(T.unsafe(nil), Array) -RuboCop::Cop::Lint::MissingSuper::OBJECT_LIFECYCLE_CALLBACKS = T.let(T.unsafe(nil), Array) - RuboCop::Cop::Lint::MissingSuper::STATELESS_CLASSES = T.let(T.unsafe(nil), Array) class RuboCop::Cop::Lint::MixedRegexpCaptureTypes < ::RuboCop::Cop::Base @@ -4484,7 +4526,7 @@ end RuboCop::Cop::Lint::NextWithoutAccumulator::MSG = T.let(T.unsafe(nil), String) -class RuboCop::Cop::Lint::NoReturnInBeginEndBlocks < ::RuboCop::Cop::Cop +class RuboCop::Cop::Lint::NoReturnInBeginEndBlocks < ::RuboCop::Cop::Base def on_lvasgn(node); end def on_op_asgn(node); end def on_or_asgn(node); end @@ -4532,6 +4574,7 @@ RuboCop::Cop::Lint::NonLocalExitFromIterator::MSG = T.let(T.unsafe(nil), String) class RuboCop::Cop::Lint::NumberConversion < ::RuboCop::Cop::Base include(::RuboCop::Cop::IgnoredMethods) extend(::RuboCop::Cop::AutoCorrector) + extend(::RuboCop::Cop::IgnoredMethods::Config) def on_send(node); end def to_method(param0 = T.unsafe(nil)); end @@ -5152,6 +5195,21 @@ end RuboCop::Cop::Lint::UnderscorePrefixedVariableName::MSG = T.let(T.unsafe(nil), String) +class RuboCop::Cop::Lint::UnexpectedBlockArity < ::RuboCop::Cop::Base + def on_block(node); end + def on_numblock(node); end + + private + + def acceptable?(node); end + def arg_count(node); end + def expected_arity(method); end + def included_method?(name); end + def methods; end +end + +RuboCop::Cop::Lint::UnexpectedBlockArity::MSG = T.let(T.unsafe(nil), String) + class RuboCop::Cop::Lint::UnifiedInteger < ::RuboCop::Cop::Base extend(::RuboCop::Cop::AutoCorrector) @@ -5167,6 +5225,7 @@ class RuboCop::Cop::Lint::UnmodifiedReduceAccumulator < ::RuboCop::Cop::Base def expression_values(param0); end def lvar_used?(param0 = T.unsafe(nil), param1); end def on_block(node); end + def on_numblock(node); end def reduce_with_block?(param0 = T.unsafe(nil)); end private @@ -5177,7 +5236,7 @@ class RuboCop::Cop::Lint::UnmodifiedReduceAccumulator < ::RuboCop::Cop::Base def check_return_values(block_node); end def potential_offense?(return_values, block_body, element_name, accumulator_name); end def return_values(block_body_node); end - def returned_accumulator_index(return_values, accumulator_name); end + def returned_accumulator_index(return_values, accumulator_name, element_name); end def returns_accumulator_anywhere?(return_values, accumulator_name); end end @@ -5505,8 +5564,11 @@ module RuboCop::Cop::MethodComplexity include(::RuboCop::Cop::ConfigurableMax) include(::RuboCop::Cop::IgnoredMethods) include(::RuboCop::Cop::Metrics::Utils::RepeatedCsendDiscount) + extend(::RuboCop::Cop::IgnoredMethods::Config) extend(::RuboCop::AST::NodePattern::Macros) + mixes_in_class_methods(::RuboCop::Cop::IgnoredMethods::Config) + def define_method?(param0 = T.unsafe(nil)); end def on_block(node); end def on_def(node); end @@ -5516,6 +5578,10 @@ module RuboCop::Cop::MethodComplexity def check_complexity(node, method_name); end def complexity(body); end + + class << self + def included(base); end + end end module RuboCop::Cop::MethodPreference @@ -5535,6 +5601,7 @@ class RuboCop::Cop::Metrics::AbcSize < ::RuboCop::Cop::Base include(::RuboCop::Cop::IgnoredMethods) include(::RuboCop::Cop::Metrics::Utils::RepeatedCsendDiscount) include(::RuboCop::Cop::MethodComplexity) + extend(::RuboCop::Cop::IgnoredMethods::Config) private @@ -5547,14 +5614,15 @@ RuboCop::Cop::Metrics::AbcSize::MSG = T.let(T.unsafe(nil), String) class RuboCop::Cop::Metrics::BlockLength < ::RuboCop::Cop::Base include(::RuboCop::Cop::ConfigurableMax) include(::RuboCop::Cop::CodeLength) + include(::RuboCop::Cop::IgnoredMethods) + extend(::RuboCop::Cop::IgnoredMethods::Config) def on_block(node); end private def cop_label; end - def excluded_method?(node); end - def excluded_methods; end + def method_receiver_excluded?(node); end end RuboCop::Cop::Metrics::BlockLength::LABEL = T.let(T.unsafe(nil), String) @@ -5592,6 +5660,7 @@ class RuboCop::Cop::Metrics::CyclomaticComplexity < ::RuboCop::Cop::Base include(::RuboCop::Cop::Metrics::Utils::RepeatedCsendDiscount) include(::RuboCop::Cop::MethodComplexity) include(::RuboCop::Cop::Metrics::Utils::IteratingBlock) + extend(::RuboCop::Cop::IgnoredMethods::Config) private @@ -5608,6 +5677,8 @@ RuboCop::Cop::Metrics::CyclomaticComplexity::MSG = T.let(T.unsafe(nil), String) class RuboCop::Cop::Metrics::MethodLength < ::RuboCop::Cop::Base include(::RuboCop::Cop::ConfigurableMax) include(::RuboCop::Cop::CodeLength) + include(::RuboCop::Cop::IgnoredMethods) + extend(::RuboCop::Cop::IgnoredMethods::Config) def on_block(node); end def on_def(node); end @@ -5638,16 +5709,21 @@ class RuboCop::Cop::Metrics::ParameterLists < ::RuboCop::Cop::Base def argument_to_lambda_or_proc?(param0 = T.unsafe(nil)); end def on_args(node); end + def on_def(node); end + def on_defs(node); end private def args_count(node); end def count_keyword_args?; end + def max_optional_parameters; end def max_params; end end RuboCop::Cop::Metrics::ParameterLists::MSG = T.let(T.unsafe(nil), String) +RuboCop::Cop::Metrics::ParameterLists::OPTIONAL_PARAMETERS_MSG = T.let(T.unsafe(nil), String) + class RuboCop::Cop::Metrics::PerceivedComplexity < ::RuboCop::Cop::Metrics::CyclomaticComplexity private @@ -5663,14 +5739,13 @@ module RuboCop::Cop::Metrics::Utils end class RuboCop::Cop::Metrics::Utils::AbcSizeCalculator + include(::RuboCop::AST::Sexp) + include(::RuboCop::Cop::Metrics::Utils::RepeatedAttributeDiscount) include(::RuboCop::Cop::Metrics::Utils::IteratingBlock) include(::RuboCop::Cop::Metrics::Utils::RepeatedCsendDiscount) - def initialize(node); end - def calculate; end def else_branch?(node); end - def evaluate_branch_nodes(node); end def evaluate_condition_node(node); end private @@ -5682,9 +5757,10 @@ class RuboCop::Cop::Metrics::Utils::AbcSizeCalculator def compound_assignment(node); end def condition?(node); end def simple_assignment?(node); end + def visit_depth_last(node, &block); end class << self - def calculate(node); end + def calculate(node, discount_repeated_attributes: T.unsafe(nil)); end end end @@ -5723,6 +5799,28 @@ end RuboCop::Cop::Metrics::Utils::IteratingBlock::KNOWN_ITERATING_METHODS = T.let(T.unsafe(nil), Set) +module RuboCop::Cop::Metrics::Utils::RepeatedAttributeDiscount + include(::RuboCop::AST::Sexp) + extend(::RuboCop::AST::NodePattern::Macros) + + def initialize(node, discount_repeated_attributes: T.unsafe(nil)); end + + def attribute_call?(param0 = T.unsafe(nil)); end + def calculate_node(node); end + def discount_repeated_attributes?; end + def evaluate_branch_nodes(node); end + def root_node?(param0 = T.unsafe(nil)); end + + private + + def discount_repeated_attribute?(send_node); end + def find_attributes(node, &block); end + def setter_to_getter(node); end + def update_repeated_attribute(node); end +end + +RuboCop::Cop::Metrics::Utils::RepeatedAttributeDiscount::VAR_SETTER_TO_GETTER = T.let(T.unsafe(nil), Hash) + module RuboCop::Cop::Metrics::Utils::RepeatedCsendDiscount def discount_for_repeated_csend?(csend_node); end def reset_on_lvasgn(node); end @@ -6731,6 +6829,7 @@ class RuboCop::Cop::Style::AndOr < ::RuboCop::Cop::Base def correct_send(node, corrector); end def correct_setter(node, corrector); end def correctable_send?(node); end + def keep_operator_precedence(corrector, node); end def message(node); end def on_conditionals(node); end def process_logical_operator(node); end @@ -6912,6 +7011,7 @@ RuboCop::Cop::Style::BlockComments::MSG = T.let(T.unsafe(nil), String) class RuboCop::Cop::Style::BlockDelimiters < ::RuboCop::Cop::Base include(::RuboCop::Cop::ConfigurableEnforcedStyle) include(::RuboCop::Cop::IgnoredMethods) + extend(::RuboCop::Cop::IgnoredMethods::Config) extend(::RuboCop::Cop::AutoCorrector) def on_block(node); end @@ -7052,7 +7152,7 @@ class RuboCop::Cop::Style::ClassAndModuleChildren < ::RuboCop::Cop::Base def nest_or_compact(corrector, node); end def one_child?(body); end def remove_end(corrector, body); end - def replace_keyword_with_module(corrector, node); end + def replace_namespace_keyword(corrector, node); end def split_on_double_colon(corrector, node, padding); end end @@ -7075,6 +7175,7 @@ RuboCop::Cop::Style::ClassCheck::RESTRICT_ON_SEND = T.let(T.unsafe(nil), Array) class RuboCop::Cop::Style::ClassEqualityComparison < ::RuboCop::Cop::Base include(::RuboCop::Cop::RangeHelp) include(::RuboCop::Cop::IgnoredMethods) + extend(::RuboCop::Cop::IgnoredMethods::Config) extend(::RuboCop::Cop::AutoCorrector) def class_comparison_candidate?(param0 = T.unsafe(nil)); end @@ -7500,6 +7601,7 @@ class RuboCop::Cop::Style::Documentation < ::RuboCop::Cop::Base def check(node, body, type); end def compact_namespace?(node); end def constant_declaration?(node); end + def macro_only?(body); end def namespace?(node); end def nodoc(node); end def nodoc?(comment, require_all: T.unsafe(nil)); end @@ -7887,6 +7989,7 @@ class RuboCop::Cop::Style::FormatString < ::RuboCop::Cop::Base def autocorrect(corrector, node); end def autocorrect_from_percent(corrector, node); end def autocorrect_to_percent(corrector, node); end + def format_single_parameter(arg); end def message(detected_style); end def method_name(style_name); end end @@ -8207,10 +8310,14 @@ class RuboCop::Cop::Style::IfWithSemicolon < ::RuboCop::Cop::Base private - def correct_to_ternary(node); end + def autocorrect(node); end + def build_else_branch(second_condition); end + def correct_elsif(node); end end -RuboCop::Cop::Style::IfWithSemicolon::MSG = T.let(T.unsafe(nil), String) +RuboCop::Cop::Style::IfWithSemicolon::MSG_IF_ELSE = T.let(T.unsafe(nil), String) + +RuboCop::Cop::Style::IfWithSemicolon::MSG_TERNARY = T.let(T.unsafe(nil), String) class RuboCop::Cop::Style::ImplicitRuntimeError < ::RuboCop::Cop::Base def implicit_runtime_error_raise_or_fail(param0 = T.unsafe(nil)); end @@ -8414,6 +8521,7 @@ class RuboCop::Cop::Style::MethodCallWithArgsParentheses < ::RuboCop::Cop::Base include(::RuboCop::Cop::IgnoredPattern) include(::RuboCop::Cop::Style::MethodCallWithArgsParentheses::RequireParentheses) include(::RuboCop::Cop::Style::MethodCallWithArgsParentheses::OmitParentheses) + extend(::RuboCop::Cop::IgnoredMethods::Config) extend(::RuboCop::Cop::AutoCorrector) def on_csend(node); end @@ -8472,15 +8580,18 @@ end class RuboCop::Cop::Style::MethodCallWithoutArgsParentheses < ::RuboCop::Cop::Base include(::RuboCop::Cop::IgnoredMethods) + extend(::RuboCop::Cop::IgnoredMethods::Config) extend(::RuboCop::Cop::AutoCorrector) def on_send(node); end private def any_assignment?(node); end + def default_argument?(node); end def ineligible_node?(node); end def offense_range(node); end + def register_offense(node); end def same_name_assignment?(node); end def variable_in_mass_assignment?(variable_name, node); end end @@ -9053,11 +9164,11 @@ RuboCop::Cop::Style::NumericLiteralPrefix::OCTAL_ZERO_ONLY_MSG = T.let(T.unsafe( RuboCop::Cop::Style::NumericLiteralPrefix::OCTAL_ZERO_ONLY_REGEX = T.let(T.unsafe(nil), Regexp) -class RuboCop::Cop::Style::NumericLiterals < ::RuboCop::Cop::Cop +class RuboCop::Cop::Style::NumericLiterals < ::RuboCop::Cop::Base include(::RuboCop::Cop::ConfigurableMax) include(::RuboCop::Cop::IntegerNode) + extend(::RuboCop::Cop::AutoCorrector) - def autocorrect(node); end def on_float(node); end def on_int(node); end @@ -9068,6 +9179,7 @@ class RuboCop::Cop::Style::NumericLiterals < ::RuboCop::Cop::Cop def format_number(node); end def max_parameter_name; end def min_digits; end + def register_offense(node); end def short_group_regex; end end @@ -9078,6 +9190,7 @@ RuboCop::Cop::Style::NumericLiterals::MSG = T.let(T.unsafe(nil), String) class RuboCop::Cop::Style::NumericPredicate < ::RuboCop::Cop::Base include(::RuboCop::Cop::ConfigurableEnforcedStyle) include(::RuboCop::Cop::IgnoredMethods) + extend(::RuboCop::Cop::IgnoredMethods::Config) extend(::RuboCop::Cop::AutoCorrector) def comparison(param0 = T.unsafe(nil)); end @@ -9405,6 +9518,17 @@ RuboCop::Cop::Style::RandomWithOffset::MSG = T.let(T.unsafe(nil), String) RuboCop::Cop::Style::RandomWithOffset::RESTRICT_ON_SEND = T.let(T.unsafe(nil), Array) +class RuboCop::Cop::Style::RedundantArgument < ::RuboCop::Cop::Base + def on_send(node); end + + private + + def redundant_arg_for_method(method_name); end + def redundant_argument?(node); end +end + +RuboCop::Cop::Style::RedundantArgument::MSG = T.let(T.unsafe(nil), String) + class RuboCop::Cop::Style::RedundantAssignment < ::RuboCop::Cop::Base extend(::RuboCop::Cop::AutoCorrector) @@ -10139,11 +10263,18 @@ RuboCop::Cop::Style::SlicingWithRange::MSG = T.let(T.unsafe(nil), String) RuboCop::Cop::Style::SlicingWithRange::RESTRICT_ON_SEND = T.let(T.unsafe(nil), Array) class RuboCop::Cop::Style::SoleNestedConditional < ::RuboCop::Cop::Base + include(::RuboCop::Cop::RangeHelp) + extend(::RuboCop::Cop::AutoCorrector) + def on_if(node); end private def allow_modifier?; end + def autocorrect(corrector, node, if_branch); end + def correct_for_basic_condition_style(corrector, node, if_branch, and_operator); end + def correct_for_comment(corrector, node, if_branch); end + def correct_for_gurad_condition_style(corrector, node, if_branch, and_operator); end def offending_branch?(branch); end end @@ -10401,10 +10532,12 @@ RuboCop::Cop::Style::SymbolLiteral::MSG = T.let(T.unsafe(nil), String) class RuboCop::Cop::Style::SymbolProc < ::RuboCop::Cop::Base include(::RuboCop::Cop::RangeHelp) include(::RuboCop::Cop::IgnoredMethods) + extend(::RuboCop::Cop::IgnoredMethods::Config) extend(::RuboCop::Cop::AutoCorrector) def destructuring_block_argument?(argument_node); end def on_block(node); end + def on_numblock(node); end def proc_node?(param0 = T.unsafe(nil)); end def symbol_proc?(param0 = T.unsafe(nil)); end @@ -11458,9 +11591,6 @@ module RuboCop::Ext::RegexpParser::Expression::Base def loc; end def origin; end def origin=(_arg0); end - def source; end - def source=(_arg0); end - def start_index; end private @@ -11539,6 +11669,8 @@ module RuboCop::Formatter::Colorizable end class RuboCop::Formatter::DisabledConfigFormatter < ::RuboCop::Formatter::BaseFormatter + include(::RuboCop::PathUtil) + def initialize(output, options = T.unsafe(nil)); end def file_finished(file, offenses); end @@ -11551,6 +11683,7 @@ class RuboCop::Formatter::DisabledConfigFormatter < ::RuboCop::Formatter::BaseFo def cop_config_params(default_cfg, cfg); end def default_config(cop_name); end def excludes(offending_files, cop_name, parent); end + def merge_mode_for_exclude?(cfg); end def output_cop(cop_name, offense_count); end def output_cop_comments(output_buffer, cfg, cop_name, offense_count); end def output_cop_config(output_buffer, cfg, cop_name); end @@ -11750,9 +11883,9 @@ RuboCop::Formatter::PacmanFormatter::FALLBACK_TERMINAL_WIDTH = T.let(T.unsafe(ni RuboCop::Formatter::PacmanFormatter::GHOST = T.let(T.unsafe(nil), String) -RuboCop::Formatter::PacmanFormatter::PACDOT = T.let(T.unsafe(nil), Rainbow::Presenter) +RuboCop::Formatter::PacmanFormatter::PACDOT = T.let(T.unsafe(nil), Rainbow::NullPresenter) -RuboCop::Formatter::PacmanFormatter::PACMAN = T.let(T.unsafe(nil), Rainbow::Presenter) +RuboCop::Formatter::PacmanFormatter::PACMAN = T.let(T.unsafe(nil), Rainbow::NullPresenter) class RuboCop::Formatter::ProgressFormatter < ::RuboCop::Formatter::ClangStyleFormatter include(::RuboCop::Formatter::TextUtil) @@ -12297,10 +12430,10 @@ end class String include(::Comparable) - include(::Colorize::InstanceMethods) include(::JSON::Ext::Generator::GeneratorMethods::String) - extend(::Colorize::ClassMethods) + include(::Colorize::InstanceMethods) extend(::JSON::Ext::Generator::GeneratorMethods::String::Extend) + extend(::Colorize::ClassMethods) def blank?; end end
false
Other
Homebrew
brew
1064678d3dd8b0acc03a9a71abab09d1d818990c.json
Add audit for unversioned URLs with checksum.
Library/Homebrew/cask/audit.rb
@@ -248,6 +248,7 @@ def check_sha256 return unless cask.sha256 check_sha256_no_check_if_latest + check_sha256_no_check_if_unversioned check_sha256_actually_256 check_sha256_invalid end @@ -260,6 +261,12 @@ def check_sha256_no_check_if_latest add_error "you should use sha256 :no_check when version is :latest" end + def check_sha256_no_check_if_unversioned + return if cask.sha256 == :no_check + + add_error "Use `sha256 :no_check` when URL is unversioned." if cask.url.unversioned? + end + def check_sha256_actually_256 odebug "Verifying sha256 string is a legal SHA-256 digest" return unless cask.sha256.is_a?(Checksum)
false
Other
Homebrew
brew
a0e0925f8eb1dc073b86da68e24341f5aea6b42d.json
Update RBI files for sorbet.
Library/Homebrew/sorbet/rbi/hidden-definitions/hidden.rbi
@@ -7675,6 +7675,11 @@ module Homebrew MIN_PORT = ::T.let(nil, ::T.untyped) end +class Homebrew::BundleVersion + extend ::T::Private::Methods::MethodHooks + extend ::T::Private::Methods::SingletonMethodHooks +end + class Homebrew::CLI::Args extend ::T::Private::Methods::MethodHooks extend ::T::Private::Methods::SingletonMethodHooks @@ -7834,6 +7839,11 @@ class Homebrew::FormulaCreator extend ::T::Private::Methods::SingletonMethodHooks end +module Homebrew::Livecheck + extend ::T::Private::Methods::MethodHooks + extend ::T::Private::Methods::SingletonMethodHooks +end + class Homebrew::Style::LineLocation extend ::T::Private::Methods::MethodHooks extend ::T::Private::Methods::SingletonMethodHooks
false
Other
Homebrew
brew
9c0bf12c7c8ae34e6eb3321880956384bb77549d.json
Update RBI files for rubocop-rails.
Library/Homebrew/sorbet/rbi/gems/rubocop-rails@2.9.1.rbi
@@ -683,8 +683,7 @@ class RuboCop::Cop::Rails::FindEach < ::RuboCop::Cop::Base private - def ignored?(relation_method); end - def method_chain(node); end + def ignored?(node); end end RuboCop::Cop::Rails::FindEach::MSG = T.let(T.unsafe(nil), String) @@ -723,8 +722,13 @@ RuboCop::Cop::Rails::HasManyOrHasOneDependent::MSG = T.let(T.unsafe(nil), String RuboCop::Cop::Rails::HasManyOrHasOneDependent::RESTRICT_ON_SEND = T.let(T.unsafe(nil), Array) class RuboCop::Cop::Rails::HelperInstanceVariable < ::RuboCop::Cop::Base + def form_builder_class?(param0 = T.unsafe(nil)); end def on_ivar(node); end def on_ivasgn(node); end + + private + + def inherit_form_builder?(node); end end RuboCop::Cop::Rails::HelperInstanceVariable::MSG = T.let(T.unsafe(nil), String)
true
Other
Homebrew
brew
9c0bf12c7c8ae34e6eb3321880956384bb77549d.json
Update RBI files for rubocop-rails.
Library/Homebrew/sorbet/rbi/hidden-definitions/hidden.rbi
@@ -7675,6 +7675,11 @@ module Homebrew MIN_PORT = ::T.let(nil, ::T.untyped) end +class Homebrew::BundleVersion + extend ::T::Private::Methods::MethodHooks + extend ::T::Private::Methods::SingletonMethodHooks +end + class Homebrew::CLI::Args extend ::T::Private::Methods::MethodHooks extend ::T::Private::Methods::SingletonMethodHooks @@ -7834,6 +7839,11 @@ class Homebrew::FormulaCreator extend ::T::Private::Methods::SingletonMethodHooks end +module Homebrew::Livecheck + extend ::T::Private::Methods::MethodHooks + extend ::T::Private::Methods::SingletonMethodHooks +end + class Homebrew::Style::LineLocation extend ::T::Private::Methods::MethodHooks extend ::T::Private::Methods::SingletonMethodHooks
true
Other
Homebrew
brew
8e389c54561e6b39fdfeaf9b90d172d9c248d6c3.json
sorbet: Update RBI files. Autogenerated by the [sorbet](https://github.com/Homebrew/brew/blob/master/.github/workflows/sorbet.yml) workflow.
Library/Homebrew/sorbet/rbi/hidden-definitions/hidden.rbi
@@ -7675,6 +7675,11 @@ module Homebrew MIN_PORT = ::T.let(nil, ::T.untyped) end +class Homebrew::BundleVersion + extend ::T::Private::Methods::MethodHooks + extend ::T::Private::Methods::SingletonMethodHooks +end + class Homebrew::CLI::Args extend ::T::Private::Methods::MethodHooks extend ::T::Private::Methods::SingletonMethodHooks @@ -7834,6 +7839,11 @@ class Homebrew::FormulaCreator extend ::T::Private::Methods::SingletonMethodHooks end +module Homebrew::Livecheck + extend ::T::Private::Methods::MethodHooks + extend ::T::Private::Methods::SingletonMethodHooks +end + class Homebrew::Style::LineLocation extend ::T::Private::Methods::MethodHooks extend ::T::Private::Methods::SingletonMethodHooks
false
Other
Homebrew
brew
7fb1620c58c1f5f9fc47934c4c1460532b0074be.json
Enable check_repository_references conditionally Enable check_repository_references when HOMEBREW_PREFIX == HOMEBREW_REPOSITORY. Co-authored-by: Mike McQuaid <mike@mikemcquaid.com>
Library/Homebrew/formula_cellar_checks.rb
@@ -210,6 +210,7 @@ def check_python_packages(lib, deps) end def check_repository_references(prefix) + return if HOMEBREW_PREFIX != HOMEBREW_REPOSITORY return unless prefix.directory? keg = Keg.new(prefix)
false
Other
Homebrew
brew
5607e4a947cc8bc81c2bf05009658d14e67dcd39.json
dev-cmd/pr-automerge: exclude draft PR
Library/Homebrew/dev-cmd/pr-automerge.rb
@@ -44,7 +44,7 @@ def pr_automerge without_labels = args.without_labels || ["do not merge", "new formula", "automerge-skip", "linux-only"] tap = Tap.fetch(args.tap || CoreTap.instance.name) - query = "is:pr is:open repo:#{tap.full_name}" + query = "is:pr is:open repo:#{tap.full_name} draft:false" query += args.ignore_failures? ? " -status:pending" : " status:success" query += " review:approved" unless args.without_approval? query += " label:\"#{args.with_label}\"" if args.with_label
false
Other
Homebrew
brew
1acb085574ab1560e55ecf21e6e7194ff435227e.json
update-report: summarize updated casks for --preinstall Also, show less output if --quiet is passed.
Library/Homebrew/cmd/update-report.rb
@@ -66,7 +66,7 @@ def update_report HOMEBREW_REPOSITORY.cd do donation_message_displayed = Utils.popen_read("git", "config", "--get", "homebrew.donationmessage").chomp == "true" - unless donation_message_displayed + if !donation_message_displayed && !args.quiet? ohai "Homebrew is run entirely by unpaid volunteers. Please consider donating:" puts " #{Formatter.url("https://github.com/Homebrew/brew#donations")}\n" @@ -118,7 +118,7 @@ def update_report if updated if hub.empty? - puts "No changes to formulae." + puts "No changes to formulae." unless args.quiet? else hub.dump(updated_formula_report: !args.preinstall?) hub.reporters.each(&:migrate_tap_migration) @@ -130,7 +130,7 @@ def update_report end puts if args.preinstall? elsif !args.preinstall? && !ENV["HOMEBREW_UPDATE_FAILED"] - puts "Already up-to-date." + puts "Already up-to-date." unless args.quiet? end Commands.rebuild_commands_completion_list @@ -456,7 +456,15 @@ def dump(updated_formula_report: true) dump_formula_report :R, "Renamed Formulae" dump_formula_report :D, "Deleted Formulae" dump_formula_report :AC, "New Casks" - dump_formula_report :MC, "Updated Casks" + if updated_formula_report + dump_formula_report :MC, "Updated Casks" + else + updated = select_formula(:MC).count + if updated.positive? + ohai "Updated Casks" + puts "Updated #{updated} #{"cask".pluralize(updated)}." + end + end dump_formula_report :DC, "Deleted Casks" end
false
Other
Homebrew
brew
91d6009891e84ec1a19bc3b9edabf4db4f96b184.json
Remove special case for XQuartz.
Library/Homebrew/test/bundle_version_spec.rb
@@ -6,18 +6,17 @@ describe Homebrew::BundleVersion do describe "#nice_version" do expected_mappings = { - ["1.2", nil] => "1.2", - [nil, "1.2.3"] => "1.2.3", - ["1.2", "1.2.3"] => "1.2.3", - ["1.2.3", "1.2"] => "1.2.3", - ["1.2.3", "8312"] => "1.2.3,8312", - ["2021", "2006"] => "2021,2006", - ["1.0", "1"] => "1.0", - ["1.0", "0"] => "1.0", - ["1.2.3.4000", "4000"] => "1.2.3.4000", - ["5", "5.0.45"] => "5.0.45", - ["XQuartz-2.7.11", "2.7.112"] => "2.7.11", - ["2.5.2(3329)", "3329"] => "2.5.2,3329", + ["1.2", nil] => "1.2", + [nil, "1.2.3"] => "1.2.3", + ["1.2", "1.2.3"] => "1.2.3", + ["1.2.3", "1.2"] => "1.2.3", + ["1.2.3", "8312"] => "1.2.3,8312", + ["2021", "2006"] => "2021,2006", + ["1.0", "1"] => "1.0", + ["1.0", "0"] => "1.0", + ["1.2.3.4000", "4000"] => "1.2.3.4000", + ["5", "5.0.45"] => "5.0.45", + ["2.5.2(3329)", "3329"] => "2.5.2,3329", } expected_mappings.each do |(short_version, version), expected_version|
false
Other
Homebrew
brew
7b9556db0618e3b3752d74572a3c4108a36878fe.json
Remove trailing `version` from `short_version`.
Library/Homebrew/bundle_version.rb
@@ -67,6 +67,8 @@ def nice_version sig { returns(T::Array[String]) } def nice_parts + short_version = self.short_version&.delete_suffix("(#{version})") if version + return [short_version] if short_version == version if short_version && version
true
Other
Homebrew
brew
7b9556db0618e3b3752d74572a3c4108a36878fe.json
Remove trailing `version` from `short_version`.
Library/Homebrew/test/bundle_version_spec.rb
@@ -17,6 +17,7 @@ ["1.2.3.4000", "4000"] => "1.2.3.4000", ["5", "5.0.45"] => "5.0.45", ["XQuartz-2.7.11", "2.7.112"] => "2.7.11", + ["2.5.2(3329)", "3329"] => "2.5.2,3329", } expected_mappings.each do |(short_version, version), expected_version|
true
Other
Homebrew
brew
7c6116af992b5fda8bc175277d862ef03624c984.json
Remove fallback for `BundleVersion`.
Library/Homebrew/bundle_version.rb
@@ -80,9 +80,7 @@ def nice_parts end end - fallback = (short_version || version).sub(/\A[^\d]+/, "") - - [fallback] + [short_version, version].compact end private :nice_parts end
false
Other
Homebrew
brew
831d034303bf972f6b4a872d5abdf6acb3439656.json
software_spec: fix cellar any handling. `cellar :any` actually requires no references to the cellar, prefix or repository (not just cellar) so we can pour those bottles anywhere regardless of the cellar, prefix or repository.
Library/Homebrew/software_spec.rb
@@ -369,16 +369,18 @@ def root_url(var = nil, specs = {}) end def compatible_locations? - compatible_cellar = cellar == :any || - cellar == :any_skip_relocation || - cellar == HOMEBREW_CELLAR.to_s + # this looks like it should check prefix and repository too but to be + # `cellar :any` actually requires no references to the cellar, prefix or + # repository. + return true if [:any, :any_skip_relocation].include?(cellar) + compatible_cellar = cellar == HOMEBREW_CELLAR.to_s compatible_prefix = prefix == HOMEBREW_PREFIX.to_s # Only check the repository matches if the prefix is the default. # This is because the bottle DSL does not allow setting a custom repository # but does allow setting a custom prefix. - compatible_repository = if prefix == Homebrew::DEFAULT_PREFIX + compatible_repository = if Homebrew.default_prefix?(prefix) repository == HOMEBREW_REPOSITORY.to_s else true
false
Other
Homebrew
brew
33483e9478bf8b48f69b1c517e634f499a47094b.json
Fix install --force-bottle for non-standard prefix Fix the error: Error: undefined method `stage' for nil:NilClass formula_installer.rb:1132:in `block in pour'
Library/Homebrew/formula_installer.rb
@@ -347,7 +347,7 @@ def install # Warn if a more recent version of this formula is available in the tap. begin - if formula.pkg_version < (v = Formulary.factory(formula.full_name).pkg_version) + if formula.pkg_version < (v = Formulary.factory(formula.full_name, force_bottle: force_bottle?).pkg_version) opoo "#{formula.full_name} #{v} is available and more recent than version #{formula.pkg_version}." end rescue FormulaUnavailableError
false
Other
Homebrew
brew
91608a67f28f3f481e93180d398056374ae8ece2.json
sorbet: Update RBI files. Autogenerated by the [sorbet](https://github.com/Homebrew/brew/blob/master/.github/workflows/sorbet.yml) workflow.
Library/Homebrew/sorbet/rbi/hidden-definitions/hidden.rbi
@@ -11477,6 +11477,79 @@ class Migrator extend ::T::Private::Methods::SingletonMethodHooks end +class MiniPortile + def activate(); end + + def apply_patch(patch_file); end + + def compile(); end + + def configure(); end + + def configure_options(); end + + def configure_options=(configure_options); end + + def configured?(); end + + def cook(); end + + def download(); end + + def downloaded?(); end + + def extract(); end + + def files(); end + + def files=(files); end + + def host(); end + + def host=(host); end + + def initialize(name, version); end + + def install(); end + + def installed?(); end + + def logger(); end + + def logger=(logger); end + + def name(); end + + def original_host(); end + + def patch(); end + + def patch_files(); end + + def patch_files=(patch_files); end + + def path(); end + + def target(); end + + def target=(target); end + + def version(); end + KEYRING_NAME = ::T.let(nil, ::T.untyped) + TAR_EXECUTABLES = ::T.let(nil, ::T.untyped) + VERSION = ::T.let(nil, ::T.untyped) +end + +class MiniPortile + def self.windows?(); end +end + +class MiniPortileCMake +end + +class MiniPortileCMake +end + MiniTest = Minitest module Minitest @@ -13153,29 +13226,6 @@ module OpenSSL::SSL TLS1_VERSION = ::T.let(nil, ::T.untyped) end -class OpenSSL::SSL::SSLContext - def add_certificate(*_); end - - def alpn_protocols(); end - - def alpn_protocols=(alpn_protocols); end - - def alpn_select_cb(); end - - def alpn_select_cb=(alpn_select_cb); end - - def max_version=(version); end - - def min_version=(version); end - DEFAULT_TMP_DH_CALLBACK = ::T.let(nil, ::T.untyped) -end - -class OpenSSL::SSL::SSLSocket - def alpn_protocol(); end - - def tmp_key(); end -end - module OpenSSL::X509 V_FLAG_NO_CHECK_TIME = ::T.let(nil, ::T.untyped) V_FLAG_TRUSTED_FIRST = ::T.let(nil, ::T.untyped)
false
Other
Homebrew
brew
f711352cfd222ee3281afc8594cf3392e03eeb06.json
Add audit for `livecheck` in casks.
Library/Homebrew/cask/audit.rb
@@ -4,6 +4,7 @@ require "cask/denylist" require "cask/download" require "digest" +require "livecheck/livecheck" require "utils/curl" require "utils/git" require "utils/shared_audits" @@ -66,10 +67,11 @@ def run! check_single_uninstall_zap check_untrusted_pkg check_hosting_with_appcast - check_latest_with_appcast + check_latest_with_appcast_or_livecheck check_latest_with_auto_updates check_stanza_requires_uninstall check_appcast_contains_version + check_livecheck_version check_gitlab_repository check_gitlab_repository_archived check_gitlab_prerelease_version @@ -274,11 +276,11 @@ def check_sha256_invalid add_error "cannot use the sha256 for an empty string: #{empty_sha256}" end - def check_latest_with_appcast + def check_latest_with_appcast_or_livecheck return unless cask.version.latest? - return unless cask.appcast - add_error "Casks with an appcast should not use version :latest" + add_error "Casks with an appcast should not use version :latest" if cask.appcast + add_error "Casks with a livecheck should not use version :latest" if cask.livecheckable? end def check_latest_with_auto_updates @@ -511,6 +513,18 @@ def check_download add_error "download not possible: #{e}" end + def check_livecheck_version + return unless appcast? + return unless cask.livecheckable? + return if cask.livecheck.skip? + return if cask.version.latest? + + latest_version = Homebrew::Livecheck.latest_version(cask)&.fetch(:latest) + return if cask.version.to_s == latest_version.to_s + + add_error "Version '#{cask.version}' differs from '#{latest_version}' retrieved by livecheck." + end + def check_appcast_contains_version return unless appcast? return if cask.appcast.to_s.empty?
true
Other
Homebrew
brew
f711352cfd222ee3281afc8594cf3392e03eeb06.json
Add audit for `livecheck` in casks.
Library/Homebrew/cli/args.rbi
@@ -24,6 +24,15 @@ module Homebrew sig { returns(T.nilable(T::Boolean)) } def force_bottle?; end + sig { returns(T.nilable(T::Boolean)) } + def newer_only?; end + + sig { returns(T.nilable(T::Boolean)) } + def full_name?; end + + sig { returns(T.nilable(T::Boolean)) } + def json?; end + sig { returns(T.nilable(T::Boolean)) } def debug?; end
true
Other
Homebrew
brew
f711352cfd222ee3281afc8594cf3392e03eeb06.json
Add audit for `livecheck` in casks.
Library/Homebrew/dev-cmd/livecheck.rb
@@ -101,6 +101,15 @@ def livecheck raise UsageError, "No formulae or casks to check." if formulae_and_casks_to_check.blank? - Livecheck.run_checks(formulae_and_casks_to_check, args) + options = { + json: args.json?, + full_name: args.full_name?, + newer_only: args.newer_only?, + quiet: args.quiet?, + debug: args.debug?, + verbose: args.verbose?, + }.compact + + Livecheck.run_checks(formulae_and_casks_to_check, **options) end end
true
Other
Homebrew
brew
f711352cfd222ee3281afc8594cf3392e03eeb06.json
Add audit for `livecheck` in casks.
Library/Homebrew/livecheck/livecheck.rb
@@ -12,6 +12,8 @@ module Homebrew # # @api private module Livecheck + extend T::Sig + module_function GITEA_INSTANCES = %w[ @@ -41,10 +43,25 @@ module Livecheck rc ].freeze + def livecheck_strategy_names + return @livecheck_strategy_names if defined?(@livecheck_strategy_names) + + # Cache demodulized strategy names, to avoid repeating this work + @livecheck_strategy_names = {} + Strategy.constants.sort.each do |strategy_symbol| + strategy = Strategy.const_get(strategy_symbol) + @livecheck_strategy_names[strategy] = strategy.name.demodulize + end + @livecheck_strategy_names.freeze + end + # Executes the livecheck logic for each formula/cask in the # `formulae_and_casks_to_check` array and prints the results. # @return [nil] - def run_checks(formulae_and_casks_to_check, args) + def run_checks( + formulae_and_casks_to_check, + full_name: false, json: false, newer_only: false, debug: false, quiet: false, verbose: false + ) # Identify any non-homebrew/core taps in use for current formulae non_core_taps = {} formulae_and_casks_to_check.each do |formula_or_cask| @@ -62,17 +79,9 @@ def run_checks(formulae_and_casks_to_check, args) Dir["#{tap_strategy_path}/*.rb"].sort.each(&method(:require)) if Dir.exist?(tap_strategy_path) end - # Cache demodulized strategy names, to avoid repeating this work - @livecheck_strategy_names = {} - Strategy.constants.sort.each do |strategy_symbol| - strategy = Strategy.const_get(strategy_symbol) - @livecheck_strategy_names[strategy] = strategy.name.demodulize - end - @livecheck_strategy_names.freeze - has_a_newer_upstream_version = false - if args.json? && !args.quiet? && $stderr.tty? + if json && !quiet && $stderr.tty? formulae_and_casks_total = if formulae_and_casks_to_check == Formula formulae_and_casks_to_check.count else @@ -96,15 +105,15 @@ def run_checks(formulae_and_casks_to_check, args) formula = formula_or_cask if formula_or_cask.is_a?(Formula) cask = formula_or_cask if formula_or_cask.is_a?(Cask::Cask) - if args.debug? && i.positive? + if debug && i.positive? puts <<~EOS ---------- EOS end - skip_result = skip_conditions(formula_or_cask, args: args) + skip_result = skip_conditions(formula_or_cask, json: json, full_name: full_name, quiet: quiet) next skip_result if skip_result != false formula&.head&.downloader&.shutup! @@ -126,17 +135,20 @@ def run_checks(formulae_and_casks_to_check, args) latest = if formula&.head_only? formula.head.downloader.fetch_last_commit else - version_info = latest_version(formula_or_cask, args: args) + version_info = latest_version( + formula_or_cask, + json: json, full_name: full_name, verbose: verbose, debug: debug, + ) version_info[:latest] if version_info.present? end if latest.blank? no_versions_msg = "Unable to get versions" - raise TypeError, no_versions_msg unless args.json? + raise TypeError, no_versions_msg unless json next version_info if version_info.is_a?(Hash) && version_info[:status] && version_info[:messages] - next status_hash(formula_or_cask, "error", [no_versions_msg], args: args) + next status_hash(formula_or_cask, "error", [no_versions_msg], full_name: full_name, verbose: verbose) end if (m = latest.to_s.match(/(.*)-release$/)) && !current.to_s.match(/.*-release$/) @@ -154,8 +166,8 @@ def run_checks(formulae_and_casks_to_check, args) is_newer_than_upstream = (formula&.stable? || cask) && (current > latest) info = {} - info[:formula] = formula_name(formula, args: args) if formula - info[:cask] = cask_name(cask, args: args) if cask + info[:formula] = formula_name(formula, full_name: full_name) if formula + info[:cask] = cask_name(cask, full_name: full_name) if cask info[:version] = { current: current.to_s, latest: latest.to_s, @@ -168,35 +180,33 @@ def run_checks(formulae_and_casks_to_check, args) info[:meta][:head_only] = true if formula&.head_only? info[:meta].merge!(version_info[:meta]) if version_info.present? && version_info.key?(:meta) - next if args.newer_only? && !info[:version][:outdated] + next if newer_only && !info[:version][:outdated] has_a_newer_upstream_version ||= true - if args.json? + if json progress&.increment - info.except!(:meta) unless args.verbose? + info.except!(:meta) unless verbose next info end - print_latest_version(info, args: args) + print_latest_version(info, verbose: verbose) nil rescue => e Homebrew.failed = true - if args.json? + if json progress&.increment - status_hash(formula_or_cask, "error", [e.to_s], args: args) - elsif !args.quiet? - onoe "#{Tty.blue}#{formula_or_cask_name(formula_or_cask, args: args)}#{Tty.reset}: #{e}" + status_hash(formula_or_cask, "error", [e.to_s], full_name: full_name, verbose: verbose) + elsif !quiet + onoe "#{Tty.blue}#{formula_or_cask_name(formula_or_cask, full_name: full_name)}#{Tty.reset}: #{e}" nil end end - if args.newer_only? && !has_a_newer_upstream_version && !args.debug? && !args.json? - puts "No newer upstream versions." - end + puts "No newer upstream versions." if newer_only && !has_a_newer_upstream_version && !debug && !json - return unless args.json? + return unless json if progress progress.finish @@ -208,100 +218,103 @@ def run_checks(formulae_and_casks_to_check, args) puts JSON.generate(formulae_checked.compact) end - def formula_or_cask_name(formula_or_cask, args:) + sig { params(formula_or_cask: T.any(Formula, Cask::Cask), full_name: T::Boolean).returns(String) } + def formula_or_cask_name(formula_or_cask, full_name: false) case formula_or_cask when Formula - formula_name(formula_or_cask, args: args) + formula_name(formula_or_cask, full_name: full_name) when Cask::Cask - cask_name(formula_or_cask, args: args) + cask_name(formula_or_cask, full_name: full_name) end end - def cask_name(cask, args:) - args.full_name? ? cask.full_name : cask.token + # Returns the fully-qualified name of a cask if the `full_name` argument is + # provided; returns the name otherwise. + sig { params(cask: Cask::Cask, full_name: T::Boolean).returns(String) } + def cask_name(cask, full_name: false) + full_name ? cask.full_name : cask.token end # Returns the fully-qualified name of a formula if the `full_name` argument is # provided; returns the name otherwise. - # @return [String] - def formula_name(formula, args:) - args.full_name? ? formula.full_name : formula.name + sig { params(formula: Formula, full_name: T::Boolean).returns(String) } + def formula_name(formula, full_name: false) + full_name ? formula.full_name : formula.name end - def status_hash(formula_or_cask, status_str, messages = nil, args:) + def status_hash(formula_or_cask, status_str, messages = nil, full_name: false, verbose: false) formula = formula_or_cask if formula_or_cask.is_a?(Formula) cask = formula_or_cask if formula_or_cask.is_a?(Cask::Cask) status_hash = {} if formula - status_hash[:formula] = formula_name(formula, args: args) + status_hash[:formula] = formula_name(formula, full_name: full_name) elsif cask - status_hash[:cask] = cask_name(formula_or_cask, args: args) + status_hash[:cask] = cask_name(formula_or_cask, full_name: full_name) end status_hash[:status] = status_str status_hash[:messages] = messages if messages.is_a?(Array) - if args.verbose? - status_hash[:meta] = { - livecheckable: formula_or_cask.livecheckable?, - } - status_hash[:meta][:head_only] = true if formula&.head_only? - end + status_hash[:meta] = { + livecheckable: formula_or_cask.livecheckable?, + } + status_hash[:meta][:head_only] = true if formula&.head_only? status_hash end # If a formula has to be skipped, it prints or returns a Hash contaning the reason # for doing so; returns false otherwise. # @return [Hash, nil, Boolean] - def skip_conditions(formula_or_cask, args:) + def skip_conditions(formula_or_cask, json: false, full_name: false, quiet: false, verbose: false) formula = formula_or_cask if formula_or_cask.is_a?(Formula) if formula&.deprecated? && !formula.livecheckable? - return status_hash(formula, "deprecated", args: args) if args.json? + return status_hash(formula, "deprecated", full_name: full_name, verbose: verbose) if json - puts "#{Tty.red}#{formula_name(formula, args: args)}#{Tty.reset} : deprecated" unless args.quiet? + puts "#{Tty.red}#{formula_name(formula, full_name: full_name)}#{Tty.reset} : deprecated" unless quiet return end if formula&.disabled? && !formula.livecheckable? - return status_hash(formula, "disabled", args: args) if args.json? + return status_hash(formula, "disabled", full_name: full_name, verbose: verbose) if json - puts "#{Tty.red}#{formula_name(formula, args: args)}#{Tty.reset} : disabled" unless args.quiet? + puts "#{Tty.red}#{formula_name(formula, full_name: full_name)}#{Tty.reset} : disabled" unless quiet return end if formula&.versioned_formula? && !formula.livecheckable? - return status_hash(formula, "versioned", args: args) if args.json? + return status_hash(formula, "versioned", full_name: full_name, verbose: verbose) if json - puts "#{Tty.red}#{formula_name(formula, args: args)}#{Tty.reset} : versioned" unless args.quiet? + puts "#{Tty.red}#{formula_name(formula, full_name: full_name)}#{Tty.reset} : versioned" unless quiet return end if formula&.head_only? && !formula.any_version_installed? head_only_msg = "HEAD only formula must be installed to be livecheckable" - return status_hash(formula, "error", [head_only_msg], args: args) if args.json? + return status_hash(formula, "error", [head_only_msg], full_name: full_name, verbose: verbose) if json - puts "#{Tty.red}#{formula_name(formula, args: args)}#{Tty.reset} : #{head_only_msg}" unless args.quiet? + puts "#{Tty.red}#{formula_name(formula, full_name: full_name)}#{Tty.reset} : #{head_only_msg}" unless quiet return end is_gist = formula&.stable&.url&.include?("gist.github.com") if formula_or_cask.livecheck.skip? || is_gist - skip_msg = if formula_or_cask.livecheck.skip_msg.is_a?(String) && - formula_or_cask.livecheck.skip_msg.present? - formula_or_cask.livecheck.skip_msg.to_s + skip_message = if formula_or_cask.livecheck.skip_msg.is_a?(String) && + formula_or_cask.livecheck.skip_msg.present? + formula_or_cask.livecheck.skip_msg.to_s.presence elsif is_gist "Stable URL is a GitHub Gist" - else - "" end - return status_hash(formula_or_cask, "skipped", (skip_msg.blank? ? nil : [skip_msg]), args: args) if args.json? + if json + skip_messages = skip_message ? [skip_message] : nil + return status_hash(formula_or_cask, "skipped", skip_messages, full_name: full_name, verbose: verbose) + end - unless args.quiet? - puts "#{Tty.red}#{formula_or_cask_name(formula_or_cask, args: args)}#{Tty.reset} : skipped" \ - "#{" - #{skip_msg}" if skip_msg.present?}" + unless quiet + puts "#{Tty.red}#{formula_or_cask_name(formula_or_cask, full_name: full_name)}#{Tty.reset} : skipped" \ + "#{" - #{skip_message}" if skip_message}" end return end @@ -311,9 +324,9 @@ def skip_conditions(formula_or_cask, args:) # Formats and prints the livecheck result for a formula. # @return [nil] - def print_latest_version(info, args:) + def print_latest_version(info, verbose:) formula_or_cask_s = "#{Tty.blue}#{info[:formula] || info[:cask]}#{Tty.reset}" - formula_or_cask_s += " (guessed)" if !info[:meta][:livecheckable] && args.verbose? + formula_or_cask_s += " (guessed)" if !info[:meta][:livecheckable] && verbose current_s = if info[:version][:newer_than_upstream] "#{Tty.red}#{info[:version][:current]}#{Tty.reset}" @@ -393,7 +406,7 @@ def preprocess_url(url) # Identifies the latest version of the formula and returns a Hash containing # the version information. Returns nil if a latest version couldn't be found. # @return [Hash, nil] - def latest_version(formula_or_cask, args:) + def latest_version(formula_or_cask, json: false, full_name: false, verbose: false, debug: false) formula = formula_or_cask if formula_or_cask.is_a?(Formula) cask = formula_or_cask if formula_or_cask.is_a?(Cask::Cask) @@ -406,19 +419,19 @@ def latest_version(formula_or_cask, args:) urls = [livecheck_url] if livecheck_url.present? urls ||= checkable_urls(formula_or_cask) - if args.debug? + if debug puts if formula - puts "Formula: #{formula_name(formula, args: args)}" + puts "Formula: #{formula_name(formula, full_name: full_name)}" puts "Head only?: true" if formula.head_only? elsif cask - puts "Cask: #{cask_name(formula_or_cask, args: args)}" + puts "Cask: #{cask_name(formula_or_cask, full_name: full_name)}" end puts "Livecheckable?: #{has_livecheckable ? "Yes" : "No"}" end urls.each_with_index do |original_url, i| - if args.debug? + if debug puts puts "URL: #{original_url}" end @@ -443,12 +456,12 @@ def latest_version(formula_or_cask, args:) ) strategy = Strategy.from_symbol(livecheck_strategy) strategy ||= strategies.first - strategy_name = @livecheck_strategy_names[strategy] + strategy_name = livecheck_strategy_names[strategy] - if args.debug? + if debug puts "URL (processed): #{url}" if url != original_url - if strategies.present? && args.verbose? - puts "Strategies: #{strategies.map { |s| @livecheck_strategy_names[s] }.join(", ")}" + if strategies.present? && verbose + puts "Strategies: #{strategies.map { |s| livecheck_strategy_names[s] }.join(", ")}" end puts "Strategy: #{strategy.blank? ? "None" : strategy_name}" puts "Regex: #{livecheck_regex.inspect}" if livecheck_regex.present? @@ -471,13 +484,13 @@ def latest_version(formula_or_cask, args:) regex = strategy_data[:regex] if strategy_data[:messages].is_a?(Array) && match_version_map.blank? - puts strategy_data[:messages] unless args.json? + puts strategy_data[:messages] unless json next if i + 1 < urls.length - return status_hash(formula, "error", strategy_data[:messages], args: args) + return status_hash(formula, "error", strategy_data[:messages], full_name: full_name, verbose: verbose) end - if args.debug? + if debug puts "URL (strategy): #{strategy_data[:url]}" if strategy_data[:url] != url puts "Regex (strategy): #{strategy_data[:regex].inspect}" if strategy_data[:regex] != livecheck_regex end @@ -491,11 +504,11 @@ def latest_version(formula_or_cask, args:) end end - if args.debug? && match_version_map.present? + if debug && match_version_map.present? puts puts "Matched Versions:" - if args.verbose? + if verbose match_version_map.each do |match, version| puts "#{match} => #{version.inspect}" end @@ -510,7 +523,7 @@ def latest_version(formula_or_cask, args:) latest: Version.new(match_version_map.values.max), } - if args.json? && args.verbose? + if json && verbose version_info[:meta] = { url: { original: original_url, @@ -519,9 +532,7 @@ def latest_version(formula_or_cask, args:) } version_info[:meta][:url][:processed] = url if url != original_url version_info[:meta][:url][:strategy] = strategy_data[:url] if strategy_data[:url] != url - if strategies.present? - version_info[:meta][:strategies] = strategies.map { |s| @livecheck_strategy_names[s] } - end + version_info[:meta][:strategies] = strategies.map { |s| livecheck_strategy_names[s] } if strategies.present? version_info[:meta][:regex] = regex.inspect if regex.present? end
true
Other
Homebrew
brew
f711352cfd222ee3281afc8594cf3392e03eeb06.json
Add audit for `livecheck` in casks.
Library/Homebrew/test/livecheck/livecheck_spec.rb
@@ -91,35 +91,29 @@ RUBY end - let(:args) { double("livecheck_args", full_name?: false, json?: false, quiet?: false, verbose?: true) } - describe "::formula_name" do it "returns the name of the formula" do - expect(livecheck.formula_name(f, args: args)).to eq("test") + expect(livecheck.formula_name(f)).to eq("test") end it "returns the full name" do - allow(args).to receive(:full_name?).and_return(true) - - expect(livecheck.formula_name(f, args: args)).to eq("test") + expect(livecheck.formula_name(f, full_name: true)).to eq("test") end end describe "::cask_name" do it "returns the token of the cask" do - expect(livecheck.cask_name(c, args: args)).to eq("test") + expect(livecheck.cask_name(c)).to eq("test") end it "returns the full name of the cask" do - allow(args).to receive(:full_name?).and_return(true) - - expect(livecheck.cask_name(c, args: args)).to eq("test") + expect(livecheck.cask_name(c, full_name: true)).to eq("test") end end describe "::status_hash" do it "returns a hash containing the livecheck status" do - expect(livecheck.status_hash(f, "error", ["Unable to get versions"], args: args)) + expect(livecheck.status_hash(f, "error", ["Unable to get versions"])) .to eq({ formula: "test", status: "error", @@ -133,47 +127,47 @@ describe "::skip_conditions" do it "skips a deprecated formula without a livecheckable" do - expect { livecheck.skip_conditions(f_deprecated, args: args) } + expect { livecheck.skip_conditions(f_deprecated) } .to output("test_deprecated : deprecated\n").to_stdout .and not_to_output.to_stderr end it "skips a disabled formula without a livecheckable" do - expect { livecheck.skip_conditions(f_disabled, args: args) } + expect { livecheck.skip_conditions(f_disabled) } .to output("test_disabled : disabled\n").to_stdout .and not_to_output.to_stderr end it "skips a versioned formula without a livecheckable" do - expect { livecheck.skip_conditions(f_versioned, args: args) } + expect { livecheck.skip_conditions(f_versioned) } .to output("test@0.0.1 : versioned\n").to_stdout .and not_to_output.to_stderr end it "skips a HEAD-only formula if not installed" do - expect { livecheck.skip_conditions(f_head_only, args: args) } + expect { livecheck.skip_conditions(f_head_only) } .to output("test_head_only : HEAD only formula must be installed to be livecheckable\n").to_stdout .and not_to_output.to_stderr end it "skips a formula with a GitHub Gist stable URL" do - expect { livecheck.skip_conditions(f_gist, args: args) } + expect { livecheck.skip_conditions(f_gist) } .to output("test_gist : skipped - Stable URL is a GitHub Gist\n").to_stdout .and not_to_output.to_stderr end it "skips a formula with a skip livecheckable" do - expect { livecheck.skip_conditions(f_skip, args: args) } + expect { livecheck.skip_conditions(f_skip) } .to output("test_skip : skipped - Not maintained\n").to_stdout .and not_to_output.to_stderr end it "returns false for a non-skippable formula" do - expect(livecheck.skip_conditions(f, args: args)).to eq(false) + expect(livecheck.skip_conditions(f)).to eq(false) end it "returns false for a non-skippable cask" do - expect(livecheck.skip_conditions(c, args: args)).to eq(false) + expect(livecheck.skip_conditions(c)).to eq(false) end end
true
Other
Homebrew
brew
87b914387f9510bc7beea40214cc2be6e303c948.json
Update RBI files for sorbet.
Library/Homebrew/sorbet/rbi/hidden-definitions/hidden.rbi
@@ -7723,6 +7723,8 @@ module Homebrew::EnvConfig def self.cleanup_max_age_days(); end + def self.cleanup_periodic_full_days(); end + def self.color?(); end def self.core_git_remote(); end @@ -27645,6 +27647,8 @@ class RuboCop::Cask::AST::Stanza def language?(); end + def livecheck?(); end + def manpage?(); end def mdimporter?(); end
false
Other
Homebrew
brew
4f0b7255acde456c8eba6016c7f0f507205f925a.json
style: add two options
Library/Homebrew/dev-cmd/style.rb
@@ -29,24 +29,32 @@ def style_args description: "Include the RuboCop cop name for each violation in the output." switch "--reset-cache", description: "Reset the RuboCop cache." + switch "--formula", "--formulae", + description: "Treat all named arguments as formulae." + switch "--cask", "--casks", + description: "Treat all named arguments as casks." comma_array "--only-cops", description: "Specify a comma-separated <cops> list to check for violations of only the "\ "listed RuboCop cops." comma_array "--except-cops", description: "Specify a comma-separated <cops> list to skip checking for violations of the "\ "listed RuboCop cops." + conflicts "--formula", "--cask" conflicts "--only-cops", "--except-cops" end end def style args = style_args.parse + only = :formula if args.formula? && !args.cask? + only = :cask if args.cask? && !args.formula? + target = if args.no_named? nil else - args.named.to_paths + args.named.to_paths(only: only) end only_cops = args.only_cops
true
Other
Homebrew
brew
4f0b7255acde456c8eba6016c7f0f507205f925a.json
style: add two options
docs/Manpage.md
@@ -1233,6 +1233,10 @@ including core code and all formulae. Include the RuboCop cop name for each violation in the output. * `--reset-cache`: Reset the RuboCop cache. +* `--formula`: + Treat all named arguments as formulae. +* `--cask`: + Treat all named arguments as casks. * `--only-cops`: Specify a comma-separated *`cops`* list to check for violations of only the listed RuboCop cops. * `--except-cops`:
true
Other
Homebrew
brew
4f0b7255acde456c8eba6016c7f0f507205f925a.json
style: add two options
manpages/brew.1
@@ -1708,6 +1708,14 @@ Include the RuboCop cop name for each violation in the output\. Reset the RuboCop cache\. . .TP +\fB\-\-formula\fR +Treat all named arguments as formulae\. +. +.TP +\fB\-\-cask\fR +Treat all named arguments as casks\. +. +.TP \fB\-\-only\-cops\fR Specify a comma\-separated \fIcops\fR list to check for violations of only the listed RuboCop cops\. .
true
Other
Homebrew
brew
704ec8abf0ba613bbf594254f3da0fc04ba200a2.json
livecheck: reinstate previous order of hashes
Library/Homebrew/livecheck/livecheck.rb
@@ -153,19 +153,18 @@ def run_checks(formulae_and_casks_to_check, args) is_newer_than_upstream = (formula&.stable? || cask) && (current > latest) - info = { - version: { - current: current.to_s, - latest: latest.to_s, - outdated: is_outdated, - newer_than_upstream: is_newer_than_upstream, - }, - meta: { - livecheckable: formula_or_cask.livecheckable?, - }, - } + info = {} info[:formula] = formula_name(formula, args: args) if formula info[:cask] = cask_name(cask, args: args) if cask + info[:version] = { + current: current.to_s, + latest: latest.to_s, + outdated: is_outdated, + newer_than_upstream: is_newer_than_upstream, + } + info[:meta] = { + livecheckable: formula_or_cask.livecheckable?, + } info[:meta][:head_only] = true if formula&.head_only? info[:meta].merge!(version_info[:meta]) if version_info.present? && version_info.key?(:meta) @@ -231,16 +230,14 @@ def formula_name(formula, args:) def status_hash(formula_or_cask, status_str, messages = nil, args:) formula = formula_or_cask if formula_or_cask.is_a?(Formula) - status_hash = { - status: status_str, - } - status_hash[:messages] = messages if messages.is_a?(Array) - + status_hash = {} if formula status_hash[:formula] = formula_name(formula, args: args) else status_hash[:cask] = cask_name(formula_or_cask, args: args) end + status_hash[:status] = status_str + status_hash[:messages] = messages if messages.is_a?(Array) if args.verbose? status_hash[:meta] = {
false
Other
Homebrew
brew
ad544e465d45da47699b1e4b4bc47a2a05ebd782.json
Add livecheck group to cask stanza order
Library/Homebrew/rubocops/cask/constants/stanza.rb
@@ -9,6 +9,7 @@ module Constants [:version, :sha256], [:language], [:url, :appcast, :name, :desc, :homepage], + [:livecheck], [ :auto_updates, :conflicts_with,
false
Other
Homebrew
brew
b8e10a47ddeb9222392fb168c57d5a7c0013e851.json
Update man page.
docs/Manpage.md
@@ -1044,27 +1044,31 @@ provided, check all kegs. Raises an error if run on uninstalled formulae. * `--cached`: Print the cached linkage values stored in `HOMEBREW_CACHE`, set by a previous `brew linkage` run. -### `livecheck` [*`formulae`*] +### `livecheck` [*`formulae`*|*`casks`*] -Check for newer versions of formulae from upstream. +Check for newer versions of formulae and/or casks from upstream. -If no formula argument is passed, the list of formulae to check is taken from `HOMEBREW_LIVECHECK_WATCHLIST` -or `~/.brew_livecheck_watchlist`. +If no formula or cask argument is passed, the list of formulae and casks to check is taken from +`HOMEBREW_LIVECHECK_WATCHLIST` or `~/.brew_livecheck_watchlist`. * `--full-name`: - Print formulae with fully-qualified names. + Print formulae/casks with fully-qualified names. * `--tap`: - Check formulae within the given tap, specified as *`user`*`/`*`repo`*. + Check formulae/casks within the given tap, specified as *`user`*`/`*`repo`*. * `--all`: - Check all available formulae. + Check all available formulae/casks. * `--installed`: - Check formulae that are currently installed. + Check formulae/casks that are currently installed. * `--newer-only`: - Show the latest version only if it's newer than the formula. + Show the latest version only if it's newer than the formula/cask. * `--json`: Output information in JSON format. * `-q`, `--quiet`: Suppress warnings, don't print a progress bar for JSON output. +* `--formula`: + Only check formulae. +* `--cask`: + Only check casks. ### `man` [*`options`*]
true
Other
Homebrew
brew
b8e10a47ddeb9222392fb168c57d5a7c0013e851.json
Update man page.
manpages/brew.1
@@ -1442,31 +1442,31 @@ For every library that a keg references, print its dylib path followed by the bi \fB\-\-cached\fR Print the cached linkage values stored in \fBHOMEBREW_CACHE\fR, set by a previous \fBbrew linkage\fR run\. . -.SS "\fBlivecheck\fR [\fIformulae\fR]" -Check for newer versions of formulae from upstream\. +.SS "\fBlivecheck\fR [\fIformulae\fR|\fIcasks\fR]" +Check for newer versions of formulae and/or casks from upstream\. . .P -If no formula argument is passed, the list of formulae to check is taken from \fBHOMEBREW_LIVECHECK_WATCHLIST\fR or \fB~/\.brew_livecheck_watchlist\fR\. +If no formula or cask argument is passed, the list of formulae and casks to check is taken from \fBHOMEBREW_LIVECHECK_WATCHLIST\fR or \fB~/\.brew_livecheck_watchlist\fR\. . .TP \fB\-\-full\-name\fR -Print formulae with fully\-qualified names\. +Print formulae/casks with fully\-qualified names\. . .TP \fB\-\-tap\fR -Check formulae within the given tap, specified as \fIuser\fR\fB/\fR\fIrepo\fR\. +Check formulae/casks within the given tap, specified as \fIuser\fR\fB/\fR\fIrepo\fR\. . .TP \fB\-\-all\fR -Check all available formulae\. +Check all available formulae/casks\. . .TP \fB\-\-installed\fR -Check formulae that are currently installed\. +Check formulae/casks that are currently installed\. . .TP \fB\-\-newer\-only\fR -Show the latest version only if it\'s newer than the formula\. +Show the latest version only if it\'s newer than the formula/cask\. . .TP \fB\-\-json\fR @@ -1476,6 +1476,14 @@ Output information in JSON format\. \fB\-q\fR, \fB\-\-quiet\fR Suppress warnings, don\'t print a progress bar for JSON output\. . +.TP +\fB\-\-formula\fR +Only check formulae\. +. +.TP +\fB\-\-cask\fR +Only check casks\. +. .SS "\fBman\fR [\fIoptions\fR]" Generate Homebrew\'s manpages\. .
true
Other
Homebrew
brew
fa64a17ae9d5c09c3dac84accaa76eb8e3478ea3.json
Remove superfluous branch.
Library/Homebrew/livecheck/livecheck.rb
@@ -116,9 +116,6 @@ def run_checks(formulae_and_casks_to_check, args) livecheck_version = formula_or_cask.livecheck.version current = if livecheck_version.is_a?(String) Version.new(livecheck_version) - elsif livecheck_version.is_a?(Array) - separator, method = livecheck_version - Version.new(formula_or_cask.version.to_s.split(separator, 2).try(method)) elsif formula if formula.head_only? formula.any_installed_version.version.commit
false
Other
Homebrew
brew
af56a99a37d93c252392129ab44ee18ea884c447.json
Use symbol for `respond_to?`.
Library/Homebrew/dev-cmd/livecheck.rb
@@ -97,7 +97,7 @@ def livecheck onoe e end end.sort_by do |formula_or_cask| - formula_or_cask.respond_to?("token") ? formula_or_cask.token : formula_or_cask.name + formula_or_cask.respond_to?(:token) ? formula_or_cask.token : formula_or_cask.name end raise UsageError, "No formulae or casks to check." if formulae_and_casks_to_check.blank?
false
Other
Homebrew
brew
3b366d05b9c8a29a89bbf773fd2557024ea977b1.json
Fix code style.
Library/Homebrew/cask/dsl.rb
@@ -278,7 +278,7 @@ def auto_updates(auto_updates = nil) def livecheck(&block) @livecheck ||= Livecheck.new(self) - return @livecheck unless block_given? + return @livecheck unless block raise CaskInvalidError.new(cask, "'livecheck' stanza may only appear once.") if @livecheckable
true
Other
Homebrew
brew
3b366d05b9c8a29a89bbf773fd2557024ea977b1.json
Fix code style.
Library/Homebrew/dev-cmd/livecheck.rb
@@ -61,16 +61,16 @@ def livecheck formulae_and_casks_to_check = if args.tap tap = Tap.fetch(args.tap) - formulae = !args.cask? ? tap.formula_names.map { |name| Formula[name] } : [] - casks = !args.formula? ? tap.cask_tokens.map { |token| Cask::CaskLoader.load(token) } : [] + formulae = args.cask? ? [] : tap.formula_names.map { |name| Formula[name] } + casks = args.formula? ? [] : tap.cask_tokens.map { |token| Cask::CaskLoader.load(token) } formulae + casks elsif args.installed? - formulae = !args.cask? ? Formula.installed : [] - casks = !args.formula? ? Cask::Caskroom.casks : [] + formulae = args.cask? ? [] : Formula.installed + casks = args.formula? ? [] : Cask::Caskroom.casks formulae + casks elsif args.all? - formulae = !args.cask? ? Formula.to_a : [] - casks = !args.formula? ? Cask::Cask.to_a : [] + formulae = args.cask? ? [] : Formula.to_a + casks = args.formula? ? [] : Cask::Cask.to_a formulae + casks elsif args.named.present? if args.formula?
true
Other
Homebrew
brew
3b366d05b9c8a29a89bbf773fd2557024ea977b1.json
Fix code style.
Library/Homebrew/livecheck/livecheck.rb
@@ -120,15 +120,15 @@ def run_checks(formulae_and_casks_to_check, args) separator, method = livecheck_version Version.new(formula_or_cask.version.to_s.split(separator, 2).try(method)) elsif formula - if formula.head_only? - formula.any_installed_version.version.commit - else - formula.stable.version - end + if formula.head_only? + formula.any_installed_version.version.commit + else + formula.stable.version + end elsif livecheck_version.is_a?(Symbol) Version.new(Cask::DSL::Version.new(formula_or_cask.version).try(livecheck_version)) - else - Version.new(formula_or_cask.version) + else + Version.new(formula_or_cask.version) end latest = if formula&.stable? || cask @@ -269,9 +269,9 @@ def skip_conditions(formula_or_cask, args:) if formula&.deprecated? && !formula.livecheckable? return status_hash(formula, "deprecated", args: args) if args.json? - puts "#{Tty.red}#{formula_name(formula, args: args)}#{Tty.reset} : deprecated" unless args.quiet? - return - end + puts "#{Tty.red}#{formula_name(formula, args: args)}#{Tty.reset} : deprecated" unless args.quiet? + return + end if formula&.disabled? && !formula.livecheckable? return status_hash(formula, "disabled", args: args) if args.json? @@ -283,17 +283,17 @@ def skip_conditions(formula_or_cask, args:) if formula&.versioned_formula? && !formula.livecheckable? return status_hash(formula, "versioned", args: args) if args.json? - puts "#{Tty.red}#{formula_name(formula, args: args)}#{Tty.reset} : versioned" unless args.quiet? - return - end + puts "#{Tty.red}#{formula_name(formula, args: args)}#{Tty.reset} : versioned" unless args.quiet? + return + end if formula&.head_only? && !formula.any_version_installed? head_only_msg = "HEAD only formula must be installed to be livecheckable" return status_hash(formula, "error", [head_only_msg], args: args) if args.json? - puts "#{Tty.red}#{formula_name(formula, args: args)}#{Tty.reset} : #{head_only_msg}" unless args.quiet? - return - end + puts "#{Tty.red}#{formula_name(formula, args: args)}#{Tty.reset} : #{head_only_msg}" unless args.quiet? + return + end is_gist = formula&.stable&.url&.include?("gist.github.com") if formula_or_cask.livecheck.skip? || is_gist @@ -312,7 +312,7 @@ def skip_conditions(formula_or_cask, args:) puts "#{Tty.red}#{formula_or_cask_name(formula_or_cask, args: args)}#{Tty.reset} : skipped" \ "#{" - #{skip_msg}" if skip_msg.present?}" end - return + return end false
true
Other
Homebrew
brew
064e93df5b32c9914fcfaf9702cd32ba4d7b7ebb.json
Collapse checkable_urls methods into one method
Library/Homebrew/livecheck/livecheck.rb
@@ -339,36 +339,28 @@ def print_latest_version(info, args:) puts "#{formula_or_cask_s} : #{current_s} ==> #{latest_s}" end - # Returns an Array containing the formula URLs that can be used by livecheck. + # Returns an Array containing the formula/cask URLs that can be used by livecheck. # @return [Array] - def checkable_formula_urls(formula) + def checkable_urls(formula_or_cask) urls = [] - urls << formula.head.url if formula.head - if formula.stable - urls << formula.stable.url - urls.concat(formula.stable.mirrors) - end - urls << formula.homepage if formula.homepage - urls.compact - end + case formula_or_cask + when Formula + urls << formula_or_cask.head.url if formula_or_cask.head + if formula_or_cask.stable + urls << formula_or_cask.stable.url + urls.concat(formula_or_cask.stable.mirrors) + end + urls << formula_or_cask.homepage if formula_or_cask.homepage + when Cask::Cask + urls << formula_or_cask.appcast.to_s if formula_or_cask.appcast + urls << formula_or_cask.url.to_s if formula_or_cask.url + urls << formula_or_cask.homepage if formula_or_cask.homepage + end - def checkable_cask_urls(cask) - urls = [] - urls << cask.appcast.to_s if cask.appcast - urls << cask.url.to_s - urls << cask.homepage if cask.homepage urls.compact end - def checkable_urls(formula_or_cask) - if formula_or_cask.is_a?(Formula) - checkable_formula_urls(formula_or_cask) - else - checkable_cask_urls(formula_or_cask) - end - end - # Preprocesses and returns the URL used by livecheck. # @return [String] def preprocess_url(url)
false
Other
Homebrew
brew
bf03893227dd7602d14852ff4dd34325dd4840df.json
Add appcast to checkable cask urls
Library/Homebrew/livecheck/livecheck.rb
@@ -358,6 +358,7 @@ def checkable_formula_urls(formula) def checkable_cask_urls(cask) urls = [] + urls << cask.appcast.to_s if cask.appcast urls << cask.url.to_s urls << cask.homepage if cask.homepage urls.compact
false
Other
Homebrew
brew
6794a78087991f84efc8f0a959a85c411733f3a3.json
livecheck: add support for casks
Library/Homebrew/cask/dsl.rb
@@ -3,6 +3,7 @@ require "locale" require "lazy_object" +require "livecheck" require "cask/artifact" @@ -81,6 +82,8 @@ class DSL :version, :appdir, :discontinued?, + :livecheck, + :livecheckable?, *ORDINARY_ARTIFACT_CLASSES.map(&:dsl_key), *ACTIVATABLE_ARTIFACT_CLASSES.map(&:dsl_key), *ARTIFACT_BLOCK_CLASSES.flat_map { |klass| [klass.dsl_key, klass.uninstall_dsl_key] }, @@ -273,6 +276,20 @@ def auto_updates(auto_updates = nil) set_unique_stanza(:auto_updates, auto_updates.nil?) { auto_updates } end + def livecheck(&block) + @livecheck ||= Livecheck.new(self) + return @livecheck unless block_given? + + raise CaskInvalidError.new(cask, "'livecheck' stanza may only appear once.") if @livecheckable + + @livecheckable = true + @livecheck.instance_eval(&block) + end + + def livecheckable? + @livecheckable == true + end + ORDINARY_ARTIFACT_CLASSES.each do |klass| define_method(klass.dsl_key) do |*args| if [*artifacts.map(&:class), klass].include?(Artifact::StageOnly) &&
true
Other
Homebrew
brew
6794a78087991f84efc8f0a959a85c411733f3a3.json
livecheck: add support for casks
Library/Homebrew/dev-cmd/livecheck.rb
@@ -54,28 +54,28 @@ def livecheck puts ENV["HOMEBREW_LIVECHECK_WATCHLIST"] if ENV["HOMEBREW_LIVECHECK_WATCHLIST"].present? end - formulae_to_check = if args.tap - Tap.fetch(args.tap).formula_names.map { |name| Formula[name] } + formulae_and_casks_to_check = if args.tap + tap = Tap.fetch(args.tap) + formulae = tap.formula_names.map { |name| Formula[name] } + casks = tap.cask_tokens.map { |token| Cask::CaskLoader.load(token) } + formulae + casks elsif args.installed? - Formula.installed + Formula.installed + Cask::Caskroom.casks elsif args.all? - Formula - elsif (formulae_args = args.named.to_formulae) && formulae_args.present? - formulae_args + Formula.to_a + Cask::Cask.to_a + elsif args.named.present? + args.named.to_formulae_and_casks elsif File.exist?(WATCHLIST_PATH) begin - Pathname.new(WATCHLIST_PATH).read.lines.map do |line| - next if line.start_with?("#") - - Formula[line.strip] - end.compact + names = Pathname.new(WATCHLIST_PATH).read.lines.reject { |line| line.start_with?("#") }.map(&:strip) + CLI::NamedArgs.new(*names).to_formulae_and_casks rescue Errno::ENOENT => e onoe e end end - raise UsageError, "No formulae to check." if formulae_to_check.blank? + raise UsageError, "No formulae or casks to check." if formulae_and_casks_to_check.blank? - Livecheck.livecheck_formulae(formulae_to_check, args) + Livecheck.livecheck_formulae_and_casks(formulae_and_casks_to_check, args) end end
true
Other
Homebrew
brew
6794a78087991f84efc8f0a959a85c411733f3a3.json
livecheck: add support for casks
Library/Homebrew/livecheck.rb
@@ -1,20 +1,20 @@ # typed: true # frozen_string_literal: true -# The {Livecheck} class implements the DSL methods used in a formula's +# The {Livecheck} class implements the DSL methods used in a formula's or cask's # `livecheck` block and stores related instance variables. Most of these methods # also return the related instance variable when no argument is provided. # # This information is used by the `brew livecheck` command to control its # behavior. class Livecheck - # A very brief description of why the formula is skipped (e.g. `No longer + # A very brief description of why the formula/cask is skipped (e.g. `No longer # developed or maintained`). # @return [String, nil] attr_reader :skip_msg - def initialize(formula) - @formula = formula + def initialize(formula_or_cask) + @formula_or_cask = formula_or_cask @regex = nil @skip = false @skip_msg = nil @@ -40,10 +40,10 @@ def regex(pattern = nil) # Sets the `@skip` instance variable to `true` and sets the `@skip_msg` # instance variable if a `String` is provided. `@skip` is used to indicate - # that the formula should be skipped and the `skip_msg` very briefly describes - # why the formula is skipped (e.g. "No longer developed or maintained"). + # that the formula/cask should be skipped and the `skip_msg` very briefly + # describes why it is skipped (e.g. "No longer developed or maintained"). # - # @param skip_msg [String] string describing why the formula is skipped + # @param skip_msg [String] string describing why the formula/cask is skipped # @return [Boolean] def skip(skip_msg = nil) if skip_msg.is_a?(String) @@ -55,7 +55,7 @@ def skip(skip_msg = nil) @skip = true end - # Should `livecheck` skip this formula? + # Should `livecheck` skip this formula/cask? def skip? @skip end @@ -81,25 +81,47 @@ def strategy(symbol = nil) # Sets the `@url` instance variable to the provided argument or returns the # `@url` instance variable when no argument is provided. The argument can be # a `String` (a URL) or a supported `Symbol` corresponding to a URL in the - # formula (e.g. `:stable`, `:homepage`, or `:head`). + # formula/cask (e.g. `:stable`, `:homepage`, or `:head`). # # @param val [String, Symbol] URL to check for version information # @return [String, nil] def url(val = nil) @url = case val when nil return @url + when :cask_url + @formula_or_cask.url when :head, :stable - @formula.send(val).url + @formula_or_cask.send(val).url when :homepage - @formula.homepage + @formula_or_cask.homepage when String val else raise TypeError, "Livecheck#url expects a String or valid Symbol" end end + # TODO: documentation + def version(val = nil) + @version = case val + when nil + return @version + when :before_comma + [",", :first] + when :after_comma + [",", :second] + when :before_colon + [":", :first] + when :after_colon + [":", :second] + when String + val + else + raise TypeError, "Livecheck#version expects a String or valid Symbol" + end + end + # Returns a `Hash` of all instance variable values. # @return [Hash] def to_hash @@ -109,6 +131,7 @@ def to_hash "skip_msg" => @skip_msg, "strategy" => @strategy, "url" => @url, + "version" => @version, } end end
true
Other
Homebrew
brew
6794a78087991f84efc8f0a959a85c411733f3a3.json
livecheck: add support for casks
Library/Homebrew/livecheck/livecheck.rb
@@ -41,18 +41,18 @@ module Livecheck rc ].freeze - # Executes the livecheck logic for each formula in the `formulae_to_check` array - # and prints the results. + # Executes the livecheck logic for each formula/cask in the + # `formulae_and_casks_to_check` array and prints the results. # @return [nil] - def livecheck_formulae(formulae_to_check, args) + def livecheck_formulae_and_casks(formulae_and_casks_to_check, args) # Identify any non-homebrew/core taps in use for current formulae non_core_taps = {} - formulae_to_check.each do |f| - next if f.tap.blank? - next if f.tap.name == CoreTap.instance.name - next if non_core_taps[f.tap.name] + formulae_and_casks_to_check.each do |fc| + next if fc.tap.blank? + next if fc.tap.name == CoreTap.instance.name + next if non_core_taps[fc.tap.name] - non_core_taps[f.tap.name] = f.tap + non_core_taps[fc.tap.name] = fc.tap end non_core_taps = non_core_taps.sort.to_h @@ -73,10 +73,10 @@ def livecheck_formulae(formulae_to_check, args) has_a_newer_upstream_version = false if args.json? && !args.quiet? && $stderr.tty? - total_formulae = if formulae_to_check == Formula - formulae_to_check.count + total_formulae = if formulae_and_casks_to_check == Formula + formulae_and_casks_to_check.count else - formulae_to_check.length + formulae_and_casks_to_check.length end Tty.with($stderr) do |stderr| @@ -92,7 +92,10 @@ def livecheck_formulae(formulae_to_check, args) ) end - formulae_checked = formulae_to_check.sort.map.with_index do |formula, i| + formulae_checked = formulae_and_casks_to_check.sort_by(&:name).map.with_index do |formula_or_cask, i| + formula = formula_or_cask if formula_or_cask.is_a?(Formula) + cask = formula_or_cask if formula_or_cask.is_a?(Cask::Cask) + if args.debug? && i.positive? puts <<~EOS @@ -101,7 +104,7 @@ def livecheck_formulae(formulae_to_check, args) EOS end - skip_result = skip_conditions(formula, args: args) + skip_result = skip_conditions(formula_or_cask, args: args) next skip_result if skip_result != false formula.head&.downloader&.shutup! @@ -110,17 +113,32 @@ def livecheck_formulae(formulae_to_check, args) # head-only formulae. A formula with `stable` and `head` that's # installed using `--head` will still use the `stable` version for # comparison. - current = if formula.head_only? - formula.any_installed_version.version.commit + livecheck_version = formula_or_cask.livecheck.version + current = if livecheck_version.is_a?(String) + livecheck_version else - formula.stable.version + version = if formula + if formula.head_only? + formula.any_installed_version.version.commit + else + formula.stable.version + end + else + Version.new(formula_or_cask.version) + end + if livecheck_version.is_a?(Array) + separator, method = livecheck_version + Version.new(version.to_s.split(separator, 2).try(method)) + else + version + end end - latest = if formula.head_only? - formula.head.downloader.fetch_last_commit - else - version_info = latest_version(formula, args: args) + latest = if formula&.stable? || cask + version_info = latest_version(formula_or_cask, args: args) version_info[:latest] if version_info.present? + else + formula.head.downloader.fetch_last_commit end if latest.blank? @@ -129,36 +147,37 @@ def livecheck_formulae(formulae_to_check, args) next version_info if version_info.is_a?(Hash) && version_info[:status] && version_info[:messages] - next status_hash(formula, "error", [no_versions_msg], args: args) + next status_hash(formula_or_cask, "error", [no_versions_msg], args: args) end if (m = latest.to_s.match(/(.*)-release$/)) && !current.to_s.match(/.*-release$/) latest = Version.new(m[1]) end - is_outdated = if formula.head_only? + is_outdated = if formula&.head_only? # A HEAD-only formula is considered outdated if the latest upstream # commit hash is different than the installed version's commit hash (current != latest) else (current < latest) end - is_newer_than_upstream = formula.stable? && (current > latest) + is_newer_than_upstream = (formula&.stable? || cask) && (current > latest) info = { - formula: formula_name(formula, args: args), version: { current: current.to_s, latest: latest.to_s, outdated: is_outdated, newer_than_upstream: is_newer_than_upstream, }, meta: { - livecheckable: formula.livecheckable?, + livecheckable: formula_or_cask.livecheckable?, }, } - info[:meta][:head_only] = true if formula.head_only? + info[:formula] = formula_name(formula, args: args) if formula + info[:cask] = cask_name(cask, args: args) if cask + info[:meta][:head_only] = true if formula&.head_only? info[:meta].merge!(version_info[:meta]) if version_info.present? && version_info.key?(:meta) next if args.newer_only? && !info[:version][:outdated] @@ -178,9 +197,9 @@ def livecheck_formulae(formulae_to_check, args) if args.json? progress&.increment - status_hash(formula, "error", [e.to_s], args: args) + status_hash(formula_or_cask, "error", [e.to_s], args: args) elsif !args.quiet? - onoe "#{Tty.blue}#{formula_name(formula, args: args)}#{Tty.reset}: #{e}" + onoe "#{Tty.blue}#{formula_or_cask_name(formula_or_cask, args: args)}#{Tty.reset}: #{e}" nil end end @@ -201,25 +220,44 @@ def livecheck_formulae(formulae_to_check, args) puts JSON.generate(formulae_checked.compact) end + def formula_or_cask_name(formula_or_cask, args:) + if formula_or_cask.is_a?(Formula) + formula_name(formula_or_cask, args: args) + else + cask_name(formula_or_cask, args: args) + end + end + + def cask_name(cask, args:) + args.full_name? ? cask.full_name : cask.token + end + # Returns the fully-qualified name of a formula if the `full_name` argument is # provided; returns the name otherwise. # @return [String] def formula_name(formula, args:) args.full_name? ? formula.full_name : formula.name end - def status_hash(formula, status_str, messages = nil, args:) + def status_hash(formula_or_cask, status_str, messages = nil, args:) + formula = formula_or_cask if formula_or_cask.is_a?(Formula) + status_hash = { - formula: formula_name(formula, args: args), - status: status_str, + status: status_str, } status_hash[:messages] = messages if messages.is_a?(Array) + if formula + status_hash[:formula] = formula_name(formula, args: args) + else + status_hash[:cask] = formula_name(formula_or_cask, args: args) + end + if args.verbose? status_hash[:meta] = { - livecheckable: formula.livecheckable?, + livecheckable: formula_or_cask.livecheckable?, } - status_hash[:meta][:head_only] = true if formula.head_only? + status_hash[:meta][:head_only] = true if formula&.head_only? end status_hash @@ -228,54 +266,56 @@ def status_hash(formula, status_str, messages = nil, args:) # If a formula has to be skipped, it prints or returns a Hash contaning the reason # for doing so; returns false otherwise. # @return [Hash, nil, Boolean] - def skip_conditions(formula, args:) - if formula.deprecated? && !formula.livecheckable? + def skip_conditions(formula_or_cask, args:) + formula = formula_or_cask if formula_or_cask.is_a?(Formula) + + if formula&.deprecated? && !formula.livecheckable? return status_hash(formula, "deprecated", args: args) if args.json? - puts "#{Tty.red}#{formula_name(formula, args: args)}#{Tty.reset} : deprecated" unless args.quiet? - return - end + puts "#{Tty.red}#{formula_name(formula, args: args)}#{Tty.reset} : deprecated" unless args.quiet? + return + end - if formula.disabled? && !formula.livecheckable? + if formula&.disabled? && !formula.livecheckable? return status_hash(formula, "disabled", args: args) if args.json? puts "#{Tty.red}#{formula_name(formula, args: args)}#{Tty.reset} : disabled" unless args.quiet? return end - if formula.versioned_formula? && !formula.livecheckable? + if formula&.versioned_formula? && !formula.livecheckable? return status_hash(formula, "versioned", args: args) if args.json? - puts "#{Tty.red}#{formula_name(formula, args: args)}#{Tty.reset} : versioned" unless args.quiet? - return - end + puts "#{Tty.red}#{formula_name(formula, args: args)}#{Tty.reset} : versioned" unless args.quiet? + return + end - if formula.head_only? && !formula.any_version_installed? + if formula&.head_only? && !formula.any_version_installed? head_only_msg = "HEAD only formula must be installed to be livecheckable" return status_hash(formula, "error", [head_only_msg], args: args) if args.json? - puts "#{Tty.red}#{formula_name(formula, args: args)}#{Tty.reset} : #{head_only_msg}" unless args.quiet? - return - end + puts "#{Tty.red}#{formula_name(formula, args: args)}#{Tty.reset} : #{head_only_msg}" unless args.quiet? + return + end - is_gist = formula.stable&.url&.include?("gist.github.com") - if formula.livecheck.skip? || is_gist - skip_msg = if formula.livecheck.skip_msg.is_a?(String) && - formula.livecheck.skip_msg.present? - formula.livecheck.skip_msg.to_s + is_gist = formula&.stable&.url&.include?("gist.github.com") + if formula_or_cask.livecheck.skip? || is_gist + skip_msg = if formula_or_cask.livecheck.skip_msg.is_a?(String) && + formula_or_cask.livecheck.skip_msg.present? + formula_or_cask.livecheck.skip_msg.to_s elsif is_gist "Stable URL is a GitHub Gist" else "" end - return status_hash(formula, "skipped", (skip_msg.blank? ? nil : [skip_msg]), args: args) if args.json? + return status_hash(formula_or_cask, "skipped", (skip_msg.blank? ? nil : [skip_msg]), args: args) if args.json? unless args.quiet? - puts "#{Tty.red}#{formula_name(formula, args: args)}#{Tty.reset} : skipped" \ + puts "#{Tty.red}#{formula_or_cask_name(formula_or_cask, args: args)}#{Tty.reset} : skipped" \ "#{" - #{skip_msg}" if skip_msg.present?}" end - return + return end false @@ -284,8 +324,8 @@ def skip_conditions(formula, args:) # Formats and prints the livecheck result for a formula. # @return [nil] def print_latest_version(info, args:) - formula_s = "#{Tty.blue}#{info[:formula]}#{Tty.reset}" - formula_s += " (guessed)" if !info[:meta][:livecheckable] && args.verbose? + formula_or_cask_s = "#{Tty.blue}#{info[:formula] || info[:cask]}#{Tty.reset}" + formula_or_cask_s += " (guessed)" if !info[:meta][:livecheckable] && args.verbose? current_s = if info[:version][:newer_than_upstream] "#{Tty.red}#{info[:version][:current]}#{Tty.reset}" @@ -299,12 +339,12 @@ def print_latest_version(info, args:) info[:version][:latest] end - puts "#{formula_s} : #{current_s} ==> #{latest_s}" + puts "#{formula_or_cask_s} : #{current_s} ==> #{latest_s}" end # Returns an Array containing the formula URLs that can be used by livecheck. # @return [Array] - def checkable_urls(formula) + def checkable_formula_urls(formula) urls = [] urls << formula.head.url if formula.head if formula.stable @@ -316,6 +356,21 @@ def checkable_urls(formula) urls.compact end + def checkable_cask_urls(cask) + urls = [] + urls << cask.url.to_s + urls << cask.homepage if cask.homepage + urls.compact + end + + def checkable_urls(formula_or_cask) + if formula_or_cask.is_a?(Formula) + checkable_formula_urls(formula_or_cask) + else + checkable_cask_urls(formula_or_cask) + end + end + # Preprocesses and returns the URL used by livecheck. # @return [String] def preprocess_url(url) @@ -357,20 +412,26 @@ def preprocess_url(url) # Identifies the latest version of the formula and returns a Hash containing # the version information. Returns nil if a latest version couldn't be found. # @return [Hash, nil] - def latest_version(formula, args:) - has_livecheckable = formula.livecheckable? - livecheck = formula.livecheck + def latest_version(formula_or_cask, args:) + formula = formula_or_cask if formula_or_cask.is_a?(Formula) + + has_livecheckable = formula_or_cask.livecheckable? + livecheck = formula_or_cask.livecheck livecheck_regex = livecheck.regex livecheck_strategy = livecheck.strategy livecheck_url = livecheck.url urls = [livecheck_url] if livecheck_url.present? - urls ||= checkable_urls(formula) + urls ||= checkable_urls(formula_or_cask) if args.debug? puts - puts "Formula: #{formula_name(formula, args: args)}" - puts "Head only?: true" if formula.head_only? + if formula + puts "Formula: #{formula_name(formula, args: args)}" + puts "Head only?: true" if formula.head_only? + else + puts "Cask: #{cask_name(formula_or_cask, args: args)}" + end puts "Livecheckable?: #{has_livecheckable ? "Yes" : "No"}" end
true
Other
Homebrew
brew
6794a78087991f84efc8f0a959a85c411733f3a3.json
livecheck: add support for casks
Library/Homebrew/test/livecheck/livecheck_spec.rb
@@ -74,6 +74,24 @@ end end + let(:c) do + Cask::CaskLoader.load(+<<-RUBY) + cask "test" do + version "0.0.1,2" + + url "https://brew.sh/test-0.0.1.tgz" + name "Test" + homepage "https://brew.sh" + + livecheck do + url "https://formulae.brew.sh/api/formula/ruby.json" + version :before_comma + regex(/"stable":"(\d+(?:\.\d+)+)"/i) + end + end + RUBY + end + let(:args) { double("livecheck_args", full_name?: false, json?: false, quiet?: false, verbose?: true) } describe "::formula_name" do @@ -88,6 +106,18 @@ end end + describe "::cask_name" do + it "returns the token of the cask" do + expect(livecheck.cask_name(c, args: args)).to eq("test") + end + + it "returns the full name of the cask" do + allow(args).to receive(:full_name?).and_return(true) + + expect(livecheck.cask_name(c, args: args)).to eq("test") + end + end + describe "::status_hash" do it "returns a hash containing the livecheck status" do expect(livecheck.status_hash(f, "error", ["Unable to get versions"], args: args)) @@ -142,6 +172,10 @@ it "returns false for a non-skippable formula" do expect(livecheck.skip_conditions(f, args: args)).to eq(false) end + + it "returns false for a non-skippable cask" do + expect(livecheck.skip_conditions(c, args: args)).to eq(false) + end end describe "::checkable_urls" do @@ -150,6 +184,7 @@ .to eq( ["https://github.com/Homebrew/brew.git", "https://brew.sh/test-0.0.1.tgz", "https://brew.sh"], ) + expect(livecheck.checkable_urls(c)).to eq(["https://brew.sh/test-0.0.1.tgz", "https://brew.sh"]) end end
true
Other
Homebrew
brew
6794a78087991f84efc8f0a959a85c411733f3a3.json
livecheck: add support for casks
Library/Homebrew/test/livecheck_spec.rb
@@ -107,6 +107,26 @@ end end + describe "#version" do + it "returns nil if not set" do + expect(livecheckable.version).to be nil + end + + it "returns value if set" do + livecheckable.version("foo") + expect(livecheckable.version).to eq("foo") + + livecheckable.version(:before_comma) + expect(livecheckable.version).to eq([",", :first]) + end + + it "raises a TypeError if the argument isn't a String or Symbol" do + expect { + livecheckable.version(/foo/) + }.to raise_error(TypeError, "Livecheck#version expects a String or valid Symbol") + end + end + describe "#to_hash" do it "returns a Hash of all instance variables" do expect(livecheckable.to_hash).to eq( @@ -116,6 +136,7 @@ "skip_msg" => nil, "strategy" => nil, "url" => nil, + "version" => nil, }, ) end
true
Other
Homebrew
brew
5b770e99651c15e9835356a9a3d59a6ffcd91584.json
Cpan: Reimplement strategy and improve tests Co-authored-by: Dario Vladovic <d.vladimyr@gmail.com>
Library/Homebrew/livecheck/strategy/cpan.rb
@@ -1,34 +1,34 @@ # typed: false # frozen_string_literal: true -require "uri" - module Homebrew module Livecheck module Strategy # The {Cpan} strategy identifies versions of software at # cpan.metacpan.org by checking directory listing pages. # - # CPAN URLs take the following format: + # CPAN URLs take the following formats: + # + # * `https://cpan.metacpan.org/authors/id/H/HO/HOMEBREW/Brew-v1.2.3.tar.gz` + # * `https://cpan.metacpan.org/authors/id/H/HO/HOMEBREW/brew/brew-v1.2.3.tar.gz` # - # * `https://cpan.metacpan.org/authors/id/M/MI/MIYAGAWA/Carton-v1.0.34.tar.gz` + # In these examples, `HOMEBREW` is the author name and the preceding `H` + # and `HO` directories correspond to the first letter(s). Some authors + # also store files in subdirectories, as in the second example above. # # @api public class Cpan NICE_NAME = "CPAN" - # The allowlist used to determine if the strategy applies to the URL. - HOST_ALLOWLIST = ["cpan.metacpan.org"].freeze + # The `Regexp` used to determine if the strategy applies to the URL. + URL_MATCH_REGEX = %r{^https?://cpan\.metacpan\.org/authors/id(?:/[^/]+){3,}/[^/]+}i.freeze # Whether the strategy can be applied to the provided URL. # # @param url [String] the URL to match against # @return [Boolean] def self.match?(url) - uri = URI.parse url - HOST_ALLOWLIST.include? uri.host - rescue URI::InvalidURIError - false + URL_MATCH_REGEX.match?(url) end # Generates a URL and regex (if one isn't provided) and passes them @@ -39,25 +39,20 @@ def self.match?(url) # @return [Hash] def self.find_versions(url, regex = nil) %r{ - /authors/id/(?<author_path>(?:[^/](?:/[^/]+){2})) # The author path (e.g. M/MI/MIYAGAWA) - /(?<package_path>.+) # The package path (e.g. Carton-v1.0.34.tar.gz) + (?<path>/authors/id(?:/[^/]+){3,}/) # Path before the filename + (?<prefix>[^/]+) # Filename text before the version + -v?\d+(?:\.\d+)* # The numeric version + (?<suffix>[^/]+) # Filename text after the version }ix =~ url - # We need a Pathname because we've monkeypatched extname to support - # double extensions (e.g. tar.gz). - pathname = Pathname.new(package_path) - - # Exteract package name - /^(?<package_name>.+)-v?\d+/ =~ pathname.basename(pathname.extname) # Use `\.t` instead of specific tarball extensions (e.g. .tar.gz) - suffix = pathname.extname.sub!(/\.t(?:ar\..+|[a-z0-9]+)$/i, "\.t") + suffix.sub!(/\.t(?:ar\..+|[a-z0-9]+)$/i, "\.t") - # A page containing a directory listing of the latest source tarball - package_dir = Pathname.new(author_path).join(pathname.dirname) - page_url = "https://cpan.metacpan.org/authors/id/#{package_dir}/" + # The directory listing page where the archive files are found + page_url = "https://cpan.metacpan.org#{path}" - # Example regex: `%r{href=.*?Carton-v?(\d+(?:\.\d+)*).t}i` - regex ||= /href=.*?#{package_name}-v?(\d+(?:\.\d+)*)#{Regexp.escape(suffix)}/i + # Example regex: `/href=.*?Brew[._-]v?(\d+(?:\.\d+)*)\.t/i` + regex ||= /href=.*?#{prefix}[._-]v?(\d+(?:\.\d+)*)#{Regexp.escape(suffix)}/i Homebrew::Livecheck::Strategy::PageMatch.find_versions(page_url, regex) end
true
Other
Homebrew
brew
5b770e99651c15e9835356a9a3d59a6ffcd91584.json
Cpan: Reimplement strategy and improve tests Co-authored-by: Dario Vladovic <d.vladimyr@gmail.com>
Library/Homebrew/test/livecheck/strategy/cpan_spec.rb
@@ -6,12 +6,14 @@ describe Homebrew::Livecheck::Strategy::Cpan do subject(:cpan) { described_class } - let(:cpan_url) { "https://cpan.metacpan.org/authors/id/M/MI/MIYAGAWA/Carton-v1.0.34.tar.gz" } + let(:cpan_url_no_subdirectory) { "https://cpan.metacpan.org/authors/id/H/HO/HOMEBREW/Brew-v1.2.3.tar.gz" } + let(:cpan_url_with_subdirectory) { "https://cpan.metacpan.org/authors/id/H/HO/HOMEBREW/brew/brew-v1.2.3.tar.gz" } let(:non_cpan_url) { "https://brew.sh/test" } describe "::match?" do it "returns true if the argument provided is a CPAN URL" do - expect(cpan.match?(cpan_url)).to be true + expect(cpan.match?(cpan_url_no_subdirectory)).to be true + expect(cpan.match?(cpan_url_with_subdirectory)).to be true end it "returns false if the argument provided is not a CPAN URL" do
true
Other
Homebrew
brew
9dec442e715a351791bc9ce18cae57d96cb718b5.json
pr-pull: prepare replacement for --workflow flag
Library/Homebrew/cli/parser.rb
@@ -194,16 +194,21 @@ def comma_array(name, description: nil) end end - def flag(*names, description: nil, required_for: nil, depends_on: nil) + def flag(*names, description: nil, replacement: nil, required_for: nil, depends_on: nil) required = if names.any? { |name| name.end_with? "=" } OptionParser::REQUIRED_ARGUMENT else OptionParser::OPTIONAL_ARGUMENT end names.map! { |name| name.chomp "=" } description = option_to_description(*names) if description.nil? - process_option(*names, description) + if replacement.nil? + process_option(*names, description) + else + description += " (disabled#{"; replaced by #{replacement}" if replacement.present?})" + end @parser.on(*names, *wrap_option_desc(description), required) do |option_value| + odisabled "the `#{names.first}` flag", replacement unless replacement.nil? names.each do |name| @args[option_to_name(name)] = option_value end
true
Other
Homebrew
brew
9dec442e715a351791bc9ce18cae57d96cb718b5.json
pr-pull: prepare replacement for --workflow flag
Library/Homebrew/dev-cmd/pr-pull.rb
@@ -51,7 +51,9 @@ def pr_pull_args description: "Message to include when autosquashing revision bumps, deletions, and rebuilds." flag "--workflow=", description: "Retrieve artifacts from the specified workflow (default: `tests.yml`). "\ - "Legacy: use --workflows instead" + "*Legacy:* use `--workflows` instead." + # TODO: enable for next major/minor release + # replacement: "`--workflows`" flag "--artifact=", description: "Download artifacts with the specified name (default: `bottles`)." flag "--bintray-org=",
true
Other
Homebrew
brew
9dec442e715a351791bc9ce18cae57d96cb718b5.json
pr-pull: prepare replacement for --workflow flag
docs/Manpage.md
@@ -1141,7 +1141,7 @@ Requires write access to the repository. * `--message`: Message to include when autosquashing revision bumps, deletions, and rebuilds. * `--workflow`: - Retrieve artifacts from the specified workflow (default: `tests.yml`). Legacy: use --workflows instead + Retrieve artifacts from the specified workflow (default: `tests.yml`). *Legacy:* use `--workflows` instead. * `--artifact`: Download artifacts with the specified name (default: `bottles`). * `--bintray-org`:
true
Other
Homebrew
brew
9dec442e715a351791bc9ce18cae57d96cb718b5.json
pr-pull: prepare replacement for --workflow flag
manpages/brew.1
@@ -1589,7 +1589,7 @@ Message to include when autosquashing revision bumps, deletions, and rebuilds\. . .TP \fB\-\-workflow\fR -Retrieve artifacts from the specified workflow (default: \fBtests\.yml\fR)\. Legacy: use \-\-workflows instead +Retrieve artifacts from the specified workflow (default: \fBtests\.yml\fR)\. \fILegacy:\fR use \fB\-\-workflows\fR instead\. . .TP \fB\-\-artifact\fR
true
Other
Homebrew
brew
9ecdf117b3f8b68dde5bc98407ffffc9f73cc5bc.json
Fix broken output on CI.
Library/Homebrew/brew.rb
@@ -46,6 +46,11 @@ class MissingEnvironmentVariables < RuntimeError; end begin trap("INT", std_trap) # restore default CTRL-C handler + if ENV["CI"] + $stdout.sync = true + $stderr.sync = true + end + empty_argv = ARGV.empty? help_flag_list = %w[-h --help --usage -?] help_flag = !ENV["HOMEBREW_HELP"].nil?
false
Other
Homebrew
brew
402600a94fa9eb3dd9ade82f5edf64a890f159d6.json
docs: add documentation for plists
docs/Formula-Cookbook.md
@@ -749,6 +749,40 @@ Homebrew provides two formula DSL methods for launchd plist files: * [`plist_name`](https://rubydoc.brew.sh/Formula#plist_name-instance_method) will return e.g. `homebrew.mxcl.<formula>` * [`plist_path`](https://rubydoc.brew.sh/Formula#plist_path-instance_method) will return e.g. `/usr/local/Cellar/foo/0.1/homebrew.mxcl.foo.plist` +There is two ways to add plists to a formula, so that [`brew services`](https://github.com/Homebrew/homebrew-services) can pick it up: +1. If the formula already provides a plist file the formula can install it into the prefix like so. + +```ruby +prefix.install_symlink "file.plist" => "#{plist_name}.plist" +``` + +1. If the formula does not provide a plist you can add a plist using the following stanzas. +This will define what the user can run manually instead of the launchd service. +```ruby + plist_options manual: "#{HOMEBREW_PREFIX}/var/some/bin/stuff run" +``` + +This provides the actual plist file, see [Apple's plist(5) man page](https://www.unix.com/man-page/mojave/5/plist/) for more information. +```ruby + def plist + <<~EOS + <?xml version="1.0" encoding="UTF-8"?> + <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> + <plist version="1.0"> + <dict> + <key>Label</key> + <string>#{plist_name}</string> + <key>ProgramArguments</key> + <array> + <string>#{var}/some/bin/stuff</string> + <string>run</string> + </array> + </dict> + </plist> + EOS + end +``` + ### Using environment variables Homebrew has multiple levels of environment variable filtering which affects variables available to formulae.
false
Other
Homebrew
brew
68e2e48b63246f7417885b7f00dfbf7800427d4e.json
Update the variable names
Library/Homebrew/cmd/update.sh
@@ -390,17 +390,17 @@ EOS fi fi - [[ -f "$HOMEBREW_LIBRARY/Taps/homebrew/homebrew-core/.git/shallow" ]] && SHALLOW_CORE=1 - [[ -f "$HOMEBREW_LIBRARY/Taps/homebrew/homebrew-cask/.git/shallow" ]] && SHALLOW_CASK=1 + [[ -f "$HOMEBREW_LIBRARY/Taps/homebrew/homebrew-core/.git/shallow" ]] && HOMEBREW_CORE_SHALLOW=1 + [[ -f "$HOMEBREW_LIBRARY/Taps/homebrew/homebrew-cask/.git/shallow" ]] && HOMEBREW_CASK_SHALLOW=1 - if [[ -n $SHALLOW_CORE || -n $SHALLOW_CASK ]] + if [[ -n $HOMEBREW_CORE_SHALLOW || -n $HOMEBREW_CASK_SHALLOW ]] then odie <<EOS - ${SHALLOW_CORE:+ - homebrew-core is a shallow clone.}${SHALLOW_CASK:+ + ${HOMEBREW_CORE_SHALLOW:+ + homebrew-core is a shallow clone.}${HOMEBREW_CASK_SHALLOW:+ homebrew-cask is a shallow clone.} - To \`brew update\`, first run:${SHALLOW_CORE:+ - git -C "$HOMEBREW_LIBRARY/Taps/homebrew/homebrew-core" fetch --unshallow}${SHALLOW_CASK:+ + To \`brew update\`, first run:${HOMEBREW_CORE_SHALLOW:+ + git -C "$HOMEBREW_LIBRARY/Taps/homebrew/homebrew-core" fetch --unshallow}${HOMEBREW_CASK_SHALLOW:+ git -C "$HOMEBREW_LIBRARY/Taps/homebrew/homebrew-cask" fetch --unshallow} This restriction has been made on GitHub's request because updating shallow clones is an extremely expensive operation due to the tree layout and traffic of
false
Other
Homebrew
brew
eb74717a9e24eb94de9a60508a208b224dff8172.json
Fix unbottled dependency handling - Rename `BuildToolsError` to `UnbottledError` to better reflect what it does (particularly now) - Improve the `UnbottledError` messaging - Raise the `UnbottledError` for dependencies also when building bottles (so that we don't try and build bottles against things that have been built from source).
Library/Homebrew/exceptions.rb
@@ -488,17 +488,18 @@ def dump(verbose: false) end end -# Raised by {FormulaInstaller#check_dependencies_bottled} and -# {FormulaInstaller#install} if the formula or its dependencies are not bottled -# and are being installed on a system without necessary build tools. -class BuildToolsError < RuntimeError +# Raised if the formula or its dependencies are not bottled and are being +# installed in a situation where a bottle is required. +class UnbottledError < RuntimeError def initialize(formulae) - super <<~EOS - The following #{"formula".pluralize(formulae.count)} + msg = +<<~EOS + The following #{"formula".pluralize(formulae.count)} cannot be installed from #{"bottle".pluralize(formulae.count)} and must be + built from source. #{formulae.to_sentence} - cannot be installed as #{"binary package".pluralize(formulae.count)} and must be built from source. - #{DevelopmentTools.installation_instructions} EOS + msg += "#{DevelopmentTools.installation_instructions}\n" unless DevelopmentTools.installed? + msg.freeze + super(msg) end end
true
Other
Homebrew
brew
eb74717a9e24eb94de9a60508a208b224dff8172.json
Fix unbottled dependency handling - Rename `BuildToolsError` to `UnbottledError` to better reflect what it does (particularly now) - Improve the `UnbottledError` messaging - Raise the `UnbottledError` for dependencies also when building bottles (so that we don't try and build bottles against things that have been built from source).
Library/Homebrew/formula_installer.rb
@@ -356,11 +356,17 @@ def install check_conflicts - raise BuildToolsError, [formula] if !pour_bottle? && !formula.bottle_unneeded? && !DevelopmentTools.installed? + raise UnbottledError, [formula] if !pour_bottle? && !formula.bottle_unneeded? && !DevelopmentTools.installed? unless ignore_deps? deps = compute_dependencies - check_dependencies_bottled(deps) if pour_bottle? && !DevelopmentTools.installed? + if ((pour_bottle? && !DevelopmentTools.installed?) || build_bottle?) && + (unbottled = unbottled_dependencies(deps)).presence + # Check that each dependency in deps has a bottle available, terminating + # abnormally with a UnbottledError if one or more don't. + raise UnbottledError, unbottled + end + install_dependencies(deps) end @@ -412,7 +418,7 @@ def install @pour_failed = true onoe e.message opoo "Bottle installation failed: building from source." - raise BuildToolsError, [formula] unless DevelopmentTools.installed? + raise UnbottledError, [formula] unless DevelopmentTools.installed? compute_and_install_dependencies unless ignore_deps? else @@ -490,16 +496,12 @@ def compute_dependencies expand_dependencies(req_deps + formula.deps) end - # Check that each dependency in deps has a bottle available, terminating - # abnormally with a BuildToolsError if one or more don't. - # Only invoked when the user has no developer tools. - def check_dependencies_bottled(deps) - unbottled = deps.reject do |dep, _| - dep_f = dep.to_formula - dep_f.pour_bottle? || dep_f.bottle_unneeded? - end + def unbottled_dependencies(deps) + deps.map(&:first).map(&:to_formula).reject do |dep_f| + next false unless dep_f.pour_bottle? - raise BuildToolsError, unbottled unless unbottled.empty? + dep_f.bottle_unneeded? || dep_f.bottled? + end end def compute_and_install_dependencies
true
Other
Homebrew
brew
eb74717a9e24eb94de9a60508a208b224dff8172.json
Fix unbottled dependency handling - Rename `BuildToolsError` to `UnbottledError` to better reflect what it does (particularly now) - Improve the `UnbottledError` messaging - Raise the `UnbottledError` for dependencies also when building bottles (so that we don't try and build bottles against things that have been built from source).
Library/Homebrew/test/formula_installer_bottle_spec.rb
@@ -83,7 +83,7 @@ def temporarily_install_bottle(formula) expect { described_class.new(formula).install - }.to raise_error(BuildToolsError) + }.to raise_error(UnbottledError) expect(formula).not_to be_latest_version_installed end
true
Other
Homebrew
brew
16d13fe086f191a0b39e08f2d8e96daa292e5f78.json
add two options to cmd/home
Library/Homebrew/cmd/home.rb
@@ -18,6 +18,11 @@ def home_args Open a <formula> or <cask>'s homepage in a browser, or open Homebrew's own homepage if no argument is provided. EOS + switch "--formula", "--formulae", + description: "Treat all named arguments as formulae." + switch "--cask", "--casks", + description: "Treat all named arguments as casks." + conflicts "--formula", "--cask" end end @@ -30,7 +35,9 @@ def home return end - homepages = args.named.to_formulae_and_casks.map do |formula_or_cask| + only = :formula if args.formula? && !args.cask? + only = :cask if args.cask? && !args.formula? + homepages = args.named.to_formulae_and_casks(only: only).map do |formula_or_cask| puts "Opening homepage for #{name_of(formula_or_cask)}" formula_or_cask.homepage end
true
Other
Homebrew
brew
16d13fe086f191a0b39e08f2d8e96daa292e5f78.json
add two options to cmd/home
docs/Manpage.md
@@ -211,6 +211,11 @@ error message if no logs are found. Open a *`formula`* or *`cask`*'s homepage in a browser, or open Homebrew's own homepage if no argument is provided. +* `--formula`: + Treat all named arguments as formulae. +* `--cask`: + Treat all named arguments as casks. + ### `info` [*`options`*] [*`formula`*|*`cask`*] Display brief statistics for your Homebrew installation.
true
Other
Homebrew
brew
16d13fe086f191a0b39e08f2d8e96daa292e5f78.json
add two options to cmd/home
manpages/brew.1
@@ -258,6 +258,14 @@ The Gist will be marked private and will not appear in listings but will be acce .SS "\fBhome\fR [\fIformula\fR|\fIcask\fR]" Open a \fIformula\fR or \fIcask\fR\'s homepage in a browser, or open Homebrew\'s own homepage if no argument is provided\. . +.TP +\fB\-\-formula\fR +Treat all named arguments as formulae\. +. +.TP +\fB\-\-cask\fR +Treat all named arguments as casks\. +. .SS "\fBinfo\fR [\fIoptions\fR] [\fIformula\fR|\fIcask\fR]" Display brief statistics for your Homebrew installation\. .
true
Other
Homebrew
brew
323fec503201eb66bf981f8fab034238db428aae.json
utils/bottles: install bundler gems if necessary.
Library/Homebrew/utils/bottles.rb
@@ -76,6 +76,7 @@ def formula_contents(bottle_file, end def add_bottle_stanza!(formula_contents, bottle_output) + Homebrew.install_bundler_gems! require "rubocop-ast" ruby_version = Version.new(HOMEBREW_REQUIRED_RUBY_VERSION).major_minor.to_f
false
Other
Homebrew
brew
b8aa67be5b0aaac8c027cd57a61213150c12c55a.json
bottle: add bottle stanza by traversing AST
Library/Homebrew/dev-cmd/bottle.rb
@@ -536,27 +536,7 @@ def merge(args:) odie "--keep-old was passed but there was no existing bottle block!" if args.keep_old? puts output update_or_add = "add" - pattern = /( - (\ {2}\#[^\n]*\n)* # comments - \ {2}( # two spaces at the beginning - (url|head)\ ['"][\S\ ]+['"] # url or head with a string - ( - ,[\S\ ]*$ # url may have options - (\n^\ {3}[\S\ ]+$)* # options can be in multiple lines - )?| - (homepage|desc|sha256|version|mirror|license)\ ['"][\S\ ]+['"]| # specs with a string - license\ ( - [^\[]+?\[[^\]]+?\]| # license may contain a list - [^{]+?{[^}]+?}| # license may contain a hash - :\S+ # license as a symbol - )| - (revision|version_scheme)\ \d+| # revision with a number - (stable|livecheck)\ do(\n+^\ {4}[\S\ ]+$)*\n+^\ {2}end # components with blocks - )\n+ # multiple empty lines - )+ - /mx - string = s.sub!(pattern, "\\0#{output}\n") - odie "Bottle block addition failed!" unless string + Utils::Bottles.add_bottle_stanza!(s.inreplace_string, output) end end
true
Other
Homebrew
brew
b8aa67be5b0aaac8c027cd57a61213150c12c55a.json
bottle: add bottle stanza by traversing AST
Library/Homebrew/rubocops/components_order.rb
@@ -11,50 +11,50 @@ module FormulaAudit # - `component_precedence_list` has component hierarchy in a nested list # where each sub array contains components' details which are at same precedence level class ComponentsOrder < FormulaCop - def audit_formula(_node, _class_node, _parent_class_node, body_node) - component_precedence_list = [ - [{ name: :include, type: :method_call }], - [{ name: :desc, type: :method_call }], - [{ name: :homepage, type: :method_call }], - [{ name: :url, type: :method_call }], - [{ name: :mirror, type: :method_call }], - [{ name: :version, type: :method_call }], - [{ name: :sha256, type: :method_call }], - [{ name: :license, type: :method_call }], - [{ name: :revision, type: :method_call }], - [{ name: :version_scheme, type: :method_call }], - [{ name: :head, type: :method_call }], - [{ name: :stable, type: :block_call }], - [{ name: :livecheck, type: :block_call }], - [{ name: :bottle, type: :block_call }], - [{ name: :pour_bottle?, type: :block_call }], - [{ name: :head, type: :block_call }], - [{ name: :bottle, type: :method_call }], - [{ name: :keg_only, type: :method_call }], - [{ name: :option, type: :method_call }], - [{ name: :deprecated_option, type: :method_call }], - [{ name: :disable!, type: :method_call }], - [{ name: :deprecate!, type: :method_call }], - [{ name: :depends_on, type: :method_call }], - [{ name: :uses_from_macos, type: :method_call }], - [{ name: :on_macos, type: :block_call }], - [{ name: :on_linux, type: :block_call }], - [{ name: :conflicts_with, type: :method_call }], - [{ name: :skip_clean, type: :method_call }], - [{ name: :cxxstdlib_check, type: :method_call }], - [{ name: :link_overwrite, type: :method_call }], - [{ name: :fails_with, type: :method_call }, { name: :fails_with, type: :block_call }], - [{ name: :go_resource, type: :block_call }, { name: :resource, type: :block_call }], - [{ name: :patch, type: :method_call }, { name: :patch, type: :block_call }], - [{ name: :needs, type: :method_call }], - [{ name: :install, type: :method_definition }], - [{ name: :post_install, type: :method_definition }], - [{ name: :caveats, type: :method_definition }], - [{ name: :plist_options, type: :method_call }, { name: :plist, type: :method_definition }], - [{ name: :test, type: :block_call }], - ] + COMPONENT_PRECEDENCE_LIST = [ + [{ name: :include, type: :method_call }], + [{ name: :desc, type: :method_call }], + [{ name: :homepage, type: :method_call }], + [{ name: :url, type: :method_call }], + [{ name: :mirror, type: :method_call }], + [{ name: :version, type: :method_call }], + [{ name: :sha256, type: :method_call }], + [{ name: :license, type: :method_call }], + [{ name: :revision, type: :method_call }], + [{ name: :version_scheme, type: :method_call }], + [{ name: :head, type: :method_call }], + [{ name: :stable, type: :block_call }], + [{ name: :livecheck, type: :block_call }], + [{ name: :bottle, type: :block_call }], + [{ name: :pour_bottle?, type: :block_call }], + [{ name: :head, type: :block_call }], + [{ name: :bottle, type: :method_call }], + [{ name: :keg_only, type: :method_call }], + [{ name: :option, type: :method_call }], + [{ name: :deprecated_option, type: :method_call }], + [{ name: :disable!, type: :method_call }], + [{ name: :deprecate!, type: :method_call }], + [{ name: :depends_on, type: :method_call }], + [{ name: :uses_from_macos, type: :method_call }], + [{ name: :on_macos, type: :block_call }], + [{ name: :on_linux, type: :block_call }], + [{ name: :conflicts_with, type: :method_call }], + [{ name: :skip_clean, type: :method_call }], + [{ name: :cxxstdlib_check, type: :method_call }], + [{ name: :link_overwrite, type: :method_call }], + [{ name: :fails_with, type: :method_call }, { name: :fails_with, type: :block_call }], + [{ name: :go_resource, type: :block_call }, { name: :resource, type: :block_call }], + [{ name: :patch, type: :method_call }, { name: :patch, type: :block_call }], + [{ name: :needs, type: :method_call }], + [{ name: :install, type: :method_definition }], + [{ name: :post_install, type: :method_definition }], + [{ name: :caveats, type: :method_definition }], + [{ name: :plist_options, type: :method_call }, { name: :plist, type: :method_definition }], + [{ name: :test, type: :block_call }], + ].freeze - @present_components, @offensive_nodes = check_order(component_precedence_list, body_node) + def audit_formula(_node, _class_node, _parent_class_node, body_node) + @present_components, @offensive_nodes = check_order(COMPONENT_PRECEDENCE_LIST, body_node) component_problem @offensive_nodes[0], @offensive_nodes[1] if @offensive_nodes
true
Other
Homebrew
brew
b8aa67be5b0aaac8c027cd57a61213150c12c55a.json
bottle: add bottle stanza by traversing AST
Library/Homebrew/rubocops/shared/helper_functions.rb
@@ -1,6 +1,8 @@ # typed: false # frozen_string_literal: true +require "rubocop" + module RuboCop module Cop # Helper functions for cops.
true
Other
Homebrew
brew
b8aa67be5b0aaac8c027cd57a61213150c12c55a.json
bottle: add bottle stanza by traversing AST
Library/Homebrew/test/utils/bottles/bottles_spec.rb
@@ -14,4 +14,262 @@ end end end + + describe "#add_bottle_stanza!" do + let(:bottle_output) do + require "active_support/core_ext/string/indent" + + <<~RUBY.chomp.indent(2) + bottle do + sha256 "f7b1fc772c79c20fddf621ccc791090bc1085fcef4da6cca03399424c66e06ca" => :sierra + end + RUBY + end + + context "when `license` is a string" do + let(:formula_contents) do + <<~RUBY.chomp + class Foo < Formula + url "https://brew.sh/foo-1.0.tar.gz" + license "MIT" + end + RUBY + end + + let(:new_contents) do + <<~RUBY.chomp + class Foo < Formula + url "https://brew.sh/foo-1.0.tar.gz" + license "MIT" + + bottle do + sha256 "f7b1fc772c79c20fddf621ccc791090bc1085fcef4da6cca03399424c66e06ca" => :sierra + end + end + RUBY + end + + it "adds `bottle` after `license`" do + described_class.add_bottle_stanza! formula_contents, bottle_output + expect(formula_contents).to eq(new_contents) + end + end + + context "when `license` is a symbol" do + let(:formula_contents) do + <<~RUBY.chomp + class Foo < Formula + url "https://brew.sh/foo-1.0.tar.gz" + license :cannot_represent + end + RUBY + end + + let(:new_contents) do + <<~RUBY.chomp + class Foo < Formula + url "https://brew.sh/foo-1.0.tar.gz" + license :cannot_represent + + bottle do + sha256 "f7b1fc772c79c20fddf621ccc791090bc1085fcef4da6cca03399424c66e06ca" => :sierra + end + end + RUBY + end + + it "adds `bottle` after `license`" do + described_class.add_bottle_stanza! formula_contents, bottle_output + expect(formula_contents).to eq(new_contents) + end + end + + context "when `license` is multiline" do + let(:formula_contents) do + <<~RUBY.chomp + class Foo < Formula + url "https://brew.sh/foo-1.0.tar.gz" + license all_of: [ + :public_domain, + "MIT", + "GPL-3.0-or-later" => { with: "Autoconf-exception-3.0" }, + ] + end + RUBY + end + + let(:new_contents) do + <<~RUBY.chomp + class Foo < Formula + url "https://brew.sh/foo-1.0.tar.gz" + license all_of: [ + :public_domain, + "MIT", + "GPL-3.0-or-later" => { with: "Autoconf-exception-3.0" }, + ] + + bottle do + sha256 "f7b1fc772c79c20fddf621ccc791090bc1085fcef4da6cca03399424c66e06ca" => :sierra + end + end + RUBY + end + + it "adds `bottle` after `license`" do + described_class.add_bottle_stanza! formula_contents, bottle_output + expect(formula_contents).to eq(new_contents) + end + end + + context "when `head` is a string" do + let(:formula_contents) do + <<~RUBY.chomp + class Foo < Formula + url "https://brew.sh/foo-1.0.tar.gz" + head "https://brew.sh/foo.git" + end + RUBY + end + + let(:new_contents) do + <<~RUBY.chomp + class Foo < Formula + url "https://brew.sh/foo-1.0.tar.gz" + head "https://brew.sh/foo.git" + + bottle do + sha256 "f7b1fc772c79c20fddf621ccc791090bc1085fcef4da6cca03399424c66e06ca" => :sierra + end + end + RUBY + end + + it "adds `bottle` after `head`" do + described_class.add_bottle_stanza! formula_contents, bottle_output + expect(formula_contents).to eq(new_contents) + end + end + + context "when `head` is a block" do + let(:formula_contents) do + <<~RUBY.chomp + class Foo < Formula + url "https://brew.sh/foo-1.0.tar.gz" + + head do + url "https://brew.sh/foo.git" + end + end + RUBY + end + + let(:new_contents) do + <<~RUBY.chomp + class Foo < Formula + url "https://brew.sh/foo-1.0.tar.gz" + + bottle do + sha256 "f7b1fc772c79c20fddf621ccc791090bc1085fcef4da6cca03399424c66e06ca" => :sierra + end + + head do + url "https://brew.sh/foo.git" + end + end + RUBY + end + + it "adds `bottle` before `head`" do + described_class.add_bottle_stanza! formula_contents, bottle_output + expect(formula_contents).to eq(new_contents) + end + end + + context "when there is a comment on the same line" do + let(:formula_contents) do + <<~RUBY.chomp + class Foo < Formula + url "https://brew.sh/foo-1.0.tar.gz" # comment + end + RUBY + end + + let(:new_contents) do + <<~RUBY.chomp + class Foo < Formula + url "https://brew.sh/foo-1.0.tar.gz" # comment + + bottle do + sha256 "f7b1fc772c79c20fddf621ccc791090bc1085fcef4da6cca03399424c66e06ca" => :sierra + end + end + RUBY + end + + it "adds `bottle` after the comment" do + described_class.add_bottle_stanza! formula_contents, bottle_output + expect(formula_contents).to eq(new_contents) + end + end + + context "when the next line is a comment" do + let(:formula_contents) do + <<~RUBY.chomp + class Foo < Formula + url "https://brew.sh/foo-1.0.tar.gz" + # comment + end + RUBY + end + + let(:new_contents) do + <<~RUBY.chomp + class Foo < Formula + url "https://brew.sh/foo-1.0.tar.gz" + # comment + + bottle do + sha256 "f7b1fc772c79c20fddf621ccc791090bc1085fcef4da6cca03399424c66e06ca" => :sierra + end + end + RUBY + end + + it "adds `bottle` after the comment" do + described_class.add_bottle_stanza! formula_contents, bottle_output + expect(formula_contents).to eq(new_contents) + end + end + + context "when the next line is blank and the one after it is a comment" do + let(:formula_contents) do + <<~RUBY.chomp + class Foo < Formula + url "https://brew.sh/foo-1.0.tar.gz" + + # comment + end + RUBY + end + + let(:new_contents) do + <<~RUBY.chomp + class Foo < Formula + url "https://brew.sh/foo-1.0.tar.gz" + + bottle do + sha256 "f7b1fc772c79c20fddf621ccc791090bc1085fcef4da6cca03399424c66e06ca" => :sierra + end + + # comment + end + RUBY + end + + it "adds `bottle` before the comment" do + described_class.add_bottle_stanza! formula_contents, bottle_output + expect(formula_contents).to eq(new_contents) + end + end + end end
true
Other
Homebrew
brew
b8aa67be5b0aaac8c027cd57a61213150c12c55a.json
bottle: add bottle stanza by traversing AST
Library/Homebrew/utils/bottles.rb
@@ -74,6 +74,77 @@ def formula_contents(bottle_file, contents end + + def add_bottle_stanza!(formula_contents, bottle_output) + require "rubocop-ast" + + ruby_version = Version.new(HOMEBREW_REQUIRED_RUBY_VERSION).major_minor.to_f + processed_source = RuboCop::AST::ProcessedSource.new(formula_contents, ruby_version) + root_node = processed_source.ast + + class_node = if root_node.class_type? + root_node + elsif root_node.begin_type? + root_node.children.find do |n| + n.class_type? && n.parent_class&.const_name == "Formula" + end + end + + odie "Could not find formula class!" if class_node.nil? + + body_node = class_node.body + odie "Formula class is empty!" if body_node.nil? + + node_before_bottle = if body_node.begin_type? + body_node.children.compact.reduce do |previous_child, current_child| + break previous_child unless component_before_bottle_block? current_child + + current_child + end + else + body_node + end + node_before_bottle = node_before_bottle.last_argument if node_before_bottle.send_type? + + expr_before_bottle = node_before_bottle.location.expression + processed_source.comments.each do |comment| + comment_expr = comment.location.expression + distance = comment_expr.first_line - expr_before_bottle.first_line + case distance + when 0 + if comment_expr.last_line > expr_before_bottle.last_line || + comment_expr.end_pos > expr_before_bottle.end_pos + expr_before_bottle = comment_expr + end + when 1 + expr_before_bottle = comment_expr + end + end + + tree_rewriter = Parser::Source::TreeRewriter.new(processed_source.buffer) + tree_rewriter.insert_after(expr_before_bottle, "\n\n#{bottle_output.chomp}") + formula_contents.replace(tree_rewriter.process) + end + + private + + def component_before_bottle_block?(node) + require "rubocops/components_order" + + RuboCop::Cop::FormulaAudit::ComponentsOrder::COMPONENT_PRECEDENCE_LIST.each do |components| + components.each do |component| + return false if component[:name] == :bottle && component[:type] == :block_call + + case component[:type] + when :method_call + return true if node.send_type? && node.method_name == component[:name] + when :block_call + return true if node.block_type? && node.method_name == component[:name] + end + end + end + false + end end # Helper functions for bottles hosted on Bintray.
true
Other
Homebrew
brew
c4da30230344247a8f61655c48ee5df2ba8801d7.json
on_macos/on_linux block: improve rubocop message Co-authored-by: Markus Reiter <me@reitermark.us>
Library/Homebrew/rubocops.rb
@@ -3,6 +3,8 @@ require_relative "load_path" +require "active_support/core_ext/array/conversions" + require "utils/sorbet" require "rubocop-performance"
true
Other
Homebrew
brew
c4da30230344247a8f61655c48ee5df2ba8801d7.json
on_macos/on_linux block: improve rubocop message Co-authored-by: Markus Reiter <me@reitermark.us>
Library/Homebrew/rubocops/components_order.rb
@@ -135,6 +135,7 @@ def audit_formula(_node, _class_node, _parent_class_node, body_node) end def check_on_os_block_content(component_precedence_list, on_os_block) + on_os_allowed_methods = %w[depends_on patch resource deprecate! disable!] _, offensive_node = check_order(component_precedence_list, on_os_block.body) component_problem(*offensive_node) if offensive_node child_nodes = on_os_block.body.begin_type? ? on_os_block.body.child_nodes : [on_os_block.body] @@ -145,16 +146,14 @@ def check_on_os_block_content(component_precedence_list, on_os_block) method_type = child.send_type? || child.block_type? next unless method_type - valid_node ||= child.method_name.to_s == "patch" - valid_node ||= child.method_name.to_s == "resource" - valid_node ||= child.method_name.to_s == "deprecate!" - valid_node ||= child.method_name.to_s == "disable!" + valid_node ||= on_os_allowed_methods.include? child.method_name.to_s - @offensive_node = on_os_block - @offense_source_range = on_os_block.source_range - unless valid_node - problem "`#{on_os_block.method_name}` can only include `depends_on`, `patch` and `resource` nodes." - end + @offensive_node = child + @offense_source_range = child.source_range + next if valid_node + + problem "`#{on_os_block.method_name}` cannot include `#{child.method_name}`. " \ + "Only #{on_os_allowed_methods.map { |m| "`#{m}`" }.to_sentence} are allowed." end end
true
Other
Homebrew
brew
c4da30230344247a8f61655c48ee5df2ba8801d7.json
on_macos/on_linux block: improve rubocop message Co-authored-by: Markus Reiter <me@reitermark.us>
Library/Homebrew/test/rubocops/components_order_spec.rb
@@ -390,9 +390,9 @@ class Foo < Formula class Foo < Formula url "https://brew.sh/foo-1.0.tgz" on_macos do - ^^^^^^^^^^^ `on_macos` can only include `depends_on`, `patch` and `resource` nodes. depends_on "readline" uses_from_macos "ncurses" + ^^^^^^^^^^^^^^^^^^^^^^^^^ `on_macos` cannot include `uses_from_macos`. [...] end end RUBY @@ -403,9 +403,9 @@ class Foo < Formula class Foo < Formula url "https://brew.sh/foo-1.0.tgz" on_linux do - ^^^^^^^^^^^ `on_linux` can only include `depends_on`, `patch` and `resource` nodes. depends_on "readline" uses_from_macos "ncurses" + ^^^^^^^^^^^^^^^^^^^^^^^^^ `on_linux` cannot include `uses_from_macos`. [...] end end RUBY
true
Other
Homebrew
brew
cb2facfec13f38ccd0926a35af4678b0ca6eb777.json
Ignore `Info.plist` for nested apps.
Library/Homebrew/unversioned_cask_checker.rb
@@ -104,7 +104,10 @@ def guess_cask_version end info_plist_paths = apps.flat_map do |app| - Pathname.glob(dir/"**"/app.source.basename/"Contents"/"Info.plist") + Pathname.glob(dir/"**"/app.source.basename/"Contents"/"Info.plist").reject do |info_plist_path| + # Ignore nested apps. + info_plist_path.parent.parent.parent.ascend.any? { |p| p.extname == ".app" } + end.sort end info_plist_paths.each do |info_plist_path| @@ -114,7 +117,7 @@ def guess_cask_version end pkg_paths = pkgs.flat_map do |pkg| - Pathname.glob(dir/"**"/pkg.path.basename) + Pathname.glob(dir/"**"/pkg.path.basename).sort end pkg_paths.each do |pkg_path|
false
Other
Homebrew
brew
e902558f9dc4dd3c09067f0419ad9e047e63023e.json
Update RBI files for sorbet.
Library/Homebrew/sorbet/rbi/hidden-definitions/hidden.rbi
@@ -8118,7 +8118,6 @@ class HeadVersion end module Homebrew - DEFAULT_REPOSITORY = ::T.let(nil, ::T.untyped) MAX_PORT = ::T.let(nil, ::T.untyped) MIN_PORT = ::T.let(nil, ::T.untyped) end
false
Other
Homebrew
brew
59cfef6db02a4c43c9ab777c17ce3cafd6803c8c.json
bump-formula-pr: handle additional edge cases
Library/Homebrew/dev-cmd/bump-formula-pr.rb
@@ -70,8 +70,8 @@ def bump_formula_pr_args flag "--tag=", description: "Specify the new git commit <tag> for the formula." flag "--revision=", - depends_on: "--tag=", - description: "Specify the new git commit <revision> corresponding to the specified <tag>." + description: "Specify the new commit <revision> corresponding to the specified git <tag> "\ + "or specified <version>." switch "-f", "--force", description: "Ignore duplicate open PRs. Remove all mirrors if `--mirror` was not specified." @@ -121,6 +121,10 @@ def use_correct_linux_tap(formula, args:) def bump_formula_pr args = bump_formula_pr_args.parse + if args.revision.present? && args.tag.nil? && args.version.nil? + raise UsageError, "`--revision` must be passed with either `--tag` or `--version`!" + end + # As this command is simplifying user-run commands then let's just use a # user path, too. ENV["PATH"] = ENV["HOMEBREW_PATH"] @@ -177,21 +181,28 @@ def bump_formula_pr check_closed_pull_requests(formula, tap_full_name, url: old_url, tag: new_tag, args: args) unless new_version false elsif !hash_type - odie "#{formula}: no --tag= or --version= argument specified!" if !new_tag && !new_version - new_tag ||= old_tag.gsub(old_version, new_version) - if new_tag == old_tag - odie <<~EOS - You need to bump this formula manually since the new tag - and old tag are both #{new_tag}. - EOS + if !new_tag && !new_version && !new_revision + raise UsageError, "#{formula}: no --tag= or --version= argument specified!" + end + + if old_tag + new_tag ||= old_tag.gsub(old_version, new_version) + if new_tag == old_tag + odie <<~EOS + You need to bump this formula manually since the new tag + and old tag are both #{new_tag}. + EOS + end + check_closed_pull_requests(formula, tap_full_name, url: old_url, tag: new_tag, args: args) unless new_version + resource_path, forced_version = fetch_resource(formula, new_version, old_url, tag: new_tag) + new_revision = Utils.popen_read("git -C \"#{resource_path}\" rev-parse -q --verify HEAD") + new_revision = new_revision.strip + else + odie "#{formula}: the current URL requires specifying a --revision= argument." unless new_revision end - check_closed_pull_requests(formula, tap_full_name, url: old_url, tag: new_tag, args: args) unless new_version - resource_path, forced_version = fetch_resource(formula, new_version, old_url, tag: new_tag) - new_revision = Utils.popen_read("git -C \"#{resource_path}\" rev-parse -q --verify HEAD") - new_revision = new_revision.strip false elsif !new_url && !new_version - odie "#{formula}: no --url= or --version= argument specified!" + raise UsageError, "#{formula}: no --url= or --version= argument specified!" else new_url ||= PyPI.update_pypi_url(old_url, new_version) unless new_url @@ -241,7 +252,7 @@ def bump_formula_pr new_hash, ], ] - else + elsif new_tag [ [ formula_spec.specs[:tag], @@ -252,6 +263,24 @@ def bump_formula_pr new_revision, ], ] + elsif new_url + [ + [ + /#{Regexp.escape(formula_spec.url)}/, + new_url, + ], + [ + formula_spec.specs[:revision], + new_revision, + ], + ] + else + [ + [ + formula_spec.specs[:revision], + new_revision, + ], + ] end old_contents = File.read(formula.path) unless args.dry_run? @@ -312,8 +341,8 @@ def bump_formula_pr if new_formula_version < old_formula_version formula.path.atomic_write(old_contents) unless args.dry_run? odie <<~EOS - You need to bump this formula manually since changing the - version from #{old_formula_version} to #{new_formula_version} would be a downgrade. + You need to bump this formula manually since changing the version + from #{old_formula_version} to #{new_formula_version} would be a downgrade. EOS elsif new_formula_version == old_formula_version formula.path.atomic_write(old_contents) unless args.dry_run?
true
Other
Homebrew
brew
59cfef6db02a4c43c9ab777c17ce3cafd6803c8c.json
bump-formula-pr: handle additional edge cases
docs/Manpage.md
@@ -889,7 +889,7 @@ nor vice versa. It must use whichever style specification the formula already us * `--tag`: Specify the new git commit *`tag`* for the formula. * `--revision`: - Specify the new git commit *`revision`* corresponding to the specified *`tag`*. + Specify the new commit *`revision`* corresponding to the specified git *`tag`* or specified *`version`*. * `-f`, `--force`: Ignore duplicate open PRs. Remove all mirrors if `--mirror` was not specified.
true
Other
Homebrew
brew
59cfef6db02a4c43c9ab777c17ce3cafd6803c8c.json
bump-formula-pr: handle additional edge cases
manpages/brew.1
@@ -1236,7 +1236,7 @@ Specify the new git commit \fItag\fR for the formula\. . .TP \fB\-\-revision\fR -Specify the new git commit \fIrevision\fR corresponding to the specified \fItag\fR\. +Specify the new commit \fIrevision\fR corresponding to the specified git \fItag\fR or specified \fIversion\fR\. . .TP \fB\-f\fR, \fB\-\-force\fR
true
Other
Homebrew
brew
026381d359ab0c10b25d6f90ecdc27771bb5e227.json
Revert "untap: add --force switch"
Library/Homebrew/cmd/untap.rb
@@ -2,7 +2,6 @@ # frozen_string_literal: true require "cli/parser" -require "formula" module Homebrew extend T::Sig @@ -17,8 +16,6 @@ def untap_args Remove a tapped formula repository. EOS - switch "-f", "--force", - description: "Untap even if formulae or casks from this tap are currently installed." min_named 1 end @@ -31,23 +28,6 @@ def untap tap = Tap.fetch(tapname) odie "Untapping #{tap} is not allowed" if tap.core_tap? - installed_tap_formulae = Formula.installed.select { |formula| formula.tap == tap } - installed_tap_casks = Cask::Caskroom.casks.select { |cask| cask.tap == tap } - - if installed_tap_formulae.length.positive? || installed_tap_casks.length.positive? - if args.force? - opoo <<~EOS - Untapping #{tap} even though it contains the following installed formulae or casks: - #{(installed_tap_formulae + installed_tap_casks.map(&:token)).join("\n")} - EOS - else - odie <<~EOS - Refusing to untap #{tap} because it contains the following installed formulae or casks: - #{(installed_tap_formulae + installed_tap_casks.map(&:token)).join("\n")} - EOS - end - end - tap.uninstall end end
true
Other
Homebrew
brew
026381d359ab0c10b25d6f90ecdc27771bb5e227.json
Revert "untap: add --force switch"
docs/Manpage.md
@@ -572,9 +572,6 @@ See also `pin`. Remove a tapped formula repository. -* `-f`, `--force`: - Untap even if formulae or casks from this tap are currently installed. - ### `update` [*`options`*] Fetch the newest version of Homebrew and all formulae from GitHub using `git`(1) and perform any necessary migrations.
true
Other
Homebrew
brew
026381d359ab0c10b25d6f90ecdc27771bb5e227.json
Revert "untap: add --force switch"
manpages/brew.1
@@ -770,10 +770,6 @@ Unpin \fIformula\fR, allowing them to be upgraded by \fBbrew upgrade\fR \fIformu .SS "\fBuntap\fR \fItap\fR" Remove a tapped formula repository\. . -.TP -\fB\-f\fR, \fB\-\-force\fR -Untap even if formulae or casks from this tap are currently installed\. -. .SS "\fBupdate\fR [\fIoptions\fR]" Fetch the newest version of Homebrew and all formulae from GitHub using \fBgit\fR(1) and perform any necessary migrations\. .
true
Other
Homebrew
brew
adab0fbb41676410229228e96d81f7d5319c719a.json
cleanup: fix portable Ruby behaviour. Better match the macOS behaviour in `ruby.sh`. Fixes #9469
Library/Homebrew/brew.sh
@@ -455,6 +455,7 @@ export HOMEBREW_MACOS_VERSION_NUMERIC export HOMEBREW_USER_AGENT export HOMEBREW_USER_AGENT_CURL export HOMEBREW_BOTTLE_DEFAULT_DOMAIN +export HOMEBREW_MACOS_SYSTEM_RUBY_NEW_ENOUGH if [[ -n "$HOMEBREW_MACOS" && -x "/usr/bin/xcode-select" ]] then
true
Other
Homebrew
brew
adab0fbb41676410229228e96d81f7d5319c719a.json
cleanup: fix portable Ruby behaviour. Better match the macOS behaviour in `ruby.sh`. Fixes #9469
Library/Homebrew/cleanup.rb
@@ -361,6 +361,8 @@ def cleanup_portable_ruby use_system_ruby = if Homebrew::EnvConfig.force_vendor_ruby? false + elsif OS.mac? + ENV["HOMEBREW_MACOS_SYSTEM_RUBY_NEW_ENOUGH"].present? else check_ruby_version = HOMEBREW_LIBRARY_PATH/"utils/ruby_check_version_script.rb" rubies.uniq.any? do |ruby|
true
Other
Homebrew
brew
1f8fd2a9ef72a860e5775bcd64b4600d41e3b52e.json
caveats: remove ZSH FPATH logic. This is too error-prone and full of edge cases. Fixes #9455
Library/Homebrew/caveats.rb
@@ -128,21 +128,10 @@ def function_completion_caveats(shell) #{root_dir}/etc/bash_completion.d EOS when :zsh - site_functions = root_dir/"share/zsh/site-functions" - zsh_caveats = +<<~EOS + <<~EOS zsh #{installed.join(" and ")} have been installed to: - #{site_functions} + #{root_dir}/share/zsh/site-functions EOS - zsh = which("zsh") || which("zsh", ENV["HOMEBREW_PATH"]) - if zsh.present? && Utils.popen_read("'#{zsh}' -ic 'echo $FPATH'").exclude?(site_functions.to_s) - zsh_caveats << <<~EOS - - #{site_functions} is not in your zsh FPATH! - Add it by following these steps: - #{Formatter.url("https://docs.brew.sh/Shell-Completion#configuring-completions-in-zsh")} - EOS - end - zsh_caveats.freeze when :fish fish_caveats = +"fish #{installed.join(" and ")} have been installed to:" fish_caveats << "\n #{root_dir}/share/fish/vendor_completions.d" if completion_installed
false
Other
Homebrew
brew
eec1d5e17f3b13a5cf2055f662a7e5a2d8edc9bc.json
Add timeout in `bump-unversioned-casks`.
Library/Homebrew/dev-cmd/bump-unversioned-casks.rb
@@ -1,6 +1,7 @@ # typed: false # frozen_string_literal: true +require "timeout" require "cask/download" require "cask/installer" require "cask/cask_loader" @@ -45,18 +46,9 @@ def self.bump_unversioned_casks state = state_file.exist? ? JSON.parse(state_file.read) : {} - cask_files = args.named.to_paths(only: :cask, recurse_tap: true) + casks = args.named.to_paths(only: :cask, recurse_tap: true).map { |path| Cask::CaskLoader.load(path) } - unversioned_cask_files = cask_files.select do |cask_file| - url = cask_file.each_line do |line| - url = line[/\s*url\s+"([^"]+)"\s*/, 1] - break url if url - end - - url.present? && url.exclude?('#{') - end.sort - - unversioned_casks = unversioned_cask_files.map { |path| Cask::CaskLoader.load(path) } + unversioned_casks = casks.select { |cask| cask.url&.unversioned? } ohai "Unversioned Casks: #{unversioned_casks.count} (#{state.size} cached)" @@ -126,16 +118,15 @@ def self.bump_unversioned_cask(cask, state:, dry_run:) end if last_time != time || last_file_size != file_size - begin - cached_download = unversioned_cask_checker.installer.download + sha256 = begin + Timeout.timeout(5.minutes) do + unversioned_cask_checker.installer.download.sha256 + end rescue => e onoe e - return end - sha256 = cached_download.sha256 - - if last_sha256 != sha256 && (version = unversioned_cask_checker.guess_cask_version) + if sha256.present? && last_sha256 != sha256 && (version = unversioned_cask_checker.guess_cask_version) if cask.version == version oh1 "Cask #{cask} is up-to-date at #{version}" else
false
Other
Homebrew
brew
4c5fc62a5d5ebbcd1c18695a779e2fb353ed337b.json
sorbet: Update RBI files. Autogenerated by the [sorbet](https://github.com/Homebrew/brew/blob/master/.github/workflows/sorbet.yml) workflow.
Library/Homebrew/sorbet/rbi/hidden-definitions/hidden.rbi
@@ -7086,6 +7086,8 @@ end class Errno::EBADRPC end +Errno::ECAPMODE = Errno::NOERROR + Errno::EDEADLOCK = Errno::NOERROR class Errno::EDEVERR @@ -7106,6 +7108,13 @@ end Errno::EIPSEC = Errno::NOERROR +class Errno::ELAST + Errno = ::T.let(nil, ::T.untyped) +end + +class Errno::ELAST +end + class Errno::ENEEDAUTH Errno = ::T.let(nil, ::T.untyped) end @@ -7127,6 +7136,8 @@ end class Errno::ENOPOLICY end +Errno::ENOTCAPABLE = Errno::NOERROR + class Errno::ENOTSUP Errno = ::T.let(nil, ::T.untyped) end @@ -7169,12 +7180,7 @@ end class Errno::EPWROFF end -class Errno::EQFULL - Errno = ::T.let(nil, ::T.untyped) -end - -class Errno::EQFULL -end +Errno::EQFULL = Errno::ELAST class Errno::ERPCMISMATCH Errno = ::T.let(nil, ::T.untyped) @@ -13513,7 +13519,6 @@ class Object def to_query(key); end def to_yaml(options=T.unsafe(nil)); end - APPLE_GEM_HOME = ::T.let(nil, ::T.untyped) ARGF = ::T.let(nil, ::T.untyped) ARGV = ::T.let(nil, ::T.untyped) BUG_REPORTS_URL = ::T.let(nil, ::T.untyped) @@ -13575,8 +13580,6 @@ class Object RUBY_DESCRIPTION = ::T.let(nil, ::T.untyped) RUBY_ENGINE = ::T.let(nil, ::T.untyped) RUBY_ENGINE_VERSION = ::T.let(nil, ::T.untyped) - RUBY_FRAMEWORK = ::T.let(nil, ::T.untyped) - RUBY_FRAMEWORK_VERSION = ::T.let(nil, ::T.untyped) RUBY_PATCHLEVEL = ::T.let(nil, ::T.untyped) RUBY_PATH = ::T.let(nil, ::T.untyped) RUBY_PLATFORM = ::T.let(nil, ::T.untyped) @@ -13633,7 +13636,11 @@ class OpenSSL::KDF::KDFError end module OpenSSL::KDF + def self.hkdf(*_); end + def self.pbkdf2_hmac(*_); end + + def self.scrypt(*_); end end class OpenSSL::OCSP::Request @@ -13642,20 +13649,29 @@ end OpenSSL::PKCS7::Signer = OpenSSL::PKCS7::SignerInfo +class OpenSSL::PKey::EC + EXPLICIT_CURVE = ::T.let(nil, ::T.untyped) +end + class OpenSSL::PKey::EC::Point def to_octet_string(_); end end module OpenSSL::SSL + OP_ALLOW_NO_DHE_KEX = ::T.let(nil, ::T.untyped) OP_ALLOW_UNSAFE_LEGACY_RENEGOTIATION = ::T.let(nil, ::T.untyped) OP_CRYPTOPRO_TLSEXT_BUG = ::T.let(nil, ::T.untyped) OP_LEGACY_SERVER_CONNECT = ::T.let(nil, ::T.untyped) + OP_NO_ENCRYPT_THEN_MAC = ::T.let(nil, ::T.untyped) + OP_NO_RENEGOTIATION = ::T.let(nil, ::T.untyped) + OP_NO_TLSv1_3 = ::T.let(nil, ::T.untyped) OP_SAFARI_ECDHE_ECDSA_BUG = ::T.let(nil, ::T.untyped) OP_TLSEXT_PADDING = ::T.let(nil, ::T.untyped) SSL2_VERSION = ::T.let(nil, ::T.untyped) SSL3_VERSION = ::T.let(nil, ::T.untyped) TLS1_1_VERSION = ::T.let(nil, ::T.untyped) TLS1_2_VERSION = ::T.let(nil, ::T.untyped) + TLS1_3_VERSION = ::T.let(nil, ::T.untyped) TLS1_VERSION = ::T.let(nil, ::T.untyped) end @@ -13670,6 +13686,8 @@ class OpenSSL::SSL::SSLContext def alpn_select_cb=(alpn_select_cb); end + def enable_fallback_scsv(); end + def max_version=(version); end def min_version=(version); end @@ -30194,7 +30212,6 @@ class Socket IPV6_PATHMTU = ::T.let(nil, ::T.untyped) IPV6_RECVPATHMTU = ::T.let(nil, ::T.untyped) IPV6_USE_MIN_MTU = ::T.let(nil, ::T.untyped) - IP_DONTFRAG = ::T.let(nil, ::T.untyped) IP_PORTRANGE = ::T.let(nil, ::T.untyped) IP_RECVDSTADDR = ::T.let(nil, ::T.untyped) IP_RECVIF = ::T.let(nil, ::T.untyped) @@ -30286,7 +30303,6 @@ module Socket::Constants IPV6_PATHMTU = ::T.let(nil, ::T.untyped) IPV6_RECVPATHMTU = ::T.let(nil, ::T.untyped) IPV6_USE_MIN_MTU = ::T.let(nil, ::T.untyped) - IP_DONTFRAG = ::T.let(nil, ::T.untyped) IP_PORTRANGE = ::T.let(nil, ::T.untyped) IP_RECVDSTADDR = ::T.let(nil, ::T.untyped) IP_RECVIF = ::T.let(nil, ::T.untyped)
false
Other
Homebrew
brew
8717f82b9d7d3a05e7411a12434551474d4212f1.json
dev-cmd/audit: add audit for checksum
Library/Homebrew/resource_auditor.rb
@@ -26,6 +26,7 @@ def initialize(resource, spec_name, options = {}) def audit audit_version audit_download_strategy + audit_checksum audit_urls self end @@ -72,6 +73,13 @@ def audit_download_strategy problem "Redundant :using value in URL" end + def audit_checksum + return if spec_name == :head + return unless DownloadStrategyDetector.detect(url, using) <= CurlDownloadStrategy + + problem "Checksum is missing" if checksum.blank? + end + def self.curl_openssl_and_deps @curl_openssl_and_deps ||= begin formulae_names = ["curl", "openssl"]
true
Other
Homebrew
brew
8717f82b9d7d3a05e7411a12434551474d4212f1.json
dev-cmd/audit: add audit for checksum
Library/Homebrew/test/dev-cmd/audit_spec.rb
@@ -564,10 +564,46 @@ class Foo < Formula let(:throttle_list) { { throttled_formulae: { "foo" => 10 } } } let(:versioned_head_spec_list) { { versioned_head_spec_allowlist: ["foo"] } } + it "doesn't allow to miss a checksum" do + fa = formula_auditor "foo", <<~RUBY + class Foo < Formula + url "https://brew.sh/foo-1.0.tgz" + end + RUBY + + fa.audit_specs + expect(fa.problems.first[:message]).to match "Checksum is missing" + end + + it "allows to miss a checksum for git strategy" do + fa = formula_auditor "foo", <<~RUBY + class Foo < Formula + url "https://brew.sh/foo.git", tag: "1.0", revision: "f5e00e485e7aa4c5baa20355b27e3b84a6912790" + end + RUBY + + fa.audit_specs + expect(fa.problems).to be_empty + end + + it "allows to miss a checksum for HEAD" do + fa = formula_auditor "foo", <<~RUBY + class Foo < Formula + url "https://brew.sh/foo-1.0.tgz" + sha256 "31cccfc6630528db1c8e3a06f6decf2a370060b982841cfab2b8677400a5092e" + head "https://brew.sh/foo.tgz" + end + RUBY + + fa.audit_specs + expect(fa.problems).to be_empty + end + it "allows versions with no throttle rate" do fa = formula_auditor "bar", <<~RUBY, core_tap: true, tap_audit_exceptions: throttle_list class Bar < Formula url "https://brew.sh/foo-1.0.1.tgz" + sha256 "31cccfc6630528db1c8e3a06f6decf2a370060b982841cfab2b8677400a5092e" end RUBY @@ -579,6 +615,7 @@ class Bar < Formula fa = formula_auditor "foo", <<~RUBY, core_tap: true, tap_audit_exceptions: throttle_list class Foo < Formula url "https://brew.sh/foo-1.0.0.tgz" + sha256 "31cccfc6630528db1c8e3a06f6decf2a370060b982841cfab2b8677400a5092e" end RUBY @@ -590,6 +627,7 @@ class Foo < Formula fa = formula_auditor "foo", <<~RUBY, core_tap: true, tap_audit_exceptions: throttle_list class Foo < Formula url "https://brew.sh/foo-1.0.10.tgz" + sha256 "31cccfc6630528db1c8e3a06f6decf2a370060b982841cfab2b8677400a5092e" end RUBY @@ -601,6 +639,7 @@ class Foo < Formula fa = formula_auditor "foo", <<~RUBY, core_tap: true, tap_audit_exceptions: throttle_list class Foo < Formula url "https://brew.sh/foo-1.0.1.tgz" + sha256 "31cccfc6630528db1c8e3a06f6decf2a370060b982841cfab2b8677400a5092e" end RUBY @@ -612,7 +651,8 @@ class Foo < Formula fa = formula_auditor "bar", <<~RUBY, core_tap: true, tap_audit_exceptions: versioned_head_spec_list class Bar < Formula url "https://brew.sh/foo-1.0.tgz" - head "https://brew.sh/foo-1.0.tgz" + sha256 "31cccfc6630528db1c8e3a06f6decf2a370060b982841cfab2b8677400a5092e" + head "https://brew.sh/foo.git" end RUBY @@ -624,19 +664,21 @@ class Bar < Formula fa = formula_auditor "bar@1", <<~RUBY, core_tap: true, tap_audit_exceptions: versioned_head_spec_list class BarAT1 < Formula url "https://brew.sh/foo-1.0.tgz" - head "https://brew.sh/foo-1.0.tgz" + sha256 "31cccfc6630528db1c8e3a06f6decf2a370060b982841cfab2b8677400a5092e" + head "https://brew.sh/foo.git" end RUBY fa.audit_specs expect(fa.problems.first[:message]).to match "Versioned formulae should not have a `HEAD` spec" end - it "allows ersioned formulae on the allowlist to have a `HEAD` spec" do + it "allows versioned formulae on the allowlist to have a `HEAD` spec" do fa = formula_auditor "foo", <<~RUBY, core_tap: true, tap_audit_exceptions: versioned_head_spec_list class Foo < Formula url "https://brew.sh/foo-1.0.tgz" - head "https://brew.sh/foo-1.0.tgz" + sha256 "31cccfc6630528db1c8e3a06f6decf2a370060b982841cfab2b8677400a5092e" + head "https://brew.sh/foo.git" end RUBY
true
Other
Homebrew
brew
9b4a7856ac92e025e9df73ed5d18e4412fa55b5c.json
Revert "RbConfig: fix broken MacOS SDK paths" This reverts commit 11445e0f3edf29ee64081c5a05b5257d9b5ccdd9.
Library/Homebrew/extend/rbconfig_extension.rb
@@ -1,17 +0,0 @@ -# typed: false -# frozen_string_literal: true - -macos_version = ENV["HOMEBREW_MACOS_VERSION"][0..4] -macos_sdk = "MacOSX#{macos_version}.sdk" - -# Ruby hardcodes what might end up being an incorrect SDK path in some of the -# variables that get used in mkmf.rb. -# This patches them up to use the correct SDK. -RbConfig::CONFIG.each do |k, v| - next unless v.include?("MacOSX.sdk") - - new_value = v.gsub("MacOSX.sdk", macos_sdk) - next unless File.exist?(new_value) - - RbConfig::CONFIG[k] = new_value -end
true
Other
Homebrew
brew
9b4a7856ac92e025e9df73ed5d18e4412fa55b5c.json
Revert "RbConfig: fix broken MacOS SDK paths" This reverts commit 11445e0f3edf29ee64081c5a05b5257d9b5ccdd9.
Library/Homebrew/utils/gems.rb
@@ -109,15 +109,6 @@ def install_bundler_gems! install_bundler! ENV["BUNDLE_GEMFILE"] = File.join(ENV.fetch("HOMEBREW_LIBRARY"), "Homebrew", "Gemfile") - - # We can't use OS.mac? because not enough has - # been required yet this early in the boot process - if ENV["HOMEBREW_SYSTEM"] == "Macintosh" - # This patches up some paths used by mkmf.rb - extend_path = File.join(ENV.fetch("HOMEBREW_LIBRARY"), "Homebrew", "extend") - ENV["RUBYOPT"] = "-r#{extend_path}/rbconfig_extension" - end - @bundle_installed ||= begin bundle = File.join(find_in_path("bundle"), "bundle") bundle_check_output = `#{bundle} check 2>&1` @@ -135,8 +126,6 @@ def install_bundler_gems! end end - ENV["RUBYOPT"] = "" - setup_gem_environment! end end
true
Other
Homebrew
brew
16270ba185e889cfb92265301b34061a123692d4.json
software_spec: add on_macos/on_linux to SoftwareSpec
Library/Homebrew/software_spec.rb
@@ -12,11 +12,13 @@ require "compilers" require "global" require "os/mac/version" +require "extend/on_os" class SoftwareSpec extend T::Sig extend Forwardable + include OnOS PREDEFINED_OPTIONS = { universal: Option.new("universal", "Build a universal binary"),
false
Other
Homebrew
brew
509ab86ece78723efdca37fec286faf9c8ee896c.json
software_spec: add on_macos/on_linux to PourBottleCheck
Library/Homebrew/software_spec.rb
@@ -12,6 +12,7 @@ require "compilers" require "global" require "os/mac/version" +require "extend/on_os" class SoftwareSpec extend T::Sig @@ -408,6 +409,8 @@ def checksums end class PourBottleCheck + include OnOS + def initialize(formula) @formula = formula end
false
Other
Homebrew
brew
c8a8b797306237404e6670dfd3cabe1edcf0639d.json
add path name to brew edit error message
Library/Homebrew/dev-cmd/edit.rb
@@ -46,7 +46,8 @@ def edit next path if path.exist? raise UsageError, "#{path} doesn't exist on disk. " \ - "Run #{Formatter.identifier("brew create $URL")} to create a new Formula!" + "Run #{Formatter.identifier("brew create --set-name #{path.basename} $URL")} " \ + "to create a new Formula!" end.presence # If no brews are listed, open the project root in an editor.
false
Other
Homebrew
brew
3f10815f4f85e6279c9f739e6d3984855deb03d3.json
os/mac/pkgconfig: add pc files for Big Sur 11.1
Library/Homebrew/os/mac/pkgconfig/11.1/expat.pc
@@ -0,0 +1,12 @@ +homebrew_sdkroot=/Library/Developer/CommandLineTools/SDKs/MacOSX11.1.sdk +prefix=${homebrew_sdkroot}/usr +exec_prefix=/usr +libdir=${exec_prefix}/lib +includedir=${prefix}/include + +Name: expat +Version: 2.2.8 +Description: expat XML parser +URL: http://www.libexpat.org +Libs: -L${libdir} -lexpat +Cflags:
true