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 | a7fe0ed8472a67362793059cf633d3030ffa11d9.json | cmd: use more and cleanup new args APIs. | Library/Homebrew/cmd/fetch.rb | @@ -39,23 +39,22 @@ def fetch_args
switch :debug
conflicts "--devel", "--HEAD"
conflicts "--build-from-source", "--build-bottle", "--force-bottle"
+ min_named :formula
end
end
def fetch
fetch_args.parse
- raise FormulaUnspecifiedError if ARGV.named.empty?
-
if args.deps?
bucket = []
- Homebrew.args.formulae.each do |f|
+ args.formulae.each do |f|
bucket << f
bucket.concat f.recursive_dependencies.map(&:to_formula)
end
bucket.uniq!
else
- bucket = Homebrew.args.formulae
+ bucket = args.formulae
end
puts "Fetching: #{bucket * ", "}" if bucket.size > 1 | true |
Other | Homebrew | brew | a7fe0ed8472a67362793059cf633d3030ffa11d9.json | cmd: use more and cleanup new args APIs. | Library/Homebrew/cmd/gist-logs.rb | @@ -142,10 +142,10 @@ def create_issue(repo, title, body)
def gist_logs
gist_logs_args.parse
- raise FormulaUnspecifiedError if Homebrew.args.resolved_formulae.length != 1
+ raise FormulaUnspecifiedError if args.resolved_formulae.length != 1
Install.perform_preinstall_checks(all_fatal: true)
Install.perform_build_from_source_checks(all_fatal: true)
- gistify_logs(Homebrew.args.resolved_formulae.first)
+ gistify_logs(args.resolved_formulae.first)
end
end | true |
Other | Homebrew | brew | a7fe0ed8472a67362793059cf633d3030ffa11d9.json | cmd: use more and cleanup new args APIs. | Library/Homebrew/cmd/home.rb | @@ -20,10 +20,10 @@ def home_args
def home
home_args.parse
- if args.remaining.empty?
+ if args.no_named?
exec_browser HOMEBREW_WWW
else
- exec_browser(*Homebrew.args.formulae.map(&:homepage))
+ exec_browser(*args.formulae.map(&:homepage))
end
end
end | true |
Other | Homebrew | brew | a7fe0ed8472a67362793059cf633d3030ffa11d9.json | cmd: use more and cleanup new args APIs. | Library/Homebrew/cmd/info.rb | @@ -67,7 +67,7 @@ def info
end
if args.category.present?
- if Homebrew.args.named.present? && !VALID_FORMULA_CATEGORIES.include?(args.category)
+ if args.named.present? && !VALID_FORMULA_CATEGORIES.include?(args.category)
raise UsageError, "--category must be one of #{VALID_FORMULA_CATEGORIES.join(", ")} when querying formulae"
end
@@ -77,31 +77,32 @@ def info
end
if args.json
- raise UsageError, "Invalid JSON version: #{args.json}" unless ["v1", true].include? args.json
- if !(args.all? || args.installed?) && Homebrew.args.named.blank?
- raise UsageError, "This command's option requires a formula argument"
+ raise UsageError, "invalid JSON version: #{args.json}" unless ["v1", true].include? args.json
+
+ if !(args.all? || args.installed?) && args.no_named?
+ raise FormulaUnspecifiedError if args.no_named?
end
print_json
elsif args.github?
- raise UsageError, "This command's option requires a formula argument" if Homebrew.args.named.blank?
+ raise FormulaUnspecifiedError if args.no_named?
- exec_browser(*Homebrew.args.formulae.map { |f| github_info(f) })
+ exec_browser(*args.formulae.map { |f| github_info(f) })
else
print_info
end
end
def print_info
- if Homebrew.args.named.blank?
+ if args.no_named?
if args.analytics?
Utils::Analytics.output
elsif HOMEBREW_CELLAR.exist?
count = Formula.racks.length
puts "#{count} #{"keg".pluralize(count)}, #{HOMEBREW_CELLAR.dup.abv}"
end
else
- Homebrew.args.named.each_with_index do |f, i|
+ args.named.each_with_index do |f, i|
puts unless i.zero?
begin
formula = if f.include?("/") || File.exist?(f)
@@ -135,7 +136,7 @@ def print_json
elsif args.installed?
Formula.installed.sort
else
- Homebrew.args.formulae
+ args.formulae
end
json = ff.map(&:to_hash)
puts JSON.generate(json) | true |
Other | Homebrew | brew | a7fe0ed8472a67362793059cf633d3030ffa11d9.json | cmd: use more and cleanup new args APIs. | Library/Homebrew/cmd/install.rb | @@ -88,22 +88,21 @@ def install_args
conflicts "--devel", "--HEAD"
conflicts "--build-from-source", "--build-bottle", "--force-bottle"
formula_options
+ min_named :formula
end
end
def install
install_args.parse
- Homebrew.args.named.each do |name|
+ args.named.each do |name|
next if File.exist?(name)
next if name !~ HOMEBREW_TAP_FORMULA_REGEX && name !~ HOMEBREW_CASK_TAP_CASK_REGEX
tap = Tap.fetch(Regexp.last_match(1), Regexp.last_match(2))
tap.install unless tap.installed?
end
- raise FormulaUnspecifiedError if args.remaining.empty?
-
if args.ignore_dependencies?
opoo <<~EOS
#{Tty.bold}--ignore-dependencies is an unsupported Homebrew developer flag!#{Tty.reset}
@@ -131,9 +130,9 @@ def install
# developer tools are available, we need to stop them early on
FormulaInstaller.prevent_build_flags unless DevelopmentTools.installed?
- Homebrew.args.formulae.each do |f|
+ args.formulae.each do |f|
# head-only without --HEAD is an error
- if !Homebrew.args.HEAD? && f.stable.nil? && f.devel.nil?
+ if !args.HEAD? && f.stable.nil? && f.devel.nil?
raise <<~EOS
#{f.full_name} is a head-only formula
Install with `brew install --HEAD #{f.full_name}` | true |
Other | Homebrew | brew | a7fe0ed8472a67362793059cf633d3030ffa11d9.json | cmd: use more and cleanup new args APIs. | Library/Homebrew/cmd/link.rb | @@ -25,20 +25,19 @@ def link_args
description: "Allow keg-only formulae to be linked."
switch :verbose
switch :debug
+ min_named :keg
end
end
def link
link_args.parse
- raise KegUnspecifiedError if ARGV.named.empty?
-
mode = OpenStruct.new
mode.overwrite = true if args.overwrite?
mode.dry_run = true if args.dry_run?
- Homebrew.args.kegs.each do |keg|
+ args.kegs.each do |keg|
keg_only = Formulary.keg_only?(keg.rack)
if keg.linked? | true |
Other | Homebrew | brew | a7fe0ed8472a67362793059cf633d3030ffa11d9.json | cmd: use more and cleanup new args APIs. | Library/Homebrew/cmd/list.rb | @@ -55,27 +55,27 @@ def list
# Unbrewed uses the PREFIX, which will exist
# Things below use the CELLAR, which doesn't until the first formula is installed.
unless HOMEBREW_CELLAR.exist?
- raise NoSuchKegError, Hombrew.args.named.first if Homebrew.args.named.present?
+ raise NoSuchKegError, Hombrew.args.named.first if args.named.present?
return
end
if args.pinned? || args.versions?
filtered_list
- elsif Homebrew.args.named.blank?
+ elsif args.no_named?
if args.full_name?
full_names = Formula.installed.map(&:full_name).sort(&tap_and_name_comparison)
return if full_names.empty?
puts Formatter.columns(full_names)
else
ENV["CLICOLOR"] = nil
- safe_system "ls", *Homebrew.args.passthrough << HOMEBREW_CELLAR
+ safe_system "ls", *args.passthrough << HOMEBREW_CELLAR
end
elsif args.verbose? || !$stdout.tty?
- system_command! "find", args: Homebrew.args.kegs.map(&:to_s) + %w[-not -type d -print], print_stdout: true
+ system_command! "find", args: args.kegs.map(&:to_s) + %w[-not -type d -print], print_stdout: true
else
- Homebrew.args.kegs.each { |keg| PrettyListing.new keg }
+ args.kegs.each { |keg| PrettyListing.new keg }
end
end
@@ -123,10 +123,10 @@ def list_unbrewed
end
def filtered_list
- names = if Homebrew.args.named.blank?
+ names = if args.no_named?
Formula.racks
else
- racks = Homebrew.args.named.map { |n| Formulary.to_rack(n) }
+ racks = args.named.map { |n| Formulary.to_rack(n) }
racks.select do |rack|
Homebrew.failed = true unless rack.exist?
rack.exist? | true |
Other | Homebrew | brew | a7fe0ed8472a67362793059cf633d3030ffa11d9.json | cmd: use more and cleanup new args APIs. | Library/Homebrew/cmd/log.rb | @@ -33,10 +33,10 @@ def log
# user path, too.
ENV["PATH"] = ENV["HOMEBREW_PATH"]
- if ARGV.named.empty?
+ if args.no_named?
git_log HOMEBREW_REPOSITORY
else
- path = Formulary.path(ARGV.named.first)
+ path = Formulary.path(args.named.first)
tap = Tap.from_path(path)
git_log path.dirname, path, tap
end
@@ -62,8 +62,8 @@ def git_log(cd_dir, path = nil, tap = nil)
git -C "#{git_cd}" fetch --unshallow
EOS
end
- args = Homebrew.args.options_only
- args += ["--follow", "--", path] unless path.nil?
- system "git", "log", *args
+ system_args = args.options_only
+ system_args += ["--follow", "--", path] if path.present?
+ system "git", "log", *system_args
end
end | true |
Other | Homebrew | brew | a7fe0ed8472a67362793059cf633d3030ffa11d9.json | cmd: use more and cleanup new args APIs. | Library/Homebrew/cmd/migrate.rb | @@ -19,15 +19,14 @@ def migrate_args
"the same taps and migrate them anyway."
switch :verbose
switch :debug
+ min_named :formula
end
end
def migrate
migrate_args.parse
- raise FormulaUnspecifiedError if Homebrew.args.named.blank?
-
- Homebrew.args.resolved_formulae.each do |f|
+ args.resolved_formulae.each do |f|
if f.oldname
unless (rack = HOMEBREW_CELLAR/f.oldname).exist? && !rack.subdirs.empty?
raise NoSuchKegError, f.oldname | true |
Other | Homebrew | brew | a7fe0ed8472a67362793059cf633d3030ffa11d9.json | cmd: use more and cleanup new args APIs. | Library/Homebrew/cmd/missing.rb | @@ -30,10 +30,10 @@ def missing
return unless HOMEBREW_CELLAR.exist?
- ff = if Homebrew.args.named.blank?
+ ff = if args.no_named?
Formula.installed.sort
else
- Homebrew.args.resolved_formulae.sort
+ args.resolved_formulae.sort
end
ff.each do |f| | true |
Other | Homebrew | brew | a7fe0ed8472a67362793059cf633d3030ffa11d9.json | cmd: use more and cleanup new args APIs. | Library/Homebrew/cmd/options.rb | @@ -32,10 +32,10 @@ def options
puts_options Formula.to_a.sort
elsif args.installed?
puts_options Formula.installed.sort
+ elsif args.no_named?
+ raise FormulaUnspecifiedError
else
- raise FormulaUnspecifiedError if args.remaining.empty?
-
- puts_options Homebrew.args.formulae
+ puts_options args.formulae
end
end
| true |
Other | Homebrew | brew | a7fe0ed8472a67362793059cf633d3030ffa11d9.json | cmd: use more and cleanup new args APIs. | Library/Homebrew/cmd/outdated.rb | @@ -35,19 +35,19 @@ def outdated_args
def outdated
outdated_args.parse
- formulae = if Homebrew.args.resolved_formulae.blank?
+ formulae = if args.resolved_formulae.blank?
Formula.installed
else
- Homebrew.args.resolved_formulae
+ args.resolved_formulae
end
if args.json
- raise UsageError, "Invalid JSON version: #{args.json}" unless ["v1", true].include? args.json
+ raise UsageError, "invalid JSON version: #{args.json}" unless ["v1", true].include? args.json
outdated = print_outdated_json(formulae)
else
outdated = print_outdated(formulae)
end
- Homebrew.failed = Homebrew.args.resolved_formulae.present? && !outdated.empty?
+ Homebrew.failed = args.resolved_formulae.present? && !outdated.empty?
end
def print_outdated(formulae) | true |
Other | Homebrew | brew | a7fe0ed8472a67362793059cf633d3030ffa11d9.json | cmd: use more and cleanup new args APIs. | Library/Homebrew/cmd/pin.rb | @@ -15,15 +15,14 @@ def pin_args
issuing the `brew upgrade` <formula> command. See also `unpin`.
EOS
switch :debug
+ min_named :formula
end
end
def pin
pin_args.parse
- raise FormulaUnspecifiedError if args.remaining.empty?
-
- Homebrew.args.resolved_formulae.each do |f|
+ args.resolved_formulae.each do |f|
if f.pinned?
opoo "#{f.name} already pinned"
elsif !f.pinnable? | true |
Other | Homebrew | brew | a7fe0ed8472a67362793059cf633d3030ffa11d9.json | cmd: use more and cleanup new args APIs. | Library/Homebrew/cmd/postinstall.rb | @@ -17,15 +17,14 @@ def postinstall_args
switch :force
switch :verbose
switch :debug
+ min_named :keg
end
end
def postinstall
postinstall_args.parse
- raise KegUnspecifiedError if args.remaining.empty?
-
- Homebrew.args.resolved_formulae.each do |f|
+ args.resolved_formulae.each do |f|
ohai "Postinstalling #{f}"
fi = FormulaInstaller.new(f)
fi.post_install | true |
Other | Homebrew | brew | a7fe0ed8472a67362793059cf633d3030ffa11d9.json | cmd: use more and cleanup new args APIs. | Library/Homebrew/cmd/readall.rb | @@ -36,10 +36,10 @@ def readall
end
options = { aliases: args.aliases? }
- taps = if ARGV.named.empty?
+ taps = if args.no_named?
Tap
else
- ARGV.named.map { |t| Tap.fetch(t) }
+ args.named.map { |t| Tap.fetch(t) }
end
taps.each do |tap|
Homebrew.failed = true unless Readall.valid_tap?(tap, options) | true |
Other | Homebrew | brew | a7fe0ed8472a67362793059cf633d3030ffa11d9.json | cmd: use more and cleanup new args APIs. | Library/Homebrew/cmd/reinstall.rb | @@ -45,19 +45,18 @@ def reinstall_args
description: "Print install times for each formula at the end of the run."
conflicts "--build-from-source", "--force-bottle"
formula_options
+ min_named :formula
end
end
def reinstall
reinstall_args.parse
- raise FormulaUnspecifiedError if args.remaining.empty?
-
FormulaInstaller.prevent_build_flags unless DevelopmentTools.installed?
Install.perform_preinstall_checks
- Homebrew.args.resolved_formulae.each do |f|
+ args.resolved_formulae.each do |f|
if f.pinned?
onoe "#{f.full_name} is pinned. You must unpin it to reinstall."
next | true |
Other | Homebrew | brew | a7fe0ed8472a67362793059cf633d3030ffa11d9.json | cmd: use more and cleanup new args APIs. | Library/Homebrew/cmd/search.rb | @@ -62,13 +62,13 @@ def search
if package_manager = PACKAGE_MANAGERS.find { |name,| args[:"#{name}?"] }
_, url = package_manager
- exec_browser url.call(URI.encode_www_form_component(args.remaining.join(" ")))
+ exec_browser url.call(URI.encode_www_form_component(args.named.join(" ")))
return
end
- if args.remaining.empty?
+ if args.no_named?
if args.casks?
- raise UsageError, "specifying both --formulae and --casks requires an argument!" if args.formulae?
+ raise UsageError, "specifying both --formulae and --casks requires <text>" if args.formulae?
puts Formatter.columns(Cask::Cask.to_a.map(&:full_name).sort)
else
@@ -78,7 +78,7 @@ def search
return
end
- query = args.remaining.join(" ")
+ query = args.named.join(" ")
string_or_regex = query_regexp(query)
if args.desc?
@@ -125,11 +125,11 @@ def search
end
return unless $stdout.tty?
- return if args.remaining.empty?
+ return if args.no_named?
metacharacters = %w[\\ | ( ) [ ] { } ^ $ * + ?].freeze
return unless metacharacters.any? do |char|
- args.remaining.any? do |arg|
+ args.named.any? do |arg|
arg.include?(char) && !arg.start_with?("/")
end
end | true |
Other | Homebrew | brew | a7fe0ed8472a67362793059cf633d3030ffa11d9.json | cmd: use more and cleanup new args APIs. | Library/Homebrew/cmd/style.rb | @@ -38,14 +38,14 @@ def style_args
def style
style_args.parse
- target = if Homebrew.args.named.blank?
+ target = if args.no_named?
nil
- elsif Homebrew.args.named.any? { |file| File.exist? file }
- Homebrew.args.named
- elsif Homebrew.args.named.any? { |tap| tap.count("/") == 1 }
- Homebrew.args.named.map { |tap| Tap.fetch(tap).path }
+ elsif args.named.any? { |file| File.exist? file }
+ args.named
+ elsif args.named.any? { |tap| tap.count("/") == 1 }
+ args.named.map { |tap| Tap.fetch(tap).path }
else
- Homebrew.args.formulae.map(&:path)
+ args.formulae.map(&:path)
end
only_cops = args.only_cops | true |
Other | Homebrew | brew | a7fe0ed8472a67362793059cf633d3030ffa11d9.json | cmd: use more and cleanup new args APIs. | Library/Homebrew/cmd/switch.rb | @@ -16,16 +16,14 @@ def switch_args
EOS
switch :verbose
switch :debug
- max_named 2
+ named 2
end
end
def switch
switch_args.parse
- raise FormulaUnspecifiedError if args.remaining.empty?
-
- name = args.remaining.first
+ name = args.named.first
rack = Formulary.to_rack(name)
odie "#{name} not found in the Cellar." unless rack.directory?
@@ -34,8 +32,7 @@ def switch
.map { |d| Keg.new(d).version }
.sort
.join(", ")
- version = args.remaining.second
- raise UsageError, "Specify one of #{name}'s installed versions: #{versions}" unless version
+ version = args.named.second
odie <<~EOS unless (rack/version).directory?
#{name} does not have a version \"#{version}\" in the Cellar. | true |
Other | Homebrew | brew | a7fe0ed8472a67362793059cf633d3030ffa11d9.json | cmd: use more and cleanup new args APIs. | Library/Homebrew/cmd/tap-info.rb | @@ -30,13 +30,13 @@ def tap_info
if args.installed?
taps = Tap
else
- taps = Homebrew.args.named.sort.map do |name|
+ taps = args.named.sort.map do |name|
Tap.fetch(name)
end
end
if args.json
- raise UsageError, "Invalid JSON version: #{args.json}" unless ["v1", true].include? args.json
+ raise UsageError, "invalid JSON version: #{args.json}" unless ["v1", true].include? args.json
print_tap_json(taps.sort_by(&:to_s))
else | true |
Other | Homebrew | brew | a7fe0ed8472a67362793059cf633d3030ffa11d9.json | cmd: use more and cleanup new args APIs. | Library/Homebrew/cmd/tap.rb | @@ -48,14 +48,14 @@ def tap
Tap.each(&:link_completions_and_manpages)
elsif args.list_pinned?
puts Tap.select(&:pinned?).map(&:name)
- elsif ARGV.named.empty?
+ elsif args.no_named?
puts Tap.names
else
- tap = Tap.fetch(ARGV.named.first)
+ tap = Tap.fetch(args.named.first)
begin
- tap.install clone_target: ARGV.named.second,
+ tap.install clone_target: args.named.second,
force_auto_update: force_auto_update?,
- quiet: Homebrew.args.quiet?
+ quiet: args.quiet?
rescue TapRemoteMismatchError => e
odie e
rescue TapAlreadyTappedError | true |
Other | Homebrew | brew | a7fe0ed8472a67362793059cf633d3030ffa11d9.json | cmd: use more and cleanup new args APIs. | Library/Homebrew/cmd/uninstall.rb | @@ -22,23 +22,22 @@ def uninstall_args
description: "Don't fail uninstall, even if <formula> is a dependency of any installed "\
"formulae."
switch :debug
+ min_named :formula
end
end
def uninstall
uninstall_args.parse
- raise KegUnspecifiedError if args.remaining.empty?
-
kegs_by_rack = if args.force?
- Hash[ARGV.named.map do |name|
+ Hash[args.named.map do |name|
rack = Formulary.to_rack(name)
next unless rack.directory?
[rack, rack.subdirs.map { |d| Keg.new(d) }]
end]
else
- Homebrew.args.kegs.group_by(&:rack)
+ args.kegs.group_by(&:rack)
end
handle_unsatisfied_dependents(kegs_by_rack)
@@ -131,7 +130,7 @@ def initialize(requireds, dependents)
protected
def sample_command
- "brew uninstall --ignore-dependencies #{ARGV.named.join(" ")}"
+ "brew uninstall --ignore-dependencies #{Homebrew.args.named.join(" ")}"
end
def are_required_by_deps | true |
Other | Homebrew | brew | a7fe0ed8472a67362793059cf633d3030ffa11d9.json | cmd: use more and cleanup new args APIs. | Library/Homebrew/cmd/unlink.rb | @@ -20,18 +20,17 @@ def unlink_args
"deleting any files."
switch :verbose
switch :debug
+ min_named :keg
end
end
def unlink
unlink_args.parse
- raise KegUnspecifiedError if args.remaining.empty?
-
mode = OpenStruct.new
mode.dry_run = true if args.dry_run?
- Homebrew.args.kegs.each do |keg|
+ args.kegs.each do |keg|
if mode.dry_run
puts "Would remove:"
keg.unlink(mode) | true |
Other | Homebrew | brew | a7fe0ed8472a67362793059cf633d3030ffa11d9.json | cmd: use more and cleanup new args APIs. | Library/Homebrew/cmd/unpack.rb | @@ -32,7 +32,7 @@ def unpack_args
def unpack
unpack_args.parse
- formulae = Homebrew.args.formulae
+ formulae = args.formulae
raise FormulaUnspecifiedError if formulae.empty?
if dir = args.destdir | true |
Other | Homebrew | brew | a7fe0ed8472a67362793059cf633d3030ffa11d9.json | cmd: use more and cleanup new args APIs. | Library/Homebrew/cmd/unpin.rb | @@ -22,9 +22,9 @@ def unpin_args
def unpin
unpin_args.parse
- raise FormulaUnspecifiedError if args.remaining.empty?
+ raise FormulaUnspecifiedError if args.no_named?
- Homebrew.args.resolved_formulae.each do |f|
+ args.resolved_formulae.each do |f|
if f.pinned?
f.unpin
elsif !f.pinnable? | true |
Other | Homebrew | brew | a7fe0ed8472a67362793059cf633d3030ffa11d9.json | cmd: use more and cleanup new args APIs. | Library/Homebrew/cmd/untap.rb | @@ -13,15 +13,14 @@ def untap_args
Remove a tapped formula repository.
EOS
switch :debug
+ min_named 1
end
end
def untap
untap_args.parse
- raise UsageError, "This command requires a tap argument from `brew tap`'s list" if args.remaining.empty?
-
- ARGV.named.each do |tapname|
+ args.named.each do |tapname|
tap = Tap.fetch(tapname)
odie "Untapping #{tap} is not allowed" if tap.core_tap?
| true |
Other | Homebrew | brew | a7fe0ed8472a67362793059cf633d3030ffa11d9.json | cmd: use more and cleanup new args APIs. | Library/Homebrew/cmd/update-report.rb | @@ -13,7 +13,7 @@ module Homebrew
def update_preinstall_header
@update_preinstall_header ||= begin
- ohai "Auto-updated Homebrew!" if ARGV.include?("--preinstall")
+ ohai "Auto-updated Homebrew!" if args.preinstall?
true
end
end
@@ -109,7 +109,7 @@ def update_report
end
if !updated
- puts "Already up-to-date." if !ARGV.include?("--preinstall") && !ENV["HOMEBREW_UPDATE_FAILED"]
+ puts "Already up-to-date." if !args.preinstall? && !ENV["HOMEBREW_UPDATE_FAILED"]
else
if hub.empty?
puts "No changes to formulae."
@@ -122,7 +122,7 @@ def update_report
.update_from_report!(hub)
end
end
- puts if ARGV.include?("--preinstall")
+ puts if args.preinstall?
end
link_completions_manpages_and_docs | true |
Other | Homebrew | brew | a7fe0ed8472a67362793059cf633d3030ffa11d9.json | cmd: use more and cleanup new args APIs. | Library/Homebrew/cmd/upgrade.rb | @@ -65,18 +65,18 @@ def upgrade
Install.perform_preinstall_checks
- if Homebrew.args.named.blank?
+ if args.no_named?
outdated = Formula.installed.select do |f|
f.outdated?(fetch_head: args.fetch_HEAD?)
end
exit 0 if outdated.empty?
else
- outdated = Homebrew.args.resolved_formulae.select do |f|
+ outdated = args.resolved_formulae.select do |f|
f.outdated?(fetch_head: args.fetch_HEAD?)
end
- (Homebrew.args.resolved_formulae - outdated).each do |f|
+ (args.resolved_formulae - outdated).each do |f|
versions = f.installed_kegs.map(&:version)
if versions.empty?
ofail "#{f.full_specified_name} not installed"
@@ -168,15 +168,15 @@ def upgrade_formula(f)
tab = Tab.for_keg(keg)
end
- build_options = BuildOptions.new(Options.create(Homebrew.args.flags_only), f.options)
+ build_options = BuildOptions.new(Options.create(args.flags_only), f.options)
options = build_options.used_options
options |= f.build.used_options
options &= f.options
fi = FormulaInstaller.new(f)
fi.options = options
fi.build_bottle = args.build_bottle?
- fi.installed_on_request = Homebrew.args.named.present?
+ fi.installed_on_request = args.named.present?
fi.link_keg ||= keg_was_linked if keg_had_linked_opt
if tab
fi.build_bottle ||= tab.built_bottle? | true |
Other | Homebrew | brew | a7fe0ed8472a67362793059cf633d3030ffa11d9.json | cmd: use more and cleanup new args APIs. | Library/Homebrew/cmd/uses.rb | @@ -38,24 +38,23 @@ def uses_args
description: "Show usage of <formula> by HEAD builds."
switch :debug
conflicts "--devel", "--HEAD"
+ min_named :formula
end
end
def uses
uses_args.parse
- raise FormulaUnspecifiedError if args.remaining.empty?
-
Formulary.enable_factory_cache!
used_formulae_missing = false
used_formulae = begin
- Homebrew.args.formulae
+ args.formulae
rescue FormulaUnavailableError => e
opoo e
used_formulae_missing = true
# If the formula doesn't exist: fake the needed formula object name.
- Homebrew.args.named.map { |name| OpenStruct.new name: name, full_name: name }
+ args.named.map { |name| OpenStruct.new name: name, full_name: name }
end
use_runtime_dependents = args.installed? && | true |
Other | Homebrew | brew | d6a8ff752f5df73e28f4252fc1539cb6f69bd486.json | docs/Homebrew-on-Linux.md: Use the bash installer | docs/Homebrew-on-Linux.md | @@ -23,7 +23,7 @@ The Homebrew package manager may be used on Linux and [Windows Subsystem for Lin
Paste at a terminal prompt:
```sh
-sh -c "$(curl -fsSL https://raw.githubusercontent.com/Linuxbrew/install/master/install.sh)"
+/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
```
The installation script installs Homebrew to `/home/linuxbrew/.linuxbrew` using *sudo* if possible and in your home directory at `~/.linuxbrew` otherwise. Homebrew does not use *sudo* after installation. Using `/home/linuxbrew/.linuxbrew` allows the use of more binary packages (bottles) than installing in your personal home directory. | false |
Other | Homebrew | brew | 7ccec0cdf0d521471d185b6a48bb3678cb536aaf.json | Use literal "python" | Library/Homebrew/language/python.rb | @@ -227,7 +227,7 @@ def create
Pathname.glob(@venv_root/"lib/python*/orig-prefix.txt").each do |prefix_file|
prefix_path = prefix_file.read
- prefix_path.sub! %r{^#{HOMEBREW_CELLAR}/#{python}/[^/]+}, Formula["python"].opt_prefix
+ prefix_path.sub! %r{^#{HOMEBREW_CELLAR}/python/[^/]+}, Formula["python"].opt_prefix
prefix_file.atomic_write prefix_path
end
end | false |
Other | Homebrew | brew | b4b17fa892404a67049f72ea0408ee7998117004.json | keg: handle more exceptions on uninstall.
Fixes https://github.com/Homebrew/brew/issues/7110 | Library/Homebrew/keg.rb | @@ -135,7 +135,7 @@ def self.find_some_installed_dependents(kegs)
f = keg.to_formula
keg_formulae << f
[f.name, f.tap]
- rescue FormulaUnavailableError
+ rescue
# If the formula for the keg can't be found,
# fall back to the information in the tab.
[keg.name, keg.tab.tap]
@@ -257,8 +257,7 @@ def remove_old_aliases
tap = begin
to_formula.tap
- rescue FormulaUnavailableError, TapFormulaAmbiguityError,
- TapFormulaWithOldnameAmbiguityError
+ rescue
# If the formula can't be found, just ignore aliases for now.
nil
end | false |
Other | Homebrew | brew | f9481d4d35ca03706fe0d1885e5c83b89e89966e.json | python: Fix error in virtualenv_install_with_resources
Fixes #7115. | Library/Homebrew/language/python.rb | @@ -172,6 +172,7 @@ def virtualenv_install_with_resources(options = {})
wanted = pythons.select { |py| needs_python?(py) }
raise FormulaAmbiguousPythonError, self if wanted.size > 1
+ python = wanted.first
python = "python3" if python == "python"
end
venv = virtualenv_create(libexec, python.delete("@")) | false |
Other | Homebrew | brew | 67d012afccc1bb19b91e29bbd99b699579d6d0b3.json | search: add separate flag for formulae | Library/Homebrew/cmd/search.rb | @@ -36,6 +36,9 @@ def search_args
If no <text> is provided, list all locally available formulae (including tapped ones).
No online search is performed.
EOS
+ switch "--formulae",
+ description: "List all locally available formulae. "\
+ "No online search is performed."
switch "--casks",
description: "List all locally available casks (including tapped ones). "\
"No online search is performed."
@@ -65,6 +68,8 @@ def search
if args.remaining.empty?
if args.casks?
+ raise UsageError, "Cannot specify --formulae and --casks without an argument!" if args.formulae?
+
puts Formatter.columns(Cask::Cask.to_a.map(&:full_name).sort)
else
puts Formatter.columns(Formula.full_names.sort)
@@ -88,14 +93,17 @@ def search
local_casks = search_casks(string_or_regex)
remote_casks = remote_results[:casks]
all_casks = local_casks + remote_casks
+ print_formulae = args.formulae?
+ print_casks = args.casks?
+ print_formulae = print_casks = true if !print_formulae && !print_casks
- if all_formulae.any?
+ if print_formulae && all_formulae.any?
ohai "Formulae"
puts Formatter.columns(all_formulae)
end
- if all_casks.any?
- puts if all_formulae.any?
+ if print_casks && all_casks.any?
+ puts if args.formulae? && all_formulae.any?
ohai "Casks"
puts Formatter.columns(all_casks)
end | true |
Other | Homebrew | brew | 67d012afccc1bb19b91e29bbd99b699579d6d0b3.json | search: add separate flag for formulae | docs/Manpage.md | @@ -425,6 +425,8 @@ search for *`text`* is extended online to `homebrew/core` and `homebrew/cask`.
If no *`text`* is provided, list all locally available formulae (including tapped
ones). No online search is performed.
+* `--formulae`:
+ List all locally available formulae. No online search is performed.
* `--casks`:
List all locally available casks (including tapped ones). No online search is performed.
* `--desc`: | true |
Other | Homebrew | brew | 67d012afccc1bb19b91e29bbd99b699579d6d0b3.json | search: add separate flag for formulae | manpages/brew-cask.1 | @@ -1,7 +1,7 @@
.\" generated with Ronn/v0.7.3
.\" http://github.com/rtomayko/ronn/tree/0.7.3
.
-.TH "BREW\-CASK" "1" "February 2020" "Homebrew" "brew-cask"
+.TH "BREW\-CASK" "1" "March 2020" "Homebrew" "brew-cask"
.
.SH "NAME"
\fBbrew\-cask\fR \- a friendly binary installer for macOS | true |
Other | Homebrew | brew | 67d012afccc1bb19b91e29bbd99b699579d6d0b3.json | search: add separate flag for formulae | manpages/brew.1 | @@ -1,7 +1,7 @@
.\" generated with Ronn/v0.7.3
.\" http://github.com/rtomayko/ronn/tree/0.7.3
.
-.TH "BREW" "1" "February 2020" "Homebrew" "brew"
+.TH "BREW" "1" "March 2020" "Homebrew" "brew"
.
.SH "NAME"
\fBbrew\fR \- The Missing Package Manager for macOS
@@ -548,6 +548,10 @@ Perform a substring search of cask tokens and formula names for \fItext\fR\. If
If no \fItext\fR is provided, list all locally available formulae (including tapped ones)\. No online search is performed\.
.
.TP
+\fB\-\-formulae\fR
+List all locally available formulae\. No online search is performed\.
+.
+.TP
\fB\-\-casks\fR
List all locally available casks (including tapped ones)\. No online search is performed\.
. | true |
Other | Homebrew | brew | 2f141c771a1a0d698c3ef0553ceb7e6a2317ef0a.json | workflows/tests: add missing newline. | .github/workflows/tests.yml | @@ -13,6 +13,7 @@ jobs:
steps:
- name: Set up Git repository
uses: actions/checkout@v1
+
- name: Set up Homebrew PATH
run: |
if [ "$RUNNER_OS" = "macOS" ]; then | false |
Other | Homebrew | brew | 5277f849d9dc30c8beac490fe163f3cb7ac7dba1.json | API: supply additional data for requirements | Library/Homebrew/formula.rb | @@ -1690,10 +1690,13 @@ def to_hash
end
hsh["requirements"] = requirements.map do |req|
+ req.name.prepend("maximum_") if req.try(:comparator) == "<="
{
"name" => req.name,
"cask" => req.cask,
"download" => req.download,
+ "version" => req.try(:version),
+ "contexts" => req.tags,
}
end
| true |
Other | Homebrew | brew | 5277f849d9dc30c8beac490fe163f3cb7ac7dba1.json | API: supply additional data for requirements | Library/Homebrew/requirements/java_requirement.rb | @@ -3,10 +3,10 @@
require "language/java"
class JavaRequirement < Requirement
- attr_reader :java_home
-
fatal true
+ attr_reader :java_home, :version
+
# A strict Java 8 requirement (1.8) should prompt the user to install
# an OpenJDK 1.8 distribution. Versions newer than Java 8 are not
# completely backwards compatible, and contain breaking changes such as | true |
Other | Homebrew | brew | 5277f849d9dc30c8beac490fe163f3cb7ac7dba1.json | API: supply additional data for requirements | Library/Homebrew/requirements/macos_requirement.rb | @@ -5,6 +5,8 @@
class MacOSRequirement < Requirement
fatal true
+ attr_reader :comparator, :version
+
def initialize(tags = [], comparator: ">=")
if comparator == "==" && tags.first.respond_to?(:map)
@version = tags.shift.map { |s| MacOS::Version.from_symbol(s) }
@@ -54,6 +56,10 @@ def message(type: :formula)
end
end
+ def inspect
+ "#<#{self.class.name}: #{tags.inspect} version#{@comparator}#{@version}>"
+ end
+
def display_s
return "macOS is required" unless version_specified?
| true |
Other | Homebrew | brew | 5277f849d9dc30c8beac490fe163f3cb7ac7dba1.json | API: supply additional data for requirements | Library/Homebrew/requirements/xcode_requirement.rb | @@ -5,6 +5,8 @@
class XcodeRequirement < Requirement
fatal true
+ attr_reader :version
+
satisfy(build_env: false) { xcode_installed_version }
def initialize(tags = []) | true |
Other | Homebrew | brew | 352774e80f9663fd6562bff6e7f5426dd5609d0c.json | Add deleted casks to report dump.
Co-Authored-By: Mike McQuaid <mike@mikemcquaid.com> | Library/Homebrew/cmd/update-report.rb | @@ -426,6 +426,7 @@ def dump
dump_formula_report :R, "Renamed Formulae"
dump_formula_report :D, "Deleted Formulae"
dump_formula_report :MC, "Updated Casks"
+ dump_formula_report :DC, "Deleted Casks"
end
private | false |
Other | Homebrew | brew | 943beaec1ed6cbe551db9336a9e8d0c2f87448b5.json | Versions docs: Add note on unstable versions | docs/Versions.md | @@ -9,6 +9,7 @@ Versioned formulae we include in [homebrew/core](https://github.com/homebrew/hom
* Versioned software should build on all Homebrew's supported versions of macOS.
* Versioned formulae should differ in major/minor (not patch) versions from the current stable release. This is because patch versions indicate bug or security updates and we want to ensure you apply security updates.
+* Unstable versions (alpha, beta, development versions) are not acceptable, not even for versioned formulae.
* Upstream should have a release branch for the versioned formulae version and still make security updates for that version, when necessary. For example, [PHP 5.5 was not a supported version but PHP 7.2 was](https://php.net/supported-versions.php) in January 2018.
* Formulae that depend on versioned formulae must not depend on the same formulae at two different versions twice in their recursive dependencies. For example, if you depend on `openssl@1.0` and `foo`, and `foo` depends on `openssl` then you must instead use `openssl`.
* Versioned formulae should only be linkable at the same time as their non-versioned counterpart if the upstream project provides support for it, e.g. using suffixed binaries. If this is not possible, use `keg_only :versioned_formula` to allow users to have multiple versions installed at once. | false |
Other | Homebrew | brew | 79a3d3568b5f5880947d7f857fbe9630b55cc492.json | python: add rewrite function for generic shebangs
From PEP 394
https://www.python.org/dev/peps/pep-0394/#for-python-script-publishers
In cases where the script is expected to be executed outside virtual environments,
developers will need to be aware of the following discrepancies across platforms and installation methods:
Older Linux distributions will provide a python command that refers to Python 2, and will likely not provide a python2 command.
Some newer Linux distributions will provide a python command that refers to Python 3.
Some Linux distributions will not provide a python command at all by default, but will provide a python3 command by default.
When potentially targeting these environments, developers may either use a Python package installation tool that rewrites shebang lines
for the installed environment, provide instructions on updating shebang lines interactively,
or else use more specific shebang lines that are tailored to the target environment. | Library/Homebrew/language/python.rb | @@ -88,6 +88,17 @@ def self.setup_install_args(prefix)
]
end
+ def self.rewrite_python_shebang(python_path)
+ Pathname(".").find do |f|
+ regex = %r{^#! ?/usr/bin/(env )?python([23](\.\d{1,2})?)$}
+ maximum_regex_length = "#! /usr/bin/env pythonx.yyy$".length
+ next unless f.file?
+ next unless regex.match?(f.read(maximum_regex_length))
+
+ Utils::Inreplace.inreplace f.to_s, regex, "#!#{python_path}"
+ end
+ end
+
# Mixin module for {Formula} adding virtualenv support features.
module Virtualenv
def self.included(base) | false |
Other | Homebrew | brew | b80af7837aea59188b9fffc7944dd0c2ecc93a42.json | bump-formula-pr: add missing URL escapes | Library/Homebrew/dev-cmd/bump-formula-pr.rb | @@ -282,12 +282,12 @@ def bump_formula_pr
]
elsif new_mirrors
replacement_pairs << [
- /^( +)(mirror \"#{new_mirrors.last}\"\n)/m,
+ /^( +)(mirror \"#{Regexp.escape(new_mirrors.last)}\"\n)/m,
"\\1\\2\\1version \"#{forced_version}\"\n",
]
else
replacement_pairs << [
- /^( +)(url \"#{new_url}\"\n)/m,
+ /^( +)(url \"#{Regexp.escape(new_url)}\"\n)/m,
"\\1\\2\\1version \"#{forced_version}\"\n",
]
end | false |
Other | Homebrew | brew | aac200a53db859ab1aa12284627eacc6f3e92cf0.json | node: detect root via Process.uid | Library/Homebrew/language/node.rb | @@ -50,7 +50,7 @@ def self.std_npm_install_args(libexec)
#{Dir.pwd}/#{pack}
]
- args << "--unsafe-perm" if ENV["USER"] == "root"
+ args << "--unsafe-perm" if Process.uid.zero?
args
end | false |
Other | Homebrew | brew | 79a1500f2b7416cac9da55f02e8ba1d09e66404f.json | node: add --unsafe-perm to std_args only if run as root | Library/Homebrew/language/node.rb | @@ -41,15 +41,18 @@ def self.std_npm_install_args(libexec)
pack = pack_for_installation
# npm install args for global style module format installed into libexec
- %W[
+ args = %W[
-ddd
--global
- --unsafe-perm
--build-from-source
--#{npm_cache_config}
--prefix=#{libexec}
#{Dir.pwd}/#{pack}
]
+
+ args << "--unsafe-perm" if ENV["USER"] == "root"
+
+ args
end
def self.local_npm_install_args | false |
Other | Homebrew | brew | 6874c79375176897b86215c410808fdacb034a51.json | node: add --unsafe-perm to std_args | Library/Homebrew/language/node.rb | @@ -44,6 +44,7 @@ def self.std_npm_install_args(libexec)
%W[
-ddd
--global
+ --unsafe-perm
--build-from-source
--#{npm_cache_config}
--prefix=#{libexec} | false |
Other | Homebrew | brew | 11ebc27e0a1659ce23993bfa6a96470fcc76f477.json | version: parse tag if detecting version | Library/Homebrew/test/version_spec.rb | @@ -684,10 +684,15 @@
.to be_detected_from("https://php.net/get/php-7.1.10.tar.gz/from/this/mirror")
end
- specify "from URL" do
+ specify "from tag" do
expect(described_class.create("1.2.3"))
.to be_detected_from("https://github.com/foo/bar.git", tag: "v1.2.3")
end
+
+ specify "beta from tag" do
+ expect(described_class.create("1.2.3-beta1"))
+ .to be_detected_from("https://github.com/foo/bar.git", tag: "v1.2.3-beta1")
+ end
end
end
| true |
Other | Homebrew | brew | 11ebc27e0a1659ce23993bfa6a96470fcc76f477.json | version: parse tag if detecting version | Library/Homebrew/version.rb | @@ -201,7 +201,7 @@ def detected_from_url?
def self.detect(url, specs)
if specs.key?(:tag)
- FromURL.new(specs[:tag][/((?:\d+\.)*\d+)/, 1])
+ FromURL.parse(specs[:tag])
else
FromURL.parse(url)
end | true |
Other | Homebrew | brew | 00aa4b7a0bb5358dfc55107231b979407ba7140c.json | Apply suggestions from code review
Co-Authored-By: Bo Anderson <mail@boanderson.me> | Library/Homebrew/cmd/upgrade.rb | @@ -187,7 +187,6 @@ def upgrade_formula(f)
upgrade_version = if f.optlinked?
"#{Keg.new(f.opt_prefix).version} -> #{f.pkg_version}"
- " #{f.pkg_version} #{fi.options.to_a.join " "}"
else
"-> #{f.pkg_version}"
end | false |
Other | Homebrew | brew | 4bde62b651a3d08543f54660871cafb0ae8c0da7.json | Apply suggestions from code review
Co-Authored-By: Mike McQuaid <mike@mikemcquaid.com> | Library/Homebrew/cmd/upgrade.rb | @@ -185,12 +185,13 @@ def upgrade_formula(f)
end
fi.prelude
- if f.optlinked?
- oh1 "Upgrading #{Formatter.identifier(f.full_specified_name)} #{Keg.new(f.opt_prefix).version} ->"\
+ upgrade_version = if f.optlinked?
+ "#{Keg.new(f.opt_prefix).version} -> #{f.pkg_version}"
" #{f.pkg_version} #{fi.options.to_a.join " "}"
else
- oh1 "Upgrading #{Formatter.identifier(f.full_specified_name)} -> #{f.pkg_version} #{fi.options.to_a.join " "}"
+ "-> #{f.pkg_version}"
end
+ oh1 "Upgrading #{Formatter.identifier(f.full_specified_name)} #{upgrade_version} #{fi.options.to_a.join(" ")}"
# first we unlink the currently active keg for this formula otherwise it is
# possible for the existing build to interfere with the build we are about to | false |
Other | Homebrew | brew | da5d804bd9fca474eb2a7f484559ad9cd1534d89.json | Inline versions of upgraded formulae | Library/Homebrew/cmd/upgrade.rb | @@ -185,7 +185,11 @@ def upgrade_formula(f)
end
fi.prelude
- oh1 "Upgrading #{Formatter.identifier(f.full_specified_name)} #{fi.options.to_a.join " "}"
+ if f.optlinked?
+ oh1 "Upgrading #{Formatter.identifier(f.full_specified_name)} #{Keg.new(f.opt_prefix).version} -> #{f.pkg_version} #{fi.options.to_a.join " "}"
+ else
+ oh1 "Upgrading #{Formatter.identifier(f.full_specified_name)} -> #{f.pkg_version} #{fi.options.to_a.join " "}"
+ end
# first we unlink the currently active keg for this formula otherwise it is
# possible for the existing build to interfere with the build we are about to | false |
Other | Homebrew | brew | 79811537fbef39b2efad2036544e0bfdc33da278.json | rubocop/urls: add go@1.13 to binary URLs whitelist | Library/Homebrew/rubocops/urls.rb | @@ -18,6 +18,7 @@ class Urls < FormulaCop
go@1.10
go@1.11
go@1.12
+ go@1.13
haskell-stack
ldc
mlton | false |
Other | Homebrew | brew | 10f529d091b6fd7db7e054191bac55dc19f24038.json | Docs: Add guides for common cases
Co-authored-by: Sam Ford <1584702+samford@users.noreply.github.com> | docs/Adding-Software-to-Homebrew.md | @@ -0,0 +1,34 @@
+# Adding Software to Homebrew
+
+Are you missing your favorite software in Homebrew? Then you're the perfect person to resolve this problem.
+
+Before you start, please check the open pull requests for [homebrew-core](https://github.com/Homebrew/homebrew-core/pulls) or [linuxbrew-core](https://github.com/Homebrew/linuxbrew-core/pulls), to make sure no one else beat you to the punch.
+
+Next, you will want to go through the [Acceptable Formulae](Acceptable-Formulae.md) documentation to determine if the software is an appropriate addition to Homebrew. If you are creating a formula for an alternative version of software already in Homebrew (for example, a major/minor version that significantly differs from the existing version), be sure to read the [Versions](Versions.md) documentation to understand versioned formulae requirements.
+
+If everything checks out, you're ready to get started on a new formula!
+
+## Writing the formula
+1. It's a good idea to find existing formulae in Homebrew that have similarities to the software you want to add. This will help you to understand how specific languages, build methods, etc. are typically handled.
+
+1. If you're starting from scratch, the [`brew create` command](Manpage.md#create-options-url) can be used to produce a basic version of your formula. This command accepts a number of options and you may be able to save yourself some work by using an appropriate template option like `--python`.
+
+1. You will now have to work to develop the boilerplate code from `brew create` into a fully-fledged formula. Your main references will be the [Formula Cookbook](Formula-Cookbook.md), similar formulae in Homebrew, and the upstream documentation for your chosen software. Be sure to also take note of the Homebrew documentation for writing [`Python`](Python-for-Formula-Authors.md) and [`Node`](Node-for-Formula-Authors.md) formulae, if applicable.
+
+1. Make sure you write a good test as part of your formula. Refer to the "[Add a test to the formula](Formula-Cookbook.md#add-a-test-to-the-formula)" section of the Cookbook for help with this.
+
+1. Try to install the formula using `brew install --build-from-source <formula>`, where \<formula\> is the name of your formula. If any errors occur, correct your formula and attempt to install it again. The formula should install without errors by the end of this step.
+
+If you're stuck, ask for help on GitHub or [Discourse](https://discourse.brew.sh). The maintainers are very happy to help but we also like to see that you've put effort into trying to find a solution first.
+
+## Testing and auditing the formula
+
+1. Run `brew audit --strict --new-formula --online <formula>` with your formula. If any errors occur, correct them in your formula and run the audit again. The audit should finish without any errors by the end of this step.
+
+1. Run your formula's test using `brew test <formula>` with your formula. Your test should finish without any errors.
+
+## Submitting the formula
+
+You're finally ready to submit your formula to the [homebrew-core](https://github.com/Homebrew/homebrew-core/) or [linuxbrew-core](https://github.com/Homebrew/linuxbrew-core/) repository. If you haven't done this before, you can refer to the [How to Open a Pull Request documentation](How-To-Open-a-Homebrew-Pull-Request.md) for help. Maintainers will review the pull request and provide feedback about any areas that need to be addressed before the formula can be added to Homebrew.
+
+If you've made it this far, congratulations on submitting a Homebrew formula! We appreciate the hard work you put into this and you can take satisfaction in knowing that your work may benefit other Homebrew users as well. | true |
Other | Homebrew | brew | 10f529d091b6fd7db7e054191bac55dc19f24038.json | Docs: Add guides for common cases
Co-authored-by: Sam Ford <1584702+samford@users.noreply.github.com> | docs/Creating-a-Homebrew-Issue.md | @@ -0,0 +1,5 @@
+# Creating a Homebrew Issue
+
+First, check to make sure your issue is not listed in the [FAQ](FAQ.md) or [Common Issues](Common-Issues.md) and can't otherwise be resolved with the information in the [Tips and Tricks](Tips-N'-Tricks.md) documentation. Next, go through the steps in the [Troubleshooting guide](Troubleshooting.md).
+
+If the preceding steps did not help, it may be appropriate to submit an issue. This can be done by navigating to the relevant repository, clicking the "Issues" link, and clicking on the "New issue" button. When creating an issue, make sure you use the provided template, as it's important in helping others to understand and potentially triage your issue efficiently. | true |
Other | Homebrew | brew | 10f529d091b6fd7db7e054191bac55dc19f24038.json | Docs: Add guides for common cases
Co-authored-by: Sam Ford <1584702+samford@users.noreply.github.com> | docs/README.md | @@ -27,6 +27,10 @@
- [Xcode](Xcode.md)
- [Kickstarter Supporters](Kickstarter-Supporters.md)
+- [Creating a Homebrew Issue](Creating-a-Homebrew-Issue.md)
+- [Updating Software in Homebrew](Updating-Software-in-Homebrew.md)
+- [Adding Software to Homebrew](Adding-Software-to-Homebrew.md)
+
## Contributors
- [How To Open A Pull Request (and get it merged)](How-To-Open-a-Homebrew-Pull-Request.md) | true |
Other | Homebrew | brew | 10f529d091b6fd7db7e054191bac55dc19f24038.json | Docs: Add guides for common cases
Co-authored-by: Sam Ford <1584702+samford@users.noreply.github.com> | docs/Updating-Software-in-Homebrew.md | @@ -0,0 +1,13 @@
+# Updating Software in Homebrew
+
+Did you find something in Homebrew that wasn't the latest version? You can help yourself and others by submitting a pull request to update the formula.
+
+First, check the pull requests in the [homebrew-core](https://github.com/Homebrew/homebrew-core/pulls) or [linuxbrew-core](https://github.com/Homebrew/linuxbrew-core/pulls) repositories to make sure there isn't already an open PR. You may also want to look through closed pull requests for the formula, as sometimes formulae run into problems preventing them from being updated and it's better to be aware of any issues before putting significant effort into an update.
+
+The guide on [opening a pull request](How-To-Open-a-Homebrew-Pull-Request.md#submit-a-new-version-of-an-existing-formula) should really be all you need, this will explain how to easily change the url to point to the latest version and that's really all you need. If you want to read up on `bump-formula-pr` before using it you could check [the manpage](Manpage.md#bump-formula-pr-options-formula).
+
+You can look back at previous pull requests that updated the formula to see how others have handled things in the past but be sure to look at a variety of PRs. Sometimes formulae are not updated properly (for example, running `bump-formula-pr` on a Python formula that needs dependency updates), so you may need to use your judgment to determine how to proceed.
+
+Once you've created the pull request in the appropriate Homebrew repository your commit(s) will be tested on our continuous integration servers, showing a green check mark when everything passed or a red X when there were failures. Maintainers will review your pull request and provide feedback about any changes that need to be made before it can be merged.
+
+We appreciate your help in keeping Homebrew's formulae up to date as new versions of software are released! | true |
Other | Homebrew | brew | a24477dad64ed8c7069811b6f0e3390973b9c9cf.json | bump-formula-pr: fix output when listing guesses | Library/Homebrew/dev-cmd/bump-formula-pr.rb | @@ -146,7 +146,7 @@ def bump_formula_pr
if guesses.count == 1
formula = guesses.shift
elsif guesses.count > 1
- odie "Couldn't guess formula for sure; could be one of these:\n#{guesses}"
+ odie "Couldn't guess formula for sure; could be one of these:\n#{guesses.map(&:name).join(", ")}"
end
end
raise FormulaUnspecifiedError unless formula | false |
Other | Homebrew | brew | 29006396dd4fd75602b44ebc81d7a30181b2d55f.json | audit: check apache.org URLs | Library/Homebrew/rubocops/urls.rb | @@ -41,6 +41,11 @@ def audit_formula(_node, _class_node, _parent_class_node, body_node)
problem "Please don't use fossies.org in the url (using as a mirror is fine)"
end
+ apache_pattern = %r{^https?://(?:[^/]*\.)?apache\.org/(?:dyn/closer\.cgi\?path=/?|dist/)(.*)}i
+ audit_urls(urls, apache_pattern) do |match, url|
+ problem "#{url} should be `https://www.apache.org/dyn/closer.lua?path=#{match[1]}`"
+ end
+
audit_urls(mirrors, /.*/) do |_, mirror|
urls.each do |url|
url_string = string_content(parameters(url).first)
@@ -58,7 +63,7 @@ def audit_formula(_node, _class_node, _parent_class_node, body_node)
%r{^http://ftpmirror\.gnu\.org/},
%r{^http://download\.savannah\.gnu\.org/},
%r{^http://download-mirror\.savannah\.gnu\.org/},
- %r{^http://[^/]*\.apache\.org/},
+ %r{^http://(?:[^/]*\.)?apache\.org/},
%r{^http://code\.google\.com/},
%r{^http://fossies\.org/},
%r{^http://mirrors\.kernel\.org/},
@@ -78,6 +83,11 @@ def audit_formula(_node, _class_node, _parent_class_node, body_node)
problem "Please use https:// for #{url}"
end
+ apache_mirror_pattern = %r{^https?://(?:[^/]*\.)?apache\.org/dyn/closer\.(?:cgi|lua)\?path=/?(.*)}i
+ audit_urls(mirrors, apache_mirror_pattern) do |match, mirror|
+ problem "Please use `https://archive.apache.org/dist/#{match[1]}` as a mirror instead of #{mirror}."
+ end
+
cpan_pattern = %r{^http://search\.mcpan\.org/CPAN/(.*)}i
audit_urls(urls, cpan_pattern) do |match, url|
problem "#{url} should be `https://cpan.metacpan.org/#{match[1]}`" | true |
Other | Homebrew | brew | 29006396dd4fd75602b44ebc81d7a30181b2d55f.json | audit: check apache.org URLs | Library/Homebrew/test/rubocops/urls_spec.rb | @@ -18,6 +18,11 @@
"url" => "http://tools.ietf.org/tools/rfcmarkup/rfcmarkup-1.119.tgz",
"msg" => "Please use https:// for http://tools.ietf.org/tools/rfcmarkup/rfcmarkup-1.119.tgz",
"col" => 2,
+ }, {
+ "url" => "https://apache.org/dyn/closer.cgi?path=/apr/apr-1.7.0.tar.bz2",
+ "msg" => "https://apache.org/dyn/closer.cgi?path=/apr/apr-1.7.0.tar.bz2 should be " \
+ "`https://www.apache.org/dyn/closer.lua?path=apr/apr-1.7.0.tar.bz2`",
+ "col" => 2,
}, {
"url" => "http://search.mcpan.org/CPAN/authors/id/Z/ZE/ZEFRAM/Perl4-CoreLibs-0.003.tar.gz",
"msg" => "http://search.mcpan.org/CPAN/authors/id/Z/ZE/ZEFRAM/Perl4-CoreLibs-0.003.tar.gz should be " \ | true |
Other | Homebrew | brew | f11ddb9aab4a6ebfa6a4be8888cca6b6908944aa.json | log: use user path
Without this, one can't use a custom pager, if it's present in
non-standard PATH, like for example Homebrew on Linux prefix. | Library/Homebrew/cmd/log.rb | @@ -29,6 +29,10 @@ def log_args
def log
log_args.parse
+ # As this command is simplifying user run commands then let's just use a
+ # user path, too.
+ ENV["PATH"] = ENV["HOMEBREW_PATH"]
+
if ARGV.named.empty?
git_log HOMEBREW_REPOSITORY
else | false |
Other | Homebrew | brew | 59747144539a3c394b6c4e5e27948df41bec22d2.json | pull: add more docs comment context. | Library/Homebrew/dev-cmd/pull.rb | @@ -289,6 +289,7 @@ def merge_commit?(url)
# Use `homebrew` remote if HOMEBREW_FORCE_HOMEBREW_ON_LINUX env variable is set.
# The `homebrew` remote points to homebrew-core tap and is used by Linux maintainers.
+ # See https://docs.brew.sh/Homebrew-linuxbrew-core-Maintainer-Guide#preparation
remote = ENV["HOMEBREW_FORCE_HOMEBREW_ON_LINUX"] ? "homebrew" : "origin"
safe_system "git", "fetch", "--quiet", remote, "pull/#{pr_number}/head"
Utils.popen_read("git", "rev-list", "--parents", "-n1", "FETCH_HEAD").count(" ") > 1 | false |
Other | Homebrew | brew | f60e2a0c4a496ddfd2e2f69f499cb229deba3f75.json | Add ghc@8.6 to binary formula URLs whitelist | Library/Homebrew/rubocops/urls.rb | @@ -13,6 +13,7 @@ class Urls < FormulaCop
fpc
ghc
ghc@8.2
+ ghc@8.6
go
go@1.9
go@1.10 | false |
Other | Homebrew | brew | 7e1da4a037db33600a1ba61f343c67fe132b090e.json | README: add missing maintainers. | README.md | @@ -58,7 +58,7 @@ Homebrew's [Technical Steering Committee](https://docs.brew.sh/Homebrew-Governan
Homebrew/brew's Linux maintainers are [Michka Popoff](https://github.com/imichka), [Shaun Jackman](https://github.com/sjackman), [Dawid Dziurla](https://github.com/dawidd6) and [Issy Long](https://github.com/issyl0).
-Homebrew's other current maintainers are [Claudia Pellegrino](https://github.com/claui), [Rui Chen](https://github.com/chenrui333), [Vitor Galvao](https://github.com/vitorgalvao), [Caleb Xu](https://github.com/alebcay), [Gautham Goli](https://github.com/GauthamGoli), [Steven Peters](https://github.com/scpeters), [William Woodruff](https://github.com/woodruffw), [Igor Kapkov](https://github.com/igas), [Izaak Beekman](https://github.com/zbeekman), [Eric Knibbe](https://github.com/EricFromCanada), [Viktor Szakats](https://github.com/vszakats), [Thierry Moisan](https://github.com/moisan), [Steven Peters](https://github.com/scpeters), [Tom Schoonjans](https://github.com/tschoonj) and [Issy Long](https://github.com/issyl0).
+Homebrew's other current maintainers are [Claudia Pellegrino](https://github.com/claui), [Zach Auten](https://github.com/zachauten), [Rui Chen](https://github.com/chenrui333), [Vitor Galvao](https://github.com/vitorgalvao), [Caleb Xu](https://github.com/alebcay), [Gautham Goli](https://github.com/GauthamGoli), [Steven Peters](https://github.com/scpeters), [Bo Anderson](https://github.com/Bo98), [William Woodruff](https://github.com/woodruffw), [Igor Kapkov](https://github.com/igas), [Alexander Bayandin](https://github.com/bayandin), [Izaak Beekman](https://github.com/zbeekman), [Eric Knibbe](https://github.com/EricFromCanada), [Viktor Szakats](https://github.com/vszakats), [Thierry Moisan](https://github.com/moisan), [Steven Peters](https://github.com/scpeters), [Tom Schoonjans](https://github.com/tschoonj) and [Issy Long](https://github.com/issyl0).
Former maintainers with significant contributions include [Jan Viljanen](https://github.com/javian), [JCount](https://github.com/jcount), [commitay](https://github.com/commitay), [Dominyk Tiller](https://github.com/DomT4), [Tim Smith](https://github.com/tdsmith), [Baptiste Fontaine](https://github.com/bfontaine), [Xu Cheng](https://github.com/xu-cheng), [Martin Afanasjew](https://github.com/UniqMartin), [Brett Koonce](https://github.com/asparagui), [Charlie Sharpsteen](https://github.com/Sharpie), [Jack Nagel](https://github.com/jacknagel), [Adam Vandenberg](https://github.com/adamv), [Andrew Janke](https://github.com/apjanke), [Alex Dunn](https://github.com/dunn), [neutric](https://github.com/neutric), [Tomasz Pajor](https://github.com/nijikon), [Uladzislau Shablinski](https://github.com/vladshablinsky), [Alyssa Ross](https://github.com/alyssais), [ilovezfs](https://github.com/ilovezfs), [Chongyu Zhu](https://github.com/lembacon) and Homebrew's creator: [Max Howell](https://github.com/mxcl).
| true |
Other | Homebrew | brew | 7e1da4a037db33600a1ba61f343c67fe132b090e.json | README: add missing maintainers. | docs/Manpage.md | @@ -1293,7 +1293,7 @@ Homebrew's Technical Steering Committee is Michka Popoff, FX Coudert, Markus Rei
Homebrew/brew's Linux maintainers are Michka Popoff, Shaun Jackman, Dawid Dziurla and Issy Long.
-Homebrew's other current maintainers are Claudia Pellegrino, Rui Chen, Vitor Galvao, Caleb Xu, Gautham Goli, Steven Peters, William Woodruff, Igor Kapkov, Izaak Beekman, Eric Knibbe, Viktor Szakats, Thierry Moisan, Steven Peters, Tom Schoonjans and Issy Long.
+Homebrew's other current maintainers are Claudia Pellegrino, Zach Auten, Rui Chen, Vitor Galvao, Caleb Xu, Gautham Goli, Steven Peters, Bo Anderson, William Woodruff, Igor Kapkov, Alexander Bayandin, Izaak Beekman, Eric Knibbe, Viktor Szakats, Thierry Moisan, Steven Peters, Tom Schoonjans and Issy Long.
Former maintainers with significant contributions include Jan Viljanen, JCount, commitay, Dominyk Tiller, Tim Smith, Baptiste Fontaine, Xu Cheng, Martin Afanasjew, Brett Koonce, Charlie Sharpsteen, Jack Nagel, Adam Vandenberg, Andrew Janke, Alex Dunn, neutric, Tomasz Pajor, Uladzislau Shablinski, Alyssa Ross, ilovezfs, Chongyu Zhu and Homebrew's creator: Max Howell.
| true |
Other | Homebrew | brew | 7e1da4a037db33600a1ba61f343c67fe132b090e.json | README: add missing maintainers. | manpages/brew.1 | @@ -1581,7 +1581,7 @@ Homebrew\'s Technical Steering Committee is Michka Popoff, FX Coudert, Markus Re
Homebrew/brew\'s Linux maintainers are Michka Popoff, Shaun Jackman, Dawid Dziurla and Issy Long\.
.
.P
-Homebrew\'s other current maintainers are Claudia Pellegrino, Rui Chen, Vitor Galvao, Caleb Xu, Gautham Goli, Steven Peters, William Woodruff, Igor Kapkov, Izaak Beekman, Eric Knibbe, Viktor Szakats, Thierry Moisan, Steven Peters, Tom Schoonjans and Issy Long\.
+Homebrew\'s other current maintainers are Claudia Pellegrino, Zach Auten, Rui Chen, Vitor Galvao, Caleb Xu, Gautham Goli, Steven Peters, Bo Anderson, William Woodruff, Igor Kapkov, Alexander Bayandin, Izaak Beekman, Eric Knibbe, Viktor Szakats, Thierry Moisan, Steven Peters, Tom Schoonjans and Issy Long\.
.
.P
Former maintainers with significant contributions include Jan Viljanen, JCount, commitay, Dominyk Tiller, Tim Smith, Baptiste Fontaine, Xu Cheng, Martin Afanasjew, Brett Koonce, Charlie Sharpsteen, Jack Nagel, Adam Vandenberg, Andrew Janke, Alex Dunn, neutric, Tomasz Pajor, Uladzislau Shablinski, Alyssa Ross, ilovezfs, Chongyu Zhu and Homebrew\'s creator: Max Howell\. | true |
Other | Homebrew | brew | 6ce083d29402526f52892a53dd2efbf80661e522.json | rubocop.yml: enable new checks. | Library/.rubocop_shared.yml | @@ -50,6 +50,14 @@ Style/CollectionMethods:
Style/FormatStringToken:
EnforcedStyle: annotated
+# autocorrectable and more readable
+Style/HashEachMethods:
+ Enabled: true
+Style/HashTransformKeys:
+ Enabled: true
+Style/HashTransformValues:
+ Enabled: true
+
# This shouldn't be enabled until LineLength is lower.
Style/IfUnlessModifier:
Enabled: false | false |
Other | Homebrew | brew | e9419e48e56356ce3925406078d89b353fe5dba3.json | tap: update docs to note non-shallow default.
Also, while we're here, `rsync` and `git` are not acronyms. | Library/Homebrew/cmd/tap.rb | @@ -22,12 +22,11 @@ def tap_args
any transport protocol that `git`(1) handles. The one-argument form of `tap`
simplifies but also limits. This two-argument command makes no
assumptions, so taps can be cloned from places other than GitHub and
- using protocols other than HTTPS, e.g. SSH, GIT, HTTP, FTP(S), RSYNC.
+ using protocols other than HTTPS, e.g. SSH, git, HTTP, FTP(S), rsync.
EOS
switch "--full",
- description: "Use a full clone when tapping a repository. By default, the repository is "\
- "cloned as a shallow copy (`--depth=1`). To convert a shallow copy to a "\
- "full copy, you can retap by passing `--full` without first untapping."
+ description: "Convert a shallow clone to a full clone without untapping. By default, taps are no "\
+ "longer cloned as shallow clones."
switch "--force-auto-update",
description: "Auto-update tap even if it is not hosted on GitHub. By default, only taps "\
"hosted on GitHub are auto-updated (for performance reasons)." | true |
Other | Homebrew | brew | e9419e48e56356ce3925406078d89b353fe5dba3.json | tap: update docs to note non-shallow default.
Also, while we're here, `rsync` and `git` are not acronyms. | docs/Manpage.md | @@ -496,10 +496,10 @@ With *`URL`* specified, tap a formula repository from anywhere, using any
transport protocol that `git`(1) handles. The one-argument form of `tap`
simplifies but also limits. This two-argument command makes no assumptions, so
taps can be cloned from places other than GitHub and using protocols other than
-HTTPS, e.g. SSH, GIT, HTTP, FTP(S), RSYNC.
+HTTPS, e.g. SSH, git, HTTP, FTP(S), rsync.
* `--full`:
- Use a full clone when tapping a repository. By default, the repository is cloned as a shallow copy (`--depth=1`). To convert a shallow copy to a full copy, you can retap by passing `--full` without first untapping.
+ Convert a shallow clone to a full clone without untapping. By default, taps are no longer cloned as shallow clones.
* `--force-auto-update`:
Auto-update tap even if it is not hosted on GitHub. By default, only taps hosted on GitHub are auto-updated (for performance reasons).
* `--repair`: | true |
Other | Homebrew | brew | e9419e48e56356ce3925406078d89b353fe5dba3.json | tap: update docs to note non-shallow default.
Also, while we're here, `rsync` and `git` are not acronyms. | manpages/brew.1 | @@ -627,11 +627,11 @@ If no arguments are provided, list all installed taps\.
With \fIURL\fR unspecified, tap a formula repository from GitHub using HTTPS\. Since so many taps are hosted on GitHub, this command is a shortcut for \fBbrew tap\fR \fIuser\fR\fB/\fR\fIrepo\fR \fBhttps://github\.com/\fR\fIuser\fR\fB/homebrew\-\fR\fIrepo\fR\.
.
.P
-With \fIURL\fR specified, tap a formula repository from anywhere, using any transport protocol that \fBgit\fR(1) handles\. The one\-argument form of \fBtap\fR simplifies but also limits\. This two\-argument command makes no assumptions, so taps can be cloned from places other than GitHub and using protocols other than HTTPS, e\.g\. SSH, GIT, HTTP, FTP(S), RSYNC\.
+With \fIURL\fR specified, tap a formula repository from anywhere, using any transport protocol that \fBgit\fR(1) handles\. The one\-argument form of \fBtap\fR simplifies but also limits\. This two\-argument command makes no assumptions, so taps can be cloned from places other than GitHub and using protocols other than HTTPS, e\.g\. SSH, git, HTTP, FTP(S), rsync\.
.
.TP
\fB\-\-full\fR
-Use a full clone when tapping a repository\. By default, the repository is cloned as a shallow copy (\fB\-\-depth=1\fR)\. To convert a shallow copy to a full copy, you can retap by passing \fB\-\-full\fR without first untapping\.
+Convert a shallow clone to a full clone without untapping\. By default, taps are no longer cloned as shallow clones\.
.
.TP
\fB\-\-force\-auto\-update\fR | true |
Other | Homebrew | brew | c46a30b5757f901d111dafc585e53df35a46e407.json | brew: remove most traces of python@2 | Library/Homebrew/dev-cmd/audit.rb | @@ -508,7 +508,6 @@ def audit_versioned_keg_only
bash-completion@2
gnupg@1.4
lua@5.1
- python@2
numpy@1.16
].freeze
@@ -706,7 +705,6 @@ def audit_specs
versioned_head_spec = %w[
bash-completion@2
imagemagick@6
- python@2
]
problem head_spec_message unless versioned_head_spec.include?(formula.name)
end | true |
Other | Homebrew | brew | c46a30b5757f901d111dafc585e53df35a46e407.json | brew: remove most traces of python@2 | Library/Homebrew/exceptions.rb | @@ -335,8 +335,8 @@ class FormulaAmbiguousPythonError < RuntimeError
def initialize(formula)
super <<~EOS
The version of python to use with the virtualenv in the `#{formula.full_name}` formula
- cannot be guessed automatically. If the simultaneous use of python and python@2
- is intentional, please add `:using => "python"` or `:using => "python@2"` to
+ cannot be guessed automatically. If the simultaneous use of multiple pythons
+ is intentional, please add `:using => "python@x.y"` to
`virtualenv_install_with_resources` to resolve the ambiguity manually.
EOS
end | true |
Other | Homebrew | brew | c46a30b5757f901d111dafc585e53df35a46e407.json | brew: remove most traces of python@2 | Library/Homebrew/formula.rb | @@ -2386,8 +2386,6 @@ def go_resource(name, &block)
# depends_on "postgresql" if build.without? "sqlite"</pre>
# <pre># Python 3.x if the `--with-python` is given to `brew install example`
# depends_on "python3" => :optional</pre>
- # <pre># Python 2.7:
- # depends_on "python@2"</pre>
def depends_on(dep)
specs.each { |spec| spec.depends_on(dep) }
end | true |
Other | Homebrew | brew | c46a30b5757f901d111dafc585e53df35a46e407.json | brew: remove most traces of python@2 | Library/Homebrew/language/python.rb | @@ -26,7 +26,6 @@ def self.site_packages(python = "python3.7")
def self.each_python(build, &block)
original_pythonpath = ENV["PYTHONPATH"]
pythons = { "python@3" => "python3",
- "python@2" => "python2.7",
"pypy" => "pypy",
"pypy3" => "pypy3" }
pythons.each do |python_formula, python|
@@ -152,17 +151,16 @@ def needs_python?(python)
# Creates a virtualenv in `libexec`, installs all `resource`s defined
# on the formula, and then installs the formula. An options hash may be
# passed (e.g., `:using => "python"`) to override the default, guessed
- # formula preference for python or python2, or to resolve an ambiguous
- # case where it's not clear whether python or python2 should be the
+ # formula preference for python or python@x.y, or to resolve an ambiguous
+ # case where it's not clear whether python or python@x.y should be the
# default guess.
def virtualenv_install_with_resources(options = {})
python = options[:using]
if python.nil?
- pythons = %w[python python@2 python2 python3 python@3 python@3.8 pypy pypy3]
+ pythons = %w[python python3 python@3 python@3.8 pypy pypy3]
wanted = pythons.select { |py| needs_python?(py) }
raise FormulaAmbiguousPythonError, self if wanted.size > 1
- python = wanted.first || "python2.7"
python = "python3" if python == "python"
end
venv = virtualenv_create(libexec, python.delete("@"))
@@ -210,16 +208,14 @@ def create
next unless f.symlink?
next unless (rp = f.realpath.to_s).start_with? HOMEBREW_CELLAR
- python = rp.include?("python@2") ? "python@2" : "python"
- new_target = rp.sub %r{#{HOMEBREW_CELLAR}/#{python}/[^/]+}, Formula[python].opt_prefix
+ new_target = rp.sub %r{#{HOMEBREW_CELLAR}/python/[^/]+}, Formula["python"].opt_prefix
f.unlink
f.make_symlink new_target
end
Pathname.glob(@venv_root/"lib/python*/orig-prefix.txt").each do |prefix_file|
prefix_path = prefix_file.read
- python = prefix_path.include?("python@2") ? "python@2" : "python"
- prefix_path.sub! %r{^#{HOMEBREW_CELLAR}/#{python}/[^/]+}, Formula[python].opt_prefix
+ prefix_path.sub! %r{^#{HOMEBREW_CELLAR}/#{python}/[^/]+}, Formula["python"].opt_prefix
prefix_file.atomic_write prefix_path
end
end | true |
Other | Homebrew | brew | c46a30b5757f901d111dafc585e53df35a46e407.json | brew: remove most traces of python@2 | docs/Gems,-Eggs-and-Perl-Modules.md | @@ -27,25 +27,7 @@ writable location. But if you installed Homebrew as we recommend,
`/usr/local` will be writable without sudo. So now you are good to
install the development tools you need without risking the use of sudo.
-## Python packages (eggs) without sudo
-
-Rather than changing the rights on `/Library/Python`, we recommend the
-following options:
-
-### With a brewed Python
-Note, `easy_install` is deprecated. We install `pip` (or `pip2` for
-Python 2) along with python/python2.
-
-We set up distutils such that `pip install` will always put modules in
-`$(brew --prefix)/lib/pythonX.Y/site-packages` and scripts in
-`$(brew --prefix)/share/python`. Therefore, you won’t need sudo!
-
-Do `brew info python` or `brew info python@2` for precise information
-about the paths. Note, a brewed Python still searches for modules in
-`/Library/Python/X.Y/site-packages` and also in
-`~/Library/Python/X.Y/lib/python/site-packages`.
-
-### With system’s Python
+### Python packages (eggs) without sudo using system’s Python
_This is only recommended if you **don't** use a brewed Python._
On macOS, any [Python version X.Y also searches in
@@ -66,7 +48,7 @@ following content:
install_lib = ~/Library/Python/$py_version_short/lib/python/site-packages
```
-### Using virtualenv (works with brewed and system’s Python)
+### Using virtualenv (with system Python)
[Virtualenv](https://virtualenv.pypa.io/) ships `pip` and
creates isolated Python environments with separate site-packages, | true |
Other | Homebrew | brew | c46a30b5757f901d111dafc585e53df35a46e407.json | brew: remove most traces of python@2 | docs/Homebrew-and-Python.md | @@ -4,45 +4,33 @@ This page describes how Python is handled in Homebrew for users. See [Python for
Homebrew should work with any [CPython](https://stackoverflow.com/questions/2324208/is-there-any-difference-between-cpython-and-python) and defaults to the macOS system Python.
-Homebrew provides formulae to brew Python 3.x and a more up-to-date Python 2.7.x.
+Homebrew provides formulae to brew Python 3.x.
-**Important:** If you choose to install a Python which isn't either of these two (system Python or brewed Python), the Homebrew team cannot support any breakage that may occur.
+Homebrew provided a `python@2` formula until the end of 2019, at which point it was removed due to the Python 2 deprecation.
-## Python 3.x or Python 2.x
-Homebrew provides one formula for Python 3.x (`python`) and another for Python 2.7.x (`python@2`).
+**Important:** If you choose to use a Python which isn't either of these two (system Python or brewed Python), the Homebrew team cannot support any breakage that may occur.
-The executables are organised as follows so that Python 2 and Python 3 can both be installed without conflict:
+## Python 3.x
+Homebrew provides a formula for Python 3.x (`python`).
+
+The executables are organised as follows:
* `python3` points to Homebrew's Python 3.x (if installed)
-* `python2` points to Homebrew's Python 2.7.x (if installed)
-* `python` points to Homebrew's Python 2.7.x (if installed) otherwise the macOS system Python. Check out `brew info python` if you wish to add Homebrew's 3.x `python` to your `PATH`.
* `pip3` points to Homebrew's Python 3.x's pip (if installed)
-* `pip` and `pip2` point to Homebrew's Python 2.7.x's pip (if installed)
-
-([Wondering which one to choose?](https://wiki.python.org/moin/Python2orPython3))
## Setuptools, Pip, etc.
-The Python formulae install [pip](https://pip.pypa.io/) (as `pip` or `pip2`) and [Setuptools](https://pypi.python.org/pypi/setuptools).
+The Python formulae install [pip](https://pip.pypa.io/) (as `pip3`) and [Setuptools](https://pypi.python.org/pypi/setuptools).
-Setuptools can be updated via pip, without having to re-brew Python:
+Setuptools can be updated via pip3, without having to re-brew Python:
```sh
-python -m pip install --upgrade setuptools
+python3 -m pip3 install --upgrade setuptools
```
-Similarly, pip can be used to upgrade itself via:
-
-```sh
-python -m pip install --upgrade pip
-```
-
-### Note on `pip install --user`
-The normal `pip install --user` is disabled for brewed Python. This is because of a bug in distutils, because Homebrew writes a `distutils.cfg` which sets the package `prefix`.
-
-A possible workaround (which puts executable scripts in `~/Library/Python/<X>.<Y>/bin`) is:
+Similarly, pip3 can be used to upgrade itself via:
```sh
-python -m pip install --user --install-option="--prefix=" <package-name>
+python3 -m pip3 install --upgrade pip3
```
## `site-packages` and the `PYTHONPATH`
@@ -75,7 +63,7 @@ These should be installed via `pip install <package>`. To discover, you can use
**Note:** macOS's system Python does not provide `pip`. Follow the [pip documentation](https://pip.readthedocs.io/en/stable/installing/#install-pip) to install it for your system Python if you would like it.
## Brewed Python modules
-For brewed Python, modules installed with `pip` or `python setup.py install` will be installed to the `$(brew --prefix)/lib/pythonX.Y/site-packages` directory (explained above). Executable Python scripts will be in `$(brew --prefix)/bin`.
+For brewed Python, modules installed with `pip3` or `python3 setup.py install` will be installed to the `$(brew --prefix)/lib/pythonX.Y/site-packages` directory (explained above). Executable Python scripts will be in `$(brew --prefix)/bin`.
The system Python may not know which compiler flags to set in order to build bindings for software installed in Homebrew so you may need to run:
@@ -92,4 +80,4 @@ Homebrew will still install Python modules into Homebrew's `site-packages` and *
Virtualenv has a `--system-site-packages` switch to allow "global" (i.e. Homebrew's) `site-packages` to be accessible from within the virtualenv.
## Why is Homebrew's Python being installed as a dependency?
-Formulae that declare an unconditional dependency on the `"python"` or `"python@2"` formulae are bottled against Homebrew's Python 3.x or 2.7.x and require it to be installed.
+Formulae that declare an unconditional dependency on the `"python"` formula are bottled against Homebrew's Python 3.x and require it to be installed. | true |
Other | Homebrew | brew | c46a30b5757f901d111dafc585e53df35a46e407.json | brew: remove most traces of python@2 | docs/Homebrew-homebrew-core-Merge-Checklist.md | @@ -28,7 +28,7 @@ Check for:
- other teams drop new version with minor release 0 but promote it to stable only after a few minor releases
- if the software uses only hosted version control (such as GitHub, GitLab or Bitbucket), the release should be tagged and if upstream marks latest/pre-releases, PR must use latest
- does changelog mention addition/removal of dependency and is it addressed in the PR
- - does formula depend on versioned formula (for example `python@2`, `go@1.10`, `erlang@17`) that can be upgraded
+ - does formula depend on versioned formula (for example `python@3.7`, `go@1.10`, `erlang@17`) that can be upgraded
- commits
- contain one formula change per commit
- ask author to squash | true |
Other | Homebrew | brew | c46a30b5757f901d111dafc585e53df35a46e407.json | brew: remove most traces of python@2 | docs/Python-for-Formula-Authors.md | @@ -149,7 +149,7 @@ Sometimes we have to edit a `Makefile` on-the-fly to use our prefix for the Pyth
Libraries built for Python 3 should include `depends_on "python"`, which will bottle against Homebrew's Python 3.x. Python 2.x libraries must function when they are installed against either the system Python or brewed Python.
-Python 2 libraries do not need a `depends_on "python@2"` declaration; they will be built with the system Python, but should still be usable with any other Python 2.7. If this is not the case, it's an upstream bug; [here's some advice for resolving it](https://blog.tim-smith.us/2015/09/python-extension-modules-os-x/).
+Python 2 libraries need a `uses_from_macos "python@2"` declaration; they will be built with the system Python, but should still be usable with any other Python 2.7. If this is not the case, it's an upstream bug; [here's some advice for resolving it](https://blog.tim-smith.us/2015/09/python-extension-modules-os-x/).
### Installing
| true |
Other | Homebrew | brew | 2c86e7e12794ffbd464a539273cd042187822ab4.json | feat: expose casks in tap.to_hash for tap-info --json | Library/Homebrew/tap.rb | @@ -529,6 +529,7 @@ def to_hash
"formula_names" => formula_names,
"formula_files" => formula_files.map(&:to_s),
"command_files" => command_files.map(&:to_s),
+ "cask_files" => cask_files.map(&:to_s),
"pinned" => pinned?,
}
| false |
Other | Homebrew | brew | 486a557cf527761d9b5a0cf54674f4d562c7bfcb.json | rubocop/lines: add protobuf to whitelist | Library/Homebrew/rubocops/lines.rb | @@ -439,6 +439,7 @@ def audit_formula(_node, _class_node, _parent_class_node, body_node)
open-mpi
openssl@1.1
pcre
+ protobuf
wolfssl
xz
].include?(@formula_name) | false |
Other | Homebrew | brew | 967b9b811238c0750f16a6cea902379e5469f15d.json | deps: give consistent results
Co-Authored-By: Mike McQuaid <mike@mikemcquaid.com> | Library/Homebrew/cmd/deps.rb | @@ -62,6 +62,13 @@ def deps
Formulary.enable_factory_cache!
recursive = !args.send("1?")
+ installed = args.installed? || ARGV.formulae.all?(&:opt_or_installed_prefix_keg)
+
+ @use_runtime_dependencies = installed && recursive &&
+ !args.include_build? &&
+ !args.include_test? &&
+ !args.include_optional? &&
+ !args.skip_recommended?
if args.tree?
if args.installed?
@@ -80,14 +87,6 @@ def deps
return
end
- installed = args.installed? || ARGV.formulae.all?(&:opt_or_installed_prefix_keg)
-
- @use_runtime_dependencies = installed && recursive &&
- !args.include_build? &&
- !args.include_test? &&
- !args.include_optional? &&
- !args.skip_recommended?
-
if Homebrew.args.remaining.empty?
raise FormulaUnspecifiedError unless args.installed?
@@ -176,7 +175,8 @@ def puts_deps_tree(formulae, recursive = false)
def recursive_deps_tree(f, prefix, recursive)
includes, ignores = argv_includes_ignores(ARGV)
- deps = reject_ignores(f.deps, ignores, includes)
+ dependables = @use_runtime_dependencies ? f.runtime_dependencies : f.deps
+ deps = reject_ignores(dependables, ignores, includes)
reqs = reject_ignores(f.requirements, ignores, includes)
dependables = reqs + deps
| false |
Other | Homebrew | brew | 6d46a4eed744229933e490b8709d11f7ec12d8da.json | cpu: add new Intel names | Library/Homebrew/extend/os/linux/hardware/cpu.rb | @@ -49,14 +49,18 @@ def family
:merom
when 0x0d
:dothan
- when 0x36, 0x26, 0x1c
+ when 0x1c, 0x26, 0x27, 0x35, 0x36
:atom
- when 0x3c, 0x3f, 0x46
+ when 0x3c, 0x3f, 0x45, 0x46
:haswell
when 0x3d, 0x47, 0x4f, 0x56
:broadwell
when 0x4e, 0x55, 0x5e, 0x8e, 0x9e
:skylake
+ when 0x66
+ :cannonlake
+ when 0x6a, 0x6c, 0x7d, 0x7e
+ :icelake
else
unknown
end | false |
Other | Homebrew | brew | f2b8d4ec08ca7c452337490c4e0286a2cfbe3518.json | Dockerfile: use normal `brew cleanup`. | Dockerfile | @@ -45,4 +45,4 @@ RUN HOMEBREW_NO_ANALYTICS=1 HOMEBREW_NO_AUTO_UPDATE=1 brew tap homebrew/core \
&& chmod -R g+w,o-w /home/linuxbrew/.linuxbrew \
&& rm -rf ~/.cache \
&& brew install-bundler-gems \
- && brew cleanup -s
+ && brew cleanup | false |
Other | Homebrew | brew | 9eedb1e2ca85b123ca69c11a787687476fb594b8.json | system_command_result_spec: fix frozen objects. | Library/Homebrew/test/system_command_result_spec.rb | @@ -120,7 +120,7 @@
context "when verbose" do
before do
- allow(Homebrew.args).to receive(:verbose?).and_return(true)
+ allow(Homebrew).to receive(:args).and_return(OpenStruct.new("verbose?" => true))
end
it "warns about garbage" do
@@ -144,7 +144,7 @@
context "when verbose" do
before do
- allow(Homebrew.args).to receive(:verbose?).and_return(true)
+ allow(Homebrew).to receive(:args).and_return(OpenStruct.new("verbose?" => true))
end
it "warns about garbage" do | false |
Other | Homebrew | brew | eec8028d4fcde1a03eeb345971114a21e8e50c2f.json | [Linux] docs: Update sponsors to say GitHub Actions not CircleCI
- We switched from Circle CI to Azure Pipelines, then to GitHub Actions.
- I can't find any directly linkable official GitHub logo assets on
https://github.com/logos and I don't want to upload an image directly
to this repo. So, remove the image. If that's acceptable. | docs/Homebrew-on-Linux.md | @@ -95,8 +95,6 @@ eval $(~/.linuxbrew/bin/brew shellenv)
## Sponsors
-Our binary packages (bottles) are built on [CircleCI](https://circleci.com/) and hosted by [Bintray](https://bintray.com/linuxbrew).
-
-[<img alt="CircleCI logo" style="height:1in" src="https://assets.brandfolder.com/otz6k5-cj8pew-e4rk9u/original/circle-logo-horizontal-black.png">](https://circleci.com/)
+Our binary packages (bottles) are built on [GitHub Actions](https://github.com/features/actions) and hosted by [Bintray](https://bintray.com/linuxbrew).
[](https://bintray.com/linuxbrew) | false |
Other | Homebrew | brew | 5ef9b8863a59356395a1bc39904083b531117c97.json | Move urls code and add devel urls | Library/Homebrew/formula.rb | @@ -1626,13 +1626,7 @@ def to_hash
"head" => head&.version&.to_s,
"bottle" => !bottle_specification.checksums.empty?,
},
- "urls" => {
- "stable" => {
- "url" => stable.url,
- "tag" => stable.specs&.dig(:tag),
- "revision" => stable.specs&.dig(:revision),
- },
- },
+ "urls" => {},
"revision" => revision,
"version_scheme" => version_scheme,
"bottle" => {},
@@ -1684,6 +1678,11 @@ def to_hash
}
end
hsh["bottle"][spec_sym] = bottle_info
+ hsh["urls"][spec_sym] = {
+ "url" => spec.url,
+ "tag" => spec.specs[:tag],
+ "revision" => spec.specs[:revision],
+ }
end
hsh["options"] = options.map do |opt| | false |
Other | Homebrew | brew | 8a9dcad2c708ce945695029c5af79b4b3965a4de.json | Move more command handling logic to commands.rb. | Library/Homebrew/brew.rb | @@ -63,19 +63,20 @@ class MissingEnvironmentVariables < RuntimeError; end
ENV["PATH"] = path
- if cmd
- internal_cmd = require? HOMEBREW_LIBRARY_PATH/"cmd"/cmd
+ require "commands"
- unless internal_cmd
- internal_dev_cmd = require? HOMEBREW_LIBRARY_PATH/"dev-cmd"/cmd
- internal_cmd = internal_dev_cmd
+ if cmd
+ internal_cmd = Commands.valid_internal_cmd?(cmd)
+ internal_cmd ||= begin
+ internal_dev_cmd = Commands.valid_internal_dev_cmd?(cmd)
if internal_dev_cmd && !ARGV.homebrew_developer?
if (HOMEBREW_REPOSITORY/".git/config").exist?
system "git", "config", "--file=#{HOMEBREW_REPOSITORY}/.git/config",
"--replace-all", "homebrew.devcmdrun", "true"
end
ENV["HOMEBREW_DEV_CMD_RUN"] = "1"
end
+ internal_dev_cmd
end
end
@@ -98,15 +99,16 @@ class MissingEnvironmentVariables < RuntimeError; end
# `Homebrew.help` never returns, except for unknown commands.
end
- if internal_cmd
- Homebrew.send cmd.to_s.tr("-", "_").downcase
- elsif which "brew-#{cmd}"
+ if internal_cmd || Commands.external_ruby_v2_cmd_path(cmd)
+ Homebrew.send Commands.method_name(cmd)
+ elsif (path = Commands.external_ruby_cmd_path(cmd))
+ require?(path)
+ exit Homebrew.failed? ? 1 : 0
+ elsif Commands.external_cmd_path(cmd)
%w[CACHE LIBRARY_PATH].each do |env|
ENV["HOMEBREW_#{env}"] = Object.const_get("HOMEBREW_#{env}").to_s
end
exec "brew-#{cmd}", *ARGV
- elsif (path = which("brew-#{cmd}.rb")) && require?(path)
- exit Homebrew.failed? ? 1 : 0
else
possible_tap = OFFICIAL_CMD_TAPS.find { |_, cmds| cmds.include?(cmd) }
possible_tap = Tap.fetch(possible_tap.first) if possible_tap | true |
Other | Homebrew | brew | 8a9dcad2c708ce945695029c5af79b4b3965a4de.json | Move more command handling logic to commands.rb. | Library/Homebrew/cli/parser.rb | @@ -17,11 +17,7 @@ def self.parse(args = ARGV, &block)
end
def self.from_cmd_path(cmd_path)
- cmd_method_prefix = cmd_path.basename(cmd_path.extname)
- .to_s
- .sub(/^brew-/, "")
- .tr("-", "_")
- cmd_args_method_name = "#{cmd_method_prefix}_args".to_sym
+ cmd_args_method_name = Commands.args_method_name(cmd_path)
begin
Homebrew.send(cmd_args_method_name) if require?(cmd_path) | true |
Other | Homebrew | brew | 8a9dcad2c708ce945695029c5af79b4b3965a4de.json | Move more command handling logic to commands.rb. | Library/Homebrew/cmd/command.rb | @@ -23,13 +23,8 @@ def command
raise UsageError, "This command requires a command argument" if args.remaining.empty?
- args.remaining.each do |c|
- cmd = HOMEBREW_INTERNAL_COMMAND_ALIASES.fetch(c, c)
+ args.remaining.each do |cmd|
path = Commands.path(cmd)
- cmd_paths = PATH.new(ENV["PATH"]).append(Tap.cmd_directories) unless path
- path ||= which("brew-#{cmd}", cmd_paths)
- path ||= which("brew-#{cmd}.rb", cmd_paths)
-
odie "Unknown command: #{cmd}" unless path
puts path
end | true |
Other | Homebrew | brew | 8a9dcad2c708ce945695029c5af79b4b3965a4de.json | Move more command handling logic to commands.rb. | Library/Homebrew/cmd/commands.rb | @@ -27,54 +27,18 @@ def commands
commands_args.parse
if args.quiet?
- cmds = internal_commands
- cmds += external_commands
- cmds += internal_developer_commands
- cmds += HOMEBREW_INTERNAL_COMMAND_ALIASES.keys if args.include_aliases?
- puts Formatter.columns(cmds.sort)
+ puts Formatter.columns(Commands.commands(aliases: args.include_aliases?))
return
end
- # Find commands in Homebrew/cmd
- ohai "Built-in commands", Formatter.columns(internal_commands.sort)
-
- # Find commands in Homebrew/dev-cmd
+ ohai "Built-in commands", Formatter.columns(Commands.internal_commands)
puts
- ohai "Built-in developer commands", Formatter.columns(internal_developer_commands.sort)
+ ohai "Built-in developer commands", Formatter.columns(Commands.internal_developer_commands)
- exts = external_commands
- return if exts.empty?
+ external_commands = Commands.external_commands
+ return if external_commands.blank?
- # Find commands in the PATH
puts
- ohai "External commands", Formatter.columns(exts)
- end
-
- def internal_commands
- find_internal_commands HOMEBREW_LIBRARY_PATH/"cmd"
- end
-
- def internal_developer_commands
- find_internal_commands HOMEBREW_LIBRARY_PATH/"dev-cmd"
- end
-
- def external_commands
- cmd_paths = PATH.new(ENV["PATH"]).append(Tap.cmd_directories)
- cmd_paths.each_with_object([]) do |path, cmds|
- Dir["#{path}/brew-*"].each do |file|
- next unless File.executable?(file)
-
- cmd = File.basename(file, ".rb")[5..-1]
- next if cmd.include?(".")
-
- cmds << cmd
- end
- end.sort
- end
-
- def find_internal_commands(directory)
- Pathname.glob(directory/"*")
- .select(&:file?)
- .map { |f| f.basename.to_s.sub(/\.(?:rb|sh)$/, "") }
+ ohai "External commands", Formatter.columns(external_commands)
end
end | true |
Other | Homebrew | brew | 8a9dcad2c708ce945695029c5af79b4b3965a4de.json | Move more command handling logic to commands.rb. | Library/Homebrew/commands.rb | @@ -1,12 +1,138 @@
# frozen_string_literal: true
module Commands
- def self.path(cmd)
+ module_function
+
+ HOMEBREW_CMD_PATH = (HOMEBREW_LIBRARY_PATH/"cmd").freeze
+ HOMEBREW_DEV_CMD_PATH = (HOMEBREW_LIBRARY_PATH/"dev-cmd").freeze
+ HOMEBREW_INTERNAL_COMMAND_ALIASES = {
+ "ls" => "list",
+ "homepage" => "home",
+ "-S" => "search",
+ "up" => "update",
+ "ln" => "link",
+ "instal" => "install", # gem does the same
+ "uninstal" => "uninstall",
+ "rm" => "uninstall",
+ "remove" => "uninstall",
+ "configure" => "diy",
+ "abv" => "info",
+ "dr" => "doctor",
+ "--repo" => "--repository",
+ "environment" => "--env",
+ "--config" => "config",
+ "-v" => "--version",
+ }.freeze
+
+ def valid_internal_cmd?(cmd)
+ require?(HOMEBREW_CMD_PATH/cmd)
+ end
+
+ def valid_internal_dev_cmd?(cmd)
+ require?(HOMEBREW_DEV_CMD_PATH/cmd)
+ end
+
+ def method_name(cmd)
+ cmd.to_s
+ .tr("-", "_")
+ .downcase
+ .to_sym
+ end
+
+ def args_method_name(cmd_path)
+ cmd_path_basename = basename_without_extension(cmd_path)
+ cmd_method_prefix = method_name(cmd_path_basename)
+ "#{cmd_method_prefix}_args".to_sym
+ end
+
+ def internal_cmd_path(cmd)
[
- HOMEBREW_LIBRARY_PATH/"cmd/#{cmd}.sh",
- HOMEBREW_LIBRARY_PATH/"dev-cmd/#{cmd}.sh",
- HOMEBREW_LIBRARY_PATH/"cmd/#{cmd}.rb",
- HOMEBREW_LIBRARY_PATH/"dev-cmd/#{cmd}.rb",
+ HOMEBREW_CMD_PATH/"#{cmd}.rb",
+ HOMEBREW_CMD_PATH/"#{cmd}.sh",
].find(&:exist?)
end
+
+ def internal_dev_cmd_path(cmd)
+ [
+ HOMEBREW_DEV_CMD_PATH/"#{cmd}.rb",
+ HOMEBREW_DEV_CMD_PATH/"#{cmd}.sh",
+ ].find(&:exist?)
+ end
+
+ # Ruby commands which can be `require`d without being run.
+ def external_ruby_v2_cmd_path(cmd)
+ path = which("#{cmd}.rb", Tap.cmd_directories)
+ path if require?(path)
+ end
+
+ # Ruby commands which are run by being `require`d.
+ def external_ruby_cmd_path(cmd)
+ which("brew-#{cmd}.rb", PATH.new(ENV["PATH"]).append(Tap.cmd_directories))
+ end
+
+ def external_cmd_path(cmd)
+ which("brew-#{cmd}", PATH.new(ENV["PATH"]).append(Tap.cmd_directories))
+ end
+
+ def path(cmd)
+ internal_cmd = HOMEBREW_INTERNAL_COMMAND_ALIASES.fetch(cmd, cmd)
+ path ||= internal_cmd_path(internal_cmd)
+ path ||= internal_dev_cmd_path(internal_cmd)
+ path ||= external_ruby_v2_cmd_path(cmd)
+ path ||= external_ruby_cmd_path(cmd)
+ path ||= external_cmd_path(cmd)
+ path
+ end
+
+ def commands(aliases: false)
+ cmds = internal_commands
+ cmds += internal_developer_commands
+ cmds += external_commands
+ cmds += internal_commands_aliases if aliases
+ cmds.sort
+ end
+
+ def internal_commands_paths
+ find_commands HOMEBREW_CMD_PATH
+ end
+
+ def internal_developer_commands_paths
+ find_commands HOMEBREW_DEV_CMD_PATH
+ end
+
+ def internal_commands
+ find_internal_commands(HOMEBREW_CMD_PATH).map(&:to_s)
+ end
+
+ def internal_developer_commands
+ find_internal_commands(HOMEBREW_DEV_CMD_PATH).map(&:to_s)
+ end
+
+ def internal_commands_aliases
+ HOMEBREW_INTERNAL_COMMAND_ALIASES.keys
+ end
+
+ def find_internal_commands(path)
+ find_commands(path).map(&:basename)
+ .map(&method(:basename_without_extension))
+ end
+
+ def external_commands
+ Tap.cmd_directories.flat_map do |path|
+ find_commands(path).select(&:executable?)
+ .map(&method(:basename_without_extension))
+ .map { |p| p.to_s.sub(/^brew(cask)?-/, '\1 ').strip }
+ end.map(&:to_s)
+ .sort
+ end
+
+ def basename_without_extension(path)
+ path.basename(path.extname)
+ end
+
+ def find_commands(path)
+ Pathname.glob("#{path}/*")
+ .select(&:file?)
+ .sort
+ end
end | true |
Other | Homebrew | brew | 8a9dcad2c708ce945695029c5af79b4b3965a4de.json | Move more command handling logic to commands.rb. | Library/Homebrew/dev-cmd/man.rb | @@ -59,8 +59,8 @@ def build_man_page
template = (SOURCE_PATH/"brew.1.md.erb").read
variables = OpenStruct.new
- variables[:commands] = generate_cmd_manpages("#{HOMEBREW_LIBRARY_PATH}/cmd/*.{rb,sh}")
- variables[:developer_commands] = generate_cmd_manpages("#{HOMEBREW_LIBRARY_PATH}/dev-cmd/{*.rb,sh}")
+ variables[:commands] = generate_cmd_manpages(Commands.internal_commands_paths)
+ variables[:developer_commands] = generate_cmd_manpages(Commands.internal_developer_commands_paths)
variables[:global_options] = global_options_manpage
readme = HOMEBREW_REPOSITORY/"README.md"
@@ -142,8 +142,7 @@ def target_path_to_format(target)
end
end
- def generate_cmd_manpages(glob)
- cmd_paths = Pathname.glob(glob).sort
+ def generate_cmd_manpages(cmd_paths)
man_page_lines = []
man_args = Homebrew.args
# preserve existing manpage order | true |
Other | Homebrew | brew | 8a9dcad2c708ce945695029c5af79b4b3965a4de.json | Move more command handling logic to commands.rb. | Library/Homebrew/global.rb | @@ -115,25 +115,6 @@ def auditing?
nil
end.compact.freeze
-HOMEBREW_INTERNAL_COMMAND_ALIASES = {
- "ls" => "list",
- "homepage" => "home",
- "-S" => "search",
- "up" => "update",
- "ln" => "link",
- "instal" => "install", # gem does the same
- "uninstal" => "uninstall",
- "rm" => "uninstall",
- "remove" => "uninstall",
- "configure" => "diy",
- "abv" => "info",
- "dr" => "doctor",
- "--repo" => "--repository",
- "environment" => "--env",
- "--config" => "config",
- "-v" => "--version",
-}.freeze
-
require "set"
require "extend/pathname" | true |
Other | Homebrew | brew | 8a9dcad2c708ce945695029c5af79b4b3965a4de.json | Move more command handling logic to commands.rb. | Library/Homebrew/help.rb | @@ -42,16 +42,11 @@ module Help
def help(cmd = nil, flags = {})
# Resolve command aliases and find file containing the implementation.
- if cmd
- cmd = HOMEBREW_INTERNAL_COMMAND_ALIASES.fetch(cmd, cmd)
- path = Commands.path(cmd)
- path ||= which("brew-#{cmd}")
- path ||= which("brew-#{cmd}.rb")
- end
+ path = Commands.path(cmd) if cmd
# Display command-specific (or generic) help in response to `UsageError`.
if (error_message = flags[:usage_error])
- $stderr.puts path ? command_help(path) : HOMEBREW_HELP
+ $stderr.puts path ? command_help(cmd, path) : HOMEBREW_HELP
$stderr.puts
onoe error_message
exit 1
@@ -72,24 +67,42 @@ def help(cmd = nil, flags = {})
# Resume execution in `brew.rb` for unknown commands.
return if path.nil?
- # Display help for commands (or generic help if undocumented).
- puts command_help(path)
+ # Display help for internal command (or generic help if undocumented).
+ puts command_help(cmd, path)
exit 0
end
- def command_help(path)
- # Let OptionParser generate help text for commands which have a parser
- if cmd_parser = CLI::Parser.from_cmd_path(path)
- return cmd_parser.generate_help_text
+ def command_help(cmd, path)
+ # Only some types of commands can have a parser.
+ output = if Commands.valid_internal_cmd?(cmd) ||
+ Commands.valid_internal_dev_cmd?(cmd) ||
+ Commands.external_ruby_v2_cmd_path(cmd)
+ parser_help(path)
end
- # Otherwise read #: lines from the file.
- help_lines = command_help_lines(path)
- if help_lines.blank?
+ output ||= comment_help(path)
+
+ output ||= if output.blank?
opoo "No help text in: #{path}" if ARGV.homebrew_developer?
- return HOMEBREW_HELP
+ HOMEBREW_HELP
end
+ output
+ end
+
+ def parser_help(path)
+ # Let OptionParser generate help text for commands which have a parser.
+ cmd_parser = CLI::Parser.from_cmd_path(path)
+ return unless cmd_parser
+
+ cmd_parser.generate_help_text
+ end
+
+ def comment_help(path)
+ # Otherwise read #: lines from the file.
+ help_lines = command_help_lines(path)
+ return if help_lines.blank?
+
Formatter.wrap(help_lines.join.gsub(/^ /, ""), COMMAND_DESC_WIDTH)
.sub("@hide_from_man_page ", "")
.sub(/^\* /, "#{Tty.bold}Usage: brew#{Tty.reset} ") | true |
Other | Homebrew | brew | 8a9dcad2c708ce945695029c5af79b4b3965a4de.json | Move more command handling logic to commands.rb. | Library/Homebrew/test/cmd/commands_spec.rb | @@ -1,6 +1,5 @@
# frozen_string_literal: true
-require "cmd/command"
require "cmd/commands"
require "fileutils"
@@ -18,82 +17,3 @@
.and be_a_success
end
end
-
-RSpec.shared_context "custom internal commands" do
- let(:cmds) do
- [
- # internal commands
- HOMEBREW_LIBRARY_PATH/"cmd/rbcmd.rb",
- HOMEBREW_LIBRARY_PATH/"cmd/shcmd.sh",
-
- # internal developer-commands
- HOMEBREW_LIBRARY_PATH/"dev-cmd/rbdevcmd.rb",
- HOMEBREW_LIBRARY_PATH/"dev-cmd/shdevcmd.sh",
- ]
- end
-
- around do |example|
- cmds.each do |f|
- FileUtils.touch f
- end
-
- example.run
- ensure
- FileUtils.rm_f cmds
- end
-end
-
-describe Homebrew do
- include_context "custom internal commands"
-
- specify "::internal_commands" do
- cmds = described_class.internal_commands
- expect(cmds).to include("rbcmd"), "Ruby commands files should be recognized"
- expect(cmds).to include("shcmd"), "Shell commands files should be recognized"
- expect(cmds).not_to include("rbdevcmd"), "Dev commands shouldn't be included"
- end
-
- specify "::internal_developer_commands" do
- cmds = described_class.internal_developer_commands
- expect(cmds).to include("rbdevcmd"), "Ruby commands files should be recognized"
- expect(cmds).to include("shdevcmd"), "Shell commands files should be recognized"
- expect(cmds).not_to include("rbcmd"), "Non-dev commands shouldn't be included"
- end
-
- specify "::external_commands" do
- mktmpdir do |dir|
- %w[brew-t1 brew-t2.rb brew-t3.py].each do |file|
- path = "#{dir}/#{file}"
- FileUtils.touch path
- FileUtils.chmod 0755, path
- end
-
- FileUtils.touch "#{dir}/brew-t4"
-
- ENV["PATH"] += "#{File::PATH_SEPARATOR}#{dir}"
- cmds = described_class.external_commands
-
- expect(cmds).to include("t1"), "Executable files should be included"
- expect(cmds).to include("t2"), "Executable Ruby files should be included"
- expect(cmds).not_to include("t3"), "Executable files with a non Ruby extension shouldn't be included"
- expect(cmds).not_to include("t4"), "Non-executable files shouldn't be included"
- end
- end
-end
-
-describe Commands do
- include_context "custom internal commands"
-
- describe "::path" do
- specify "returns the path for an internal command" do
- expect(described_class.path("rbcmd")).to eq(HOMEBREW_LIBRARY_PATH/"cmd/rbcmd.rb")
- expect(described_class.path("shcmd")).to eq(HOMEBREW_LIBRARY_PATH/"cmd/shcmd.sh")
- expect(described_class.path("idontexist1234")).to be nil
- end
-
- specify "returns the path for an internal developer-command" do
- expect(described_class.path("rbdevcmd")).to eq(HOMEBREW_LIBRARY_PATH/"dev-cmd/rbdevcmd.rb")
- expect(described_class.path("shdevcmd")).to eq(HOMEBREW_LIBRARY_PATH/"dev-cmd/shdevcmd.sh")
- end
- end
-end | true |
Other | Homebrew | brew | 8a9dcad2c708ce945695029c5af79b4b3965a4de.json | Move more command handling logic to commands.rb. | Library/Homebrew/test/commands_spec.rb | @@ -0,0 +1,80 @@
+# frozen_string_literal: true
+
+require "commands"
+
+RSpec.shared_context "custom internal commands" do
+ let(:cmds) do
+ [
+ # internal commands
+ Commands::HOMEBREW_CMD_PATH/"rbcmd.rb",
+ Commands::HOMEBREW_CMD_PATH/"shcmd.sh",
+
+ # internal developer-commands
+ Commands::HOMEBREW_DEV_CMD_PATH/"rbdevcmd.rb",
+ Commands::HOMEBREW_DEV_CMD_PATH/"shdevcmd.sh",
+ ]
+ end
+
+ around do |example|
+ cmds.each do |f|
+ FileUtils.touch f
+ end
+
+ example.run
+ ensure
+ FileUtils.rm_f cmds
+ end
+end
+
+describe Commands do
+ include_context "custom internal commands"
+
+ specify "::internal_commands" do
+ cmds = described_class.internal_commands
+ expect(cmds).to include("rbcmd"), "Ruby commands files should be recognized"
+ expect(cmds).to include("shcmd"), "Shell commands files should be recognized"
+ expect(cmds).not_to include("rbdevcmd"), "Dev commands shouldn't be included"
+ end
+
+ specify "::internal_developer_commands" do
+ cmds = described_class.internal_developer_commands
+ expect(cmds).to include("rbdevcmd"), "Ruby commands files should be recognized"
+ expect(cmds).to include("shdevcmd"), "Shell commands files should be recognized"
+ expect(cmds).not_to include("rbcmd"), "Non-dev commands shouldn't be included"
+ end
+
+ specify "::external_commands" do
+ mktmpdir do |dir|
+ %w[t0.rb brew-t1 brew-t2.rb brew-t3.py].each do |file|
+ path = "#{dir}/#{file}"
+ FileUtils.touch path
+ FileUtils.chmod 0755, path
+ end
+
+ FileUtils.touch "#{dir}/brew-t4"
+
+ allow(Tap).to receive(:cmd_directories).and_return([dir])
+
+ cmds = described_class.external_commands
+
+ expect(cmds).to include("t0"), "Executable v2 Ruby files should be included"
+ expect(cmds).to include("t1"), "Executable files should be included"
+ expect(cmds).to include("t2"), "Executable Ruby files should be included"
+ expect(cmds).to include("t3"), "Executable files with a Ruby extension should be included"
+ expect(cmds).not_to include("t4"), "Non-executable files shouldn't be included"
+ end
+ end
+
+ describe "::path" do
+ specify "returns the path for an internal command" do
+ expect(described_class.path("rbcmd")).to eq(HOMEBREW_LIBRARY_PATH/"cmd/rbcmd.rb")
+ expect(described_class.path("shcmd")).to eq(HOMEBREW_LIBRARY_PATH/"cmd/shcmd.sh")
+ expect(described_class.path("idontexist1234")).to be nil
+ end
+
+ specify "returns the path for an internal developer-command" do
+ expect(described_class.path("rbdevcmd")).to eq(HOMEBREW_LIBRARY_PATH/"dev-cmd/rbdevcmd.rb")
+ expect(described_class.path("shdevcmd")).to eq(HOMEBREW_LIBRARY_PATH/"dev-cmd/shdevcmd.sh")
+ end
+ end
+end | true |
Other | Homebrew | brew | 82fde4e1e520934635aa9a6212c7954e9d68a134.json | Add stable url, tag and revision to json output | Library/Homebrew/formula.rb | @@ -1626,6 +1626,13 @@ def to_hash
"head" => head&.version&.to_s,
"bottle" => !bottle_specification.checksums.empty?,
},
+ "urls" => {
+ "stable" => {
+ "url" => stable.url,
+ "tag" => stable.specs&.dig(:tag),
+ "revision" => stable.specs&.dig(:revision),
+ },
+ },
"revision" => revision,
"version_scheme" => version_scheme,
"bottle" => {}, | false |
Other | Homebrew | brew | acde828a45c452b54413a3cd711752343e54f3cf.json | ARGV: Replace ARGV.verbose? with Homebrew.args.verbose? | Library/Homebrew/cleaner.rb | @@ -58,7 +58,7 @@ def prune
# actual files gets removed correctly.
dirs.reverse_each do |d|
if d.children.empty?
- puts "rmdir: #{d} (empty)" if ARGV.verbose?
+ puts "rmdir: #{d} (empty)" if Homebrew.args.verbose?
d.rmdir
end
end | true |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.