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
8b9ac2b2e030a70bd6ee99ac8b0c9b9f92fd621b.json
x11_requirement: remove custom minimum version. This isn't desired or needed. Ensure older code still works, though.
Library/Homebrew/test/x11_requirement_spec.rb
@@ -19,11 +19,6 @@ other = described_class.new("foo") expect(subject).not_to eql(other) end - - it "returns false if the minimum version differs" do - other = described_class.new(default_name, ["2.5"]) - expect(subject).not_to eql(other) - end end describe "#modify_build_environment" do
true
Other
Homebrew
brew
0db069602ec160736e150064894b5e33fefa2373.json
Refactor: Move FormulaAudit.check_http_content to utils/curl
Library/Homebrew/cask/lib/hbc/audit.rb
@@ -2,7 +2,7 @@ require "hbc/download" require "digest" require "utils/git" -require "dev-cmd/audit" +require "utils/curl" module Hbc class Audit @@ -284,7 +284,7 @@ def check_https_availability end def check_url_for_https_availability(url_to_check) - problem = FormulaAuditor.check_http_content(url_to_check.to_s) + problem = curl_check_http_content(url_to_check.to_s) add_error problem unless problem.nil? end
true
Other
Homebrew
brew
0db069602ec160736e150064894b5e33fefa2373.json
Refactor: Move FormulaAudit.check_http_content to utils/curl
Library/Homebrew/dev-cmd/audit.rb
@@ -40,6 +40,7 @@ require "formula" require "formula_versions" require "utils" +require "utils/curl" require "extend/ENV" require "formula_cellar_checks" require "official_taps" @@ -202,98 +203,6 @@ def initialize(formula, options = {}) @specs = %w[stable devel head].map { |s| formula.send(s) }.compact end - def self.check_http_content(url, user_agents: [:default], check_content: false, strict: false, require_http: false) - return unless url.start_with? "http" - - details = nil - user_agent = nil - hash_needed = url.start_with?("http:") && !require_http - user_agents.each do |ua| - details = http_content_headers_and_checksum(url, hash_needed: hash_needed, user_agent: ua) - user_agent = ua - break if details[:status].to_s.start_with?("2") - end - - unless details[:status] - # Hack around https://github.com/Homebrew/brew/issues/3199 - return if MacOS.version == :el_capitan - return "The URL #{url} is not reachable" - end - - unless details[:status].start_with? "2" - return "The URL #{url} is not reachable (HTTP status code #{details[:status]})" - end - - return unless hash_needed - - secure_url = url.sub "http", "https" - secure_details = - http_content_headers_and_checksum(secure_url, hash_needed: true, user_agent: user_agent) - - if !details[:status].to_s.start_with?("2") || - !secure_details[:status].to_s.start_with?("2") - return - end - - etag_match = details[:etag] && - details[:etag] == secure_details[:etag] - content_length_match = - details[:content_length] && - details[:content_length] == secure_details[:content_length] - file_match = details[:file_hash] == secure_details[:file_hash] - - if etag_match || content_length_match || file_match - return "The URL #{url} should use HTTPS rather than HTTP" - end - - return unless check_content - - no_protocol_file_contents = %r{https?:\\?/\\?/} - details[:file] = details[:file].gsub(no_protocol_file_contents, "/") - secure_details[:file] = secure_details[:file].gsub(no_protocol_file_contents, "/") - - # Check for the same content after removing all protocols - if details[:file] == secure_details[:file] - return "The URL #{url} should use HTTPS rather than HTTP" - end - - return unless strict - - # Same size, different content after normalization - # (typical causes: Generated ID, Timestamp, Unix time) - if details[:file].length == secure_details[:file].length - return "The URL #{url} may be able to use HTTPS rather than HTTP. Please verify it in a browser." - end - - lenratio = (100 * secure_details[:file].length / details[:file].length).to_i - return unless (90..110).cover?(lenratio) - "The URL #{url} may be able to use HTTPS rather than HTTP. Please verify it in a browser." - end - - def self.http_content_headers_and_checksum(url, hash_needed: false, user_agent: :default) - max_time = hash_needed ? "600" : "25" - output, = curl_output( - "--connect-timeout", "15", "--include", "--max-time", max_time, "--location", url, - user_agent: user_agent - ) - - status_code = :unknown - while status_code == :unknown || status_code.to_s.start_with?("3") - headers, _, output = output.partition("\r\n\r\n") - status_code = headers[%r{HTTP\/.* (\d+)}, 1] - end - - output_hash = Digest::SHA256.digest(output) if hash_needed - - { - status: status_code, - etag: headers[%r{ETag: ([wW]\/)?"(([^"]|\\")*)"}, 2], - content_length: headers[/Content-Length: (\d+)/, 1], - file_hash: output_hash, - file: output, - } - end - def audit_style return unless @style_offenses display_cop_names = ARGV.include?("--display-cop-names") @@ -558,10 +467,10 @@ def audit_homepage return unless @online return unless DevelopmentTools.curl_handles_most_https_certificates? - if http_content_problem = FormulaAuditor.check_http_content(homepage, - user_agents: [:browser, :default], - check_content: true, - strict: @strict) + if http_content_problem = curl_check_http_content(homepage, + user_agents: [:browser, :default], + check_content: true, + strict: @strict) problem http_content_problem end end @@ -1037,7 +946,7 @@ def audit_urls # A `brew mirror`'ed URL is usually not yet reachable at the time of # pull request. next if url =~ %r{^https://dl.bintray.com/homebrew/mirror/} - if http_content_problem = FormulaAuditor.check_http_content(url, require_http: curl_openssl_or_deps) + if http_content_problem = curl_check_http_content(url, require_http: curl_openssl_or_deps) problem http_content_problem end elsif strategy <= GitDownloadStrategy
true
Other
Homebrew
brew
0db069602ec160736e150064894b5e33fefa2373.json
Refactor: Move FormulaAudit.check_http_content to utils/curl
Library/Homebrew/utils/curl.rb
@@ -59,3 +59,95 @@ def curl_download(*args, to: nil, continue_at: "-", **options) def curl_output(*args, **options) Open3.capture3(*curl_args(*args, show_output: true, **options)) end + +def curl_check_http_content(url, user_agents: [:default], check_content: false, strict: false, require_http: false) + return unless url.start_with? "http" + + details = nil + user_agent = nil + hash_needed = url.start_with?("http:") && !require_http + user_agents.each do |ua| + details = curl_http_content_headers_and_checksum(url, hash_needed: hash_needed, user_agent: ua) + user_agent = ua + break if details[:status].to_s.start_with?("2") + end + + unless details[:status] + # Hack around https://github.com/Homebrew/brew/issues/3199 + return if MacOS.version == :el_capitan + return "The URL #{url} is not reachable" + end + + unless details[:status].start_with? "2" + return "The URL #{url} is not reachable (HTTP status code #{details[:status]})" + end + + return unless hash_needed + + secure_url = url.sub "http", "https" + secure_details = + curl_http_content_headers_and_checksum(secure_url, hash_needed: true, user_agent: user_agent) + + if !details[:status].to_s.start_with?("2") || + !secure_details[:status].to_s.start_with?("2") + return + end + + etag_match = details[:etag] && + details[:etag] == secure_details[:etag] + content_length_match = + details[:content_length] && + details[:content_length] == secure_details[:content_length] + file_match = details[:file_hash] == secure_details[:file_hash] + + if etag_match || content_length_match || file_match + return "The URL #{url} should use HTTPS rather than HTTP" + end + + return unless check_content + + no_protocol_file_contents = %r{https?:\\?/\\?/} + details[:file] = details[:file].gsub(no_protocol_file_contents, "/") + secure_details[:file] = secure_details[:file].gsub(no_protocol_file_contents, "/") + + # Check for the same content after removing all protocols + if details[:file] == secure_details[:file] + return "The URL #{url} should use HTTPS rather than HTTP" + end + + return unless strict + + # Same size, different content after normalization + # (typical causes: Generated ID, Timestamp, Unix time) + if details[:file].length == secure_details[:file].length + return "The URL #{url} may be able to use HTTPS rather than HTTP. Please verify it in a browser." + end + + lenratio = (100 * secure_details[:file].length / details[:file].length).to_i + return unless (90..110).cover?(lenratio) + "The URL #{url} may be able to use HTTPS rather than HTTP. Please verify it in a browser." +end + +def curl_http_content_headers_and_checksum(url, hash_needed: false, user_agent: :default) + max_time = hash_needed ? "600" : "25" + output, = curl_output( + "--connect-timeout", "15", "--include", "--max-time", max_time, "--location", url, + user_agent: user_agent + ) + + status_code = :unknown + while status_code == :unknown || status_code.to_s.start_with?("3") + headers, _, output = output.partition("\r\n\r\n") + status_code = headers[%r{HTTP\/.* (\d+)}, 1] + end + + output_hash = Digest::SHA256.digest(output) if hash_needed + + { + status: status_code, + etag: headers[%r{ETag: ([wW]\/)?"(([^"]|\\")*)"}, 2], + content_length: headers[/Content-Length: (\d+)/, 1], + file_hash: output_hash, + file: output, + } +end
true
Other
Homebrew
brew
5ed5e500e5680bb2276320070ce685f04df33c55.json
Reuse FormulaAuditor to check Cask's URLs
Library/Homebrew/cask/lib/hbc/audit.rb
@@ -2,6 +2,7 @@ require "hbc/download" require "digest" require "utils/git" +require "dev-cmd/audit" module Hbc class Audit @@ -277,75 +278,14 @@ def core_formula_url end def check_https_availability - check_url_for_https_availability(cask.homepage) unless cask.url.to_s.empty? + check_url_for_https_availability(cask.url) unless cask.url.to_s.empty? check_url_for_https_availability(cask.appcast) unless cask.appcast.to_s.empty? check_url_for_https_availability(cask.homepage) unless cask.homepage.to_s.empty? end def check_url_for_https_availability(url_to_check) - if schema_http?(url_to_check) - result, effective_url = access_url(url_to_check.sub(/^http:/, 'https:')) - if schema_https?(effective_url) && result == 1 - add_error "Change #{url_to_check} to #{url_to_check.sub(/^http:/, 'https:')}" - else - result, effective_url = access_url(url_to_check) - - if result == 0 - add_error "URL is not reachable #{url_to_check}" - end - end - else - result, effective_url = access_url(url_to_check) - if result == 1 && schema_https?(effective_url) - return - else - result, effective_url = access_url(url_to_check.sub(/^https:/, 'http:')) - if result == 1 && schema_http?(effective_url) - add_error "Change #{url_to_check} to #{url_to_check.sub(/^https:/, 'http:')}" - else - add_error "URL is not reachable #{url_to_check}" - end - end - end - end - - def access_url(url_to_access) - # return values: - # 1, effective URL : URL reachable, no schema change - # 0, nil : URL unreachable - # -1, effective URL : URL reachable, but schema changed - - curl_executable, *args = curl_args( - "--compressed", "--location", "--fail", - "--write-out", "%{http_code} %{url_effective}", - "--output", "/dev/null", "--head", - url_to_access, - user_agent: :fake - ) - result = @command.run(curl_executable, args: args, print_stderr: false) - if result.success? - http_code, url_effective = result.stdout.chomp.split(' ') - odebug "input: #{url_to_access} effective: #{url_effective} code: #{http_code}" - - # Fail if return code not 2XX or 3XX - return 0, nil if http_code.to_i < 200 && http_code.to_i > 300 - - # Fail if URL schema changed - # ([4] is either http[s]:// or http[:]// ) - return -1, url_effective if url_to_access[4] != url_effective[4] - - return 1, url_effective - else - return 0, nil - end - end - - def schema_http?(url) - url[/^http:/] ? 1 : nil - end - - def schema_https?(url) - url[/^https:/] ? 1 : nil + problem = FormulaAuditor.check_http_content(url_to_check.to_s) + add_error problem unless problem.nil? end def check_download
false
Other
Homebrew
brew
e363889d27bb7fddaea513fb733c3c050d3af144.json
Add audit check for URL schema
Library/Homebrew/cask/lib/hbc/audit.rb
@@ -30,6 +30,7 @@ def run! check_url check_generic_artifacts check_token_conflicts + check_https_availability check_download check_single_pre_postflight check_single_uninstall_zap @@ -275,6 +276,78 @@ def core_formula_url "#{core_tap.default_remote}/blob/master/Formula/#{cask.token}.rb" end + def check_https_availability + check_url_for_https_availability(cask.homepage) unless cask.url.to_s.empty? + check_url_for_https_availability(cask.appcast) unless cask.appcast.to_s.empty? + check_url_for_https_availability(cask.homepage) unless cask.homepage.to_s.empty? + end + + def check_url_for_https_availability(url_to_check) + if schema_http?(url_to_check) + result, effective_url = access_url(url_to_check.sub(/^http:/, 'https:')) + if schema_https?(effective_url) && result == 1 + add_error "Change #{url_to_check} to #{url_to_check.sub(/^http:/, 'https:')}" + else + result, effective_url = access_url(url_to_check) + + if result == 0 + add_error "URL is not reachable #{url_to_check}" + end + end + else + result, effective_url = access_url(url_to_check) + if result == 1 && schema_https?(effective_url) + return + else + result, effective_url = access_url(url_to_check.sub(/^https:/, 'http:')) + if result == 1 && schema_http?(effective_url) + add_error "Change #{url_to_check} to #{url_to_check.sub(/^https:/, 'http:')}" + else + add_error "URL is not reachable #{url_to_check}" + end + end + end + end + + def access_url(url_to_access) + # return values: + # 1, effective URL : URL reachable, no schema change + # 0, nil : URL unreachable + # -1, effective URL : URL reachable, but schema changed + + curl_executable, *args = curl_args( + "--compressed", "--location", "--fail", + "--write-out", "%{http_code} %{url_effective}", + "--output", "/dev/null", + url_to_access, + user_agent: :fake + ) + result = @command.run(curl_executable, args: args, print_stderr: false) + if result.success? + http_code, url_effective = result.stdout.chomp.split(' ') + odebug "input: #{url_to_access} effective: #{url_effective} code: #{http_code}" + + # Fail if return code not 2XX or 3XX + return 0, nil if http_code.to_i < 200 && http_code.to_i > 300 + + # Fail if URL schema changed + # ([4] is either http[s]:// or http[:]// ) + return -1, url_effective if url_to_access[4] != url_effective[4] + + return 1, url_effective + else + return 0, nil + end + end + + def schema_http?(url) + url[/^http:/] ? 1 : nil + end + + def schema_https?(url) + url[/^https:/] ? 1 : nil + end + def check_download return unless download && cask.url odebug "Auditing download"
false
Other
Homebrew
brew
9d1573c0405ead882a38d2bb70cfd66f76c06ccf.json
Fix unused variable.
Library/Homebrew/compat/hbc/cli.rb
@@ -11,7 +11,7 @@ class CLI EOS end) - option "--caskroom=PATH", (lambda do |value| + option "--caskroom=PATH", (lambda do |*| odisabled "`brew cask` with the `--caskroom` flag" end) end
false
Other
Homebrew
brew
cf892c432ef12bffd01518a4fa507ae277056c63.json
Revert extra deletion
Library/Homebrew/cmd/install.rb
@@ -328,6 +328,7 @@ def install_formula(f) fi = FormulaInstaller.new(f) fi.options = build_options.used_options fi.invalid_option_names = build_options.invalid_option_names + fi.ignore_deps = ARGV.ignore_deps? fi.only_deps = ARGV.only_deps? fi.build_bottle = ARGV.build_bottle? fi.interactive = ARGV.interactive?
false
Other
Homebrew
brew
06b9f1c50d62b8f60cf80e407492a3b202e67096.json
config: Print the linked_version [Linux] Otherwise when the keg was installed but out-of-date, it would display "N/A".
Library/Homebrew/extend/os/linux/system_config.rb
@@ -20,11 +20,9 @@ def host_gcc_version `#{gcc} --version 2>/dev/null`[/ (\d+\.\d+\.\d+)/, 1] end - def formula_version(formula) + def formula_linked_version(formula) return "N/A" unless CoreTap.instance.installed? - f = Formulary.factory formula - return "N/A" unless f.installed? - f.version + Formulary.factory(formula).linked_version || "N/A" rescue FormulaUnavailableError return "N/A" end @@ -35,7 +33,7 @@ def dump_verbose_config(out = $stdout) out.puts "OS: #{host_os_version}" out.puts "/usr/bin/gcc: #{host_gcc_version}" ["glibc", "gcc", "xorg"].each do |f| - out.puts "#{f}: #{formula_version f}" + out.puts "#{f}: #{formula_linked_version f}" end end end
false
Other
Homebrew
brew
7c6d2c95f6055dce5a946d985cf4248166ec5513.json
Fix a test failure when svn is not installed
Library/Homebrew/test/utils/svn_spec.rb
@@ -7,7 +7,11 @@ end it "returns svn version if svn available" do - expect(described_class.svn_available?).to be_truthy + if File.executable? "/usr/bin/svn" + expect(described_class.svn_available?).to be_truthy + else + expect(described_class.svn_available?).to be_falsey + end end end
false
Other
Homebrew
brew
fb85ed01bc170e389dd62a2a2872d962b7dad5a6.json
lines_cop: Convert ARGV audit to negative look ahead
Library/Homebrew/rubocops/extend/formula_cop.rb
@@ -127,6 +127,22 @@ def find_instance_method_call(node, instance, method_name) end end + # Matches receiver part of method, + # EX: to match `ARGV.<whatever>()` + # call `find_instance_call(node, "ARGV")` + # yields to a block with parent node of receiver + def find_instance_call(node, name) + node.each_descendant(:send) do |method_node| + next if method_node.receiver.nil? + next if method_node.receiver.const_name != name && + method_node.receiver.method_name != name + @offense_source_range = method_node.receiver.source_range + @offensive_node = method_node.receiver + return true unless block_given? + yield method_node + end + end + # Returns nil if does not depend on dependency_name # args: node - dependency_name - dependency's name def depends_on?(dependency_name, *types)
true
Other
Homebrew
brew
fb85ed01bc170e389dd62a2a2872d962b7dad5a6.json
lines_cop: Convert ARGV audit to negative look ahead
Library/Homebrew/rubocops/lines_cop.rb
@@ -162,10 +162,9 @@ def audit_formula(_node, _class_node, _parent_class_node, body_node) end end - [:debug?, :verbose?, :value].each do |method_name| - find_instance_method_call(body_node, "ARGV", method_name) do - problem "Use build instead of ARGV to check options" - end + find_instance_call(body_node, "ARGV") do |method_node| + next if [:debug?, :verbose?, :value].index(method_node.method_name) + problem "Use build instead of ARGV to check options" end find_instance_method_call(body_node, :man, :+) do |method|
true
Other
Homebrew
brew
fb85ed01bc170e389dd62a2a2872d962b7dad5a6.json
lines_cop: Convert ARGV audit to negative look ahead
Library/Homebrew/test/rubocops/lines_cop_spec.rb
@@ -541,13 +541,12 @@ class Foo < Formula end it "Using ARGV to check options" do - expect_offense(<<~RUBY) + expect_no_offenses(<<~RUBY) class Foo < Formula desc "foo" url 'http://example.com/foo-1.0.tgz' def install verbose = ARGV.verbose? - ^^^^^^^^^^^^^ Use build instead of ARGV to check options end end RUBY @@ -739,6 +738,7 @@ class Foo < Formula test do head = ARGV.include? "--HEAD" ^^^^^^ Use "if build.head?" instead + ^^^^ Use build instead of ARGV to check options end end RUBY
true
Other
Homebrew
brew
0ce7a74c585eb01df60f1e9d353825d90bd3d969.json
Hardware::CPU: Implement OS-agnostic methods
Library/Homebrew/extend/os/linux/hardware/cpu.rb
@@ -1,26 +1,13 @@ module Hardware class CPU class << self - def universal_archs - [].extend ArchitectureListExtension - end - def cpuinfo @cpuinfo ||= File.read("/proc/cpuinfo") end - def type - @type ||= if cpuinfo =~ /Intel|AMD/ - :intel - elsif cpuinfo =~ /ARM|Marvell/ - :arm - else - :dunno - end - end - def family return :arm if arm? + return :ppc if ppc? return :dunno unless intel? # See https://software.intel.com/en-us/articles/intel-architecture-and-processor-identification-with-cpuid-model-and-family-numbers cpu_family = cpuinfo[/^cpu family\s*: ([0-9]+)/, 1].to_i @@ -70,12 +57,9 @@ def family end end - def cores - cpuinfo.scan(/^processor/).size - end - def flags - @flags ||= cpuinfo[/^(flags|Features).*/, 0].split + @flags ||= cpuinfo[/^(flags|Features).*/, 0]&.split + @flags ||= [] end # Compatibility with Mac method, which returns lowercase symbols @@ -95,12 +79,6 @@ def sse3? def sse4? flags.include? "sse4_1" end - - alias is_64_bit? lm? - - def bits - is_64_bit? ? 64 : 32 - end end end end
true
Other
Homebrew
brew
0ce7a74c585eb01df60f1e9d353825d90bd3d969.json
Hardware::CPU: Implement OS-agnostic methods
Library/Homebrew/extend/os/mac/hardware/cpu.rb
@@ -75,22 +75,6 @@ def extmodel sysctl_int("machdep.cpu.extmodel") end - def cores - sysctl_int("hw.ncpu") - end - - def bits - sysctl_bool("hw.cpu64bit_capable") ? 64 : 32 - end - - def arch_32_bit - intel? ? :i386 : :ppc - end - - def arch_64_bit - intel? ? :x86_64 : :ppc64 - end - # Returns an array that's been extended with ArchitectureListExtension, # which provides helpers like #as_arch_flags and #as_cmake_arch_flags. def universal_archs
true
Other
Homebrew
brew
0ce7a74c585eb01df60f1e9d353825d90bd3d969.json
Hardware::CPU: Implement OS-agnostic methods
Library/Homebrew/hardware.rb
@@ -19,16 +19,48 @@ def optimization_flags end def arch_32_bit - :i386 + if arm? + :arm + elsif intel? + :i386 + elsif ppc? + :ppc32 + else + :dunno + end end def arch_64_bit - :x86_64 + if arm? + :arm64 + elsif intel? + :x86_64 + elsif ppc? + :ppc64 + else + :dunno + end + end + + def arch + case bits + when 32 + arch_32_bit + when 64 + arch_64_bit + else + :dunno + end + end + + def universal_archs + [arch].extend ArchitectureListExtension end def type case RUBY_PLATFORM when /x86_64/, /i\d86/ then :intel + when /arm/ then :arm when /ppc\d+/ then :ppc else :dunno end @@ -39,13 +71,16 @@ def family end def cores - 1 + return @cores if @cores + @cores = Utils.popen_read("getconf", "_NPROCESSORS_ONLN").chomp.to_i + @cores = 1 unless $CHILD_STATUS.success? + @cores end def bits - case RUBY_PLATFORM - when /x86_64/, /ppc64/ then 64 - when /i\d86/, /ppc/ then 32 + @bits ||= case RUBY_PLATFORM + when /x86_64/, /ppc64/, /aarch64|arm64/ then 64 + when /i\d86/, /ppc/, /arm/ then 32 end end
true
Other
Homebrew
brew
36c0dbfe13d6185d34a35a1a386d95a3a4046a30.json
Simplify `PATH` usage in `Formula`.
Library/Homebrew/formula.rb
@@ -1622,7 +1622,7 @@ def run_test TEMP: HOMEBREW_TEMP, TMP: HOMEBREW_TEMP, TERM: "dumb", - PATH: PATH.new(ENV["PATH"]).append(HOMEBREW_PREFIX/"bin"), + PATH: PATH.new(ENV["PATH"], HOMEBREW_PREFIX/"bin"), HOMEBREW_PATH: nil, _JAVA_OPTIONS: "#{ENV["_JAVA_OPTIONS"]} -Duser.home=#{HOMEBREW_CACHE}/java_cache", }
false
Other
Homebrew
brew
8bbe9b744f627f1b3741b4b667e64ed797e6323a.json
hooks/bottles: remove bottle hooks. These were removed from Boxen in: https://github.com/boxen/puppet-homebrew/pull/108
Library/Homebrew/formula_installer.rb
@@ -9,7 +9,6 @@ require "formula_cellar_checks" require "install_renamed" require "cmd/postinstall" -require "hooks/bottles" require "debrew" require "sandbox" require "emoji" @@ -81,8 +80,6 @@ def build_bottle? end def pour_bottle?(install_bottle_options = { warn: false }) - return true if Homebrew::Hooks::Bottles.formula_has_bottle?(formula) - return false if @pour_failed return false if !formula.bottled? && !formula.local_bottle_path @@ -855,10 +852,6 @@ def post_install end def pour - if Homebrew::Hooks::Bottles.formula_has_bottle?(formula) - return if Homebrew::Hooks::Bottles.pour_formula_bottle(formula) - end - if (bottle_path = formula.local_bottle_path) downloader = LocalBottleDownloadStrategy.new(bottle_path) else
true
Other
Homebrew
brew
8bbe9b744f627f1b3741b4b667e64ed797e6323a.json
hooks/bottles: remove bottle hooks. These were removed from Boxen in: https://github.com/boxen/puppet-homebrew/pull/108
Library/Homebrew/hooks/bottles.rb
@@ -1,35 +0,0 @@ -# Boxen (and perhaps others) want to override our bottling infrastructure so -# they can avoid declaring checksums in formulae files. -# Instead of periodically breaking their monkeypatches let's add some hooks that -# we can query to allow their own behaviour. - -# PLEASE DO NOT EVER RENAME THIS CLASS OR ADD/REMOVE METHOD ARGUMENTS! -module Homebrew - module Hooks - module Bottles - def self.setup_formula_has_bottle(&block) - @has_bottle = block - true - end - - def self.setup_pour_formula_bottle(&block) - @pour_bottle = block - true - end - - def self.formula_has_bottle?(formula) - return false unless @has_bottle - @has_bottle.call formula - end - - def self.pour_formula_bottle(formula) - return false unless @pour_bottle - @pour_bottle.call formula - end - - def self.reset_hooks - @has_bottle = @pour_bottle = nil - end - end - end -end
true
Other
Homebrew
brew
8bbe9b744f627f1b3741b4b667e64ed797e6323a.json
hooks/bottles: remove bottle hooks. These were removed from Boxen in: https://github.com/boxen/puppet-homebrew/pull/108
Library/Homebrew/test/bottle_hooks_spec.rb
@@ -1,51 +0,0 @@ -require "formula_installer" -require "hooks/bottles" - -describe Homebrew::Hooks::Bottles do - alias_matcher :pour_bottle, :be_pour_bottle - - subject { FormulaInstaller.new formula } - - let(:formula) do - double( - bottled?: false, - local_bottle_path: nil, - bottle_disabled?: false, - some_random_method: true, - keg_only?: false, - ) - end - - after(:each) do - described_class.reset_hooks - end - - describe "#setup_formula_has_bottle" do - context "given a block which evaluates to true" do - before(:each) do - described_class.setup_formula_has_bottle(&:some_random_method) - end - - it { is_expected.to pour_bottle } - end - - context "given a block which evaluates to false" do - before(:each) do - described_class.setup_formula_has_bottle { |f| !f.some_random_method } - end - - it { is_expected.not_to pour_bottle } - end - end - - describe "#setup_pour_formula_bottle" do - before(:each) do - described_class.setup_formula_has_bottle { true } - described_class.setup_pour_formula_bottle(&:some_random_method) - end - - it "does not raise an error" do - expect { subject.pour }.not_to raise_error - end - end -end
true
Other
Homebrew
brew
022303f96c6226001308b994ad68b460f5df579b.json
Unify proxy documentation. Specify under the list of environment variables how to set each of those that we passthrough and use.
Library/Homebrew/manpages/brew.1.md.erb
@@ -235,20 +235,26 @@ can take several different forms: * `HOMEBREW_VERBOSE`: If set, Homebrew always assumes `--verbose` when running commands. -## USING HOMEBREW BEHIND A PROXY + * `http_proxy`: + Sets the HTTP proxy to be used by `curl`, `git` and `svn` when downloading + through Homebrew. + + * `https_proxy`: + Sets the HTTPS proxy to be used by `curl`, `git` and `svn` when downloading + through Homebrew. -Homebrew uses several commands for downloading files (e.g. `curl`, `git`, `svn`). -Many of these tools can download via a proxy. It's common for these tools -to read proxy parameters from environment variables. + * `ftp_proxy`: + Sets the FTP proxy to be used by `curl`, `git` and `svn` when downloading + through Homebrew. -For the majority of cases setting `http_proxy` is enough. You can set this in -your shell profile, or you can use it before a brew command: +## USING HOMEBREW BEHIND A PROXY +Use the `http_proxy`, `https_proxy` and/or `ftp_proxy` documented above. For example for an unauthenticated HTTP proxy: - http_proxy=http://<host>:<port> brew install foo + export http_proxy=http://<host>:<port> -If your proxy requires authentication: +And for an authenticated HTTP proxy: - http_proxy=http://<user>:<password>@<host>:<port> brew install foo + export http_proxy=http://<user>:<password>@<host>:<port> ## SEE ALSO
true
Other
Homebrew
brew
022303f96c6226001308b994ad68b460f5df579b.json
Unify proxy documentation. Specify under the list of environment variables how to set each of those that we passthrough and use.
docs/Manpage.md
@@ -1077,20 +1077,26 @@ can take several different forms: * `HOMEBREW_VERBOSE`: If set, Homebrew always assumes `--verbose` when running commands. -## USING HOMEBREW BEHIND A PROXY + * `http_proxy`: + Sets the HTTP proxy to be used by `curl`, `git` and `svn` when downloading + through Homebrew. + + * `https_proxy`: + Sets the HTTPS proxy to be used by `curl`, `git` and `svn` when downloading + through Homebrew. -Homebrew uses several commands for downloading files (e.g. `curl`, `git`, `svn`). -Many of these tools can download via a proxy. It's common for these tools -to read proxy parameters from environment variables. + * `ftp_proxy`: + Sets the FTP proxy to be used by `curl`, `git` and `svn` when downloading + through Homebrew. -For the majority of cases setting `http_proxy` is enough. You can set this in -your shell profile, or you can use it before a brew command: +## USING HOMEBREW BEHIND A PROXY +Use the `http_proxy`, `https_proxy` and/or `ftp_proxy` documented above. For example for an unauthenticated HTTP proxy: - http_proxy=http://`host`:`port` brew install foo + export http_proxy=http://`host`:`port` -If your proxy requires authentication: +And for an authenticated HTTP proxy: - http_proxy=http://`user`:`password`@`host`:`port` brew install foo + export http_proxy=http://`user`:`password`@`host`:`port` ## SEE ALSO
true
Other
Homebrew
brew
022303f96c6226001308b994ad68b460f5df579b.json
Unify proxy documentation. Specify under the list of environment variables how to set each of those that we passthrough and use.
docs/Tips-N'-Tricks.md
@@ -55,23 +55,6 @@ run `mv the_tarball $(brew --cache -s <formula>)`. You can also pre-cache the download by using the command `brew fetch formula` which also displays the SHA-256 hash. This can be useful for updating formulae to new versions. -## Using Homebrew behind a proxy -Behind the scenes, Homebrew uses several commands for downloading files (e.g. `curl`, `git`, `svn`). Many of these tools can download via a proxy. It's a common (though not universal) convention for these command-line tools to observe getting the proxy parameters from environment variables (e.g. `http_proxy`). Unfortunately, most tools are inconsistent in their use of these environment parameters (e.g. `curl` supports `http_proxy`, `HTTPS_PROXY`, `FTP_PROXY`, `GOPHER_PROXY`, `ALL_PROXY`, `NO_PROXY`). - -Luckily, for the majority of cases setting `http_proxy` is enough. -You can set this environment variable in several ways (search on the -internet for details), including at runtime: - -```sh -http_proxy=http://<proxyhost>:<proxyport> brew install <formula> -``` - -To use proxy authentication: - -```sh -http_proxy=http://<user>:<password>@<proxyhost>:<proxyport> brew install <formula> -``` - ## Installing stuff without the Xcode CLT ```sh
true
Other
Homebrew
brew
022303f96c6226001308b994ad68b460f5df579b.json
Unify proxy documentation. Specify under the list of environment variables how to set each of those that we passthrough and use.
manpages/brew.1
@@ -1104,30 +1104,39 @@ This issue typically occurs when using FileVault or custom SSD configurations\. \fBHOMEBREW_VERBOSE\fR If set, Homebrew always assumes \fB\-\-verbose\fR when running commands\. . -.SH "USING HOMEBREW BEHIND A PROXY" -Homebrew uses several commands for downloading files (e\.g\. \fBcurl\fR, \fBgit\fR, \fBsvn\fR)\. Many of these tools can download via a proxy\. It\'s common for these tools to read proxy parameters from environment variables\. +.TP +\fBhttp_proxy\fR +Sets the HTTP proxy to be used by \fBcurl\fR, \fBgit\fR and \fBsvn\fR when downloading through Homebrew\. . -.P -For the majority of cases setting \fBhttp_proxy\fR is enough\. You can set this in your shell profile, or you can use it before a brew command: +.TP +\fBhttps_proxy\fR +Sets the HTTPS proxy to be used by \fBcurl\fR, \fBgit\fR and \fBsvn\fR when downloading through Homebrew\. +. +.TP +\fBftp_proxy\fR +Sets the FTP proxy to be used by \fBcurl\fR, \fBgit\fR and \fBsvn\fR when downloading through Homebrew\. +. +.SH "USING HOMEBREW BEHIND A PROXY" +Use the \fBhttp_proxy\fR, \fBhttps_proxy\fR and/or \fBftp_proxy\fR documented above\. For example for an unauthenticated HTTP proxy: . .IP "" 4 . .nf -http_proxy=http://<host>:<port> brew install foo +export http_proxy=http://<host>:<port> . .fi . .IP "" 0 . .P -If your proxy requires authentication: +And for an authenticated HTTP proxy: . .IP "" 4 . .nf -http_proxy=http://<user>:<password>@<host>:<port> brew install foo +export http_proxy=http://<user>:<password>@<host>:<port> . .fi .
true
Other
Homebrew
brew
74433968f61bd6098fed0ecd663bccbd0d69bd35.json
version/null: add to_i method. Fixes #3504.
Library/Homebrew/version/null.rb
@@ -30,6 +30,10 @@ def to_f Float::NAN end + def to_i + 0 + end + def to_s "" end
false
Other
Homebrew
brew
959f54d3ce3e3945cf8dca3b1c5ff7a23f310809.json
bin/brew: add lowercase variants.
bin/brew
@@ -88,8 +88,8 @@ then PATH="/usr/bin:/bin:/usr/sbin:/sbin" FILTERED_ENV=() - for VAR in HOME SHELL PATH TERM LOGNAME USER CI TRAVIS SUDO_ASKPASS - http_proxy HTTPS_PROXY FTP_PROXY \ + for VAR in HOME SHELL PATH TERM LOGNAME USER CI TRAVIS SUDO_ASKPASS \ + http_proxy https_proxy ftp_proxy HTTPS_PROXY FTP_PROXY \ "${!HOMEBREW_@}" "${!TRAVIS_@}" "${!JENKINS_@}" do # Skip if variable value is empty.
false
Other
Homebrew
brew
5d449cf34e659dfc21ef67fbc4a0dbc70718e904.json
Fix external Cask commands.
Library/Homebrew/cask/lib/hbc/cli.rb
@@ -113,9 +113,9 @@ def self.run_command(command, *args) # other Ruby libraries must do everything via "require" klass.run(*args) end - elsif which("brewcask-#{command}") + elsif external_command = which("brewcask-#{command}", ENV["HOMEBREW_PATH"]) # arbitrary external executable on PATH, Homebrew-style - exec "brewcask-#{command}", *ARGV[1..-1] + exec external_command, *ARGV[1..-1] elsif Pathname.new(command.to_s).executable? && command.to_s.include?("/") && !command.to_s.match(/\.rb$/)
false
Other
Homebrew
brew
9227c8fe3c09cecf551cca060ee45c37cfc30be6.json
Try #2 at handling backed up Casks Avoid using variables altogether; fork out the purge into two specialized + one common function
Library/Homebrew/cask/lib/hbc/installer.rb
@@ -29,7 +29,6 @@ def initialize(cask, command: SystemCommand, force: false, skip_cask_deps: false @require_sha = require_sha @reinstall = false @upgrade = upgrade - @backed_up = false end attr_predicate :binaries?, :force?, :skip_cask_deps?, :require_sha?, :upgrade?, :verbose?, :backed_up? @@ -383,7 +382,6 @@ def start_upgrade end def backup - @backed_up = true @cask.staged_path.rename backup_path end @@ -393,7 +391,6 @@ def restore_backup Pathname.new(@cask.staged_path).rmtree if @cask.staged_path.exist? backup_path.rename @cask.staged_path - @backed_up = false end def revert_upgrade @@ -404,7 +401,7 @@ def revert_upgrade end def finalize_upgrade - purge_versioned_files + purge_backed_versioned_files puts summary end @@ -439,11 +436,7 @@ def zap def backup_path return nil if @cask.staged_path.nil? - if backed_up? - Pathname.new "#{@cask.staged_path}.upgrading" - else - @cask.staged_path - end + Pathname.new "#{@cask.staged_path}.upgrading" end def version_is_latest? @@ -454,19 +447,27 @@ def gain_permissions_remove(path) Utils.gain_permissions_remove(path, command: @command) end - def purge_versioned_files + def purge_backed_versioned_files ohai "Purging files for version #{@cask.version} of Cask #{@cask}" # versioned staged distribution - if upgrade? - staged_path = backup_path - else - staged_path = @cask.staged_path - end + gain_permissions_remove(backup_path) if !backup_path.nil? && backup_path.exist? - gain_permissions_remove(staged_path) if !staged_path.nil? && staged_path.exist? + # Homebrew-Cask metadata + purge_metadata + end + + def purge_versioned_files + ohai "Purging files for version #{@cask.version} of Cask #{@cask}" + + # versioned staged distribution + gain_permissions_remove(@cask.staged_path) if !@cask.staged_path.nil? && @cask.staged_path.exist? # Homebrew-Cask metadata + purge_metadata + end + + def purge_metadata if @cask.metadata_versioned_path.respond_to?(:children) && @cask.metadata_versioned_path.exist? && !(upgrade? && version_is_latest?)
false
Other
Homebrew
brew
2ff114bc32ce677ed133ea805e4686214aaf8153.json
Use the proper path when purging metadata
Library/Homebrew/cask/lib/hbc/installer.rb
@@ -452,7 +452,7 @@ def purge_versioned_files ohai "Purging files for version #{@cask.version} of Cask #{@cask}" # versioned staged distribution - if version_is_latest? + if upgrade? && version_is_latest? staged_path = backup_path(@cask.staged_path) else staged_path = @cask.staged_path @@ -463,7 +463,7 @@ def purge_versioned_files # Homebrew-Cask metadata if @cask.metadata_versioned_path.respond_to?(:children) && @cask.metadata_versioned_path.exist? && - !version_is_latest? + !(upgrade? && version_is_latest?) @cask.metadata_versioned_path.children.each do |subdir| unless PERSISTENT_METADATA_SUBDIRS.include?(subdir.basename) gain_permissions_remove(subdir)
false
Other
Homebrew
brew
2dbc4ffaf3c4f0ade903a428e635d470000a0729.json
vendor-install: Add ARM bottle for portable-ruby
Library/Homebrew/cmd/vendor-install.sh
@@ -21,8 +21,16 @@ then fi elif [[ -n "$HOMEBREW_LINUX" ]] then - ruby_URL="https://homebrew.bintray.com/bottles-portable/portable-ruby-2.3.3.x86_64_linux.bottle.1.tar.gz" - ruby_SHA="33643b1ca6f860d6df01686636326785763e5e81cf0cef37d8a7ab96a6ca1fa1" + case "$HOMEBREW_PROCESSOR" in + armv7l) + ruby_URL="https://homebrew.bintray.com/bottles-portable/portable-ruby-2.3.3.armv7l_linux.bottle.1.tar.gz" + ruby_SHA="d26affe6f6ac299557a9044b311b4066b554874fc828ebc323d2705d3f4a8249" + ;; + x86_64) + ruby_URL="https://homebrew.bintray.com/bottles-portable/portable-ruby-2.3.3.x86_64_linux.bottle.1.tar.gz" + ruby_SHA="33643b1ca6f860d6df01686636326785763e5e81cf0cef37d8a7ab96a6ca1fa1" + ;; + esac fi # Execute the specified command, and suppress stderr unless HOMEBREW_STDERR is set.
false
Other
Homebrew
brew
8abe60d2dc3f010112aa671a82e4dceb22c11e5b.json
Remove redundant --greedy
Library/Homebrew/test/cask/cli/upgrade_spec.rb
@@ -96,7 +96,7 @@ end describe "with --greedy it checks additional Casks" do - it 'includes the Casks with "auto_updates true" or "version latest" with --greedy' do + it 'includes the Casks with "auto_updates true" or "version latest"' do local_caffeine = Hbc::CaskLoader.load("local-caffeine") local_caffeine_path = Hbc.appdir.join("Caffeine.app") auto_updates = Hbc::CaskLoader.load("auto-updates")
false
Other
Homebrew
brew
a2730c8618ebb512cf00318af6d4987dbee1efe5.json
Implement more of @reitermarkus's comments - Include tests in context - replace 'route' with 'path' - more assorted fixes
Library/Homebrew/test/cask/cli/upgrade_spec.rb
@@ -3,7 +3,7 @@ describe Hbc::CLI::Upgrade, :cask do it_behaves_like "a command that handles invalid options" - shared_context "Proper Casks" do + context "successful upgrade" do let(:installed) { [ "outdated/local-caffeine", @@ -17,164 +17,156 @@ allow_any_instance_of(described_class).to receive(:verbose?).and_return(true) end - end - - shared_context "Casks that will fail upon upgrade" do - let(:installed) { - [ - "outdated/bad-checksum", - "outdated/will-fail-if-upgraded", - ] - } - - before(:example) do - installed.each { |cask| Hbc::CLI::Install.run(cask) } - allow_any_instance_of(described_class).to receive(:verbose?).and_return(true) + describe 'without --greedy it ignores the Casks with "version latest" or "auto_updates true"' do + it "updates all the installed Casks when no token is provided" do + local_caffeine = Hbc::CaskLoader.load("local-caffeine") + local_caffeine_path = Hbc.appdir.join("Caffeine.app") + local_transmission = Hbc::CaskLoader.load("local-transmission") + local_transmission_path = Hbc.appdir.join("Transmission.app") + + expect(local_caffeine).to be_installed + expect(local_caffeine_path).to be_a_directory + expect(local_caffeine.versions).to include("1.2.2") + + expect(local_transmission).to be_installed + expect(local_transmission_path).to be_a_directory + expect(local_transmission.versions).to include("2.60") + + described_class.run + + expect(local_caffeine).to be_installed + expect(local_caffeine_path).to be_a_directory + expect(local_caffeine.versions).to include("1.2.3") + + expect(local_transmission).to be_installed + expect(local_transmission_path).to be_a_directory + expect(local_transmission.versions).to include("2.61") + end + + it "updates only the Casks specified in the command line" do + local_caffeine = Hbc::CaskLoader.load("local-caffeine") + local_caffeine_path = Hbc.appdir.join("Caffeine.app") + local_transmission = Hbc::CaskLoader.load("local-transmission") + local_transmission_path = Hbc.appdir.join("Transmission.app") + + expect(local_caffeine).to be_installed + expect(local_caffeine_path).to be_a_directory + expect(local_caffeine.versions).to include("1.2.2") + + expect(local_transmission).to be_installed + expect(local_transmission_path).to be_a_directory + expect(local_transmission.versions).to include("2.60") + + described_class.run("local-caffeine") + + expect(local_caffeine).to be_installed + expect(local_caffeine_path).to be_a_directory + expect(local_caffeine.versions).to include("1.2.3") + + expect(local_transmission).to be_installed + expect(local_transmission_path).to be_a_directory + expect(local_transmission.versions).to include("2.60") + end + + it 'updates "auto_updates" and "latest" Casks when their tokens are provided in the command line' do + local_caffeine = Hbc::CaskLoader.load("local-caffeine") + local_caffeine_path = Hbc.appdir.join("Caffeine.app") + auto_updates = Hbc::CaskLoader.load("auto-updates") + auto_updates_path = Hbc.appdir.join("MyFancyApp.app") + + expect(local_caffeine).to be_installed + expect(local_caffeine_path).to be_a_directory + expect(local_caffeine.versions).to include("1.2.2") + + expect(auto_updates).to be_installed + expect(auto_updates_path).to be_a_directory + expect(auto_updates.versions).to include("2.57") + + described_class.run("local-caffeine", "auto-updates") + + expect(local_caffeine).to be_installed + expect(local_caffeine_path).to be_a_directory + expect(local_caffeine.versions).to include("1.2.3") + + expect(auto_updates).to be_installed + expect(auto_updates_path).to be_a_directory + expect(auto_updates.versions).to include("2.61") + end end - end - - describe 'without --greedy it ignores the Casks with "version latest" or "auto_updates true"' do - include_context "Proper Casks" - it "and updates all the installed Casks when no token is provided" do - local_caffeine = Hbc::CaskLoader.load("local-caffeine") - local_caffeine_route = Hbc.appdir.join("Caffeine.app") - local_transmission = Hbc::CaskLoader.load("local-transmission") - local_transmission_route = Hbc.appdir.join("Transmission.app") + describe "with --greedy it checks additional Casks" do + it 'includes the Casks with "auto_updates true" or "version latest" with --greedy' do + local_caffeine = Hbc::CaskLoader.load("local-caffeine") + local_caffeine_path = Hbc.appdir.join("Caffeine.app") + auto_updates = Hbc::CaskLoader.load("auto-updates") + auto_updates_path = Hbc.appdir.join("MyFancyApp.app") + local_transmission = Hbc::CaskLoader.load("local-transmission") + local_transmission_path = Hbc.appdir.join("Transmission.app") - expect(local_caffeine).to be_installed - expect(local_caffeine_route).to be_a_directory - expect(local_caffeine.versions).to include("1.2.2") + expect(local_caffeine).to be_installed + expect(local_caffeine_path).to be_a_directory + expect(local_caffeine.versions).to include("1.2.2") - expect(local_transmission).to be_installed - expect(local_transmission_route).to be_a_directory - expect(local_transmission.versions).to include("2.60") + expect(auto_updates).to be_installed + expect(auto_updates_path).to be_a_directory + expect(auto_updates.versions).to include("2.57") - described_class.run + expect(local_transmission).to be_installed + expect(local_transmission_path).to be_a_directory + expect(local_transmission.versions).to include("2.60") - expect(local_caffeine).to be_installed - expect(local_caffeine_route).to be_a_directory - expect(local_caffeine.versions).to include("1.2.3") + described_class.run("--greedy") - expect(local_transmission).to be_installed - expect(local_transmission_route).to be_a_directory - expect(local_transmission.versions).to include("2.61") - end - - it "and updates only the Casks specified in the command line" do - local_caffeine = Hbc::CaskLoader.load("local-caffeine") - local_caffeine_route = Hbc.appdir.join("Caffeine.app") - local_transmission = Hbc::CaskLoader.load("local-transmission") - local_transmission_route = Hbc.appdir.join("Transmission.app") + expect(local_caffeine).to be_installed + expect(local_caffeine_path).to be_a_directory + expect(local_caffeine.versions).to include("1.2.3") - expect(local_caffeine).to be_installed - expect(local_caffeine_route).to be_a_directory - expect(local_caffeine.versions).to include("1.2.2") + expect(auto_updates).to be_installed + expect(auto_updates_path).to be_a_directory + expect(auto_updates.versions).to include("2.61") - expect(local_transmission).to be_installed - expect(local_transmission_route).to be_a_directory - expect(local_transmission.versions).to include("2.60") + expect(local_transmission).to be_installed + expect(local_transmission_path).to be_a_directory + expect(local_transmission.versions).to include("2.61") + end - described_class.run("local-caffeine") + it 'does not include the Casks with "auto_updates true" when the version did not change' do + cask = Hbc::CaskLoader.load("auto-updates") + cask_path = Hbc.appdir.join("MyFancyApp.app") - expect(local_caffeine).to be_installed - expect(local_caffeine_route).to be_a_directory - expect(local_caffeine.versions).to include("1.2.3") + expect(cask).to be_installed + expect(cask_path).to be_a_directory + expect(cask.versions).to include("2.57") - expect(local_transmission).to be_installed - expect(local_transmission_route).to be_a_directory - expect(local_transmission.versions).to include("2.60") - end + described_class.run("auto-updates", "--greedy") - it 'updates "auto_updates" and "latest" Casks when their tokens are provided in the command line' do - local_caffeine = Hbc::CaskLoader.load("local-caffeine") - local_caffeine_route = Hbc.appdir.join("Caffeine.app") - auto_updates = Hbc::CaskLoader.load("auto-updates") - auto_updates_path = Hbc.appdir.join("MyFancyApp.app") + expect(cask).to be_installed + expect(cask_path).to be_a_directory + expect(cask.versions).to include("2.61") - expect(local_caffeine).to be_installed - expect(local_caffeine_route).to be_a_directory - expect(local_caffeine.versions).to include("1.2.2") + described_class.run("auto-updates", "--greedy") - expect(auto_updates).to be_installed - expect(auto_updates_path).to be_a_directory - expect(auto_updates.versions).to include("2.57") - - described_class.run("local-caffeine", "auto-updates") - - expect(local_caffeine).to be_installed - expect(local_caffeine_route).to be_a_directory - expect(local_caffeine.versions).to include("1.2.3") - - expect(auto_updates).to be_installed - expect(auto_updates_path).to be_a_directory - expect(auto_updates.versions).to include("2.61") + expect(cask).to be_installed + expect(cask_path).to be_a_directory + expect(cask.versions).to include("2.61") + end end end - describe "with --greedy it checks additional Casks" do - include_context "Proper Casks" - - it 'includes the Casks with "auto_updates true" or "version latest" with --greedy' do - local_caffeine = Hbc::CaskLoader.load("local-caffeine") - local_caffeine_route = Hbc.appdir.join("Caffeine.app") - auto_updates = Hbc::CaskLoader.load("auto-updates") - auto_updates_path = Hbc.appdir.join("MyFancyApp.app") - local_transmission = Hbc::CaskLoader.load("local-transmission") - local_transmission_route = Hbc.appdir.join("Transmission.app") - - expect(local_caffeine).to be_installed - expect(local_caffeine_route).to be_a_directory - expect(local_caffeine.versions).to include("1.2.2") - - expect(auto_updates).to be_installed - expect(auto_updates_path).to be_a_directory - expect(auto_updates.versions).to include("2.57") - - expect(local_transmission).to be_installed - expect(local_transmission_route).to be_a_directory - expect(local_transmission.versions).to include("2.60") - - described_class.run("--greedy") - - expect(local_caffeine).to be_installed - expect(local_caffeine_route).to be_a_directory - expect(local_caffeine.versions).to include("1.2.3") - - expect(auto_updates).to be_installed - expect(auto_updates_path).to be_a_directory - expect(auto_updates.versions).to include("2.61") - - expect(local_transmission).to be_installed - expect(local_transmission_route).to be_a_directory - expect(local_transmission.versions).to include("2.61") - end - - it 'does not include the Casks with "auto_updates true" when the version did not change' do - auto_updates = Hbc::CaskLoader.load("auto-updates") - auto_updates_path = Hbc.appdir.join("MyFancyApp.app") - - expect(auto_updates).to be_installed - expect(auto_updates_path).to be_a_directory - expect(auto_updates.versions).to include("2.57") - - described_class.run("auto-updates", "--greedy") - - expect(auto_updates).to be_installed - expect(auto_updates_path).to be_a_directory - expect(auto_updates.versions).to include("2.61") + context "failed upgrade" do + let(:installed) { + [ + "outdated/bad-checksum", + "outdated/will-fail-if-upgraded", + ] + } - described_class.run("auto-updates", "--greedy") + before(:example) do + installed.each { |cask| Hbc::CLI::Install.run(cask) } - expect(auto_updates).to be_installed - expect(auto_updates_path).to be_a_directory - expect(auto_updates.versions).to include("2.61") + allow_any_instance_of(described_class).to receive(:verbose?).and_return(true) end - end - - describe "handles borked upgrades" do - include_context "Casks that will fail upon upgrade" output_reverted = Regexp.new <<~EOS Warning: Reverting upgrade for Cask .* @@ -198,7 +190,7 @@ expect(will_fail_if_upgraded.staged_path).to_not exist end - it "by not restoring the old Cask if the upgrade failed pre-install" do + it "does not restore the old Cask if the upgrade failed pre-install" do bad_checksum = Hbc::CaskLoader.load("bad-checksum") bad_checksum_path = Hbc.appdir.join("Caffeine.app")
false
Other
Homebrew
brew
baa3d187d63d5a9bb17fd4dbc052a899b597c2b8.json
Add CVSRequirement and SubversionRequirement Use these two requirements in DependencyCollector. Remove the unused function MacOS::Xcode.provides_cvs?
Library/Homebrew/dependency_collector.rb
@@ -159,7 +159,9 @@ def resource_dep(spec, tags) elsif strategy <= BazaarDownloadStrategy Dependency.new("bazaar", tags) elsif strategy <= CVSDownloadStrategy - Dependency.new("cvs", tags) if MacOS.version >= :mavericks || !MacOS::Xcode.provides_cvs? + CVSRequirement.new(tags) + elsif strategy <= SubversionDownloadStrategy + SubversionRequirement.new(tags) elsif strategy < AbstractDownloadStrategy # allow unknown strategies to pass through else
true
Other
Homebrew
brew
baa3d187d63d5a9bb17fd4dbc052a899b597c2b8.json
Add CVSRequirement and SubversionRequirement Use these two requirements in DependencyCollector. Remove the unused function MacOS::Xcode.provides_cvs?
Library/Homebrew/os/mac/xcode.rb
@@ -174,10 +174,6 @@ def provides_gcc? version < "4.3" end - def provides_cvs? - version < "5.0" - end - def default_prefix? if version < "4.3" prefix.to_s.start_with? "/Developer"
true
Other
Homebrew
brew
baa3d187d63d5a9bb17fd4dbc052a899b597c2b8.json
Add CVSRequirement and SubversionRequirement Use these two requirements in DependencyCollector. Remove the unused function MacOS::Xcode.provides_cvs?
Library/Homebrew/requirements.rb
@@ -114,10 +114,15 @@ def message end end +class CVSRequirement < Requirement + fatal true + default_formula "cvs" + satisfy { which "cvs" } +end + class MercurialRequirement < Requirement fatal true default_formula "mercurial" - satisfy { which("hg") } end @@ -126,3 +131,9 @@ class GitRequirement < Requirement default_formula "git" satisfy { Utils.git_available? } end + +class SubversionRequirement < Requirement + fatal true + default_formula "subversion" + satisfy { Utils.svn_available? } +end
true
Other
Homebrew
brew
baa3d187d63d5a9bb17fd4dbc052a899b597c2b8.json
Add CVSRequirement and SubversionRequirement Use these two requirements in DependencyCollector. Remove the unused function MacOS::Xcode.provides_cvs?
Library/Homebrew/test/dependency_collector_spec.rb
@@ -84,6 +84,18 @@ def find_requirement(klass) expect(subject.add(resource)).to be_an_instance_of(GitRequirement) end + it "creates a resource dependency from a CVS URL" do + resource = Resource.new + resource.url(":pserver:anonymous:@example.com:/cvsroot/foo/bar", using: :cvs) + expect(subject.add(resource)).to be_an_instance_of(CVSRequirement) + end + + it "creates a resource dependency from a Subversion URL" do + resource = Resource.new + resource.url("svn://example.com/foo/bar") + expect(subject.add(resource)).to be_an_instance_of(SubversionRequirement) + end + it "creates a resource dependency from a '.7z' URL" do resource = Resource.new resource.url("http://example.com/foo.7z")
true
Other
Homebrew
brew
9be85385b33491185fc0defdf0e7cec7639081f6.json
lines_cop: Add condition to prevent false positives
Library/Homebrew/rubocops/lines_cop.rb
@@ -331,6 +331,7 @@ def audit_formula(_node, _class_node, _parent_class_node, body_node) end find_instance_method_call(body_node, "Dir", :[]) do |method| + next unless parameters(method).size == 1 path = parameters(method).first next unless path.str_type? next unless match = regex_match_group(path, /^[^\*{},]+$/)
false
Other
Homebrew
brew
7ee98eb421380afd45144ef8df1656cb22d4bb66.json
Implement more of @reitermarkus's comments - Simplify outdated Casks checks - Make use of RSpec's let(:) and .and syntax
Library/Homebrew/cask/lib/hbc/cli/upgrade.rb
@@ -12,7 +12,8 @@ def initialize(*) end def run - outdated_casks = casks(alternative: -> { Hbc.installed }).select { |cask| cask.outdated?(greedy?) || (args.include?(cask.token) && cask.outdated?(true)) } + outdated_casks = casks(alternative: -> { Hbc.installed.select { |cask| + cask.outdated?(greedy?) } }).select { |cask| cask.outdated?(true) } if outdated_casks.empty? oh1 "No Casks to upgrade"
true
Other
Homebrew
brew
7ee98eb421380afd45144ef8df1656cb22d4bb66.json
Implement more of @reitermarkus's comments - Simplify outdated Casks checks - Make use of RSpec's let(:) and .and syntax
Library/Homebrew/test/cask/cli/upgrade_spec.rb
@@ -4,28 +4,30 @@ it_behaves_like "a command that handles invalid options" shared_context "Proper Casks" do - before(:example) do - installed = - [ - "outdated/local-caffeine", - "outdated/local-transmission", - "outdated/auto-updates", - ] + let(:installed) { + [ + "outdated/local-caffeine", + "outdated/local-transmission", + "outdated/auto-updates", + ] + } + before(:example) do installed.each { |cask| Hbc::CLI::Install.run(cask) } allow_any_instance_of(described_class).to receive(:verbose?).and_return(true) end end shared_context "Casks that will fail upon upgrade" do - before(:example) do - installed = - [ - "outdated/bad-checksum", - "outdated/will-fail-if-upgraded", - ] + let(:installed) { + [ + "outdated/bad-checksum", + "outdated/will-fail-if-upgraded", + ] + } + before(:example) do installed.each { |cask| Hbc::CLI::Install.run(cask) } allow_any_instance_of(described_class).to receive(:verbose?).and_return(true) @@ -76,7 +78,7 @@ expect(Hbc::CaskLoader.load("local-transmission").versions).to include("2.60") end - it 'but updates "auto_updates" and "latest" Casks when their tokens are provided in the command line' do + it 'updates "auto_updates" and "latest" Casks when their tokens are provided in the command line' do expect(Hbc::CaskLoader.load("local-caffeine")).to be_installed expect(Hbc.appdir.join("Caffeine.app")).to be_a_directory expect(Hbc::CaskLoader.load("local-caffeine").versions).to include("1.2.2") @@ -152,16 +154,14 @@ Warning: Reverting upgrade for Cask .* EOS - it "by restoring the old Cask if the upgrade's install failed" do + it "restores the old Cask if the upgrade failed" do expect(Hbc::CaskLoader.load("will-fail-if-upgraded")).to be_installed expect(Hbc.appdir.join("container")).to be_a_file expect(Hbc::CaskLoader.load("will-fail-if-upgraded").versions).to include("1.2.2") expect { - expect { - described_class.run("will-fail-if-upgraded") - }.to raise_error(Hbc::CaskError) - }.to output(output_reverted).to_stderr + described_class.run("will-fail-if-upgraded") + }.to raise_error(Hbc::CaskError).and output(output_reverted).to_stderr expect(Hbc::CaskLoader.load("will-fail-if-upgraded")).to be_installed expect(Hbc.appdir.join("container")).to be_a_file @@ -175,10 +175,8 @@ expect(Hbc::CaskLoader.load("bad-checksum").versions).to include("1.2.2") expect { - expect { - described_class.run("bad-checksum") - }.to raise_error(Hbc::CaskSha256MismatchError) - }.to_not output(output_reverted).to_stderr + described_class.run("bad-checksum") + }.to raise_error(Hbc::CaskSha256MismatchError).and (not_to_output output_reverted).to_stderr expect(Hbc::CaskLoader.load("bad-checksum")).to be_installed expect(Hbc.appdir.join("Caffeine.app")).to be_a_directory
true
Other
Homebrew
brew
e32299e6527e51a06dbe3966dcaae0bca775808f.json
patch: Use patch found in the PATH
Library/Homebrew/patch.rb
@@ -64,10 +64,9 @@ def contents; end def apply data = contents.gsub("HOMEBREW_PREFIX", HOMEBREW_PREFIX) - cmd = "/usr/bin/patch" args = %W[-g 0 -f -#{strip}] - IO.popen("#{cmd} #{args.join(" ")}", "w") { |p| p.write(data) } - raise ErrorDuringExecution.new(cmd, args) unless $CHILD_STATUS.success? + Utils.popen_write("patch", *args) { |p| p.write(data) } + raise ErrorDuringExecution.new("patch", args) unless $CHILD_STATUS.success? end def inspect @@ -150,7 +149,7 @@ def apply patch_files.each do |patch_file| ohai "Applying #{patch_file}" patch_file = patch_dir/patch_file - safe_system "/usr/bin/patch", "-g", "0", "-f", "-#{strip}", "-i", patch_file + safe_system "patch", "-g", "0", "-f", "-#{strip}", "-i", patch_file end end end
false
Other
Homebrew
brew
28f4d68b31959483a2245a17e4b28fa5e440c8d5.json
bottle: use HOMEBREW_GIT_* vars. This allows them to be passed through from `brew test-bot`.
Library/Homebrew/dev-cmd/bottle.rb
@@ -469,6 +469,17 @@ def merge end unless ARGV.include? "--no-commit" + if ENV["HOMEBREW_GIT_NAME"] + ENV["GIT_AUTHOR_NAME"] = + ENV["GIT_COMMITTER_NAME"] = + ENV["HOMEBREW_GIT_NAME"] + end + if ENV["HOMEBREW_GIT_EMAIL"] + ENV["GIT_AUTHOR_EMAIL"] = + ENV["GIT_COMMITTER_EMAIL"] = + ENV["HOMEBREW_GIT_EMAIL"] + end + short_name = formula_name.split("/", -1).last pkg_version = bottle_hash["formula"]["pkg_version"]
false
Other
Homebrew
brew
9ebf3388040f696f61144c5baf50673fcadadff6.json
diagnostic: fix paths usage. - Don't allow taking an argument. This doesn't work and never has as it caches the result regardless of the argument. - Don't rely on the PATH to check for external commands.
Library/Homebrew/diagnostic.rb
@@ -434,7 +434,7 @@ def check_user_path_1 message = "" - paths(ENV["HOMEBREW_PATH"]).each do |p| + paths.each do |p| case p when "/usr/bin" unless @seen_prefix_bin @@ -577,7 +577,7 @@ def check_for_config_scripts /Applications/Server.app/Contents/ServerRoot/usr/sbin ].map(&:downcase) - paths(ENV["HOMEBREW_PATH"]).each do |p| + paths.each do |p| next if whitelist.include?(p.downcase) || !File.directory?(p) realpath = Pathname.new(p).realpath.to_s @@ -1045,7 +1045,7 @@ def check_for_pth_support end def check_for_external_cmd_name_conflict - cmds = paths.flat_map { |p| Dir["#{p}/brew-*"] }.uniq + cmds = Tap.cmd_directories.flat_map { |p| Dir["#{p}/brew-*"] }.uniq cmds = cmds.select { |cmd| File.file?(cmd) && File.executable?(cmd) } cmd_map = {} cmds.each do |cmd|
true
Other
Homebrew
brew
9ebf3388040f696f61144c5baf50673fcadadff6.json
diagnostic: fix paths usage. - Don't allow taking an argument. This doesn't work and never has as it caches the result regardless of the argument. - Don't rely on the PATH to check for external commands.
Library/Homebrew/test/diagnostic_spec.rb
@@ -194,7 +194,7 @@ FileUtils.chmod 0755, cmd end - ENV["PATH"] = [path1, path2, ENV["PATH"]].join File::PATH_SEPARATOR + allow(Tap).to receive(:cmd_directories).and_return([path1, path2]) expect(subject.check_for_external_cmd_name_conflict) .to match("brew-foo")
true
Other
Homebrew
brew
9ebf3388040f696f61144c5baf50673fcadadff6.json
diagnostic: fix paths usage. - Don't allow taking an argument. This doesn't work and never has as it caches the result regardless of the argument. - Don't rely on the PATH to check for external commands.
Library/Homebrew/utils.rb
@@ -420,8 +420,8 @@ def nostdout end end -def paths(env_path = ENV["PATH"]) - @paths ||= PATH.new(env_path).collect do |p| +def paths + @paths ||= PATH.new(ENV["HOMEBREW_PATH"]).collect do |p| begin File.expand_path(p).chomp("/") rescue ArgumentError
true
Other
Homebrew
brew
36fe355159385669fbd5c294b901ed1df5bc745f.json
Add tests for upgrade recovery
Library/Homebrew/cask/lib/hbc/cli/upgrade.rb
@@ -41,6 +41,9 @@ def run require_sha: require_sha?, upgrade: true) + started_upgrade = false + new_artifacts_installed = false + begin # Start new Cask's installation steps new_cask_installer.check_conflicts @@ -51,18 +54,22 @@ def run # Move the old Cask's artifacts back to staging old_cask_installer.start_upgrade + # And flag it so in case of error + started_upgrade = true # Install the new Cask new_cask_installer.install_artifacts + new_artifacts_installed = true new_cask_installer.enable_accessibility_access # If successful, wipe the old Cask from staging old_cask_installer.finalize_upgrade rescue CaskError => e opoo e.message - new_cask_installer.uninstall - old_cask_installer.revert_upgrade + new_cask_installer.uninstall_artifacts if new_artifacts_installed + new_cask_installer.purge_versioned_files + old_cask_installer.revert_upgrade if started_upgrade end end end
true
Other
Homebrew
brew
36fe355159385669fbd5c294b901ed1df5bc745f.json
Add tests for upgrade recovery
Library/Homebrew/test/cask/cli/upgrade_spec.rb
@@ -3,21 +3,39 @@ describe Hbc::CLI::Upgrade, :cask do it_behaves_like "a command that handles invalid options" - before(:example) do - installed = - [ - "outdated/local-caffeine", - "outdated/local-transmission", - "outdated/auto-updates", - ] + shared_context "Proper Casks" do + before(:example) do + installed = + [ + "outdated/local-caffeine", + "outdated/local-transmission", + "outdated/auto-updates", + ] + + installed.each { |cask| Hbc::CLI::Install.run(cask) } + + allow_any_instance_of(described_class).to receive(:verbose?).and_return(true) + end + end + + shared_context "Casks that will fail upon upgrade" do + before(:example) do + installed = + [ + "outdated/bad-checksum", + "outdated/will-fail-if-upgraded", + ] - installed.each { |cask| Hbc::CLI::Install.run(cask) } + installed.each { |cask| Hbc::CLI::Install.run(cask) } - allow_any_instance_of(described_class).to receive(:verbose?).and_return(true) + allow_any_instance_of(described_class).to receive(:verbose?).and_return(true) + end end describe 'without --greedy it ignores the Casks with "version latest" or "auto_updates true"' do - it "updates all the installed Casks when no token is provided" do + include_context "Proper Casks" + + it "and updates all the installed Casks when no token is provided" do expect(Hbc::CaskLoader.load("local-caffeine")).to be_installed expect(Hbc.appdir.join("Caffeine.app")).to be_a_directory expect(Hbc::CaskLoader.load("local-caffeine").versions).to include("1.2.2") @@ -37,7 +55,7 @@ expect(Hbc::CaskLoader.load("local-transmission").versions).to include("2.61") end - it "updates only the Casks specified in the command line" do + it "and updates only the Casks specified in the command line" do expect(Hbc::CaskLoader.load("local-caffeine")).to be_installed expect(Hbc.appdir.join("Caffeine.app")).to be_a_directory expect(Hbc::CaskLoader.load("local-caffeine").versions).to include("1.2.2") @@ -58,7 +76,7 @@ expect(Hbc::CaskLoader.load("local-transmission").versions).to include("2.60") end - it 'ignores "auto_updates" and "latest" Casks even when their tokens are provided in the command line' do + it 'and ignores "auto_updates" and "latest" Casks even when their tokens are provided in the command line' do expect(Hbc::CaskLoader.load("local-caffeine")).to be_installed expect(Hbc.appdir.join("Caffeine.app")).to be_a_directory expect(Hbc::CaskLoader.load("local-caffeine").versions).to include("1.2.2") @@ -80,6 +98,8 @@ end describe "with --greedy it checks additional Casks" do + include_context "Proper Casks" + it 'includes the Casks with "auto_updates true" or "version latest" with --greedy' do expect(Hbc::CaskLoader.load("auto-updates")).to be_installed expect(Hbc.appdir.join("MyFancyApp.app")).to be_a_directory @@ -124,4 +144,42 @@ expect(Hbc::CaskLoader.load("auto-updates").versions).to include("2.61") end end + + describe "handles borked upgrades" do + include_context "Casks that will fail upon upgrade" + + output_reverted = Regexp.new <<~EOS + Warning: Reverting upgrade for Cask .* + EOS + + it "by restoring the old Cask if the upgrade's install failed" do + expect(Hbc::CaskLoader.load("will-fail-if-upgraded")).to be_installed + expect(Hbc.appdir.join("container")).to be_a_file + expect(Hbc::CaskLoader.load("will-fail-if-upgraded").versions).to include("1.2.2") + + expect { + described_class.run("will-fail-if-upgraded") + }.to output(output_reverted).to_stderr + + expect(Hbc::CaskLoader.load("will-fail-if-upgraded")).to be_installed + expect(Hbc.appdir.join("container")).to be_a_file + expect(Hbc::CaskLoader.load("will-fail-if-upgraded").versions).to include("1.2.2") + expect(Hbc::CaskLoader.load("will-fail-if-upgraded").staged_path).to_not exist + end + + it "by not restoring the old Cask if the upgrade failed pre-install" do + expect(Hbc::CaskLoader.load("bad-checksum")).to be_installed + expect(Hbc.appdir.join("Caffeine.app")).to be_a_directory + expect(Hbc::CaskLoader.load("bad-checksum").versions).to include("1.2.2") + + expect { + described_class.run("bad-checksum") + }.to_not output(output_reverted).to_stderr + + expect(Hbc::CaskLoader.load("bad-checksum")).to be_installed + expect(Hbc.appdir.join("Caffeine.app")).to be_a_directory + expect(Hbc::CaskLoader.load("bad-checksum").versions).to include("1.2.2") + expect(Hbc::CaskLoader.load("bad-checksum").staged_path).to_not exist + end + end end
true
Other
Homebrew
brew
36fe355159385669fbd5c294b901ed1df5bc745f.json
Add tests for upgrade recovery
Library/Homebrew/test/support/fixtures/cask/Casks/outdated/bad-checksum.rb
@@ -0,0 +1,9 @@ +cask 'bad-checksum' do + version '1.2.2' + sha256 '67cdb8a02803ef37fdbf7e0be205863172e41a561ca446cd84f0d7ab35a99d94' + + url "file://#{TEST_FIXTURE_DIR}/cask/caffeine.zip" + homepage 'http://example.com/local-caffeine' + + app 'Caffeine.app' +end
true
Other
Homebrew
brew
36fe355159385669fbd5c294b901ed1df5bc745f.json
Add tests for upgrade recovery
Library/Homebrew/test/support/fixtures/cask/Casks/outdated/will-fail-if-upgraded.rb
@@ -0,0 +1,9 @@ +cask 'will-fail-if-upgraded' do + version '1.2.2' + sha256 'fab685fabf73d5a9382581ce8698fce9408f5feaa49fa10d9bc6c510493300f5' + + url "file://#{TEST_FIXTURE_DIR}/cask/container.tar.gz" + homepage 'https://example.com/container-tar-gz' + + app 'container' +end
true
Other
Homebrew
brew
36fe355159385669fbd5c294b901ed1df5bc745f.json
Add tests for upgrade recovery
Library/Homebrew/test/support/fixtures/cask/Casks/will-fail-if-upgraded.rb
@@ -0,0 +1,9 @@ +cask 'will-fail-if-upgraded' do + version '1.2.3' + sha256 'e44ffa103fbf83f55c8d0b1bea309a43b2880798dae8620b1ee8da5e1095ec68' + + url "file://#{TEST_FIXTURE_DIR}/cask/transmission-2.61.dmg" + homepage 'http://example.com/local-transmission' + + app 'container' +end
true
Other
Homebrew
brew
fea5350d52de54eca9d6f30c67bd2fa008ca8328.json
Add line break to string
Library/Homebrew/cask/lib/hbc/cli/internal_stanza.rb
@@ -46,8 +46,10 @@ def initialize(*) return if DSL::DSL_METHODS.include?(stanza) raise ArgumentError, - "Unknown/unsupported stanza: '#{stanza}' Check cask reference"\ - " for supported stanzas." + <<~EOS + Unknown/unsupported stanza: '#{stanza}' + Check cask reference for supported stanzas. + EOS end def run
true
Other
Homebrew
brew
fea5350d52de54eca9d6f30c67bd2fa008ca8328.json
Add line break to string
Library/Homebrew/test/cask/cli/internal_stanza_spec.rb
@@ -9,7 +9,7 @@ it "raises an exception when stanza is unknown/unsupported" do expect { described_class.new("this_stanza_does_not_exist", "with-gpg") - }.to raise_error(/Unknown\/unsupported stanza/) + }.to raise_error(%r{Unknown/unsupported stanza}) end it "raises an exception when normal stanza is not present on cask" do
true
Other
Homebrew
brew
5eab54f892cfac39c78a3d092f3084ce817fca04.json
Reduce verbosity of artifacts hash
Library/Homebrew/cask/lib/hbc/cli/internal_stanza.rb
@@ -66,7 +66,7 @@ def run end if stanza == :artifacts - value = Hash[value.map { |v| [v.class.dsl_key, v] }] + value = Hash[value.map { |v| [v.class.dsl_key, v.to_s] }] value = value[artifact_name] if artifact_name end
false
Other
Homebrew
brew
52343142a7d9cb871fc1f4affc3edb9caff69ab5.json
Remove unused variables. Refactor code
Library/Homebrew/cask/lib/hbc/cli/internal_stanza.rb
@@ -24,9 +24,6 @@ class InternalStanza < AbstractInternalCommand ARTIFACTS = DSL::ORDINARY_ARTIFACT_CLASSES.map(&:dsl_key) + DSL::ARTIFACT_BLOCK_CLASSES.map(&:dsl_key) - ARTIFACTS_CLASSES = - DSL::ORDINARY_ARTIFACT_CLASSES + - DSL::ARTIFACT_BLOCK_CLASSES option "--table", :table, false option "--quiet", :quiet, false @@ -69,27 +66,12 @@ def run end if stanza == :artifacts - result = {} - value.each do |e| - result[e.class.dsl_key] = e.summarize - end - value = result - end - - if artifact_name - result = nil - value.each do |k, v| - if k == artifact_name - result = v - break - end - end - value = result + value = Hash[value.map { |v| [v.class.dsl_key, v] }] + value = value[artifact_name] if artifact_name end if value.nil? || (value.respond_to?(:to_a) && value.to_a.empty?) || - (value.respond_to?(:to_s) && value.to_s == "{}") # || - + (value.respond_to?(:to_s) && value.to_s == "{}") raise CaskError, "no such stanza '#{artifact_name ? artifact_name : stanza}' on Cask '#{cask}'" end
false
Other
Homebrew
brew
255e991cc32da3141afc1a50e1f643d8e028a9f6.json
Remove obsolete code to fix tests.
Library/Homebrew/cask/lib/hbc/cli/internal_stanza.rb
@@ -66,7 +66,6 @@ def run end if value.nil? || (value.respond_to?(:to_a) && value.to_a.empty?) || - (value.respond_to?(:to_h) && value.to_h.empty?) || (value.respond_to?(:to_s) && value.to_s == "{}") || (artifact_name && !value.key?(artifact_name))
false
Other
Homebrew
brew
7f70080c94b6ef9b772b3464a0c0bb9420a407e0.json
Add another test to increase coverage.
Library/Homebrew/test/cask/cli/internal_stanza_spec.rb
@@ -25,4 +25,11 @@ command.run end.to raise_error(/no such stanza/) end + + it "shows all artifact stanzas when using 'artifacts' keyword" do + command = described_class.new("artifacts", "with-gpg") + expect do + command.run + end.to output("{:app=>[[\"Caffeine.app\"]]}\n").to_stdout + end end
false
Other
Homebrew
brew
4d4722c97c2e92f1fd17ed056f5a700e881eab4d.json
Remove more uses of EOS.undent.
Library/Homebrew/test/dev-cmd/audit_spec.rb
@@ -221,7 +221,7 @@ class Foo < Formula describe "a dependency on a macOS-provided keg-only formula" do describe "which is whitelisted" do let(:fa) do - formula_auditor "foo", <<-EOS.undent, new_formula: true + formula_auditor "foo", <<~EOS, new_formula: true class Foo < Formula url "http://example.com/foo-1.0.tgz" homepage "http://example.com" @@ -253,7 +253,7 @@ class Foo < Formula describe "which is not whitelisted" do let(:fa) do - formula_auditor "foo", <<-EOS.undent, new_formula: true + formula_auditor "foo", <<~EOS, new_formula: true class Foo < Formula url "http://example.com/foo-1.0.tgz" homepage "http://example.com"
true
Other
Homebrew
brew
4d4722c97c2e92f1fd17ed056f5a700e881eab4d.json
Remove more uses of EOS.undent.
docs/Formula-Cookbook.md
@@ -553,7 +553,7 @@ Sometimes a package fails to build when using a certain compiler. Since recent [ ```ruby fails_with :llvm do build 2335 - cause <<-EOS.undent + cause <<~EOS The "cause" field should include a short summary of the error. Include the URLs of any relevant information, such as upstream bug reports. Wrap the text at a sensible boundary (~72-80 characters), but do not break
true
Other
Homebrew
brew
5f301755c0ee06689981197e7aa7d4c7d95434a2.json
Use HOMEBREW_AUTO_UPDATE_CHECKED variable. Rather than reusing `HOMEBREW_NO_AUTO_UPDATE` to indicate that we've already made a check. This allows `HOMEBREW_NO_AUTO_UPDATE` to be displayed properly by `brew config`.
Library/Homebrew/brew.sh
@@ -312,6 +312,7 @@ update-preinstall-timer() { update-preinstall() { [[ -z "$HOMEBREW_HELP" ]] || return [[ -z "$HOMEBREW_NO_AUTO_UPDATE" ]] || return + [[ -z "$HOMEBREW_AUTO_UPDATE_CHECKED" ]] || return [[ -z "$HOMEBREW_UPDATE_PREINSTALL" ]] || return if [[ "$HOMEBREW_COMMAND" = "install" || "$HOMEBREW_COMMAND" = "upgrade" || "$HOMEBREW_COMMAND" = "tap" ]] @@ -346,7 +347,7 @@ update-preinstall() { fi # If we've checked for updates, we don't need to check again. - export HOMEBREW_NO_AUTO_UPDATE="1" + export HOMEBREW_AUTO_UPDATE_CHECKED="1" } if [[ -n "$HOMEBREW_BASH_COMMAND" ]]
true
Other
Homebrew
brew
5f301755c0ee06689981197e7aa7d4c7d95434a2.json
Use HOMEBREW_AUTO_UPDATE_CHECKED variable. Rather than reusing `HOMEBREW_NO_AUTO_UPDATE` to indicate that we've already made a check. This allows `HOMEBREW_NO_AUTO_UPDATE` to be displayed properly by `brew config`.
Library/Homebrew/system_config.rb
@@ -181,6 +181,7 @@ def dump_verbose_config(f = $stdout) HOMEBREW_ANALYTICS_ID HOMEBREW_ANALYTICS_USER_UUID + HOMEBREW_AUTO_UPDATE_CHECKED HOMEBREW_BREW_FILE HOMEBREW_COMMAND_DEPTH HOMEBREW_CURL
true
Other
Homebrew
brew
3f8f2c672632d74c188adab5d7fdc879ef0c008a.json
bump-formula-pr: use GitHub vars under env filter. Ensure that the various variables are passed through and reset correctly. If we end up doing this in a bunch of places we may add some helpers to simplify this.
Library/Homebrew/dev-cmd/bump-formula-pr.rb
@@ -117,6 +117,14 @@ def bump_formula_pr # user path, too. ENV["PATH"] = ENV["HOMEBREW_PATH"] + # Setup GitHub environment variables + %w[GITHUB_USER GITHUB_PASSWORD GITHUB_TOKEN].each do |env| + homebrew_env = ENV["HOMEBREW_#{env}"] + next unless homebrew_env + next if homebrew_env.empty? + ENV[env] = homebrew_env + end + formula = ARGV.formulae.first if formula
true
Other
Homebrew
brew
3f8f2c672632d74c188adab5d7fdc879ef0c008a.json
bump-formula-pr: use GitHub vars under env filter. Ensure that the various variables are passed through and reset correctly. If we end up doing this in a bunch of places we may add some helpers to simplify this.
bin/brew
@@ -47,7 +47,8 @@ HOMEBREW_LIBRARY="$HOMEBREW_REPOSITORY/Library" # Whitelist and copy to HOMEBREW_* all variables previously mentioned in # manpage or used elsewhere by Homebrew. for VAR in AWS_ACCESS_KEY_ID AWS_SECRET_ACCESS_KEY BINTRAY_USER BINTRAY_KEY \ - BROWSER EDITOR GIT PATH VISUAL + BROWSER EDITOR GIT PATH VISUAL \ + GITHUB_USER GITHUB_PASSWORD GITHUB_TOKEN do # Skip if variable value is empty. [[ -z "${!VAR}" ]] && continue
true
Other
Homebrew
brew
ac799d9f2d8cff87d01b69174056f65552517721.json
brew list --pinned: pass explicit sort to handle APFS
Library/Homebrew/cmd/list.rb
@@ -108,7 +108,7 @@ def filtered_list end if ARGV.include? "--pinned" pinned_versions = {} - names.each do |d| + names.sort.each do |d| keg_pin = (HOMEBREW_PINNED_KEGS/d.basename.to_s) if keg_pin.exist? || keg_pin.symlink? pinned_versions[d] = keg_pin.readlink.basename.to_s
false
Other
Homebrew
brew
ccecdab4cd069a82820e239c1821076396314826.json
brew list --versions: pass explicit sort to handle APFS
Library/Homebrew/cmd/list.rb
@@ -118,7 +118,7 @@ def filtered_list puts d.basename.to_s.concat(ARGV.include?("--versions") ? " #{version}" : "") end else # --versions without --pinned - names.each do |d| + names.sort.each do |d| versions = d.subdirs.map { |pn| pn.basename.to_s } next if ARGV.include?("--multiple") && versions.length < 2 puts "#{d.basename} #{versions * " "}"
false
Other
Homebrew
brew
e300713f253029ef91a86bc4006d316582fc6d13.json
xcode: check Xcode installed before using version. This avoids infinite recursion described in: https://github.com/Homebrew/brew/pull/3422#issuecomment-342001451
Library/Homebrew/os/mac/xcode.rb
@@ -272,7 +272,9 @@ def version def detect_version # CLT isn't a distinct entity pre-4.3, and pkgutil doesn't exist # at all on Tiger, so just count it as installed if Xcode is installed - return MacOS::Xcode.version if MacOS::Xcode.version < "3.0" + if MacOS::Xcode.installed? && MacOS::Xcode.version < "3.0" + return MacOS::Xcode.version + end version = nil [MAVERICKS_PKG_ID, MAVERICKS_NEW_PKG_ID, STANDALONE_PKG_ID, FROM_XCODE_PKG_ID].each do |id|
false
Other
Homebrew
brew
603d6fd1f56a6edb37cbbc70cf1cbfe892455082.json
ENV/super: simplify version checks.
Library/Homebrew/extend/os/mac/extend/ENV/super.rb
@@ -91,18 +91,18 @@ def setup_build_environment(formula = nil) generic_setup_build_environment(formula) self["HOMEBREW_SDKROOT"] = effective_sysroot - if MacOS::Xcode.without_clt? || (MacOS::Xcode.installed? && MacOS::Xcode.version.to_i >= 7) + if MacOS::Xcode.without_clt? || MacOS::Xcode.version.to_i >= 7 self["MACOSX_DEPLOYMENT_TARGET"] = MacOS.version.to_s self["SDKROOT"] = MacOS.sdk_path end # Filter out symbols known not to be defined since GNU Autotools can't # reliably figure this out with Xcode 8 and above. - if MacOS.version == "10.12" && MacOS::Xcode.installed? && MacOS::Xcode.version >= "9.0" + if MacOS.version == "10.12" && MacOS::Xcode.version >= "9.0" %w[fmemopen futimens open_memstream utimensat].each do |s| ENV["ac_cv_func_#{s}"] = "no" end - elsif MacOS.version == "10.11" && MacOS::Xcode.installed? && MacOS::Xcode.version >= "8.0" + elsif MacOS.version == "10.11" && MacOS::Xcode.version >= "8.0" %w[basename_r clock_getres clock_gettime clock_settime dirname_r getentropy mkostemp mkostemps timingsafe_bcmp].each do |s| ENV["ac_cv_func_#{s}"] = "no"
false
Other
Homebrew
brew
8c6defd9cf58840bd08af30147a9f6305a219712.json
diagnostic: simplify version checks.
Library/Homebrew/extend/os/mac/diagnostic.rb
@@ -50,7 +50,6 @@ def check_for_unsupported_macos end def check_xcode_up_to_date - return unless MacOS::Xcode.installed? return unless MacOS::Xcode.outdated? # Travis CI images are going to end up outdated so don't complain when @@ -78,7 +77,6 @@ def check_xcode_up_to_date end def check_clt_up_to_date - return unless MacOS::CLT.installed? return unless MacOS::CLT.outdated? # Travis CI images are going to end up outdated so don't complain when @@ -108,7 +106,6 @@ def check_xcode_8_without_clt_on_el_capitan end def check_xcode_minimum_version - return unless MacOS::Xcode.installed? return unless MacOS::Xcode.below_minimum_version? <<~EOS @@ -119,7 +116,6 @@ def check_xcode_minimum_version end def check_clt_minimum_version - return unless MacOS::CLT.installed? return unless MacOS::CLT.below_minimum_version? <<~EOS @@ -281,13 +277,8 @@ def check_xcode_license_approved EOS end - def check_for_latest_xquartz - return unless MacOS::XQuartz.version - return if MacOS::XQuartz.provided_by_apple? - - installed_version = Version.create(MacOS::XQuartz.version) - latest_version = Version.create(MacOS::XQuartz.latest_version) - return if installed_version >= latest_version + def check_xquartz_up_to_date + return unless MacOS::XQuartz.outdated? <<~EOS Your XQuartz (#{installed_version}) is outdated. @@ -298,8 +289,7 @@ def check_for_latest_xquartz end def check_for_beta_xquartz - return unless MacOS::XQuartz.version - return unless MacOS::XQuartz.version.include? "beta" + return unless MacOS::XQuartz.version.to_s.include?("beta") <<~EOS The following beta release of XQuartz is installed: #{MacOS::XQuartz.version}
false
Other
Homebrew
brew
b69d71edea36ed8845801c037a72e92dace248a8.json
system_config: handle new non-string Xcode version
Library/Homebrew/extend/os/mac/system_config.rb
@@ -4,7 +4,7 @@ def xcode if instance_variable_defined?(:@xcode) @xcode elsif MacOS::Xcode.installed? - @xcode = MacOS::Xcode.version + @xcode = MacOS::Xcode.version.to_s @xcode += " => #{MacOS::Xcode.prefix}" unless MacOS::Xcode.default_prefix? @xcode end
false
Other
Homebrew
brew
f0b25b5482ba43611c77d94c2326c35f14b6de3d.json
requirement: convert Cellar path to opt path.
Library/Homebrew/requirement.rb
@@ -77,7 +77,11 @@ def default_formula? def satisfied_result_parent return unless @satisfied_result.is_a?(Pathname) - @satisfied_result.resolved_path.parent + parent = @satisfied_result.resolved_path.parent + if parent.to_s =~ %r{^#{Regexp.escape(HOMEBREW_CELLAR)}/([\w+-.@]+)/[^/]+/(s?bin)/?$} + parent = HOMEBREW_PREFIX/"opt/#{Regexp.last_match(1)}/#{Regexp.last_match(2)}" + end + parent end # Overriding #modify_build_environment is deprecated.
false
Other
Homebrew
brew
04367c4dafdf85a47a7f9f5e8444b1ad1a5cd5af.json
bump-formula-pr: --message: add newlines before and after hr Without an empty line before the horizontal rule (---), "Created with `brew bump-formula-pr`." is treated as a setext header. The newline before the hr is not part of the heredoc because putting it in would trip up Rubocop.
Library/Homebrew/dev-cmd/bump-formula-pr.rb
@@ -335,8 +335,9 @@ def bump_formula_pr EOS user_message = ARGV.value("message") if user_message - pr_message += <<~EOS + pr_message += "\n" + <<~EOS --- + #{user_message} EOS end
false
Other
Homebrew
brew
a8788015b69c5525efe2cd47ba67c1e6950d1526.json
Cask doctor: add macOS & Java versions
Library/Homebrew/cask/lib/hbc/cli/doctor.rb
@@ -1,3 +1,5 @@ +require "system_config" + module Hbc class CLI class Doctor < AbstractCommand @@ -9,6 +11,8 @@ def initialize(*) def run ohai "Homebrew-Cask Version", Hbc.full_version + ohai "macOS", MacOS.full_version + ohai "Java", SystemConfig.describe_java ohai "Homebrew-Cask Install Location", self.class.render_install_location ohai "Homebrew-Cask Staging Location", self.class.render_staging_location(Hbc.caskroom) ohai "Homebrew-Cask Cached Downloads", self.class.render_cached_downloads
false
Other
Homebrew
brew
3769bcc52338a4381d19443c18386f8261297fd7.json
formula: fix safe navigation bug Safe navigation needs to be chained to preserve equivalence. Fixes a bug introduced by 01e9ec9a in #3183.
Library/Homebrew/formula.rb
@@ -1528,10 +1528,10 @@ def to_hash "oldname" => oldname, "aliases" => aliases, "versions" => { - "stable" => stable&.version.to_s, + "stable" => stable&.version&.to_s, "bottle" => bottle ? true : false, - "devel" => devel&.version.to_s, - "head" => head&.version.to_s, + "devel" => devel&.version&.to_s, + "head" => head&.version&.to_s, }, "revision" => revision, "version_scheme" => version_scheme,
false
Other
Homebrew
brew
eaae7f3a5b7dcce0d6c4a3238547996e886b7144.json
Fix last remaining style issues
Library/Homebrew/cask/lib/hbc/audit.rb
@@ -57,9 +57,8 @@ def check_single_pre_postflight add_warning "only a single preflight stanza is allowed" end - if cask.artifacts.count { |k| k.is_a?(Hbc::Artifact::PostflightBlock) && k.directives.key?(:postflight) } > 1 - add_warning "only a single postflight stanza is allowed" - end + return unless cask.artifacts.count { |k| k.is_a?(Hbc::Artifact::PostflightBlock) && k.directives.key?(:postflight) } > 1 + add_warning "only a single postflight stanza is allowed" end def check_single_uninstall_zap @@ -77,9 +76,8 @@ def check_single_uninstall_zap add_warning "only a single uninstall_postflight stanza is allowed" end - if cask.artifacts.count { |k| k.is_a?(Hbc::Artifact::Zap) } > 1 - add_warning "only a single zap stanza is allowed" - end + return unless cask.artifacts.count { |k| k.is_a?(Hbc::Artifact::Zap) } > 1 + add_warning "only a single zap stanza is allowed" end def check_required_stanzas
false
Other
Homebrew
brew
50c09f8c5737336b124ac53d4996b4f61af1590f.json
xcode: expect Xcode 9.1 on Sierra & High Sierra
Library/Homebrew/os/mac/xcode.rb
@@ -17,13 +17,13 @@ def latest_version when "10.9" then "6.2" when "10.10" then "7.2.1" when "10.11" then "8.2.1" - when "10.12" then "9.0.1" - when "10.13" then "9.0.1" + when "10.12" then "9.1" + when "10.13" then "9.1" else raise "macOS '#{MacOS.version}' is invalid" unless OS::Mac.prerelease? # Default to newest known version of Xcode for unreleased macOS versions. - "9.0.1" + "9.1" end end
false
Other
Homebrew
brew
7f2e4f583a5789a86712322818612c439307b90d.json
Finalize metadata handling and uninstall logic
Library/Homebrew/cask/lib/hbc/cli/upgrade.rb
@@ -34,25 +34,29 @@ def run old_cask_installer = Installer.new(old_cask, binaries: binaries?, verbose: verbose?, force: force?, upgrade: true) - old_cask_installer.uninstall - - begin - odebug "Installing new version of Cask #{old_cask}" - - new_cask = CaskLoader.load(old_cask.to_s) + new_cask = CaskLoader.load(old_cask.to_s) + new_cask_installer = Installer.new(new_cask, binaries: binaries?, verbose: verbose?, force: force?, skip_cask_deps: skip_cask_deps?, require_sha: require_sha?, - upgrade: true).install + upgrade: true) + + begin + # purge artifacts BUT keep metadata aside + old_cask_installer.start_upgrade + + # install BUT do not yet save metadata + new_cask_installer.install + + # if successful, remove old metadata and install new old_cask_installer.finalize_upgrade - rescue CaskUnavailableError => e - opoo e.message - rescue CaskAlreadyInstalledError => e + rescue CaskError => e opoo e.message + old_cask_installer.revert_upgrade end end end
true
Other
Homebrew
brew
7f2e4f583a5789a86712322818612c439307b90d.json
Finalize metadata handling and uninstall logic
Library/Homebrew/cask/lib/hbc/installer.rb
@@ -83,8 +83,8 @@ def stage def install odebug "Hbc::Installer#install" - if @cask.installed? && !force? && !@reinstall && !@upgrade - raise CaskAlreadyInstalledError, @cask + if @cask.installed? && !force? && !@reinstall + raise CaskAlreadyInstalledError, @cask unless @upgrade end check_conflicts @@ -369,17 +369,28 @@ def uninstall oh1 "Uninstalling Cask #{@cask}" disable_accessibility_access uninstall_artifacts - return if @upgrade - purge_versioned_files purge_caskroom_path if force? end - def finalize_upgrade + def start_upgrade return unless @upgrade + oh1 "Starting upgrade for Cask #{@cask}" - purge_versioned_files - purge_caskroom_path if force? + disable_accessibility_access + uninstall_artifacts + end + + def revert_upgrade + return unless @upgrade + opoo "Reverting upgrade for Cask #{@cask}" + reinstall + end + + def finalize_upgrade + return unless @upgrade + purge_versioned_files(upgrade: true) + oh1 "Cask #{@cask} was successfully upgraded!" end def uninstall_artifacts @@ -414,7 +425,7 @@ def gain_permissions_remove(path) Utils.gain_permissions_remove(path, command: @command) end - def purge_versioned_files + def purge_versioned_files(upgrade: false) odebug "Purging files for version #{@cask.version} of Cask #{@cask}" # versioned staged distribution @@ -430,10 +441,10 @@ def purge_versioned_files end end @cask.metadata_versioned_path.rmdir_if_possible - @cask.metadata_master_container_path.rmdir_if_possible + @cask.metadata_master_container_path.rmdir_if_possible unless upgrade # toplevel staged distribution - @cask.caskroom_path.rmdir_if_possible + @cask.caskroom_path.rmdir_if_possible unless upgrade end def purge_caskroom_path
true
Other
Homebrew
brew
8fd18eab2133aeb33fc0f42f9707f69da64d0f8d.json
text_cop: drop go_resource recommendation
Library/Homebrew/rubocops/text_cop.rb
@@ -46,7 +46,7 @@ def audit_formula(_node, _class_node, _parent_class_node, body_node) end find_method_with_args(body_node, :system, "go", "get") do - problem "Formulae should not use `go get`. If non-vendored resources are required use `go_resource`s." + problem "Do not use `go get`. Please ask upstream to implement Go vendoring" end end end
false
Other
Homebrew
brew
917c138eeb4af0cee212f94edc425512dfbade99.json
Add tests for uninstall_* and zap stanzas
Library/Homebrew/test/cask/audit_spec.rb
@@ -91,6 +91,120 @@ def include_msg?(messages, msg) end end + describe "preflight stanza checks" do + let(:error_msg) { "only a single preflight stanza is allowed" } + + context "when the cask has no preflight stanza" do + let(:cask_token) { "with-zap-rmdir" } + it { should_not warn_with(error_msg) } + end + + context "when the cask has only one preflight stanza" do + let(:cask_token) { "with-preflight" } + it { should_not warn_with(error_msg) } + end + + context "when the cask has multiple preflight stanzas" do + let(:cask_token) { "with-preflight-multi" } + it { is_expected.to warn_with(error_msg) } + end + end + + describe "uninstall_postflight stanza checks" do + let(:error_msg) { "only a single postflight stanza is allowed" } + + context "when the cask has no postflight stanza" do + let(:cask_token) { "with-zap-rmdir" } + it { should_not warn_with(error_msg) } + end + + context "when the cask has only one postflight stanza" do + let(:cask_token) { "with-postflight" } + it { should_not warn_with(error_msg) } + end + + context "when the cask has multiple postflight stanzas" do + let(:cask_token) { "with-postflight-multi" } + it { is_expected.to warn_with(error_msg) } + end + end + + describe "uninstall stanza checks" do + let(:error_msg) { "only a single uninstall stanza is allowed" } + + context "when the cask has no uninstall stanza" do + let(:cask_token) { "with-zap-rmdir" } + it { should_not warn_with(error_msg) } + end + + context "when the cask has only one uninstall stanza" do + let(:cask_token) { "with-uninstall-rmdir" } + it { should_not warn_with(error_msg) } + end + + context "when the cask has multiple uninstall stanzas" do + let(:cask_token) { "with-uninstall-multi" } + it { is_expected.to warn_with(error_msg) } + end + end + + describe "uninstall_preflight stanza checks" do + let(:error_msg) { "only a single uninstall_preflight stanza is allowed" } + + context "when the cask has no uninstall_preflight stanza" do + let(:cask_token) { "with-zap-rmdir" } + it { should_not warn_with(error_msg) } + end + + context "when the cask has only one uninstall_preflight stanza" do + let(:cask_token) { "with-uninstall-preflight" } + it { should_not warn_with(error_msg) } + end + + context "when the cask has multiple uninstall_preflight stanzas" do + let(:cask_token) { "with-uninstall-preflight-multi" } + it { is_expected.to warn_with(error_msg) } + end + end + + describe "uninstall_postflight stanza checks" do + let(:error_msg) { "only a single uninstall_postflight stanza is allowed" } + + context "when the cask has no uninstall_postflight stanza" do + let(:cask_token) { "with-zap-rmdir" } + it { should_not warn_with(error_msg) } + end + + context "when the cask has only one uninstall_postflight stanza" do + let(:cask_token) { "with-uninstall-postflight" } + it { should_not warn_with(error_msg) } + end + + context "when the cask has multiple uninstall_postflight stanzas" do + let(:cask_token) { "with-uninstall-postflight-multi" } + it { is_expected.to warn_with(error_msg) } + end + end + + describe "zap stanza checks" do + let(:error_msg) { "only a single zap stanza is allowed" } + + context "when the cask has no zap stanza" do + let(:cask_token) { "with-uninstall-rmdir" } + it { should_not warn_with(error_msg) } + end + + context "when the cask has only one zap stanza" do + let(:cask_token) { "with-zap-rmdir" } + it { should_not warn_with(error_msg) } + end + + context "when the cask has multiple zap stanzas" do + let(:cask_token) { "with-zap-multi" } + it { is_expected.to warn_with(error_msg) } + end + end + describe "version checks" do let(:error_msg) { "you should use version :latest instead of version 'latest'" }
true
Other
Homebrew
brew
917c138eeb4af0cee212f94edc425512dfbade99.json
Add tests for uninstall_* and zap stanzas
Library/Homebrew/test/support/fixtures/cask/Casks/with-postflight-multi.rb
@@ -0,0 +1,13 @@ +cask 'with-postflight-multi' do + version '1.2.3' + sha256 '8c62a2b791cf5f0da6066a0a4b6e85f62949cd60975da062df44adf887f4370b' + + url "file://#{TEST_FIXTURE_DIR}/cask/MyFancyPkg.zip" + homepage 'http://example.com/fancy-pkg' + + pkg 'MyFancyPkg/Fancy.pkg' + + postflight do end + + postflight do end +end
true
Other
Homebrew
brew
917c138eeb4af0cee212f94edc425512dfbade99.json
Add tests for uninstall_* and zap stanzas
Library/Homebrew/test/support/fixtures/cask/Casks/with-postflight.rb
@@ -0,0 +1,11 @@ +cask 'with-postflight' do + version '1.2.3' + sha256 '8c62a2b791cf5f0da6066a0a4b6e85f62949cd60975da062df44adf887f4370b' + + url "file://#{TEST_FIXTURE_DIR}/cask/MyFancyPkg.zip" + homepage 'http://example.com/fancy-pkg' + + pkg 'MyFancyPkg/Fancy.pkg' + + postflight do end +end
true
Other
Homebrew
brew
917c138eeb4af0cee212f94edc425512dfbade99.json
Add tests for uninstall_* and zap stanzas
Library/Homebrew/test/support/fixtures/cask/Casks/with-preflight-multi.rb
@@ -0,0 +1,13 @@ +cask 'with-preflight-multi' do + version '1.2.3' + sha256 '8c62a2b791cf5f0da6066a0a4b6e85f62949cd60975da062df44adf887f4370b' + + url "file://#{TEST_FIXTURE_DIR}/cask/MyFancyPkg.zip" + homepage 'http://example.com/fancy-pkg' + + pkg 'MyFancyPkg/Fancy.pkg' + + preflight do end + + preflight do end +end
true
Other
Homebrew
brew
917c138eeb4af0cee212f94edc425512dfbade99.json
Add tests for uninstall_* and zap stanzas
Library/Homebrew/test/support/fixtures/cask/Casks/with-preflight.rb
@@ -0,0 +1,11 @@ +cask 'with-preflight' do + version '1.2.3' + sha256 '8c62a2b791cf5f0da6066a0a4b6e85f62949cd60975da062df44adf887f4370b' + + url "file://#{TEST_FIXTURE_DIR}/cask/MyFancyPkg.zip" + homepage 'http://example.com/fancy-pkg' + + pkg 'MyFancyPkg/Fancy.pkg' + + preflight do end +end
true
Other
Homebrew
brew
917c138eeb4af0cee212f94edc425512dfbade99.json
Add tests for uninstall_* and zap stanzas
Library/Homebrew/test/support/fixtures/cask/Casks/with-uninstall-multi.rb
@@ -0,0 +1,13 @@ +cask 'with-uninstall-multi' do + version '1.2.3' + sha256 '8c62a2b791cf5f0da6066a0a4b6e85f62949cd60975da062df44adf887f4370b' + + url "file://#{TEST_FIXTURE_DIR}/cask/MyFancyPkg.zip" + homepage 'http://example.com/fancy-pkg' + + pkg 'MyFancyPkg/Fancy.pkg' + + uninstall rmdir: "#{TEST_TMPDIR}/empty_directory_path" + + uninstall delete: "#{TEST_TMPDIR}/empty_directory_path" +end
true
Other
Homebrew
brew
917c138eeb4af0cee212f94edc425512dfbade99.json
Add tests for uninstall_* and zap stanzas
Library/Homebrew/test/support/fixtures/cask/Casks/with-uninstall-postflight-multi.rb
@@ -0,0 +1,13 @@ +cask 'with-uninstall-postflight-multi' do + version '1.2.3' + sha256 '8c62a2b791cf5f0da6066a0a4b6e85f62949cd60975da062df44adf887f4370b' + + url "file://#{TEST_FIXTURE_DIR}/cask/MyFancyPkg.zip" + homepage 'http://example.com/fancy-pkg' + + pkg 'MyFancyPkg/Fancy.pkg' + + uninstall_postflight do end + + uninstall_postflight do end +end
true
Other
Homebrew
brew
917c138eeb4af0cee212f94edc425512dfbade99.json
Add tests for uninstall_* and zap stanzas
Library/Homebrew/test/support/fixtures/cask/Casks/with-uninstall-postflight.rb
@@ -0,0 +1,11 @@ +cask 'with-uninstall-postflight' do + version '1.2.3' + sha256 '8c62a2b791cf5f0da6066a0a4b6e85f62949cd60975da062df44adf887f4370b' + + url "file://#{TEST_FIXTURE_DIR}/cask/MyFancyPkg.zip" + homepage 'http://example.com/fancy-pkg' + + pkg 'MyFancyPkg/Fancy.pkg' + + uninstall_postflight do end +end
true
Other
Homebrew
brew
917c138eeb4af0cee212f94edc425512dfbade99.json
Add tests for uninstall_* and zap stanzas
Library/Homebrew/test/support/fixtures/cask/Casks/with-uninstall-preflight-multi.rb
@@ -0,0 +1,13 @@ +cask 'with-uninstall-preflight-multi' do + version '1.2.3' + sha256 '8c62a2b791cf5f0da6066a0a4b6e85f62949cd60975da062df44adf887f4370b' + + url "file://#{TEST_FIXTURE_DIR}/cask/MyFancyPkg.zip" + homepage 'http://example.com/fancy-pkg' + + pkg 'MyFancyPkg/Fancy.pkg' + + uninstall_preflight do end + + uninstall_preflight do end +end
true
Other
Homebrew
brew
917c138eeb4af0cee212f94edc425512dfbade99.json
Add tests for uninstall_* and zap stanzas
Library/Homebrew/test/support/fixtures/cask/Casks/with-uninstall-preflight.rb
@@ -0,0 +1,11 @@ +cask 'with-uninstall-preflight' do + version '1.2.3' + sha256 '8c62a2b791cf5f0da6066a0a4b6e85f62949cd60975da062df44adf887f4370b' + + url "file://#{TEST_FIXTURE_DIR}/cask/MyFancyPkg.zip" + homepage 'http://example.com/fancy-pkg' + + pkg 'MyFancyPkg/Fancy.pkg' + + uninstall_preflight do end +end
true
Other
Homebrew
brew
917c138eeb4af0cee212f94edc425512dfbade99.json
Add tests for uninstall_* and zap stanzas
Library/Homebrew/test/support/fixtures/cask/Casks/with-zap-multi.rb
@@ -0,0 +1,13 @@ +cask 'with-zap-multi' do + version '1.2.3' + sha256 '8c62a2b791cf5f0da6066a0a4b6e85f62949cd60975da062df44adf887f4370b' + + url "file://#{TEST_FIXTURE_DIR}/cask/MyFancyPkg.zip" + homepage 'http://example.com/fancy-pkg' + + pkg 'MyFancyPkg/Fancy.pkg' + + zap rmdir: "#{TEST_TMPDIR}/empty_directory_path" + + zap delete: "#{TEST_TMPDIR}/empty_directory_path" +end
true
Other
Homebrew
brew
55727b789532fbfa7997929aa0506d7843eda3ce.json
Hack a first working version of upgrade
Library/Homebrew/cask/lib/hbc/cli.rb
@@ -21,6 +21,7 @@ require "hbc/cli/search" require "hbc/cli/style" require "hbc/cli/uninstall" +require "hbc/cli/upgrade" require "hbc/cli/--version" require "hbc/cli/zap"
true
Other
Homebrew
brew
55727b789532fbfa7997929aa0506d7843eda3ce.json
Hack a first working version of upgrade
Library/Homebrew/cask/lib/hbc/cli/upgrade.rb
@@ -0,0 +1,65 @@ +module Hbc + class CLI + class Upgrade < AbstractCommand + option "--greedy", :greedy, false + option "--quiet", :quiet, false + option "--force", :force, false + option "--force-update", :force_update, false + option "--skip-cask-deps", :skip_cask_deps, false + + def initialize(*) + super + self.verbose = ($stdout.tty? || verbose?) && !quiet? + end + + def run + outdated_casks = casks(alternative: -> { Hbc.installed }).find_all { |cask| cask.outdated?(greedy?) } + + if outdated_casks.empty? + oh1 "No packages to upgrade" + else + oh1 "Upgrading #{Formatter.pluralize(outdated_casks.length, "outdated package")}, with result:" + puts outdated_casks.map { |f| "#{f.full_name} #{f.version}" } * ", " + end + + outdated_casks.each do |old_cask| + odebug "Uninstalling Cask #{old_cask}" + + raise CaskNotInstalledError, old_cask unless old_cask.installed? || force? + + unless old_cask.installed_caskfile.nil? + # use the same cask file that was used for installation, if possible + old_cask = CaskLoader.load(old_cask.installed_caskfile) if old_cask.installed_caskfile.exist? + end + + old_cask_installer = Installer.new(old_cask, binaries: binaries?, verbose: verbose?, force: force?, upgrade: true) + + old_cask_installer.uninstall + + begin + odebug "Installing new version of Cask #{old_cask}" + + new_cask = CaskLoader.load(old_cask.to_s) + + Installer.new(new_cask, binaries: binaries?, + verbose: verbose?, + force: force?, + skip_cask_deps: skip_cask_deps?, + require_sha: require_sha?, + upgrade: true).install + + old_cask_installer.finalize_upgrade + rescue CaskUnavailableError => e + opoo e.message + rescue CaskAlreadyInstalledError => e + opoo e.message + end + end + end + + def self.help + "upgrades all outdated casks" + end + end + end +end
true
Other
Homebrew
brew
55727b789532fbfa7997929aa0506d7843eda3ce.json
Hack a first working version of upgrade
Library/Homebrew/cask/lib/hbc/installer.rb
@@ -19,7 +19,7 @@ class Installer PERSISTENT_METADATA_SUBDIRS = ["gpg"].freeze - def initialize(cask, command: SystemCommand, force: false, skip_cask_deps: false, binaries: true, verbose: false, require_sha: false) + def initialize(cask, command: SystemCommand, force: false, skip_cask_deps: false, binaries: true, verbose: false, require_sha: false, upgrade: false) @cask = cask @command = command @force = force @@ -28,6 +28,7 @@ def initialize(cask, command: SystemCommand, force: false, skip_cask_deps: false @verbose = verbose @require_sha = require_sha @reinstall = false + @upgrade = upgrade end attr_predicate :binaries?, :force?, :skip_cask_deps?, :require_sha?, :verbose? @@ -82,7 +83,7 @@ def stage def install odebug "Hbc::Installer#install" - if @cask.installed? && !force? && !@reinstall + if @cask.installed? && !force? && !@reinstall && !@upgrade raise CaskAlreadyInstalledError, @cask end @@ -129,7 +130,7 @@ def uninstall_existing_cask installed_cask = installed_caskfile.exist? ? CaskLoader.load(installed_caskfile) : @cask # Always force uninstallation, ignore method parameter - Installer.new(installed_cask, binaries: binaries?, verbose: verbose?, force: true).uninstall + Installer.new(installed_cask, binaries: binaries?, verbose: verbose?, force: true, upgrade: @upgrade).uninstall end def summary @@ -368,6 +369,15 @@ def uninstall oh1 "Uninstalling Cask #{@cask}" disable_accessibility_access uninstall_artifacts + return if @upgrade + + purge_versioned_files + purge_caskroom_path if force? + end + + def finalize_upgrade + return unless @upgrade + purge_versioned_files purge_caskroom_path if force? end
true
Other
Homebrew
brew
55727b789532fbfa7997929aa0506d7843eda3ce.json
Hack a first working version of upgrade
Library/Homebrew/test/cask/cli/upgrade_spec.rb
@@ -0,0 +1,78 @@ +require_relative "shared_examples/invalid_option" + +describe Hbc::CLI::Upgrade, :cask do + let(:installed) do + [ + Hbc::CaskLoader.load(cask_path("outdated/local-caffeine")), + Hbc::CaskLoader.load(cask_path("outdated/local-transmission")), + Hbc::CaskLoader.load(cask_path("outdated/auto-updates")), + ] + end + + it_behaves_like "a command that handles invalid options" + + before(:example) do + installed.each { |cask| InstallHelper.install_with_caskfile(cask) } + + allow_any_instance_of(described_class).to receive(:verbose?).and_return(true) + end + + describe 'without --greedy it ignores the Casks with "version latest" or "auto_updates true"' do + it "updates all the installed Casks when no token is provided" do + described_class.run + + expect(Hbc::CaskLoader.load("local-caffeine")).to be_installed + expect(Hbc.appdir.join("Caffeine.app")).to be_a_directory + expect(Hbc::CaskLoader.load("local-caffeine").versions).to include("1.2.3") + + expect(Hbc::CaskLoader.load("local-transmission")).to be_installed + expect(Hbc.appdir.join("Transmission.app")).to be_a_directory + expect(Hbc::CaskLoader.load("local-transmission").versions).to include("2.61") + end + + it "updates only the Casks specified in the command line" do + expect(Hbc::CaskLoader.load("local-caffeine").versions).to include("1.2.2") + expect(Hbc::CaskLoader.load("local-transmission").versions).to include("2.60") + + described_class.run("local-caffeine") + + expect(Hbc::CaskLoader.load("local-caffeine").versions).to include("1.2.3") + expect(Hbc::CaskLoader.load("local-caffeine").versions).to_not include("1.2.2") + expect(Hbc::CaskLoader.load("local-transmission").versions).to include("2.60") + end + + it 'ignores "auto_updates" and "latest" Casks even when their tokens are provided in the command line' do + expect(Hbc::CaskLoader.load("local-caffeine").versions).to include("1.2.2") + expect(Hbc::CaskLoader.load("auto-updates").versions).to include("2.57") + + described_class.run("local-caffeine", "auto-updates", "version-latest-string") + + expect(Hbc::CaskLoader.load("local-caffeine").versions).to include("1.2.3") + expect(Hbc::CaskLoader.load("auto-updates").versions).to include("2.57") + end + end + + describe "with --greedy it checks additional Casks" do + it 'includes the Casks with "auto_updates true" or "version latest" with --greedy' do + expect(Hbc::CaskLoader.load("auto-updates").versions).to include("2.57") + expect(Hbc::CaskLoader.load("local-caffeine").versions).to include("1.2.2") + expect(Hbc::CaskLoader.load("local-transmission").versions).to include("2.60") + + described_class.run("--greedy") + + expect(Hbc::CaskLoader.load("auto-updates").versions).to include("2.61") + expect(Hbc::CaskLoader.load("local-caffeine").versions).to include("1.2.3") + expect(Hbc::CaskLoader.load("local-transmission").versions).to include("2.61") + end + + it 'does not include the Casks with "auto_updates true" when the version did not change' do + cask = Hbc::CaskLoader.load(cask_path("auto-updates")) + InstallHelper.install_with_caskfile(cask) + expect(Hbc::CaskLoader.load("auto-updates").versions).to include("2.61") + + described_class.run("auto-updates", "--greedy") + + expect(Hbc::CaskLoader.load("auto-updates").versions).to include("2.61") + end + end +end
true
Other
Homebrew
brew
35493774785fbe870881c9cf5f7e4d66ab4926d2.json
cmd/sh: set working PS1 for zsh. The `bash`, default one is broken on `zsh`.
Library/Homebrew/cmd/sh.rb
@@ -25,7 +25,11 @@ def sh # superenv stopped adding brew's bin but generally users will want it ENV["PATH"] = PATH.new(ENV["PATH"]).insert(1, HOMEBREW_PREFIX/"bin") end - ENV["PS1"] = 'brew \[\033[1;32m\]\w\[\033[0m\]$ ' + if ENV["SHELL"].include?("zsh") + ENV["PS1"] = "brew %B%F{green}~%f%b$ " + else + ENV["PS1"] = 'brew \[\033[1;32m\]\w\[\033[0m\]$ ' + end ENV["VERBOSE"] = "1" puts <<~EOS Your shell has been configured to use Homebrew's build environment;
false
Other
Homebrew
brew
640b1e9dcb3fb96f6a54c0d63da4fb1985351a83.json
formula_desc_cop: ensure no full stops at the end of desc - This was a suggestion by Mike McQuaid in my `homebrew-core` audit description PR. Based on ilovezfs's incantation `grep -r -E 'desc ".*\."' *.rb`, some formulae descriptions do end in full stops. (My initial assessment of this failed to account for the fact that descriptions are strings and so end in `"`.) - Add an autocorrect for this cop, too.
Library/Homebrew/rubocops/formula_desc_cop.rb
@@ -40,6 +40,7 @@ def audit_formula(_node, _class_node, _parent_class_node, body_node) # - Checks for correct usage of `command-line` in `desc` # - Checks description starts with a capital letter # - Checks if `desc` contains the formula name + # - Checks if `desc` ends with a full stop class Desc < FormulaCop VALID_LOWERCASE_WORDS = %w[ ex @@ -78,8 +79,13 @@ def audit_formula(_node, _class_node, _parent_class_node, body_node) end # Check if formula's desc starts with formula's name - return unless regex_match_group(desc, /^#{@formula_name} /i) - problem "Description shouldn't start with the formula name" + if regex_match_group(desc, /^#{@formula_name} /i) + problem "Description shouldn't start with the formula name" + end + + # Check if a full stop is used at the end of a formula's desc + return unless regex_match_group(desc, /\.$/) + problem "Description shouldn't end with a full stop" end private @@ -97,6 +103,7 @@ def autocorrect(node) correction.gsub!(/(^|[^a-z])#{@formula_name}([^a-z]|$)/i, "\\1\\2") correction.gsub!(/^(['"]?)\s+/, "\\1") correction.gsub!(/\s+(['"]?)$/, "\\1") + correction.gsub!(/\.$/, "") corrector.insert_before(node.source_range, correction) corrector.remove(node.source_range) end
true
Other
Homebrew
brew
640b1e9dcb3fb96f6a54c0d63da4fb1985351a83.json
formula_desc_cop: ensure no full stops at the end of desc - This was a suggestion by Mike McQuaid in my `homebrew-core` audit description PR. Based on ilovezfs's incantation `grep -r -E 'desc ".*\."' *.rb`, some formulae descriptions do end in full stops. (My initial assessment of this failed to account for the fact that descriptions are strings and so end in `"`.) - Add an autocorrect for this cop, too.
Library/Homebrew/test/rubocops/formula_desc_cop_spec.rb
@@ -91,6 +91,16 @@ class Foo < Formula RUBY end + it "When the description ends with a full stop" do + expect_offense(<<~RUBY, "/homebrew-core/Formula/foo.rb") + class Foo < Formula + url 'http://example.com/foo-1.0.tgz' + desc 'Description with a full stop at the end.' + ^ Description shouldn\'t end with a full stop + end + RUBY + end + it "autocorrects all rules" do source = <<~EOS class Foo < Formula
true
Other
Homebrew
brew
3448335a14612bc7d3d426f79e3705b2bdad26cd.json
system_config: get perl/ruby from HOMEBREW_PATH. This is the actual user path when env filtering is enabled.
Library/Homebrew/system_config.rb
@@ -73,7 +73,7 @@ def describe_path(path) end def describe_perl - describe_path(which("perl")) + describe_path(which("perl", ENV["HOMEBREW_PATH"])) end def describe_python @@ -96,7 +96,7 @@ def describe_python end def describe_ruby - ruby = which "ruby" + ruby = which "ruby", ENV["HOMEBREW_PATH"] return "N/A" if ruby.nil? ruby_binary = Utils.popen_read ruby, "-rrbconfig", "-e", \ 'include RbConfig;print"#{CONFIG["bindir"]}/#{CONFIG["ruby_install_name"]}#{CONFIG["EXEEXT"]}"'
false
Other
Homebrew
brew
526299913fe757af28de9bad868635124b26e071.json
Remove usless comments.
Library/Homebrew/diagnostic.rb
@@ -1097,7 +1097,7 @@ def check_for_tap_ruby_files_locations def all methods.map(&:to_s).grep(/^check_/) end - end # end class Checks + end end end
true
Other
Homebrew
brew
526299913fe757af28de9bad868635124b26e071.json
Remove usless comments.
Library/Homebrew/language/python.rb
@@ -245,7 +245,7 @@ def do_install(targets) "-v", "--no-deps", "--no-binary", ":all:", "--ignore-installed", *targets end - end # class Virtualenv - end # module Virtualenv - end # module Python -end # module Language + end + end + end +end
true
Other
Homebrew
brew
d067b5f4344b31beef8cf0adb494c819a0e337bf.json
lines_cop: fix clang detection. We only care about e.g. `gcc`/`llvm-gcc`/`clang` being at the beginning of a `system` call and not anywhere within the string.
Library/Homebrew/rubocops/lines_cop.rb
@@ -176,7 +176,7 @@ def audit_formula(_node, _class_node, _parent_class_node, body_node) # Avoid hard-coding compilers find_every_method_call_by_name(body_node, :system).each do |method| param = parameters(method).first - if match = regex_match_group(param, %r{(/usr/bin/)?(gcc|llvm-gcc|clang)\s?}) + if match = regex_match_group(param, %r{^(/usr/bin/)?(gcc|llvm-gcc|clang)\s?}) problem "Use \"\#{ENV.cc}\" instead of hard-coding \"#{match[2]}\"" elsif match = regex_match_group(param, %r{(/usr/bin/)?((g|llvm-g|clang)\+\+)\s?}) problem "Use \"\#{ENV.cxx}\" instead of hard-coding \"#{match[2]}\"" @@ -185,9 +185,9 @@ def audit_formula(_node, _class_node, _parent_class_node, body_node) find_instance_method_call(body_node, "ENV", :[]=) do |method| param = parameters(method)[1] - if match = regex_match_group(param, %r{(/usr/bin/)?(gcc|llvm-gcc|clang)\s?}) + if match = regex_match_group(param, %r{^(/usr/bin/)?(gcc|llvm-gcc|clang)\s?}) problem "Use \"\#{ENV.cc}\" instead of hard-coding \"#{match[2]}\"" - elsif match = regex_match_group(param, %r{(/usr/bin/)?((g|llvm-g|clang)\+\+)\s?}) + elsif match = regex_match_group(param, %r{^(/usr/bin/)?((g|llvm-g|clang)\+\+)\s?}) problem "Use \"\#{ENV.cxx}\" instead of hard-coding \"#{match[2]}\"" end end
false
Other
Homebrew
brew
1937625d861ef1ef7bc0796477fdb81e7dbb9cf4.json
github: require formula name to be in issue title
Library/Homebrew/utils/github.rb
@@ -235,7 +235,7 @@ def search_code(**qualifiers) def issues_for_formula(name, options = {}) tap = options[:tap] || CoreTap.instance - search_issues(name, state: "open", repo: "#{tap.user}/homebrew-#{tap.repo}") + search_issues(name, state: "open", repo: "#{tap.user}/homebrew-#{tap.repo}", in: "title") end def print_pull_requests_matching(query)
false
Other
Homebrew
brew
6554b2595bc4ea6427d3838f023fd52b238366e2.json
docs: fix poor visibility in syntax highlighting
docs/css/pygments.css
@@ -33,7 +33,7 @@ .ne { color: #990000; font-weight: bold } /* Name.Exception */ .nf { color: #999999; font-weight: bold } /* Name.Function */ .nn { color: #555555 } /* Name.Namespace */ -.nt { color: #000080 } /* Name.Tag */ +.nt { color: #008080 } /* Name.Tag */ .nv { color: #008080 } /* Name.Variable */ .ow { font-weight: bold } /* Operator.Word */ .w { color: #bbbbbb } /* Text.Whitespace */
false