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 | 84b2276fd866342cd84c6ada8ffc13c5c209c3cf.json | Use guard clauses. | Library/Homebrew/cask/lib/hbc/cli/search.rb | @@ -41,14 +41,15 @@ def self.render_results(exact_match, partial_matches, search_term)
ohai "Exact match"
puts exact_match
end
- unless partial_matches.empty?
- if extract_regexp search_term
- ohai "Regexp matches"
- else
- ohai "Partial matches"
- end
- puts Formatter.columns(partial_matches)
+
+ return if partial_matches.empty?
+
+ if extract_regexp search_term
+ ohai "Regexp matches"
+ else
+ ohai "Partial matches"
end
+ puts Formatter.columns(partial_matches)
end
def self.help | true |
Other | Homebrew | brew | 84b2276fd866342cd84c6ada8ffc13c5c209c3cf.json | Use guard clauses. | Library/Homebrew/cask/lib/hbc/installer.rb | @@ -28,22 +28,21 @@ def initialize(cask, command: SystemCommand, force: false, skip_cask_deps: false
def self.print_caveats(cask)
odebug "Printing caveats"
- unless cask.caveats.empty?
- output = capture_output do
- cask.caveats.each do |caveat|
- if caveat.respond_to?(:eval_and_print)
- caveat.eval_and_print(cask)
- else
- puts caveat
- end
+ return if cask.caveats.empty?
+
+ output = capture_output do
+ cask.caveats.each do |caveat|
+ if caveat.respond_to?(:eval_and_print)
+ caveat.eval_and_print(cask)
+ else
+ puts caveat
end
end
-
- unless output.empty?
- ohai "Caveats"
- puts output
- end
end
+
+ return if output.empty?
+ ohai "Caveats"
+ puts output
end
def self.capture_output(&block) | true |
Other | Homebrew | brew | 84b2276fd866342cd84c6ada8ffc13c5c209c3cf.json | Use guard clauses. | Library/Homebrew/cask/lib/hbc/utils.rb | @@ -137,13 +137,13 @@ def self.method_missing_message(method, token, section = nil)
def self.nowstamp_metadata_path(container_path)
@timenow ||= Time.now.gmtime
- if container_path.respond_to?(:join)
- precision = 3
- timestamp = @timenow.strftime("%Y%m%d%H%M%S")
- fraction = format("%.#{precision}f", @timenow.to_f - @timenow.to_i)[1..-1]
- timestamp.concat(fraction)
- container_path.join(timestamp)
- end
+ return unless container_path.respond_to?(:join)
+
+ precision = 3
+ timestamp = @timenow.strftime("%Y%m%d%H%M%S")
+ fraction = format("%.#{precision}f", @timenow.to_f - @timenow.to_i)[1..-1]
+ timestamp.concat(fraction)
+ container_path.join(timestamp)
end
def self.size_in_bytes(files) | true |
Other | Homebrew | brew | 84b2276fd866342cd84c6ada8ffc13c5c209c3cf.json | Use guard clauses. | Library/Homebrew/cleanup.rb | @@ -10,10 +10,9 @@ def self.cleanup
cleanup_cellar
cleanup_cache
cleanup_logs
- unless ARGV.dry_run?
- cleanup_lockfiles
- rm_ds_store
- end
+ return if ARGV.dry_run?
+ cleanup_lockfiles
+ rm_ds_store
end
def self.update_disk_cleanup_size(path_size) | true |
Other | Homebrew | brew | 84b2276fd866342cd84c6ada8ffc13c5c209c3cf.json | Use guard clauses. | Library/Homebrew/descriptions.rb | @@ -57,42 +57,41 @@ def self.ensure_cache
# If it does exist, but the Report is empty, just touch the cache file.
# Otherwise, use the report to update the cache.
def self.update_cache(report)
- if CACHE_FILE.exist?
- if report.empty?
- FileUtils.touch CACHE_FILE
- else
- renamings = report.select_formula(:R)
- alterations = report.select_formula(:A) + report.select_formula(:M) +
- renamings.map(&:last)
- cache_formulae(alterations, save: false)
- uncache_formulae(report.select_formula(:D) +
- renamings.map(&:first))
- end
+ return unless CACHE_FILE.exist?
+
+ if report.empty?
+ FileUtils.touch CACHE_FILE
+ else
+ renamings = report.select_formula(:R)
+ alterations = report.select_formula(:A) + report.select_formula(:M) +
+ renamings.map(&:last)
+ cache_formulae(alterations, save: false)
+ uncache_formulae(report.select_formula(:D) +
+ renamings.map(&:first))
end
end
# Given an array of formula names, add them and their descriptions to the
# cache. Save the updated cache to disk, unless explicitly told not to.
def self.cache_formulae(formula_names, options = { save: true })
- if cache
- formula_names.each do |name|
- begin
- desc = Formulary.factory(name).desc
- rescue FormulaUnavailableError, *FormulaVersions::IGNORED_EXCEPTIONS
- end
- @cache[name] = desc
+ return unless cache
+
+ formula_names.each do |name|
+ begin
+ desc = Formulary.factory(name).desc
+ rescue FormulaUnavailableError, *FormulaVersions::IGNORED_EXCEPTIONS
end
- save_cache if options[:save]
+ @cache[name] = desc
end
+ save_cache if options[:save]
end
# Given an array of formula names, remove them and their descriptions from
# the cache. Save the updated cache to disk, unless explicitly told not to.
def self.uncache_formulae(formula_names, options = { save: true })
- if cache
- formula_names.each { |name| @cache.delete(name) }
- save_cache if options[:save]
- end
+ return unless cache
+ formula_names.each { |name| @cache.delete(name) }
+ save_cache if options[:save]
end
# Given a regex, find all formulae whose specified fields contain a match. | true |
Other | Homebrew | brew | 84b2276fd866342cd84c6ada8ffc13c5c209c3cf.json | Use guard clauses. | Library/Homebrew/extend/ENV/std.rb | @@ -11,9 +11,8 @@ module Stdenv
DEFAULT_FLAGS = "-march=core2 -msse4".freeze
def self.extended(base)
- unless ORIGINAL_PATHS.include? HOMEBREW_PREFIX/"bin"
- base.prepend_path "PATH", "#{HOMEBREW_PREFIX}/bin"
- end
+ return if ORIGINAL_PATHS.include? HOMEBREW_PREFIX/"bin"
+ base.prepend_path "PATH", "#{HOMEBREW_PREFIX}/bin"
end
# @private | true |
Other | Homebrew | brew | 84b2276fd866342cd84c6ada8ffc13c5c209c3cf.json | Use guard clauses. | Library/Homebrew/sandbox.rb | @@ -27,10 +27,9 @@ def self.test?
end
def self.print_sandbox_message
- unless @printed_sandbox_message
- ohai "Using the sandbox"
- @printed_sandbox_message = true
- end
+ return if @printed_sandbox_message
+ ohai "Using the sandbox"
+ @printed_sandbox_message = true
end
def initialize | true |
Other | Homebrew | brew | d2e2110e80d52e94d84989d71abe9c184d8341f5.json | cc: Add -frounding-math to list of ignored flags | Library/Homebrew/shims/super/cc | @@ -160,7 +160,7 @@ class Cmd
"-fcaller-saves", "-fthread-jumps", "-fno-reorder-blocks", "-fcse-skip-blocks",
"-frerun-cse-after-loop", "-frerun-loop-opt", "-fcse-follow-jumps",
"-fno-regmove", "-fno-for-scope", "-fno-tree-pre", "-fno-tree-dominator-opts",
- "-fuse-linker-plugin"
+ "-fuse-linker-plugin", "-frounding-math"
# clang doesn't support these flags
args << arg unless tool =~ /^clang/
when "--fast-math" | false |
Other | Homebrew | brew | c7be025229dbbe86d85982a135c75b04c9ba00f2.json | CompilerSelector: fix null check, tests | Library/Homebrew/compilers.rb | @@ -122,13 +122,13 @@ def find_compiler
GNU_GCC_VERSIONS.reverse_each do |v|
name = "gcc-#{v}"
version = compiler_version(name)
- yield Compiler.new(name, version) if version
+ yield Compiler.new(name, version) unless version.null?
end
when :llvm
# no-op. DSL supported, compiler is not.
else
version = compiler_version(compiler)
- yield Compiler.new(compiler, version) if version
+ yield Compiler.new(compiler, version) unless version.null?
end
end
end | true |
Other | Homebrew | brew | c7be025229dbbe86d85982a135c75b04c9ba00f2.json | CompilerSelector: fix null check, tests | Library/Homebrew/test/test_compiler_selector.rb | @@ -15,15 +15,17 @@ class CompilerVersions
:clang_build_version
def initialize
- @gcc_4_0_build_version = nil
- @gcc_build_version = 5666
- @clang_build_version = 425
+ @gcc_4_0_build_version = Version::NULL
+ @gcc_build_version = Version.create("5666")
+ @llvm_build_version = Version::NULL
+ @clang_build_version = Version.create("425")
end
def non_apple_gcc_version(name)
case name
- when "gcc-4.8" then "4.8.1"
- when "gcc-4.7" then "4.7.1"
+ when "gcc-4.8" then Version.create("4.8.1")
+ when "gcc-4.7" then Version.create("4.7.1")
+ else Version::NULL
end
end
end
@@ -101,13 +103,13 @@ def test_gcc_precedence
end
def test_missing_gcc
- @versions.gcc_build_version = nil
+ @versions.gcc_build_version = Version::NULL
@f << :clang << :llvm << { gcc: "4.8" } << { gcc: "4.7" }
assert_raises(CompilerSelectionError) { actual_cc }
end
def test_missing_llvm_and_gcc
- @versions.gcc_build_version = nil
+ @versions.gcc_build_version = Version::NULL
@f << :clang << { gcc: "4.8" } << { gcc: "4.7" }
assert_raises(CompilerSelectionError) { actual_cc }
end | true |
Other | Homebrew | brew | d8c19fd7d5f658f17f63f1136de6f80a46be0d76.json | SystemConfig: fix version reporting | Library/Homebrew/system_config.rb | @@ -143,9 +143,9 @@ def dump_verbose_config(f = $stdout)
f.puts "HOMEBREW_BOTTLE_DOMAIN: #{BottleSpecification::DEFAULT_DOMAIN}"
f.puts hardware if hardware
f.puts "Homebrew Ruby: #{describe_homebrew_ruby}"
- f.puts "GCC-4.0: build #{gcc_40}" if gcc_40
- f.puts "GCC-4.2: build #{gcc_42}" if gcc_42
- f.puts "Clang: #{clang ? "#{clang} build #{clang_build}" : "N/A"}"
+ f.puts "GCC-4.0: build #{gcc_40}" unless gcc_40.null?
+ f.puts "GCC-4.2: build #{gcc_42}" unless gcc_42.null?
+ f.puts "Clang: #{clang.null? ? "N/A" : "#{clang} build #{clang_build}"}"
f.puts "Git: #{describe_git}"
f.puts "Perl: #{describe_perl}"
f.puts "Python: #{describe_python}" | false |
Other | Homebrew | brew | 4e3d23ad14b29832f14784939acc5afe2f1b28f8.json | Resource: set version to nil if version is null
Is this the right fix? This fixes version cascading from the parent. | Library/Homebrew/resource.rb | @@ -145,7 +145,10 @@ def url(val = nil, specs = {})
end
def version(val = nil)
- @version ||= detect_version(val)
+ @version ||= begin
+ version = detect_version(val)
+ version.null? ? nil : version
+ end
end
def mirror(val)
@@ -155,7 +158,7 @@ def mirror(val)
private
def detect_version(val)
- return if val.nil? && url.nil?
+ return Version::NULL if val.nil? && url.nil?
case val
when nil then Version.detect(url, specs) | false |
Other | Homebrew | brew | 20bbeb5e9c4cdd5fb5b7cc92b46325d86b543cf8.json | Return compiler versions and builds as Versions | Library/Homebrew/compilers.rb | @@ -14,7 +14,14 @@ module CompilerConstants
class CompilerFailure
attr_reader :name
- attr_rw :version
+
+ def version(val = nil)
+ if val
+ @version = Version.parse(val.to_s)
+ else
+ @version
+ end
+ end
# Allows Apple compiler `fails_with` statements to keep using `build`
# even though `build` and `version` are the same internally
@@ -45,7 +52,7 @@ def self.create(spec, &block)
def initialize(name, version, &block)
@name = name
- @version = version
+ @version = Version.parse(version.to_s)
instance_eval(&block) if block_given?
end
| true |
Other | Homebrew | brew | 20bbeb5e9c4cdd5fb5b7cc92b46325d86b543cf8.json | Return compiler versions and builds as Versions | Library/Homebrew/development_tools.rb | @@ -44,7 +44,9 @@ def default_compiler
def gcc_40_build_version
@gcc_40_build_version ||=
if (path = locate("gcc-4.0"))
- `#{path} --version 2>/dev/null`[/build (\d{4,})/, 1].to_i
+ Version.new `#{path} --version 2>/dev/null`[/build (\d{4,})/, 1].to_i
+ else
+ Version::NULL
end
end
alias gcc_4_0_build_version gcc_40_build_version
@@ -54,7 +56,9 @@ def gcc_42_build_version
begin
gcc = locate("gcc-4.2") || HOMEBREW_PREFIX.join("opt/apple-gcc42/bin/gcc-4.2")
if gcc.exist? && !gcc.realpath.basename.to_s.start_with?("llvm")
- `#{gcc} --version 2>/dev/null`[/build (\d{4,})/, 1].to_i
+ Version.new `#{gcc} --version 2>/dev/null`[/build (\d{4,})/, 1]
+ else
+ Version::NULL
end
end
end
@@ -63,22 +67,30 @@ def gcc_42_build_version
def clang_version
@clang_version ||=
if (path = locate("clang"))
- `#{path} --version`[/(?:clang|LLVM) version (\d\.\d)/, 1]
+ Version.new `#{path} --version`[/(?:clang|LLVM) version (\d\.\d)/, 1]
+ else
+ Version::NULL
end
end
def clang_build_version
@clang_build_version ||=
if (path = locate("clang"))
- `#{path} --version`[/clang-(\d{2,})/, 1].to_i
+ Version.new `#{path} --version`[/clang-(\d{2,})/, 1]
+ else
+ Version::NULL
end
end
def non_apple_gcc_version(cc)
(@non_apple_gcc_version ||= {}).fetch(cc) do
path = HOMEBREW_PREFIX.join("opt", "gcc", "bin", cc)
path = locate(cc) unless path.exist?
- version = `#{path} --version`[/gcc(?:-\d(?:\.\d)? \(.+\))? (\d\.\d\.\d)/, 1] if path
+ version = if path
+ Version.new(`#{path} --version`[/gcc(?:-\d(?:\.\d)? \(.+\))? (\d\.\d\.\d)/, 1])
+ else
+ Version::NULL
+ end
@non_apple_gcc_version[cc] = version
end
end | true |
Other | Homebrew | brew | 7e09379669b8288f280ddf84e2a10a9cf349d038.json | vendor: Update ruby-macho to 0.2.6.
This brings fixes for behavior expected in #1460. | Library/Homebrew/vendor/README.md | @@ -5,7 +5,7 @@ Vendored Dependencies
* [plist](https://github.com/bleything/plist), version 3.1.0
-* [ruby-macho](https://github.com/Homebrew/ruby-macho), version 0.2.5
+* [ruby-macho](https://github.com/Homebrew/ruby-macho), version 0.2.6
## Licenses:
| true |
Other | Homebrew | brew | 7e09379669b8288f280ddf84e2a10a9cf349d038.json | vendor: Update ruby-macho to 0.2.6.
This brings fixes for behavior expected in #1460. | Library/Homebrew/vendor/macho/macho.rb | @@ -13,5 +13,5 @@
# The primary namespace for ruby-macho.
module MachO
# release version
- VERSION = "0.2.5".freeze
+ VERSION = "0.2.6".freeze
end | true |
Other | Homebrew | brew | 7e09379669b8288f280ddf84e2a10a9cf349d038.json | vendor: Update ruby-macho to 0.2.6.
This brings fixes for behavior expected in #1460. | Library/Homebrew/vendor/macho/macho/fat_file.rb | @@ -34,9 +34,7 @@ def initialize(filename)
@filename = filename
@raw_data = File.open(@filename, "rb", &:read)
- @header = populate_fat_header
- @fat_archs = populate_fat_archs
- @machos = populate_machos
+ populate_fields
end
# Initializes a new FatFile instance from a binary string.
@@ -45,9 +43,7 @@ def initialize(filename)
def initialize_from_bin(bin)
@filename = nil
@raw_data = bin
- @header = populate_fat_header
- @fat_archs = populate_fat_archs
- @machos = populate_machos
+ populate_fields
end
# The file's raw fat data.
@@ -122,6 +118,21 @@ def filetype
machos.first.filetype
end
+ # Populate the instance's fields with the raw Fat Mach-O data.
+ # @return [void]
+ # @note This method is public, but should (almost) never need to be called.
+ def populate_fields
+ @header = populate_fat_header
+ @fat_archs = populate_fat_archs
+ @machos = populate_machos
+ end
+
+ # All load commands responsible for loading dylibs in the file's Mach-O's.
+ # @return [Array<MachO::DylibCommand>] an array of DylibCommands
+ def dylib_load_commands
+ machos.map(&:dylib_load_commands).flatten
+ end
+
# The file's dylib ID. If the file is not a dylib, returns `nil`.
# @example
# file.dylib_id # => 'libBar.dylib'
@@ -149,7 +160,7 @@ def change_dylib_id(new_id, options = {})
macho.change_dylib_id(new_id, options)
end
- synchronize_raw_data
+ repopulate_raw_machos
end
alias dylib_id= change_dylib_id
@@ -180,7 +191,7 @@ def change_install_name(old_name, new_name, options = {})
macho.change_install_name(old_name, new_name, options)
end
- synchronize_raw_data
+ repopulate_raw_machos
end
alias change_dylib change_install_name
@@ -206,7 +217,7 @@ def change_rpath(old_path, new_path, options = {})
macho.change_rpath(old_path, new_path, options)
end
- synchronize_raw_data
+ repopulate_raw_machos
end
# Add the given runtime path to the file's Mach-Os.
@@ -221,7 +232,7 @@ def add_rpath(path, options = {})
macho.add_rpath(path, options)
end
- synchronize_raw_data
+ repopulate_raw_machos
end
# Delete the given runtime path from the file's Mach-Os.
@@ -236,7 +247,7 @@ def delete_rpath(path, options = {})
macho.delete_rpath(path, options)
end
- synchronize_raw_data
+ repopulate_raw_machos
end
# Extract a Mach-O with the given CPU type from the file.
@@ -324,6 +335,17 @@ def populate_machos
machos
end
+ # Repopulate the raw Mach-O data with each internal Mach-O object.
+ # @return [void]
+ # @api private
+ def repopulate_raw_machos
+ machos.each_with_index do |macho, i|
+ arch = fat_archs[i]
+
+ @raw_data[arch.offset, arch.size] = macho.serialize
+ end
+ end
+
# Yield each Mach-O object in the file, rescuing and accumulating errors.
# @param options [Hash]
# @option options [Boolean] :strict (true) whether or not to fail loudly
@@ -351,16 +373,5 @@ def each_macho(options = {})
# Non-strict mode: Raise first error if *all* Mach-O slices failed.
raise errors.first if errors.size == machos.size
end
-
- # Synchronize the raw file data with each internal Mach-O object.
- # @return [void]
- # @api private
- def synchronize_raw_data
- machos.each_with_index do |macho, i|
- arch = fat_archs[i]
-
- @raw_data[arch.offset, arch.size] = macho.serialize
- end
- end
end
end | true |
Other | Homebrew | brew | 7e09379669b8288f280ddf84e2a10a9cf349d038.json | vendor: Update ruby-macho to 0.2.6.
This brings fixes for behavior expected in #1460. | Library/Homebrew/vendor/macho/macho/load_commands.rb | @@ -612,52 +612,14 @@ def initialize(view, cmd, cmdsize, init_address, init_module, reserved1,
# A load command containing the address of the dynamic shared library
# initialization routine and an index into the module table for the module
# that defines the routine. Corresponds to LC_ROUTINES_64.
- class RoutinesCommand64 < LoadCommand
- # @return [Fixnum] the address of the initialization routine
- attr_reader :init_address
-
- # @return [Fixnum] the index into the module table that the init routine is defined in
- attr_reader :init_module
-
- # @return [void]
- attr_reader :reserved1
-
- # @return [void]
- attr_reader :reserved2
-
- # @return [void]
- attr_reader :reserved3
-
- # @return [void]
- attr_reader :reserved4
-
- # @return [void]
- attr_reader :reserved5
-
- # @return [void]
- attr_reader :reserved6
-
+ class RoutinesCommand64 < RoutinesCommand
# @see MachOStructure::FORMAT
# @api private
FORMAT = "L=2Q=8".freeze
# @see MachOStructure::SIZEOF
# @api private
SIZEOF = 72
-
- # @api private
- def initialize(view, cmd, cmdsize, init_address, init_module, reserved1,
- reserved2, reserved3, reserved4, reserved5, reserved6)
- super(view, cmd, cmdsize)
- @init_address = init_address
- @init_module = init_module
- @reserved1 = reserved1
- @reserved2 = reserved2
- @reserved3 = reserved3
- @reserved4 = reserved4
- @reserved5 = reserved5
- @reserved6 = reserved6
- end
end
# A load command signifying membership of a subframework containing the name | true |
Other | Homebrew | brew | c5bd5c4aa7f0595c91431407ff5bda4b1938afc3.json | bottle: improve relocatability check
Given how common it is for formulae to hard-code `etc` and `var`, check
for those paths (`/usr/local/etc` and `/usr/local/var`) when determing
relocatability. | Library/Homebrew/dev-cmd/bottle.rb | @@ -251,6 +251,8 @@ def bottle_formula(f)
relocatable = false if keg_contain?(cellar, keg, ignores)
if prefix != prefix_check
relocatable = false if keg_contain_absolute_symlink_starting_with?(prefix, keg)
+ relocatable = false if keg_contain?("#{prefix}/etc", keg, ignores)
+ relocatable = false if keg_contain?("#{prefix}/var", keg, ignores)
end
skip_relocation = relocatable && !keg.require_relocation?
end | false |
Other | Homebrew | brew | 262eaca56e9efbb21a20be2fe83af563c9b9289e.json | diagnostic: add build error checks. | Library/Homebrew/diagnostic.rb | @@ -93,6 +93,10 @@ def fatal_development_tools_checks
%w[
].freeze
end
+
+ def build_error_checks
+ (development_tools_checks + %w[
+ ]).freeze
end
def check_for_installed_developer_tools | true |
Other | Homebrew | brew | 262eaca56e9efbb21a20be2fe83af563c9b9289e.json | diagnostic: add build error checks. | Library/Homebrew/extend/os/mac/diagnostic.rb | @@ -22,6 +22,11 @@ def fatal_development_tools_checks
check_clt_minimum_version
].freeze
end
+
+ def build_error_checks
+ (development_tools_checks + %w[
+ check_for_unsupported_macos
+ ]).freeze
end
def check_for_unsupported_macos | true |
Other | Homebrew | brew | bccd792bbffaf0c219f402d893be4c5c0d284d97.json | diagnostic: add checks for minimum Xcode/CLT versions. | Library/Homebrew/extend/os/mac/diagnostic.rb | @@ -104,6 +104,27 @@ def check_xcode_8_without_clt_on_el_capitan
EOS
end
+ def check_xcode_minimum_version
+ return unless MacOS::Xcode.installed?
+ return unless MacOS::Xcode.minimum_version?
+
+ <<-EOS.undent
+ Your Xcode (#{MacOS::Xcode.version}) is too outdated.
+ Please update to Xcode #{MacOS::Xcode.latest_version} (or delete it).
+ #{MacOS::Xcode.update_instructions}
+ EOS
+ end
+
+ def check_clt_minimum_version
+ return unless MacOS::CLT.installed?
+ return unless MacOS::CLT.minimum_version?
+
+ <<-EOS.undent
+ Your Command Line Tools are too outdated.
+ #{MacOS::CLT.update_instructions}
+ EOS
+ end
+
def check_for_osx_gcc_installer
return unless MacOS.version < "10.7" || ((MacOS::Xcode.version || "0") > "4.1")
return unless DevelopmentTools.clang_version == "2.1" | false |
Other | Homebrew | brew | 4015d0465a975aaac26d5a47395ab61e29d1702f.json | xcode: add checks for Xcode/CLT minimum versions. | Library/Homebrew/os/mac/xcode.rb | @@ -25,6 +25,17 @@ def latest_version
end
end
+ def minimum_version
+ case MacOS.version
+ when "10.12" then "8.0"
+ else "2.0"
+ end
+ end
+
+ def minimum_version?
+ version < minimum_version
+ end
+
def prerelease?
# TODO: bump to version >= "8.3" after Xcode 8.2 is stable.
version >= "8.2"
@@ -205,6 +216,17 @@ def latest_version
end
end
+ def minimum_version
+ case MacOS.version
+ when "10.12" then "8.0.0"
+ else "4.0.0"
+ end
+ end
+
+ def minimum_version?
+ version < minimum_version
+ end
+
def outdated?
if MacOS.version >= :mavericks
version = Utils.popen_read("#{MAVERICKS_PKG_PATH}/usr/bin/clang --version") | false |
Other | Homebrew | brew | bfa19b338518f50ec7e5c2d2ed4919fa50217dee.json | audit: Escape interpolated string in regexp
This avoids issues with names containing special characters like e.g. [
Fixes #1431 | Library/Homebrew/dev-cmd/audit.rb | @@ -741,7 +741,7 @@ def audit_text
end
bin_names.each do |name|
["system", "shell_output", "pipe_output"].each do |cmd|
- if text =~ /(def test|test do).*#{cmd}[\(\s]+['"]#{name}[\s'"]/m
+ if text =~ /(def test|test do).*#{cmd}[\(\s]+['"]#{Regexp.escape name}[\s'"]/m
problem %(fully scope test #{cmd} calls e.g. #{cmd} "\#{bin}/#{name}")
end
end | false |
Other | Homebrew | brew | 0e15ffff627c17b6c83e7424c0f1357e99902802.json | Correct a few typos
...and update man pages where applicable | Library/Homebrew/cask/lib/hbc/utils.rb | @@ -117,7 +117,7 @@ def self.path_occupied?(path)
def self.error_message_with_suggestions
<<-EOS.undent
- Follow the instuctions here:
+ Follow the instructions here:
#{Formatter.url(PREBUG_URL)}
If this doesn’t fix the problem, please report this bug: | true |
Other | Homebrew | brew | 0e15ffff627c17b6c83e7424c0f1357e99902802.json | Correct a few typos
...and update man pages where applicable | Library/Homebrew/cmd/unpack.rb | @@ -6,7 +6,7 @@
#: If `--patch` is passed, patches for <formulae> will be applied to the
#: unpacked source.
#:
-#: If `--git` is passed, a Git repository will be initalized in the unpacked
+#: If `--git` is passed, a Git repository will be initialized in the unpacked
#: source. This is useful for creating patches for the software.
require "stringio" | true |
Other | Homebrew | brew | 0e15ffff627c17b6c83e7424c0f1357e99902802.json | Correct a few typos
...and update man pages where applicable | Library/Homebrew/dev-cmd/audit.rb | @@ -11,7 +11,7 @@
#: connection are run.
#:
#: If `--new-formula` is passed, various additional checks are run that check
-#: if a new formula is eligable for Homebrew. This should be used when creating
+#: if a new formula is eligible for Homebrew. This should be used when creating
#: new formulae and implies `--strict` and `--online`.
#:
#: If `--display-cop-names` is passed, the RuboCop cop name for each violation | true |
Other | Homebrew | brew | 0e15ffff627c17b6c83e7424c0f1357e99902802.json | Correct a few typos
...and update man pages where applicable | Library/Homebrew/download_strategy.rb | @@ -20,7 +20,7 @@ def initialize(name, resource)
def fetch
end
- # Supress output
+ # Suppress output
def shutup!
@shutup = true
end | true |
Other | Homebrew | brew | 0e15ffff627c17b6c83e7424c0f1357e99902802.json | Correct a few typos
...and update man pages where applicable | Library/Homebrew/formula.rb | @@ -1599,7 +1599,7 @@ def test_fixtures(file)
HOMEBREW_LIBRARY_PATH.join("test", "fixtures", file)
end
- # This method is overriden in {Formula} subclasses to provide the installation instructions.
+ # This method is overridden in {Formula} subclasses to provide the installation instructions.
# The sources (from {.url}) are downloaded, hash-checked and
# Homebrew changes into a temporary directory where the
# archive was unpacked or repository cloned. | true |
Other | Homebrew | brew | 0e15ffff627c17b6c83e7424c0f1357e99902802.json | Correct a few typos
...and update man pages where applicable | Library/Homebrew/migrator.rb | @@ -165,7 +165,7 @@ def migrate
rescue Interrupt
ignore_interrupts { backup_oldname }
rescue Exception => e
- onoe "Error occured while migrating."
+ onoe "Error occurred while migrating."
puts e
puts e.backtrace if ARGV.debug?
puts "Backuping..."
@@ -293,7 +293,7 @@ def unlink_oldname_cellar
end
end
- # Backup everything if errors occured while migrating.
+ # Backup everything if errors occurred while migrating.
def backup_oldname
unlink_oldname_opt
unlink_oldname_cellar | true |
Other | Homebrew | brew | 0e15ffff627c17b6c83e7424c0f1357e99902802.json | Correct a few typos
...and update man pages where applicable | docs/brew.1.html | @@ -374,7 +374,7 @@ <h2 id="COMMANDS">COMMANDS</h2>
<p>If <code>--patch</code> is passed, patches for <var>formulae</var> will be applied to the
unpacked source.</p>
-<p>If <code>--git</code> is passed, a Git repository will be initalized in the unpacked
+<p>If <code>--git</code> is passed, a Git repository will be initialized in the unpacked
source. This is useful for creating patches for the software.</p></dd>
<dt><code>unpin</code> <var>formulae</var></dt><dd><p>Unpin <var>formulae</var>, allowing them to be upgraded by <code>brew upgrade</code>. See also
<code>pin</code>.</p></dd>
@@ -447,7 +447,7 @@ <h2 id="DEVELOPER-COMMANDS">DEVELOPER COMMANDS</h2>
connection are run.</p>
<p>If <code>--new-formula</code> is passed, various additional checks are run that check
-if a new formula is eligable for Homebrew. This should be used when creating
+if a new formula is eligible for Homebrew. This should be used when creating
new formulae and implies <code>--strict</code> and <code>--online</code>.</p>
<p>If <code>--display-cop-names</code> is passed, the RuboCop cop name for each violation | true |
Other | Homebrew | brew | 0e15ffff627c17b6c83e7424c0f1357e99902802.json | Correct a few typos
...and update man pages where applicable | 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" "October 2016" "Homebrew" "brew-cask"
+.TH "BREW\-CASK" "1" "November 2016" "Homebrew" "brew-cask"
.
.SH "NAME"
\fBbrew\-cask\fR \- a friendly binary installer for macOS | true |
Other | Homebrew | brew | 0e15ffff627c17b6c83e7424c0f1357e99902802.json | Correct a few typos
...and update man pages where applicable | 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" "October 2016" "Homebrew" "brew"
+.TH "BREW" "1" "November 2016" "Homebrew" "brew"
.
.SH "NAME"
\fBbrew\fR \- The missing package manager for macOS
@@ -518,7 +518,7 @@ Unpack the source files for \fIformulae\fR into subdirectories of the current wo
If \fB\-\-patch\fR is passed, patches for \fIformulae\fR will be applied to the unpacked source\.
.
.IP
-If \fB\-\-git\fR is passed, a Git repository will be initalized in the unpacked source\. This is useful for creating patches for the software\.
+If \fB\-\-git\fR is passed, a Git repository will be initialized in the unpacked source\. This is useful for creating patches for the software\.
.
.TP
\fBunpin\fR \fIformulae\fR
@@ -626,7 +626,7 @@ If \fB\-\-strict\fR is passed, additional checks are run, including RuboCop styl
If \fB\-\-online\fR is passed, additional slower checks that require a network connection are run\.
.
.IP
-If \fB\-\-new\-formula\fR is passed, various additional checks are run that check if a new formula is eligable for Homebrew\. This should be used when creating new formulae and implies \fB\-\-strict\fR and \fB\-\-online\fR\.
+If \fB\-\-new\-formula\fR is passed, various additional checks are run that check if a new formula is eligible for Homebrew\. This should be used when creating new formulae and implies \fB\-\-strict\fR and \fB\-\-online\fR\.
.
.IP
If \fB\-\-display\-cop\-names\fR is passed, the RuboCop cop name for each violation is included in the output\. | true |
Other | Homebrew | brew | f796fe794d2827d61feb4eb7509697f2312ed7d9.json | rubocop: exclude more tap dirs from hash rockets.
This is useful for e.g. homebrew/bundle that doesn't live in just
`cmd`. | Library/.rubocop.yml | @@ -88,7 +88,10 @@ Style/GuardClause:
Style/HashSyntax:
EnforcedStyle: hash_rockets
Exclude:
+ - '**/bin/**/*'
- '**/cmd/**/*'
+ - '**/lib/**/*'
+ - '**/spec/**/*'
# disabled until it respects line length
Style/IfUnlessModifier: | false |
Other | Homebrew | brew | 72f889fef06def94083f4d0457b5729ef151bc16.json | audit: restore check that was lost in #927
This audit check ensures that certain build dependencies
are explicitly marked either as `:build` or `:run`.
It seems to have been lost in #927.
It was also adjusted in #1290. | Library/Homebrew/dev-cmd/audit.rb | @@ -415,6 +415,12 @@ def audit_deps
EOS
when *BUILD_TIME_DEPS
next if dep.build? || dep.run?
+ problem <<-EOS.undent
+ #{dep} dependency should be
+ depends_on "#{dep}" => :build
+ Or if it is indeed a runtime dependency
+ depends_on "#{dep}" => :run
+ EOS
end
end
end | false |
Other | Homebrew | brew | 3396d479d2cc87fed0f9a74f711881ea1784e0d6.json | build: write options to file.
These can be useful for later inspection or upload by `gist-logs` if
there's a failed install and it's unclear from logs alone what options
were used. | Library/Homebrew/build.rb | @@ -132,6 +132,8 @@ def install
else
formula.prefix.mkpath
+ (formula.logs/"00.options.out").write \
+ "#{formula.full_name} #{formula.build.used_options.sort.join(" ")}".strip
formula.install
stdlibs = detect_stdlibs(ENV.compiler) | false |
Other | Homebrew | brew | 9f382bfd538cfdefd17712a19cd426ba4917175e.json | boneyard-formula-pr: add reason argument.
Used to provide a user-facing reason why this formula was boneyarded. | Library/Homebrew/dev-cmd/boneyard-formula-pr.rb | @@ -1,10 +1,12 @@
#: @hide_from_man_page
-#: * `boneyard-formula-pr` [`--dry-run`] [`--local`] <formula-name>:
+#: * `boneyard-formula-pr` [`--dry-run`] [`--local`] [`--reason=<reason>`] <formula-name> :
#: Creates a pull request to boneyard a formula.
#:
#: If `--dry-run` is passed, print what would be done rather than doing it.
#:
#: If `--local` is passed, perform only local operations (i.e. don't push or create PR).
+#:
+#: If `--reason=<reason>` is passed, append this to the commit/PR message.
require "formula"
require "utils/json"
@@ -24,6 +26,7 @@ module Homebrew
def boneyard_formula_pr
local_only = ARGV.include?("--local")
formula = ARGV.formulae.first
+ reason = ARGV.value("reason")
odie "No formula found!" unless formula
formula_relpath = formula.path.relative_path_from(formula.tap.path)
@@ -70,6 +73,9 @@ def boneyard_formula_pr
end
end
branch = "#{formula.name}-boneyard"
+
+ reason = " because #{reason}" if reason
+
if ARGV.dry_run?
puts "cd #{formula.tap.path}"
puts "git checkout --no-track -b #{branch} origin/master"
@@ -80,7 +86,7 @@ def boneyard_formula_pr
puts "hub fork"
puts "hub fork (to read $HUB_REMOTE)"
puts "git push $HUB_REMOTE #{branch}:#{branch}"
- puts "hub pull-request -m $'#{formula.name}: migrate to boneyard\\n\\nCreated with `brew boneyard-formula-pr`.'"
+ puts "hub pull-request -m $'#{formula.name}: migrate to boneyard\\n\\nCreated with `brew boneyard-formula-pr`#{reason}.'"
end
else
cd formula.tap.path
@@ -98,7 +104,7 @@ def boneyard_formula_pr
pr_message = <<-EOS.undent
#{formula.name}: migrate to boneyard
- Created with `brew boneyard-formula-pr`.
+ Created with `brew boneyard-formula-pr`#{reason}.
EOS
pr_url = Utils.popen_read("hub", "pull-request", "-m", pr_message).chomp
end
@@ -120,7 +126,7 @@ def boneyard_formula_pr
puts "hub fork"
puts "hub fork (to read $HUB_REMOTE)"
puts "git push $HUB_REMOTE #{branch}:#{branch}"
- puts "hub pull-request --browse -m $'#{formula.name}: migrate from #{formula.tap.repo}\\n\\nGoes together with $PR_URL\\n\\nCreated with `brew boneyard-formula-pr`.'"
+ puts "hub pull-request --browse -m $'#{formula.name}: migrate from #{formula.tap.repo}\\n\\nGoes together with $PR_URL\\n\\nCreated with `brew boneyard-formula-pr`#{reason}.'"
end
else
cd boneyard_tap.formula_dir
@@ -144,7 +150,7 @@ def boneyard_formula_pr
Goes together with #{pr_url}.
- Created with `brew boneyard-formula-pr`.
+ Created with `brew boneyard-formula-pr`#{reason}.
EOS
end
end | false |
Other | Homebrew | brew | 702345ee67db78d8f2a97f68f4b4bd2803ad8538.json | docs: fix typo for brew missing | Library/Homebrew/cmd/missing.rb | @@ -3,7 +3,7 @@
#: given, check all installed brews.
#:
#: If `--hide=`<hidden> is passed, act as if none of <hidden> are installed.
-#: <hidden> should be a comma-seperated list of formulae.
+#: <hidden> should be a comma-separated list of formulae.
require "formula"
require "tab" | false |
Other | Homebrew | brew | e26750e11290f6b299fcbf8419ac051a985e0e1a.json | superenv: treat timingsafe_bcmp as weak on 10.11
Xcode 8.1 added timingsafe_bcmp to string.h and libsystem_c.tbd,
and 10.12.1 added it to libsystem_c.dylib, but it is not present in
libsystem_c.dylib on 10.11.6 (15G1108).
It may appear in libsystem_c.dylib in a later 10.11 release or it may
be marked weak on 10.11 in a later Xcode release.
Fixes Homebrew/homebrew-core#6344. | Library/Homebrew/extend/os/mac/extend/ENV/super.rb | @@ -98,7 +98,7 @@ def setup_build_environment(formula = nil)
# can't reliably figure this out with Xcode 8 on its own yet.
if MacOS.version == "10.11" && MacOS::Xcode.installed? && MacOS::Xcode.version >= "8.0"
%w[basename_r clock_getres clock_gettime clock_settime dirname_r
- getentropy mkostemp mkostemps].each do |s|
+ getentropy mkostemp mkostemps timingsafe_bcmp].each do |s|
ENV["ac_cv_func_#{s}"] = "no"
end
| false |
Other | Homebrew | brew | a3efe57fd62f587dd0242815cc02296560ec161a.json | docs: remove zmwangx from the list of maintainers | README.md | @@ -40,7 +40,7 @@ This is our PGP key which is valid until May 24, 2017.
## Who Are You?
Homebrew's lead maintainer is [Mike McQuaid](https://github.com/mikemcquaid).
-Homebrew's current maintainers are [Misty De Meo](https://github.com/mistydemeo), [Andrew Janke](https://github.com/apjanke), [Xu Cheng](https://github.com/xu-cheng), [Tomasz Pajor](https://github.com/nijikon), [Josh Hagins](https://github.com/jawshooah), [Baptiste Fontaine](https://github.com/bfontaine), [Zhiming Wang](https://github.com/zmwangx), [Markus Reiter](https://github.com/reitermarkus), [ilovezfs](https://github.com/ilovezfs), [Martin Afanasjew](https://github.com/UniqMartin), [Tom Schoonjans](https://github.com/tschoonj), [Uladzislau Shablinski](https://github.com/vladshablinsky), [Tim Smith](https://github.com/tdsmith) and [Alex Dunn](https://github.com/dunn).
+Homebrew's current maintainers are [Misty De Meo](https://github.com/mistydemeo), [Andrew Janke](https://github.com/apjanke), [Xu Cheng](https://github.com/xu-cheng), [Tomasz Pajor](https://github.com/nijikon), [Josh Hagins](https://github.com/jawshooah), [Baptiste Fontaine](https://github.com/bfontaine), [Markus Reiter](https://github.com/reitermarkus), [ilovezfs](https://github.com/ilovezfs), [Martin Afanasjew](https://github.com/UniqMartin), [Tom Schoonjans](https://github.com/tschoonj), [Uladzislau Shablinski](https://github.com/vladshablinsky), [Tim Smith](https://github.com/tdsmith) and [Alex Dunn](https://github.com/dunn).
Former maintainers with significant contributions include [Dominyk Tiller](https://github.com/DomT4), [Brett Koonce](https://github.com/asparagui), [Jack Nagel](https://github.com/jacknagel), [Adam Vandenberg](https://github.com/adamv) and Homebrew's creator: [Max Howell](https://github.com/mxcl).
| true |
Other | Homebrew | brew | a3efe57fd62f587dd0242815cc02296560ec161a.json | docs: remove zmwangx from the list of maintainers | docs/brew.1.html | @@ -765,7 +765,7 @@ <h2 id="AUTHORS">AUTHORS</h2>
<p>Homebrew's lead maintainer is Mike McQuaid.</p>
-<p>Homebrew's current maintainers are Misty De Meo, Andrew Janke, Xu Cheng, Tomasz Pajor, Josh Hagins, Baptiste Fontaine, Zhiming Wang, Markus Reiter, ilovezfs, Martin Afanasjew, Tom Schoonjans, Uladzislau Shablinski, Tim Smith and Alex Dunn.</p>
+<p>Homebrew's current maintainers are Misty De Meo, Andrew Janke, Xu Cheng, Tomasz Pajor, Josh Hagins, Baptiste Fontaine, Markus Reiter, ilovezfs, Martin Afanasjew, Tom Schoonjans, Uladzislau Shablinski, Tim Smith and Alex Dunn.</p>
<p>Former maintainers with significant contributions include Dominyk Tiller, Brett Koonce, Jack Nagel, Adam Vandenberg and Homebrew's creator: Max Howell.</p>
| true |
Other | Homebrew | brew | a3efe57fd62f587dd0242815cc02296560ec161a.json | docs: remove zmwangx from the list of maintainers | manpages/brew.1 | @@ -1034,7 +1034,7 @@ Homebrew Documentation: \fIhttps://github\.com/Homebrew/brew/blob/master/docs/\f
Homebrew\'s lead maintainer is Mike McQuaid\.
.
.P
-Homebrew\'s current maintainers are Misty De Meo, Andrew Janke, Xu Cheng, Tomasz Pajor, Josh Hagins, Baptiste Fontaine, Zhiming Wang, Markus Reiter, ilovezfs, Martin Afanasjew, Tom Schoonjans, Uladzislau Shablinski, Tim Smith and Alex Dunn\.
+Homebrew\'s current maintainers are Misty De Meo, Andrew Janke, Xu Cheng, Tomasz Pajor, Josh Hagins, Baptiste Fontaine, Markus Reiter, ilovezfs, Martin Afanasjew, Tom Schoonjans, Uladzislau Shablinski, Tim Smith and Alex Dunn\.
.
.P
Former maintainers with significant contributions include Dominyk Tiller, Brett Koonce, Jack Nagel, Adam Vandenberg and Homebrew\'s creator: Max Howell\. | true |
Other | Homebrew | brew | ec83d1decb7cf7166ccf0021f998503975a845f3.json | uninstall: remove more integration tests | Library/Homebrew/test/test_uninstall.rb | @@ -23,44 +23,8 @@ def test_check_for_dependents_when_ignore_dependencies
end
class IntegrationCommandTestUninstall < IntegrationCommandTestCase
- def setup
- super
- @f1_path = setup_test_formula "testball_f1", <<-CONTENT
- def install
- FileUtils.touch prefix/touch("hello")
- end
- CONTENT
- @f2_path = setup_test_formula "testball_f2", <<-CONTENT
- depends_on "testball_f1"
-
- def install
- FileUtils.touch prefix/touch("hello")
- end
- CONTENT
- end
-
- def f1
- Formulary.factory(@f1_path)
- end
-
- def f2
- Formulary.factory(@f2_path)
- end
-
def test_uninstall
- cmd("install", "testball_f2")
- run_as_not_developer do
- assert_match "Refusing to uninstall",
- cmd_fail("uninstall", "testball_f1")
- refute_empty f1.installed_kegs
-
- assert_match "Uninstalling #{f2.rack}",
- cmd("uninstall", "testball_f2")
- assert_empty f2.installed_kegs
-
- assert_match "Uninstalling #{f1.rack}",
- cmd("uninstall", "testball_f1")
- assert_empty f1.installed_kegs
- end
+ cmd("install", testball)
+ assert_match "Uninstalling testball", cmd("uninstall", "--force", testball)
end
end | false |
Other | Homebrew | brew | d0ad09708218bfbffed4857387b259bceba177c2.json | uninstall: remove duplicated method
This was moved to Keg, but looks like I forgot to get rid of it here. | Library/Homebrew/cmd/uninstall.rb | @@ -92,39 +92,6 @@ def check_for_dependents(kegs)
true
end
- # Will return some kegs, and some dependencies, if they're present.
- # For efficiency, we don't bother trying to get complete data.
- def find_some_installed_dependents(kegs)
- kegs.each do |keg|
- dependents = keg.installed_dependents - kegs
- dependents.map! { |d| "#{d.name} #{d.version}" }
- return [keg], dependents if dependents.any?
- end
-
- # Find formulae that didn't have dependencies saved in all of their kegs,
- # so need them to be calculated now.
- #
- # This happens after the initial dependency check because it's sloooow.
- remaining_formulae = Formula.installed.select { |f|
- f.installed_kegs.any? { |k| Tab.for_keg(k).runtime_dependencies.nil? }
- }
-
- keg_names = kegs.map(&:name)
- kegs_by_name = kegs.group_by(&:to_formula)
- remaining_formulae.each do |dependent|
- required = dependent.missing_dependencies(hide: keg_names)
- required.select! do |f|
- kegs_by_name.key?(f)
- end
- next unless required.any?
-
- required_kegs = required.map { |f| kegs_by_name[f].sort_by(&:version).last }
- return required_kegs, [dependent]
- end
-
- nil
- end
-
def rm_pin(rack)
Formulary.from_rack(rack).unpin
rescue | false |
Other | Homebrew | brew | c4c855b9fc8695664a66dd7822a483b91e3e26e3.json | ARGV: extract #values from missing | Library/Homebrew/cmd/missing.rb | @@ -18,10 +18,8 @@ def missing
ARGV.resolved_formulae
end
- hide = (ARGV.value("hide") || "").split(",")
-
ff.each do |f|
- missing = f.missing_dependencies(hide: hide)
+ missing = f.missing_dependencies(hide: ARGV.values("hide"))
next if missing.empty?
print "#{f}: " if ff.size > 1 | true |
Other | Homebrew | brew | c4c855b9fc8695664a66dd7822a483b91e3e26e3.json | ARGV: extract #values from missing | Library/Homebrew/extend/ARGV.rb | @@ -121,6 +121,13 @@ def value(name)
flag_with_value.strip_prefix(arg_prefix) if flag_with_value
end
+ # Returns an array of values that were given as a comma-seperated list.
+ # @see value
+ def values(name)
+ return unless val = value(name)
+ val.split(",")
+ end
+
def force?
flag? "--force"
end | true |
Other | Homebrew | brew | c4c855b9fc8695664a66dd7822a483b91e3e26e3.json | ARGV: extract #values from missing | Library/Homebrew/test/test_ARGV.rb | @@ -62,4 +62,19 @@ def test_flag?
assert !@argv.flag?("--frotz")
assert !@argv.flag?("--debug")
end
+
+ def test_value
+ @argv << "--foo=" << "--bar=ab"
+ assert_equal "", @argv.value("foo")
+ assert_equal "ab", @argv.value("bar")
+ assert_nil @argv.value("baz")
+ end
+
+ def test_values
+ @argv << "--foo=" << "--bar=a" << "--baz=b,c"
+ assert_equal [], @argv.values("foo")
+ assert_equal ["a"], @argv.values("bar")
+ assert_equal ["b", "c"], @argv.values("baz")
+ assert_nil @argv.values("qux")
+ end
end | true |
Other | Homebrew | brew | a4dc835ba06e7d1cd2a6b6b4ffacf4416b35ffea.json | uninstall: call Formula#missing_dependencies directly | Library/Homebrew/cmd/uninstall.rb | @@ -76,7 +76,7 @@ def uninstall
end
def check_for_dependents(kegs)
- return false unless result = find_some_installed_dependents(kegs)
+ return false unless result = Keg.find_some_installed_dependents(kegs)
requireds, dependents = result
@@ -108,8 +108,16 @@ def find_some_installed_dependents(kegs)
remaining_formulae = Formula.installed.select { |f|
f.installed_kegs.any? { |k| Tab.for_keg(k).runtime_dependencies.nil? }
}
- Diagnostic.missing_deps(remaining_formulae, kegs.map(&:name)) do |dependent, required|
- kegs_by_name = kegs.group_by(&:to_formula)
+
+ keg_names = kegs.map(&:name)
+ kegs_by_name = kegs.group_by(&:to_formula)
+ remaining_formulae.each do |dependent|
+ required = dependent.missing_dependencies(hide: keg_names)
+ required.select! do |f|
+ kegs_by_name.key?(f)
+ end
+ next unless required.any?
+
required_kegs = required.map { |f| kegs_by_name[f].sort_by(&:version).last }
return required_kegs, [dependent]
end | true |
Other | Homebrew | brew | a4dc835ba06e7d1cd2a6b6b4ffacf4416b35ffea.json | uninstall: call Formula#missing_dependencies directly | Library/Homebrew/keg.rb | @@ -87,6 +87,41 @@ def to_s; <<-EOS.undent
mime-info pixmaps sounds postgresql
].freeze
+ # Will return some kegs, and some dependencies, if they're present.
+ # For efficiency, we don't bother trying to get complete data.
+ def self.find_some_installed_dependents(kegs)
+ # First, check in the tabs of installed Formulae.
+ kegs.each do |keg|
+ dependents = keg.installed_dependents - kegs
+ dependents.map! { |d| "#{d.name} #{d.version}" }
+ return [keg], dependents if dependents.any?
+ end
+
+ # Some kegs won't have modern Tabs with the dependencies listed.
+ # In this case, fall back to Formula#missing_dependencies.
+
+ # Find formulae that didn't have dependencies saved in all of their kegs,
+ # so need them to be calculated now.
+ #
+ # This happens after the initial dependency check because it's sloooow.
+ remaining_formulae = Formula.installed.select { |f|
+ f.installed_kegs.any? { |k| Tab.for_keg(k).runtime_dependencies.nil? }
+ }
+
+ keg_names = kegs.map(&:name)
+ kegs_by_name = kegs.group_by(&:to_formula)
+ remaining_formulae.each do |dependent|
+ required = dependent.missing_dependencies(hide: keg_names)
+ required.select! { |f| kegs_by_name.key?(f) }
+ next unless required.any?
+
+ required_kegs = required.map { |f| kegs_by_name[f].sort_by(&:version).last }
+ return required_kegs, [dependent]
+ end
+
+ nil
+ end
+
# if path is a file in a keg then this will return the containing Keg object
def self.for(path)
path = path.realpath | true |
Other | Homebrew | brew | a4dc835ba06e7d1cd2a6b6b4ffacf4416b35ffea.json | uninstall: call Formula#missing_dependencies directly | Library/Homebrew/test/test_uninstall.rb | @@ -31,6 +31,32 @@ def test_uninstall
assert_empty Formulary.factory(testball).installed_kegs
end
+ def test_uninstall_with_unrelated_missing_deps_in_tab
+ setup_test_formula "testball"
+ run_as_not_developer do
+ cmd("install", testball)
+ cmd("install", "testball_f2")
+ cmd("uninstall", "--ignore-dependencies", "testball_f1")
+ cmd("uninstall", testball)
+ end
+ end
+
+ def test_uninstall_with_unrelated_missing_deps_not_in_tab
+ setup_test_formula "testball"
+ run_as_not_developer do
+ cmd("install", testball)
+ cmd("install", "testball_f2")
+
+ f2_keg = f2.installed_kegs.first
+ f2_tab = Tab.for_keg(f2_keg)
+ f2_tab.runtime_dependencies = nil
+ f2_tab.write
+
+ cmd("uninstall", "--ignore-dependencies", "testball_f1")
+ cmd("uninstall", testball)
+ end
+ end
+
def test_uninstall_leaving_dependents
cmd("install", "testball_f2")
run_as_not_developer do | true |
Other | Homebrew | brew | 422f38b945ac9f13ea5f9290b022a18c811445e4.json | missing: call Formula#missing_dependencies directly | Library/Homebrew/cmd/missing.rb | @@ -18,8 +18,13 @@ def missing
ARGV.resolved_formulae
end
- Diagnostic.missing_deps(ff, ARGV.value("hide")) do |name, missing|
- print "#{name}: " if ff.size > 1
+ hide = (ARGV.value("hide") || "").split(",")
+
+ ff.each do |f|
+ missing = f.missing_dependencies(hide: hide)
+ next if missing.empty?
+
+ print "#{f}: " if ff.size > 1
puts missing.join(" ")
end
end | false |
Other | Homebrew | brew | c88b67f3a8f7e90ad974eaf82d00fd88827a1e4c.json | missing: simplify code a bit | Library/Homebrew/diagnostic.rb | @@ -8,6 +8,8 @@
module Homebrew
module Diagnostic
def self.missing_deps(ff, hide = nil)
+ hide ||= []
+
missing = {}
ff.each do |f|
missing_deps = f.recursive_dependencies do |dependent, dep|
@@ -20,12 +22,8 @@ def self.missing_deps(ff, hide = nil)
end
missing_deps.map!(&:to_formula)
- if hide
- missing_deps.reject! do |d|
- !hide.include?(d.name) && d.installed_prefixes.any?
- end
- else
- missing_deps.reject! { |d| d.installed_prefixes.any? }
+ missing_deps.reject! do |d|
+ !hide.include?(d.name) && d.installed_prefixes.any?
end
unless missing_deps.empty? | false |
Other | Homebrew | brew | 8e3e8e31c23e5ec6e204ee5462cb9d22119891ee.json | missing: add tests for not missing and hide | Library/Homebrew/test/test_missing.rb | @@ -1,11 +1,34 @@
require "helper/integration_command_test_case"
class IntegrationCommandTestMissing < IntegrationCommandTestCase
- def test_missing
+ def setup
+ super
+
setup_test_formula "foo"
setup_test_formula "bar"
+ end
+
+ def make_prefix(name)
+ (HOMEBREW_CELLAR/name/"1.0").mkpath
+ end
+
+ def test_missing_missing
+ make_prefix "bar"
- (HOMEBREW_CELLAR/"bar/1.0").mkpath
assert_match "foo", cmd("missing")
end
+
+ def test_missing_not_missing
+ make_prefix "foo"
+ make_prefix "bar"
+
+ assert_empty cmd("missing")
+ end
+
+ def test_missing_hide
+ make_prefix "foo"
+ make_prefix "bar"
+
+ assert_match "foo", cmd("missing", "--hide=foo")
+ end
end | false |
Other | Homebrew | brew | 888c44b238b6a5afa705ca46f6a682ac1c4bb729.json | uninstall: fix dependent order bug | Library/Homebrew/cmd/uninstall.rb | @@ -16,7 +16,7 @@ def uninstall
if !ARGV.force?
ARGV.kegs.each do |keg|
- dependents = keg.installed_dependents
+ dependents = keg.installed_dependents - ARGV.kegs
if dependents.any?
dependents_output = dependents.map { |k| "#{k.name} #{k.version}" }.join(", ")
conjugation = dependents.count == 1 ? "is" : "are" | true |
Other | Homebrew | brew | 888c44b238b6a5afa705ca46f6a682ac1c4bb729.json | uninstall: fix dependent order bug | Library/Homebrew/test/test_uninstall.rb | @@ -1,8 +1,43 @@
require "helper/integration_command_test_case"
class IntegrationCommandTestUninstall < IntegrationCommandTestCase
+ def setup
+ super
+ @f1_path = setup_test_formula "testball_f1", <<-CONTENT
+ def install
+ FileUtils.touch prefix/touch("hello")
+ end
+ CONTENT
+ @f2_path = setup_test_formula "testball_f2", <<-CONTENT
+ depends_on "testball_f1"
+
+ def install
+ FileUtils.touch prefix/touch("hello")
+ end
+ CONTENT
+ end
+
def test_uninstall
cmd("install", testball)
assert_match "Uninstalling testball", cmd("uninstall", "--force", testball)
end
+
+ def test_uninstall_leaving_dependents
+ cmd("install", "testball_f2")
+ assert_match "Refusing to uninstall", cmd_fail("uninstall", "testball_f1")
+ assert_match "Uninstalling #{Formulary.factory(@f2_path).rack}",
+ cmd("uninstall", "testball_f2")
+ end
+
+ def test_uninstall_dependent_first
+ cmd("install", "testball_f2")
+ assert_match "Uninstalling #{Formulary.factory(@f1_path).rack}",
+ cmd("uninstall", "testball_f2", "testball_f1")
+ end
+
+ def test_uninstall_dependent_last
+ cmd("install", "testball_f2")
+ assert_match "Uninstalling #{Formulary.factory(@f2_path).rack}",
+ cmd("uninstall", "testball_f1", "testball_f2")
+ end
end | true |
Other | Homebrew | brew | 6a406763f306d88c52729343b4a65e9050f8981f.json | Open incomplete download in append mode
Open the incomplete download in append mode instead of write mode.
Opening in write mode truncates the existing file, so curl keeps
restarting downloads instead of resuming the incomplete downloads. | Library/Homebrew/cask/lib/hbc/download_strategy.rb | @@ -105,7 +105,7 @@ def fetch
else
had_incomplete_download = temporary_path.exist?
begin
- File.open(temporary_path, "w+") do |f|
+ File.open(temporary_path, "a+") do |f|
f.flock(File::LOCK_EX)
_fetch
f.flock(File::LOCK_UN) | false |
Other | Homebrew | brew | 652c5bc865ebda25ead84c5cab04a4688b4e2b9a.json | formula_installer: fix regression in #1253
Apparently `cellar :any_skip_relocation` doesn't actually mean we
can skip relocation, at least for text files. | Library/Homebrew/formula_installer.rb | @@ -762,12 +762,11 @@ def pour
end
keg = Keg.new(formula.prefix)
+ tab = Tab.for_keg(keg)
+ Tab.clear_cache
- unless formula.bottle_specification.skip_relocation?
- tab = Tab.for_keg(keg)
- Tab.clear_cache
- keg.replace_placeholders_with_locations tab.changed_files
- end
+ skip_linkage = formula.bottle_specification.skip_relocation?
+ keg.replace_placeholders_with_locations tab.changed_files, skip_linkage: skip_linkage
Pathname.glob("#{formula.bottle_prefix}/{etc,var}/**/*") do |path|
path.extend(InstallRenamed) | true |
Other | Homebrew | brew | 652c5bc865ebda25ead84c5cab04a4688b4e2b9a.json | formula_installer: fix regression in #1253
Apparently `cellar :any_skip_relocation` doesn't actually mean we
can skip relocation, at least for text files. | Library/Homebrew/keg_relocate.rb | @@ -40,7 +40,7 @@ def replace_locations_with_placeholders
replace_text_in_files(relocation)
end
- def replace_placeholders_with_locations(files)
+ def replace_placeholders_with_locations(files, skip_linkage: false)
relocation = Relocation.new(
old_prefix: PREFIX_PLACEHOLDER,
old_cellar: CELLAR_PLACEHOLDER,
@@ -49,7 +49,7 @@ def replace_placeholders_with_locations(files)
new_cellar: HOMEBREW_CELLAR.to_s,
new_repository: HOMEBREW_REPOSITORY.to_s
)
- relocate_dynamic_linkage(relocation)
+ relocate_dynamic_linkage(relocation) unless skip_linkage
replace_text_in_files(relocation, files: files)
end
| true |
Other | Homebrew | brew | 5b64fa6fb179bee5e45e16bb4f860579d76d4210.json | metafiles: convert Metafiles class to module | Library/Homebrew/metafiles.rb | @@ -1,6 +1,6 @@
require "set"
-class Metafiles
+module Metafiles
# https://github.com/github/markup#markups
EXTENSIONS = Set.new %w[
.adoc .asc .asciidoc .creole .html .markdown .md .mdown .mediawiki .mkdn
@@ -11,12 +11,14 @@ class Metafiles
news notes notice readme todo
].freeze
- def self.list?(file)
+ module_function
+
+ def list?(file)
return false if %w[.DS_Store INSTALL_RECEIPT.json].include?(file)
!copy?(file)
end
- def self.copy?(file)
+ def copy?(file)
file = file.downcase
ext = File.extname(file)
file = File.basename(file, ext) if EXTENSIONS.include?(ext) | false |
Other | Homebrew | brew | 9628a613cfe75669c180bf78d086f0372efce30e.json | metafiles: use Set.new instead of Array#to_set | Library/Homebrew/metafiles.rb | @@ -2,14 +2,14 @@
class Metafiles
# https://github.com/github/markup#markups
- EXTENSIONS = %w[
+ EXTENSIONS = Set.new %w[
.adoc .asc .asciidoc .creole .html .markdown .md .mdown .mediawiki .mkdn
.org .pod .rdoc .rst .rtf .textile .txt .wiki
- ].to_set.freeze
- BASENAMES = %w[
+ ].freeze
+ BASENAMES = Set.new %w[
about authors changelog changes copying copyright history license licence
news notes notice readme todo
- ].to_set.freeze
+ ].freeze
def self.list?(file)
return false if %w[.DS_Store INSTALL_RECEIPT.json].include?(file) | false |
Other | Homebrew | brew | ce33f593b4259d5710cdf36da808be884ddedeef.json | metafiles: convert EXTENSIONS and BASENAMES from Array to Set | Library/Homebrew/metafiles.rb | @@ -1,13 +1,15 @@
+require "set"
+
class Metafiles
# https://github.com/github/markup#markups
EXTENSIONS = %w[
.adoc .asc .asciidoc .creole .html .markdown .md .mdown .mediawiki .mkdn
.org .pod .rdoc .rst .rtf .textile .txt .wiki
- ].freeze
+ ].to_set.freeze
BASENAMES = %w[
about authors changelog changes copying copyright history license licence
news notes notice readme todo
- ].freeze
+ ].to_set.freeze
def self.list?(file)
return false if %w[.DS_Store INSTALL_RECEIPT.json].include?(file) | false |
Other | Homebrew | brew | b2870c2480744aa7d202c4975e3169b05035f7ed.json | hbc/qualified_token: use regex captures instead of String#split | Library/Homebrew/cask/lib/hbc/qualified_token.rb | @@ -2,10 +2,8 @@ module Hbc
module QualifiedToken
def self.parse(arg)
return nil unless arg.is_a?(String)
- return nil unless arg.downcase =~ HOMEBREW_TAP_CASK_REGEX
- # eg caskroom/cask/google-chrome
- # per https://github.com/Homebrew/brew/blob/master/docs/brew-tap.md
- user, repo, token = arg.downcase.split("/")
+ return nil unless match = arg.downcase.match(HOMEBREW_TAP_CASK_REGEX)
+ user, repo, token = match.captures
odebug "[user, repo, token] might be [#{user}, #{repo}, #{token}]"
[user, repo, token]
end | false |
Other | Homebrew | brew | 0b8af5771f590bfb5cea7bccd4bd0fc77a973113.json | Remove duplicate description of <token> | Library/Homebrew/manpages/brew-cask.1.md | @@ -89,9 +89,6 @@ names, and other aspects of this manual are still subject to change.
* `reinstall` <token> [ <token> ...]
Reinstall the given Cask.
- <token> is usually the ID of a Cask as returned by `brew cask search`,
- but see [OTHER WAYS TO SPECIFY A CASK][] for variations.
-
* `search` or `-S` [<text> | /<regexp>/]:
Without argument, display all Casks available for install, otherwise
perform a substring search of known Cask tokens for <text> or, if the | true |
Other | Homebrew | brew | 0b8af5771f590bfb5cea7bccd4bd0fc77a973113.json | Remove duplicate description of <token> | manpages/brew-cask.1 | @@ -79,9 +79,6 @@ If \fItoken\fR is given, summarize the staged files associated with the given Ca
.IP "\(bu" 4
\fBreinstall\fR \fItoken\fR [ \fItoken\fR \.\.\.] Reinstall the given Cask\.
.
-.IP
-\fItoken\fR is usually the ID of a Cask as returned by \fBbrew cask search\fR, but see \fIOTHER WAYS TO SPECIFY A CASK\fR for variations\.
-.
.IP "\(bu" 4
\fBsearch\fR or \fB\-S\fR [\fItext\fR | /\fIregexp\fR/]: Without argument, display all Casks available for install, otherwise perform a substring search of known Cask tokens for \fItext\fR or, if the text is delimited by slashes (/\fIregexp\fR/), it is interpreted as a Ruby regular expression\.
. | true |
Other | Homebrew | brew | 44f1354d63d8c95a61bb12353838c03e9abbebb6.json | hbc/qualified_token: simplify token parsing
- Stop supporting archaic "user-repo/token" syntax
- Move regex for parsing tapped Cask token to tap_constants | Library/Homebrew/cask/lib/hbc/qualified_token.rb | @@ -1,37 +1,11 @@
module Hbc
module QualifiedToken
- REPO_PREFIX = "homebrew-".freeze
-
- # per https://github.com/Homebrew/homebrew/blob/4c7bc9ec3bca729c898ee347b6135ba692ee0274/Library/Homebrew/cmd/tap.rb#L121
- USER_REGEX = /[a-z0-9_\-]+/
-
- # per https://github.com/Homebrew/homebrew/blob/4c7bc9ec3bca729c898ee347b6135ba692ee0274/Library/Homebrew/cmd/tap.rb#L121
- REPO_REGEX = /(?:#{REPO_PREFIX})?\w+/
-
- # per https://github.com/caskroom/homebrew-cask/blob/master/CONTRIBUTING.md#generating-a-token-for-the-cask
- TOKEN_REGEX = /[a-z0-9\-]+/
-
- TAP_REGEX = %r{#{USER_REGEX}[/\-]#{REPO_REGEX}}
-
- QUALIFIED_TOKEN_REGEX = %r{#{TAP_REGEX}/#{TOKEN_REGEX}}
-
def self.parse(arg)
- return nil unless arg.is_a?(String) && arg.downcase =~ /^#{QUALIFIED_TOKEN_REGEX}$/
- path_elements = arg.downcase.split("/")
- if path_elements.count == 2
- # eg phinze-cask/google-chrome.
- # Not certain this form is needed, but it was supported in the past.
- token = path_elements[1]
- dash_elements = path_elements[0].split("-")
- repo = dash_elements.pop
- dash_elements.pop if dash_elements.count > 1 && dash_elements[-1] + "-" == REPO_PREFIX
- user = dash_elements.join("-")
- else
- # eg caskroom/cask/google-chrome
- # per https://github.com/Homebrew/brew/blob/master/docs/brew-tap.md
- user, repo, token = path_elements
- end
- repo.sub!(/^#{REPO_PREFIX}/, "")
+ return nil unless arg.is_a?(String)
+ return nil unless arg.downcase =~ HOMEBREW_TAP_CASK_REGEX
+ # eg caskroom/cask/google-chrome
+ # per https://github.com/Homebrew/brew/blob/master/docs/brew-tap.md
+ user, repo, token = arg.downcase.split("/")
odebug "[user, repo, token] might be [#{user}, #{repo}, #{token}]"
[user, repo, token]
end | true |
Other | Homebrew | brew | 44f1354d63d8c95a61bb12353838c03e9abbebb6.json | hbc/qualified_token: simplify token parsing
- Stop supporting archaic "user-repo/token" syntax
- Move regex for parsing tapped Cask token to tap_constants | Library/Homebrew/tap_constants.rb | @@ -1,5 +1,7 @@
# match taps' formulae, e.g. someuser/sometap/someformula
HOMEBREW_TAP_FORMULA_REGEX = %r{^([\w-]+)/([\w-]+)/([\w+-.@]+)$}
+# match taps' casks, e.g. someuser/sometap/somecask
+HOMEBREW_TAP_CASK_REGEX = %r{^([\w-]+)/([\w-]+)/([a-z0-9\-]+)$}
# match taps' directory paths, e.g. HOMEBREW_LIBRARY/Taps/someuser/sometap
HOMEBREW_TAP_DIR_REGEX = %r{#{Regexp.escape(HOMEBREW_LIBRARY.to_s)}/Taps/([\w-]+)/([\w-]+)}
# match taps' formula paths, e.g. HOMEBREW_LIBRARY/Taps/someuser/sometap/someformula | true |
Other | Homebrew | brew | 95d4a258914867ef6237709dd03971dbec765324.json | Fix linting errors | Library/Homebrew/cask/lib/hbc/cli/reinstall.rb | @@ -14,8 +14,9 @@ def self.install_casks(cask_tokens, force, skip_cask_deps, require_sha)
unless latest_installed_version.nil?
latest_installed_cask_file = installed_cask.metadata_master_container_path
- .join(latest_installed_version.join(File::Separator),
- "Casks", "#{cask_token}.rb")
+ .join(latest_installed_version
+ .join(File::Separator),
+ "Casks", "#{cask_token}.rb")
# use the same cask file that was used for installation, if possible
installed_cask = Hbc.load(latest_installed_cask_file) if latest_installed_cask_file.exist? | false |
Other | Homebrew | brew | 32dc78835db1dff9135c3da9bc577f29469fb059.json | Add documentation for cask reinstall command | Library/Homebrew/manpages/brew-cask.1.md | @@ -86,6 +86,12 @@ names, and other aspects of this manual are still subject to change.
If <token> is given, summarize the staged files associated with the
given Cask.
+ * `reinstall` <token> [ <token> ...]
+ Reinstall the given Cask.
+
+ <token> is usually the ID of a Cask as returned by `brew cask search`,
+ but see [OTHER WAYS TO SPECIFY A CASK][] for variations.
+
* `search` or `-S` [<text> | /<regexp>/]:
Without argument, display all Casks available for install, otherwise
perform a substring search of known Cask tokens for <text> or, if the | true |
Other | Homebrew | brew | 32dc78835db1dff9135c3da9bc577f29469fb059.json | Add documentation for cask reinstall command | manpages/brew-cask.1 | @@ -34,78 +34,68 @@ The tokens returned by \fBsearch\fR are suitable as arguments for most other com
.
.SH "COMMANDS"
.
-.TP
-\fBaudit\fR [ \fItoken\fR \.\.\. ]
-Check the given Casks for installability\. If no tokens are given on the command line, all Casks are audited\.
+.IP "\(bu" 4
+\fBaudit\fR [ \fItoken\fR \.\.\. ]: Check the given Casks for installability\. If no tokens are given on the command line, all Casks are audited\.
.
-.TP
-\fBcat\fR \fItoken\fR [ \fItoken\fR \.\.\. ]
-Dump the given Cask definition file to the standard output\.
+.IP "\(bu" 4
+\fBcat\fR \fItoken\fR [ \fItoken\fR \.\.\. ]: Dump the given Cask definition file to the standard output\.
.
-.TP
-\fBcleanup\fR [\-\-outdated]
-Clean up cached downloads and tracker symlinks\. With \fB\-\-outdated\fR, only clean up cached downloads older than 10 days old\.
+.IP "\(bu" 4
+\fBcleanup\fR [\-\-outdated]: Clean up cached downloads and tracker symlinks\. With \fB\-\-outdated\fR, only clean up cached downloads older than 10 days old\.
.
-.TP
-\fBcreate\fR \fItoken\fR
-Generate a Cask definition file for the Cask identified by \fItoken\fR and open a template for it in your favorite editor\.
+.IP "\(bu" 4
+\fBcreate\fR \fItoken\fR: Generate a Cask definition file for the Cask identified by \fItoken\fR and open a template for it in your favorite editor\.
.
-.TP
-\fBdoctor\fR or \fBdr\fR
-Check for configuration issues\. Can be useful to upload as a gist for developers along with a bug report\.
+.IP "\(bu" 4
+\fBdoctor\fR or \fBdr\fR: Check for configuration issues\. Can be useful to upload as a gist for developers along with a bug report\.
.
-.TP
-\fBedit\fR \fItoken\fR
-Open the given Cask definition file for editing\.
+.IP "\(bu" 4
+\fBedit\fR \fItoken\fR: Open the given Cask definition file for editing\.
.
-.TP
-\fBfetch\fR [\-\-force] \fItoken\fR [ \fItoken\fR \.\.\. ]
-Download remote application files for the given Cask to the local cache\. With \fB\-\-force\fR, force re\-download even if the files are already cached\.
+.IP "\(bu" 4
+\fBfetch\fR [\-\-force] \fItoken\fR [ \fItoken\fR \.\.\. ]: Download remote application files for the given Cask to the local cache\. With \fB\-\-force\fR, force re\-download even if the files are already cached\.
.
-.TP
-\fBhome\fR or \fBhomepage\fR [ \fItoken\fR \.\.\. ]
-Display the homepage associated with a given Cask in a browser\.
+.IP "\(bu" 4
+\fBhome\fR or \fBhomepage\fR [ \fItoken\fR \.\.\. ]: Display the homepage associated with a given Cask in a browser\.
.
.IP
With no arguments, display the project page \fIhttp://caskroom\.io\fR\.
.
-.TP
-\fBinfo\fR or \fBabv\fR \fItoken\fR [ \fItoken\fR \.\.\. ]
-Display information about the given Cask\.
+.IP "\(bu" 4
+\fBinfo\fR or \fBabv\fR \fItoken\fR [ \fItoken\fR \.\.\. ]: Display information about the given Cask\.
.
-.TP
-\fBinstall\fR [\-\-force] [\-\-skip\-cask\-deps] [\-\-require\-sha] \fItoken\fR [ \fItoken\fR \.\.\. ]
-Install the given Cask\. With \fB\-\-force\fR, re\-install even if the Cask appears to be already present\. With \fB\-\-skip\-cask\-deps\fR, skip any Cask dependencies\. \fB\-\-require\-sha\fR will abort installation if the Cask does not have a checksum defined\.
+.IP "\(bu" 4
+\fBinstall\fR [\-\-force] [\-\-skip\-cask\-deps] [\-\-require\-sha] \fItoken\fR [ \fItoken\fR \.\.\. ]: Install the given Cask\. With \fB\-\-force\fR, re\-install even if the Cask appears to be already present\. With \fB\-\-skip\-cask\-deps\fR, skip any Cask dependencies\. \fB\-\-require\-sha\fR will abort installation if the Cask does not have a checksum defined\.
.
.IP
\fItoken\fR is usually the ID of a Cask as returned by \fBbrew cask search\fR, but see \fIOTHER WAYS TO SPECIFY A CASK\fR for variations\.
.
-.TP
-\fBlist\fR or \fBls\fR [\-1] [\-\-versions] [ \fItoken\fR \.\.\. ]
-Without any arguments, list all installed Casks\. With \fB\-1\fR, always format the output in a single column\. With \fB\-\-versions\fR, show all installed versions\.
+.IP "\(bu" 4
+\fBlist\fR or \fBls\fR [\-1] [\-\-versions] [ \fItoken\fR \.\.\. ]: Without any arguments, list all installed Casks\. With \fB\-1\fR, always format the output in a single column\. With \fB\-\-versions\fR, show all installed versions\.
.
.IP
If \fItoken\fR is given, summarize the staged files associated with the given Cask\.
.
-.TP
-\fBsearch\fR or \fB\-S\fR [\fItext\fR | /\fIregexp\fR/]
-Without argument, display all Casks available for install, otherwise perform a substring search of known Cask tokens for \fItext\fR or, if the text is delimited by slashes (/\fIregexp\fR/), it is interpreted as a Ruby regular expression\.
+.IP "\(bu" 4
+\fBreinstall\fR \fItoken\fR [ \fItoken\fR \.\.\.] Reinstall the given Cask\.
.
-.TP
-\fBstyle\fR [\-\-fix] [ \fItoken\fR \.\.\. ]
-Check the given Casks for correct style using RuboCop Cask \fIhttps://github\.com/caskroom/rubocop\-cask\fR\. If no tokens are given on the command line, all Casks are checked\. With \fB\-\-fix\fR, auto\-correct any style errors if possible\.
+.IP
+\fItoken\fR is usually the ID of a Cask as returned by \fBbrew cask search\fR, but see \fIOTHER WAYS TO SPECIFY A CASK\fR for variations\.
.
-.TP
-\fBuninstall\fR or \fBrm\fR or \fBremove\fR [\-\-force] \fItoken\fR [ \fItoken\fR \.\.\. ]
-Uninstall the given Cask\. With \fB\-\-force\fR, uninstall even if the Cask does not appear to be present\.
+.IP "\(bu" 4
+\fBsearch\fR or \fB\-S\fR [\fItext\fR | /\fIregexp\fR/]: Without argument, display all Casks available for install, otherwise perform a substring search of known Cask tokens for \fItext\fR or, if the text is delimited by slashes (/\fIregexp\fR/), it is interpreted as a Ruby regular expression\.
.
-.TP
-\fBupdate\fR
-For convenience\. \fBbrew cask update\fR is a synonym for \fBbrew update\fR\.
+.IP "\(bu" 4
+\fBstyle\fR [\-\-fix] [ \fItoken\fR \.\.\. ]: Check the given Casks for correct style using RuboCop Cask \fIhttps://github\.com/caskroom/rubocop\-cask\fR\. If no tokens are given on the command line, all Casks are checked\. With \fB\-\-fix\fR, auto\-correct any style errors if possible\.
.
-.TP
-\fBzap\fR \fItoken\fR [ \fItoken\fR \.\.\. ]
-Unconditionally remove \fIall\fR files associated with the given Cask\.
+.IP "\(bu" 4
+\fBuninstall\fR or \fBrm\fR or \fBremove\fR [\-\-force] \fItoken\fR [ \fItoken\fR \.\.\. ]: Uninstall the given Cask\. With \fB\-\-force\fR, uninstall even if the Cask does not appear to be present\.
+.
+.IP "\(bu" 4
+\fBupdate\fR: For convenience\. \fBbrew cask update\fR is a synonym for \fBbrew update\fR\.
+.
+.IP "\(bu" 4
+\fBzap\fR \fItoken\fR [ \fItoken\fR \.\.\. ]: Unconditionally remove \fIall\fR files associated with the given Cask\.
.
.IP
Implicitly performs all actions associated with \fBuninstall\fR, even if the Cask does not appear to be currently installed\.
@@ -119,6 +109,8 @@ If the Cask definition contains a \fBzap\fR stanza, performs additional \fBzap\f
.IP
\fB\fBzap\fR may remove files which are shared between applications\.\fR
.
+.IP "" 0
+.
.SH "OPTIONS"
To make these options persistent, see the ENVIRONMENT section, below\.
. | true |
Other | Homebrew | brew | 0b176f9cc8ee4f95271fc398b6e9a521bda9ebdb.json | Add dictionary artifact | Library/Homebrew/cask/lib/hbc/artifact.rb | @@ -2,6 +2,7 @@
require "hbc/artifact/artifact" # generic 'artifact' stanza
require "hbc/artifact/binary"
require "hbc/artifact/colorpicker"
+require "hbc/artifact/dictionary"
require "hbc/artifact/font"
require "hbc/artifact/input_method"
require "hbc/artifact/installer"
@@ -38,6 +39,7 @@ def self.artifacts
Pkg,
Prefpane,
Qlplugin,
+ Dictionary,
Font,
Service,
StageOnly, | true |
Other | Homebrew | brew | 0b176f9cc8ee4f95271fc398b6e9a521bda9ebdb.json | Add dictionary artifact | Library/Homebrew/cask/lib/hbc/artifact/dictionary.rb | @@ -0,0 +1,8 @@
+require "hbc/artifact/moved"
+
+module Hbc
+ module Artifact
+ class Dictionary < Moved
+ end
+ end
+end | true |
Other | Homebrew | brew | 0b176f9cc8ee4f95271fc398b6e9a521bda9ebdb.json | Add dictionary artifact | Library/Homebrew/cask/lib/hbc/cli.rb | @@ -54,6 +54,7 @@ class CLI
"--colorpickerdir=" => :colorpickerdir=,
"--prefpanedir=" => :prefpanedir=,
"--qlplugindir=" => :qlplugindir=,
+ "--dictionarydir=" => :dictionarydir=,
"--fontdir=" => :fontdir=,
"--servicedir=" => :servicedir=,
"--input_methoddir=" => :input_methoddir=, | true |
Other | Homebrew | brew | 0b176f9cc8ee4f95271fc398b6e9a521bda9ebdb.json | Add dictionary artifact | Library/Homebrew/cask/lib/hbc/cli/internal_stanza.rb | @@ -28,6 +28,7 @@ class InternalStanza < InternalUseBase
:artifact,
:prefpane,
:qlplugin,
+ :dictionary,
:font,
:service,
:colorpicker, | true |
Other | Homebrew | brew | 0b176f9cc8ee4f95271fc398b6e9a521bda9ebdb.json | Add dictionary artifact | Library/Homebrew/cask/lib/hbc/dsl.rb | @@ -24,6 +24,7 @@ class DSL
:audio_unit_plugin,
:binary,
:colorpicker,
+ :dictionary,
:font,
:input_method,
:internet_plugin, | true |
Other | Homebrew | brew | 0b176f9cc8ee4f95271fc398b6e9a521bda9ebdb.json | Add dictionary artifact | Library/Homebrew/cask/lib/hbc/locations.rb | @@ -64,6 +64,12 @@ def qlplugindir
@qlplugindir ||= Pathname.new("~/Library/QuickLook").expand_path
end
+ attr_writer :dictionarydir
+
+ def dictionarydir
+ @dictionarydir ||= Pathname.new("~/Library/Dictionaries").expand_path
+ end
+
attr_writer :fontdir
def fontdir | true |
Other | Homebrew | brew | 0b176f9cc8ee4f95271fc398b6e9a521bda9ebdb.json | Add dictionary artifact | Library/Homebrew/cask/test/cask/cli/options_test.rb | @@ -57,6 +57,20 @@
Hbc.colorpickerdir.must_equal Pathname("/some/path/bar")
end
+ it "supports setting the dictionarydir" do
+ Hbc::CLI.process_options %w[help --dictionarydir=/some/path/foo]
+
+ Hbc.dictionarydir.must_equal Pathname("/some/path/foo")
+ end
+
+ it "supports setting the dictionarydir from ENV" do
+ ENV["HOMEBREW_CASK_OPTS"] = "--dictionarydir=/some/path/bar"
+
+ Hbc::CLI.process_options %w[help]
+
+ Hbc.dictionarydir.must_equal Pathname("/some/path/bar")
+ end
+
it "supports setting the fontdir" do
Hbc::CLI.process_options %w[help --fontdir=/some/path/foo]
| true |
Other | Homebrew | brew | 0b176f9cc8ee4f95271fc398b6e9a521bda9ebdb.json | Add dictionary artifact | Library/Homebrew/manpages/brew-cask.1.md | @@ -155,6 +155,9 @@ in a future version.
* `--qlplugindir=<path>`:
Target location for QuickLook Plugins. The default value is `~/Library/QuickLook`.
+ * `--dictionarydir=<path>`:
+ Target location for Dictionaries. The default value is `~/Library/Dictionaries`.
+
* `--fontdir=<path>`:
Target location for Fonts. The default value is `~/Library/Fonts`.
| true |
Other | Homebrew | brew | 0b176f9cc8ee4f95271fc398b6e9a521bda9ebdb.json | Add dictionary artifact | completions/zsh/_brew_cask | @@ -169,6 +169,7 @@ _brew_cask()
'--colorpickerdir=-:Target location for Color Pickers. The default value is ~/Library/ColorPickers.' \
'--prefpanedir=-:Target location for Preference Panes. The default value is ~/Library/PreferencePanes.' \
'--qlplugindir=-:Target location for QuickLook Plugins. The default value is ~/Library/QuickLook.' \
+ '--dictionarydir=-:Target location for Dictionaries. The default value is ~/Library/Dictionaries.' \
'--fontdir=-:Target location for Fonts. The default value is ~/Library/Fonts.' \
'--servicedir=-:Target location for Services. The default value is ~/Library/Services.' \
'--input_methoddir=-:Target location for Input Methods. The default value is ~/Library/Input Methods.' \ | true |
Other | Homebrew | brew | 0b176f9cc8ee4f95271fc398b6e9a521bda9ebdb.json | Add dictionary artifact | manpages/brew-cask.1 | @@ -162,6 +162,10 @@ Target location for Preference Panes\. The default value is \fB~/Library/Prefere
Target location for QuickLook Plugins\. The default value is \fB~/Library/QuickLook\fR\.
.
.TP
+\fB\-\-dictionarydir=<path>\fR
+Target location for Dictionaries\. The default value is \fB~/Library/Dictionaries\fR\.
+.
+.TP
\fB\-\-fontdir=<path>\fR
Target location for Fonts\. The default value is \fB~/Library/Fonts\fR\.
. | true |
Other | Homebrew | brew | cb8af6d751d1c31bc379f96f5aeee9cc84cacf49.json | Fix failing test caused by `repo_info`. | Library/Homebrew/cask/lib/hbc/cli/info.rb | @@ -20,7 +20,7 @@ def self.info(cask)
puts "#{cask.token}: #{cask.version}"
puts Formatter.url(cask.homepage) if cask.homepage
installation_info(cask)
- puts "From: #{Formatter.url(repo_info(cask))}" if repo_info(cask)
+ puts "From: #{Formatter.url(repo_info(cask))}"
name_info(cask)
artifact_info(cask)
Installer.print_caveats(cask)
@@ -53,7 +53,11 @@ def self.name_info(cask)
def self.repo_info(cask)
user, repo, token = QualifiedToken.parse(Hbc.all_tokens.detect { |t| t.split("/").last == cask.token })
remote_tap = Tap.fetch(user, repo)
- return remote_tap.remote.to_s if remote_tap.custom_remote?
+
+ if remote_tap.custom_remote? && !remote_tap.remote.nil?
+ return remote_tap.remote.to_s
+ end
+
"#{remote_tap.default_remote}/blob/master/Casks/#{token}.rb"
end
| true |
Other | Homebrew | brew | cb8af6d751d1c31bc379f96f5aeee9cc84cacf49.json | Fix failing test caused by `repo_info`. | Library/Homebrew/cask/test/cask/cli/info_test.rb | @@ -8,7 +8,7 @@
local-caffeine: 1.2.3
http://example.com/local-caffeine
Not installed
- From: https://github.com/caskroom/homebrew-testcasks/blob/master/Casks/local-caffeine.rb
+ From: https://github.com/caskroom/homebrew-test/blob/master/Casks/local-caffeine.rb
==> Name
None
==> Artifacts
@@ -22,15 +22,15 @@
local-caffeine: 1.2.3
http://example.com/local-caffeine
Not installed
- From: https://github.com/caskroom/homebrew-testcasks/blob/master/Casks/local-caffeine.rb
+ From: https://github.com/caskroom/homebrew-test/blob/master/Casks/local-caffeine.rb
==> Name
None
==> Artifacts
Caffeine.app (app)
local-transmission: 2.61
http://example.com/local-transmission
Not installed
- From: https://github.com/caskroom/homebrew-testcasks/blob/master/Casks/local-transmission.rb
+ From: https://github.com/caskroom/homebrew-test/blob/master/Casks/local-transmission.rb
==> Name
None
==> Artifacts
@@ -58,7 +58,7 @@
with-caveats: 1.2.3
http://example.com/local-caffeine
Not installed
- From: https://github.com/caskroom/homebrew-testcasks/blob/master/Casks/with-caveats.rb
+ From: https://github.com/caskroom/homebrew-test/blob/master/Casks/with-caveats.rb
==> Name
None
==> Artifacts
@@ -84,7 +84,7 @@
with-conditional-caveats: 1.2.3
http://example.com/local-caffeine
Not installed
- From: https://github.com/caskroom/homebrew-testcasks/blob/master/Casks/with-conditional-caveats.rb
+ From: https://github.com/caskroom/homebrew-test/blob/master/Casks/with-conditional-caveats.rb
==> Name
None
==> Artifacts | true |
Other | Homebrew | brew | 827b48912ab0a2d36ca7b29d8bd5849b360c9c6c.json | Avoid empty rescue. | Library/Homebrew/cask/test/cask/cli/install_test.rb | @@ -63,16 +63,20 @@
lambda {
begin
Hbc::CLI::Install.run("googlechrome")
- rescue Hbc::CaskError; end
- }.must_output nil, /No available Cask for googlechrome\. Did you mean:\ngoogle-chrome/
+ rescue Hbc::CaskError
+ nil
+ end
+ }.must_output(nil, /No available Cask for googlechrome\. Did you mean:\ngoogle-chrome/)
end
it "returns multiple suggestions for a Cask fragment" do
lambda {
begin
Hbc::CLI::Install.run("google")
- rescue Hbc::CaskError; end
- }.must_output nil, /No available Cask for google\. Did you mean one of:\ngoogle/
+ rescue Hbc::CaskError
+ nil
+ end
+ }.must_output(nil, /No available Cask for google\. Did you mean one of:\ngoogle/)
end
describe "when no Cask is specified" do | false |
Other | Homebrew | brew | 8c488de3f654af452d1cdfe5be26aca87b29af3c.json | Remove unnecessary string interpolation. | Library/Homebrew/cask/lib/hbc/cli/info.rb | @@ -53,7 +53,7 @@ def self.name_info(cask)
def self.repo_info(cask)
user, repo, token = QualifiedToken.parse(Hbc.all_tokens.detect { |t| t.split("/").last == cask.token })
remote_tap = Tap.fetch(user, repo)
- return "#{remote_tap.remote}" if remote_tap.custom_remote?
+ return remote_tap.remote.to_s if remote_tap.custom_remote?
"#{remote_tap.default_remote}/blob/master/Casks/#{token}.rb"
end
| false |
Other | Homebrew | brew | 15b858ccc4de1e76e8251c69b5f1a30af223d3c3.json | Use double quotes. | Library/Homebrew/cask/spec/formatter_spec.rb | @@ -5,10 +5,10 @@
describe "::columns" do
let(:input) {
[
- 'aa',
- 'bbb',
- 'ccc',
- 'dd'
+ "aa",
+ "bbb",
+ "ccc",
+ "dd",
]
}
subject { described_class.columns(input) } | false |
Other | Homebrew | brew | 783dbcc937b3f8afb79e7e8ff7cb6ff9f591746c.json | Use short-style lambdas. | Library/Homebrew/cask/test/cask/artifact/alt_target_test.rb | @@ -5,7 +5,7 @@
let(:cask) { Hbc.load("with-alt-target") }
let(:install_phase) {
- lambda { Hbc::Artifact::App.new(cask).install_phase }
+ -> { Hbc::Artifact::App.new(cask).install_phase }
}
let(:source_path) { cask.staged_path.join("Caffeine.app") } | true |
Other | Homebrew | brew | 783dbcc937b3f8afb79e7e8ff7cb6ff9f591746c.json | Use short-style lambdas. | Library/Homebrew/cask/test/cask/artifact/app_test.rb | @@ -9,13 +9,8 @@
let(:source_path) { cask.staged_path.join("Caffeine.app") }
let(:target_path) { Hbc.appdir.join("Caffeine.app") }
- let(:install_phase) {
- lambda { app.install_phase }
- }
-
- let(:uninstall_phase) {
- lambda { app.uninstall_phase }
- }
+ let(:install_phase) { -> { app.install_phase } }
+ let(:uninstall_phase) { -> { app.uninstall_phase } }
before do
TestHelper.install_without_artifacts(cask) | true |
Other | Homebrew | brew | 783dbcc937b3f8afb79e7e8ff7cb6ff9f591746c.json | Use short-style lambdas. | Library/Homebrew/cask/test/cask/artifact/generic_artifact_test.rb | @@ -4,7 +4,7 @@
let(:cask) { Hbc.load("with-generic-artifact") }
let(:install_phase) {
- lambda { Hbc::Artifact::Artifact.new(cask).install_phase }
+ -> { Hbc::Artifact::Artifact.new(cask).install_phase }
}
let(:source_path) { cask.staged_path.join("Caffeine.app") } | true |
Other | Homebrew | brew | 783dbcc937b3f8afb79e7e8ff7cb6ff9f591746c.json | Use short-style lambdas. | Library/Homebrew/cask/test/cask/artifact/suite_test.rb | @@ -3,9 +3,7 @@
describe Hbc::Artifact::Suite do
let(:cask) { Hbc.load("with-suite") }
- let(:install_phase) {
- lambda { Hbc::Artifact::Suite.new(cask).install_phase }
- }
+ let(:install_phase) { -> { Hbc::Artifact::Suite.new(cask).install_phase } }
let(:target_path) { Hbc.appdir.join("Caffeine") }
let(:source_path) { cask.staged_path.join("Caffeine") } | true |
Other | Homebrew | brew | 783dbcc937b3f8afb79e7e8ff7cb6ff9f591746c.json | Use short-style lambdas. | Library/Homebrew/cask/test/cask/artifact/two_apps_correct_test.rb | @@ -5,7 +5,7 @@
let(:cask) { Hbc.load("with-two-apps-correct") }
let(:install_phase) {
- lambda { Hbc::Artifact::App.new(cask).install_phase }
+ -> { Hbc::Artifact::App.new(cask).install_phase }
}
let(:source_path_mini) { cask.staged_path.join("Caffeine Mini.app") } | true |
Other | Homebrew | brew | ceec5a82c15cf636c8953da15ae73fbc882c5424.json | Use guard clauses. | Library/Homebrew/cask/lib/hbc/cask.rb | @@ -11,10 +11,9 @@ def initialize(token, sourcefile_path: nil, dsl: nil, &block)
@token = token
@sourcefile_path = sourcefile_path
@dsl = dsl || DSL.new(@token)
- if block_given?
- @dsl.instance_eval(&block)
- @dsl.language_eval
- end
+ return unless block_given?
+ @dsl.instance_eval(&block)
+ @dsl.language_eval
end
DSL::DSL_METHODS.each do |method_name| | false |
Other | Homebrew | brew | 13e3272e37d18f0ad3a6273519958bcada30dbbb.json | Remove Cask’s RuboCop configuration. | Library/.rubocop.yml | @@ -1,5 +1,7 @@
AllCops:
TargetRubyVersion: 2.0
+ Exclude:
+ - '**/Casks/**/*'
Metrics/AbcSize:
Enabled: false | true |
Other | Homebrew | brew | 13e3272e37d18f0ad3a6273519958bcada30dbbb.json | Remove Cask’s RuboCop configuration. | Library/Homebrew/.rubocop.yml | @@ -6,7 +6,7 @@ AllCops:
Include:
- '**/.simplecov'
Exclude:
- - 'cask/**/*'
+ - '**/Casks/**/*'
- '**/vendor/**/*'
# so many of these in formulae but none in here | true |
Other | Homebrew | brew | 13e3272e37d18f0ad3a6273519958bcada30dbbb.json | Remove Cask’s RuboCop configuration. | Library/Homebrew/cask/.rubocop.yml | @@ -1,131 +0,0 @@
-AllCops:
- TargetRubyVersion: 2.0
- Exclude:
- - '**/.simplecov'
- - '**/Casks/**/*'
- - '**/vendor/**/*'
-
-Metrics/AbcSize:
- Enabled: false
-
-Metrics/ClassLength:
- Enabled: false
-
-Metrics/CyclomaticComplexity:
- Enabled: false
-
-Metrics/LineLength:
- Enabled: false
-
-Metrics/MethodLength:
- Enabled: false
-
-Metrics/ModuleLength:
- CountComments: false
- Exclude:
- - 'lib/hbc/locations.rb'
- - 'lib/hbc/macos.rb'
- - 'lib/hbc/utils.rb'
-
-Metrics/PerceivedComplexity:
- Enabled: false
-
-Style/AlignHash:
- EnforcedHashRocketStyle: table
- EnforcedColonStyle: table
-
-Style/BarePercentLiterals:
- EnforcedStyle: percent_q
-
-Style/BlockDelimiters:
- EnforcedStyle: semantic
- FunctionalMethods:
- - expect
- - let
- - let!
- - subject
- - watch
- - inject
- - map
- - map!
- - collect
- - collect!
- - reject
- - reject!
- - delete_if
- - with_object
- ProceduralMethods:
- - after
- - at_exit
- - before
- - benchmark
- - bm
- - bmbm
- - capture_io
- - capture_output
- - capture_subprocess_io
- - chdir
- - context
- - create
- - define_method
- - define_singleton_method
- - each_with_object
- - fork
- - measure
- - new
- - open
- - realtime
- - shutup
- - tap
- - each
- - reverse_each
- IgnoredMethods:
- - it
- - its
- - lambda
- - proc
-
-Style/ClassAndModuleChildren:
- EnforcedStyle: nested
-
-Style/Documentation:
- Enabled: false
-
-Style/FileName:
- Regex: !ruby/regexp /^((([\dA-Z]+|[\da-z]+)(_([\dA-Z]+|[\da-z]+))*|(\-\-)?([\dA-Z]+|[\da-z]+)(-([\dA-Z]+|[\da-z]+))*))(\.rb)?$/
-
-Style/HashSyntax:
- EnforcedStyle: ruby19_no_mixed_keys
-
-Style/IndentArray:
- EnforcedStyle: align_brackets
-
-Style/IndentHash:
- EnforcedStyle: align_braces
-
-Style/PercentLiteralDelimiters:
- PreferredDelimiters:
- '%': '{}'
- '%i': '{}'
- '%q': '{}'
- '%Q': '{}'
- '%r': '{}'
- '%s': '()'
- '%w': '[]'
- '%W': '[]'
- '%x': '()'
-
-Style/RaiseArgs:
- EnforcedStyle: exploded
-
-Style/RegexpLiteral:
- EnforcedStyle: percent_r
-
-Style/StringLiterals:
- EnforcedStyle: double_quotes
-
-Style/StringLiteralsInInterpolation:
- EnforcedStyle: double_quotes
-
-Style/TrailingCommaInLiteral:
- EnforcedStyleForMultiline: comma | true |
Other | Homebrew | brew | 31fb99680026fb285bc69f1641e3fbdbed09ee98.json | Remove unncessary semicolon | Library/Homebrew/cask/lib/hbc/cli/reinstall.rb | @@ -9,7 +9,7 @@ def self.install_casks(cask_tokens, force, skip_cask_deps, require_sha)
if cask.installed?
# use copy of cask for uninstallation to avoid 'No such file or directory' bug
- installed_cask = cask;
+ installed_cask = cask
latest_installed_version = installed_cask.timestamped_versions.last
unless latest_installed_version.nil? | false |
Other | Homebrew | brew | 1d8e59b31f060b6d60a98d888263d2be783637ce.json | dev-cmd/man: use SOURCE_PATH instead of HOMEBREW_LIBRARY
Don't Repeat Yourself. | Library/Homebrew/dev-cmd/man.rb | @@ -41,7 +41,7 @@ def regenerate_man_pages
convert_man_page(markup, TARGET_DOC_PATH/"brew.1.html")
convert_man_page(markup, TARGET_MAN_PATH/"brew.1")
- cask_markup = (HOMEBREW_LIBRARY/"Homebrew/manpages/brew-cask.1.md").read
+ cask_markup = (SOURCE_PATH/"brew-cask.1.md").read
convert_man_page(cask_markup, TARGET_MAN_PATH/"brew-cask.1")
end
| false |
Other | Homebrew | brew | 1f963267b6bd415ce3024bb7860d5253ad8e0132.json | Update Rubocop style.
Another look at the current Rubocop rules and how they fit with our
existing and desired future style. Almost all of these changes were
automatic. Split some rules between formulae/brew where brew doesn't
have millions of cases that need fixed. | Library/.rubocop.yml | @@ -48,6 +48,12 @@ Style/AlignHash:
Style/AlignParameters:
Enabled: false
+Style/BarePercentLiterals:
+ EnforcedStyle: percent_q
+
+Style/BlockDelimiters:
+ EnforcedStyle: line_count_based
+
Style/CaseIndentation:
IndentWhenRelativeTo: end
@@ -76,9 +82,11 @@ Style/FileName:
Style/GuardClause:
Enabled: false
+# depends_on a: :b looks weird in formulae.
Style/HashSyntax:
EnforcedStyle: hash_rockets
+# disabled until it respects line length
Style/IfUnlessModifier:
Enabled: false
@@ -133,24 +141,15 @@ Style/StringLiterals:
Style/StringLiteralsInInterpolation:
EnforcedStyle: double_quotes
-# TODO: enforce when rubocop has shipped this
-# https://github.com/bbatsov/rubocop/pull/3513
Style/TernaryParentheses:
Enabled: false
# makes diffs nicer
Style/TrailingCommaInLiteral:
EnforcedStyleForMultiline: comma
-Style/UnneededCapitalW:
- Enabled: false
-
-# TODO: enforce when rubocop has fixed this
-# https://github.com/bbatsov/rubocop/issues/3516
Style/VariableNumber:
Enabled: false
-# TODO: enforce when rubocop has fixed this
-# https://github.com/bbatsov/rubocop/issues/1543
Style/WordArray:
Enabled: false | true |
Other | Homebrew | brew | 1f963267b6bd415ce3024bb7860d5253ad8e0132.json | Update Rubocop style.
Another look at the current Rubocop rules and how they fit with our
existing and desired future style. Almost all of these changes were
automatic. Split some rules between formulae/brew where brew doesn't
have millions of cases that need fixed. | Library/Homebrew/.rubocop.yml | @@ -9,93 +9,31 @@ AllCops:
- 'cask/**/*'
- '**/vendor/**/*'
+# so many of these in formulae but none in here
+Lint/AmbiguousRegexpLiteral:
+ Enabled: true
+
# `formula do` uses nested method definitions
Lint/NestedMethodDefinition:
Exclude:
- 'test/**/*'
+# so many of these in formulae but none in here
+Lint/ParenthesesAsGroupedExpression:
+ Enabled: false
+
Metrics/ModuleLength:
CountComments: false
Exclude:
- 'cask/lib/hbc/locations.rb'
- 'cask/lib/hbc/macos.rb'
- 'cask/lib/hbc/utils.rb'
-Style/BarePercentLiterals:
- EnforcedStyle: percent_q
-
-Style/BlockDelimiters:
- EnforcedStyle: semantic
- FunctionalMethods:
- - expect
- - find
- - let
- - let!
- - subject
- - watch
- - inject
- - map
- - map!
- - collect
- - collect!
- - reject
- - reject!
- - delete_if
- - with_object
- - popen_read
- ProceduralMethods:
- - after
- - at_exit
- - before
- - benchmark
- - bm
- - bmbm
- - capture_io
- - capture_output
- - capture_subprocess_io
- - chdir
- - context
- - create
- - define_method
- - define_singleton_method
- - fork
- - measure
- - new
- - open
- - realtime
- - shutup
- - tap
- - each
- - each_pair
- - each_with_index
- - reverse_each
- - ignore_interrupts
- IgnoredMethods:
- - each_with_object
- - it
- - its
- - lambda
- - proc
- - formula
- - mock
- - devel
- - stable
- - head
- - assert_raises
- - assert_nothing_raised
- - resource
- - with_build_environment
- - ensure_writable
- - satisfy
- - fetch
- - brew
- - expand
- - env
- - recursive_dependencies
- - trap
- - link_dir
- - with_system_path
+# so many of these in formulae but none in here
+Style/GuardClause:
+ Enabled: true
+# hash-rockets preferred for formulae, a: 1 preferred elsewhere
Style/HashSyntax:
EnforcedStyle: ruby19_no_mixed_keys
@@ -109,4 +47,3 @@ Style/PredicateName:
Exclude:
- 'compat/**/*'
NameWhitelist: is_32_bit?, is_64_bit?
- | true |
Other | Homebrew | brew | 1f963267b6bd415ce3024bb7860d5253ad8e0132.json | Update Rubocop style.
Another look at the current Rubocop rules and how they fit with our
existing and desired future style. Almost all of these changes were
automatic. Split some rules between formulae/brew where brew doesn't
have millions of cases that need fixed. | Library/Homebrew/cmd/missing.rb | @@ -20,7 +20,7 @@ def missing
Diagnostic.missing_deps(ff) do |name, missing|
print "#{name}: " if ff.size > 1
- puts (missing * " ").to_s
+ puts missing.join(" ")
end
end
end | true |
Other | Homebrew | brew | 1f963267b6bd415ce3024bb7860d5253ad8e0132.json | Update Rubocop style.
Another look at the current Rubocop rules and how they fit with our
existing and desired future style. Almost all of these changes were
automatic. Split some rules between formulae/brew where brew doesn't
have millions of cases that need fixed. | Library/Homebrew/cmd/style.rb | @@ -49,7 +49,7 @@ def check_style_impl(files, output_type, options = {})
fix = options[:fix]
Homebrew.install_gem_setup_path! "rubocop", "0.43.0"
- args = %W[
+ args = %w[
--force-exclusion
]
args << "--auto-correct" if fix | true |
Other | Homebrew | brew | 1f963267b6bd415ce3024bb7860d5253ad8e0132.json | Update Rubocop style.
Another look at the current Rubocop rules and how they fit with our
existing and desired future style. Almost all of these changes were
automatic. Split some rules between formulae/brew where brew doesn't
have millions of cases that need fixed. | Library/Homebrew/dev-cmd/audit.rb | @@ -137,7 +137,7 @@ class FormulaAuditor
attr_reader :formula, :text, :problems
- BUILD_TIME_DEPS = %W[
+ BUILD_TIME_DEPS = %w[
autoconf
automake
boost-build
@@ -449,9 +449,8 @@ def audit_options
end
return unless @new_formula
- unless formula.deprecated_options.empty?
- problem "New formulae should not use `deprecated_option`."
- end
+ return if formula.deprecated_options.empty?
+ problem "New formulae should not use `deprecated_option`."
end
def audit_desc | true |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.