aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Library/.rubocop.yml3
-rw-r--r--Library/Homebrew/cask/lib/hbc/artifact/base.rb10
-rw-r--r--Library/Homebrew/cask/lib/hbc/artifact/nested_container.rb2
-rw-r--r--Library/Homebrew/cask/lib/hbc/artifact/uninstall_base.rb33
-rw-r--r--Library/Homebrew/cask/lib/hbc/cask.rb11
-rw-r--r--Library/Homebrew/cask/lib/hbc/cask_dependencies.rb37
-rw-r--r--Library/Homebrew/cask/lib/hbc/cask_loader.rb43
-rw-r--r--Library/Homebrew/cask/lib/hbc/checkable.rb14
-rw-r--r--Library/Homebrew/cask/lib/hbc/container/base.rb9
-rw-r--r--Library/Homebrew/cask/lib/hbc/container/dmg.rb105
-rw-r--r--Library/Homebrew/cask/lib/hbc/download_strategy.rb2
-rw-r--r--Library/Homebrew/cask/lib/hbc/dsl.rb4
-rw-r--r--Library/Homebrew/cask/lib/hbc/dsl/depends_on.rb4
-rw-r--r--Library/Homebrew/cask/lib/hbc/exceptions.rb12
-rw-r--r--Library/Homebrew/cask/lib/hbc/installer.rb88
-rw-r--r--Library/Homebrew/cask/lib/hbc/system_command.rb6
-rw-r--r--Library/Homebrew/cask/lib/hbc/url.rb2
-rw-r--r--Library/Homebrew/cask/lib/hbc/url_checker.rb2
-rw-r--r--Library/Homebrew/cask/lib/hbc/utils.rb17
-rw-r--r--Library/Homebrew/caveats.rb6
-rw-r--r--Library/Homebrew/checksum.rb7
-rw-r--r--Library/Homebrew/cmd/info.rb4
-rw-r--r--Library/Homebrew/cmd/style.rb6
-rw-r--r--Library/Homebrew/cmd/update-report.rb6
-rw-r--r--Library/Homebrew/constants.rb2
-rw-r--r--Library/Homebrew/debrew.rb11
-rw-r--r--Library/Homebrew/dependencies.rb59
-rw-r--r--Library/Homebrew/dependency.rb5
-rw-r--r--Library/Homebrew/dev-cmd/audit.rb17
-rw-r--r--Library/Homebrew/dev-cmd/bump-formula-pr.rb5
-rw-r--r--Library/Homebrew/download_strategy.rb5
-rw-r--r--Library/Homebrew/extend/os/linux/hardware/cpu.rb7
-rw-r--r--Library/Homebrew/extend/predicable.rb9
-rw-r--r--Library/Homebrew/formula.rb115
-rw-r--r--Library/Homebrew/formula_installer.rb11
-rw-r--r--Library/Homebrew/formula_support.rb2
-rw-r--r--Library/Homebrew/global.rb2
-rw-r--r--Library/Homebrew/language/node.rb31
-rw-r--r--Library/Homebrew/missing_formula.rb4
-rw-r--r--Library/Homebrew/os/mac/pkgconfig/10.13/libcurl.pc4
-rw-r--r--Library/Homebrew/os/mac/xcode.rb3
-rw-r--r--Library/Homebrew/resource.rb1
-rw-r--r--Library/Homebrew/rubocops.rb1
-rw-r--r--Library/Homebrew/software_spec.rb14
-rw-r--r--Library/Homebrew/test/cask/artifact/uninstall_zap_shared_examples.rb8
-rw-r--r--Library/Homebrew/test/cask/cli/style_spec.rb16
-rw-r--r--Library/Homebrew/test/cask/container/dmg_spec.rb11
-rw-r--r--Library/Homebrew/test/cask/depends_on_spec.rb2
-rw-r--r--Library/Homebrew/test/language/node_spec.rb35
-rw-r--r--Library/Homebrew/test/spec_helper.rb10
-rw-r--r--Library/Homebrew/test/utils/trash_spec.rb32
-rw-r--r--Library/Homebrew/test/version_spec.rb26
-rwxr-xr-xLibrary/Homebrew/utils/trash.swift43
-rw-r--r--Library/Homebrew/version.rb9
-rw-r--r--docs/Installation.md2
-rw-r--r--docs/Interesting-Taps-and-Forks.md (renamed from docs/Interesting-Taps-&-Forks.md)0
-rw-r--r--docs/Node-for-Formula-Authors.md8
-rw-r--r--docs/_config.yml11
-rw-r--r--docs/_layouts/base.html15
l---------docs/favicon.ico1
-rw-r--r--docs/img/apple-touch-icon-114x114-precomposed.pngbin9328 -> 0 bytes
-rw-r--r--docs/img/apple-touch-icon-120x120-precomposed.pngbin10045 -> 0 bytes
-rw-r--r--docs/img/apple-touch-icon-144x144-precomposed.pngbin12248 -> 0 bytes
-rw-r--r--docs/img/apple-touch-icon-152x152-precomposed.pngbin12942 -> 0 bytes
-rw-r--r--docs/img/apple-touch-icon-57x57-precomposed.pngbin4647 -> 0 bytes
-rw-r--r--docs/img/apple-touch-icon-72x72-precomposed.pngbin5914 -> 0 bytes
-rw-r--r--docs/img/apple-touch-icon-76x76-precomposed.pngbin6246 -> 0 bytes
-rw-r--r--docs/img/apple-touch-icon.png (renamed from docs/img/apple-touch-icon-180x180-precomposed.png)bin15557 -> 15557 bytes
-rw-r--r--docs/img/favicon-16x16.pngbin44048 -> 0 bytes
-rw-r--r--docs/img/favicon-192x192.pngbin16712 -> 0 bytes
-rw-r--r--docs/img/favicon-32x32.pngbin44048 -> 0 bytes
-rw-r--r--docs/img/favicon-96x96.pngbin44048 -> 0 bytes
-rw-r--r--docs/robots.txt4
73 files changed, 476 insertions, 498 deletions
diff --git a/Library/.rubocop.yml b/Library/.rubocop.yml
index 703912781..dbff189ef 100644
--- a/Library/.rubocop.yml
+++ b/Library/.rubocop.yml
@@ -33,6 +33,9 @@ FormulaAuditStrict/ComponentsRedundancy:
FormulaAudit/Homepage:
Enabled: true
+FormulaAudit/LegacyPatches:
+ Enabled: true
+
# `system` is a special case and aligns on second argument
Layout/AlignParameters:
Enabled: false
diff --git a/Library/Homebrew/cask/lib/hbc/artifact/base.rb b/Library/Homebrew/cask/lib/hbc/artifact/base.rb
index 2d9330b13..ae15552a4 100644
--- a/Library/Homebrew/cask/lib/hbc/artifact/base.rb
+++ b/Library/Homebrew/cask/lib/hbc/artifact/base.rb
@@ -1,6 +1,8 @@
module Hbc
module Artifact
class Base
+ extend Predicable
+
def self.artifact_name
@artifact_name ||= name.sub(/^.*:/, "").gsub(/(.)([A-Z])/, '\1_\2').downcase
end
@@ -65,13 +67,7 @@ module Hbc
{}
end
- def verbose?
- @verbose
- end
-
- def force?
- @force
- end
+ attr_predicate :force?, :verbose?
def initialize(cask, command: SystemCommand, force: false, verbose: false)
@cask = cask
diff --git a/Library/Homebrew/cask/lib/hbc/artifact/nested_container.rb b/Library/Homebrew/cask/lib/hbc/artifact/nested_container.rb
index 45f23fe37..84253ea30 100644
--- a/Library/Homebrew/cask/lib/hbc/artifact/nested_container.rb
+++ b/Library/Homebrew/cask/lib/hbc/artifact/nested_container.rb
@@ -16,7 +16,7 @@ module Hbc
end
ohai "Extracting nested container #{source.basename}"
- container.new(@cask, source, @command).extract
+ container.new(@cask, source, @command, verbose: verbose?).extract
FileUtils.remove_entry_secure(source)
end
end
diff --git a/Library/Homebrew/cask/lib/hbc/artifact/uninstall_base.rb b/Library/Homebrew/cask/lib/hbc/artifact/uninstall_base.rb
index 96243d201..695b5a950 100644
--- a/Library/Homebrew/cask/lib/hbc/artifact/uninstall_base.rb
+++ b/Library/Homebrew/cask/lib/hbc/artifact/uninstall_base.rb
@@ -194,6 +194,8 @@ module Hbc
end
def each_resolved_path(action, paths)
+ return enum_for(:each_resolved_path, action, paths) unless block_given?
+
paths.each do |path|
resolved_path = Pathname.new(path)
@@ -226,12 +228,33 @@ module Hbc
def uninstall_trash(*paths)
return if paths.empty?
+ resolved_paths = each_resolved_path(:trash, paths).to_a
+
ohai "Trashing files:"
- each_resolved_path(:trash, paths) do |path, resolved_paths|
- puts path
- resolved_paths.each { |resolved_path| Utils.gain_permissions(resolved_path, ["-R"], @command) }
- @command.run!("/usr/bin/xargs", args: ["-0", "--", HOMEBREW_LIBRARY_PATH/"utils/trash.swift"], input: resolved_paths.join("\0"))
- end
+ puts resolved_paths.map(&:first)
+ trash_paths(*resolved_paths.flat_map(&:last))
+ end
+
+ def trash_paths(*paths)
+ @command.run!("/usr/bin/osascript", args: ["-e", <<-'EOS'.undent, *paths])
+ on run argv
+ repeat with i from 1 to (count argv)
+ set item i of argv to (item i of argv as POSIX file)
+ end repeat
+
+ tell application "Finder"
+ set trashedItems to (move argv to trash)
+ set output to ""
+
+ repeat with i from 1 to (count trashedItems)
+ set item i of trashedItems to POSIX path of (item i of trashedItems as string)
+ set output to output & (item i of trashedItems) & (do shell script "printf \"\\0\"")
+ end repeat
+
+ return output
+ end tell
+ end run
+ EOS
end
def uninstall_rmdir(*directories)
diff --git a/Library/Homebrew/cask/lib/hbc/cask.rb b/Library/Homebrew/cask/lib/hbc/cask.rb
index e1cdb5dea..672d18954 100644
--- a/Library/Homebrew/cask/lib/hbc/cask.rb
+++ b/Library/Homebrew/cask/lib/hbc/cask.rb
@@ -1,5 +1,3 @@
-require "forwardable"
-
require "hbc/dsl"
require "hbc/metadata"
@@ -73,6 +71,15 @@ module Hbc
@token
end
+ def hash
+ token.hash
+ end
+
+ def eql?(other)
+ token == other.token
+ end
+ alias == eql?
+
def dumpcask
odebug "Cask instance dumps in YAML:"
odebug "Cask instance toplevel:", to_yaml
diff --git a/Library/Homebrew/cask/lib/hbc/cask_dependencies.rb b/Library/Homebrew/cask/lib/hbc/cask_dependencies.rb
index 8bba5df8e..0edda074e 100644
--- a/Library/Homebrew/cask/lib/hbc/cask_dependencies.rb
+++ b/Library/Homebrew/cask/lib/hbc/cask_dependencies.rb
@@ -1,35 +1,36 @@
+require "delegate"
+
require "hbc/topological_hash"
module Hbc
- class CaskDependencies
- attr_reader :cask, :graph, :sorted
+ class CaskDependencies < DelegateClass(Array)
+ attr_reader :cask, :graph
def initialize(cask)
@cask = cask
@graph = graph_dependencies
- @sorted = sort
+ super(sort)
end
- def graph_dependencies
- deps_in = ->(csk) { csk.depends_on ? csk.depends_on.cask || [] : [] }
- walk = lambda do |acc, deps|
- deps.each do |dep|
- next if acc.key?(dep)
- succs = deps_in.call CaskLoader.load(dep)
- acc[dep] = succs
- walk.call(acc, succs)
- end
- acc
- end
+ private
- graphed = walk.call({}, @cask.depends_on.cask)
- TopologicalHash[graphed]
+ def graph_dependencies(cask = self.cask, acc = TopologicalHash.new)
+ return acc if acc.key?(cask)
+ deps = cask.depends_on.cask.map(&CaskLoader.public_method(:load))
+ acc[cask] = deps
+ deps.each do |dep|
+ graph_dependencies(dep, acc)
+ end
+ acc
end
def sort
- @graph.tsort
+ raise CaskSelfReferencingDependencyError, cask.token if graph[cask].include?(cask)
+ graph.tsort - [cask]
rescue TSort::Cyclic
- raise CaskCyclicCaskDependencyError, @cask.token
+ strongly_connected_components = graph.strongly_connected_components.sort_by(&:count)
+ cyclic_dependencies = strongly_connected_components.last - [cask]
+ raise CaskCyclicDependencyError.new(cask.token, cyclic_dependencies.join(", "))
end
end
end
diff --git a/Library/Homebrew/cask/lib/hbc/cask_loader.rb b/Library/Homebrew/cask/lib/hbc/cask_loader.rb
index 43fd9080d..8cd010ef6 100644
--- a/Library/Homebrew/cask/lib/hbc/cask_loader.rb
+++ b/Library/Homebrew/cask/lib/hbc/cask_loader.rb
@@ -1,12 +1,14 @@
module Hbc
module CaskLoader
class FromContentLoader
+ attr_reader :content
+
def initialize(content)
@content = content
end
def load
- instance_eval(@content.force_encoding("UTF-8"), __FILE__, __LINE__)
+ instance_eval(content.force_encoding("UTF-8"), __FILE__, __LINE__)
end
private
@@ -18,25 +20,25 @@ module Hbc
class FromPathLoader < FromContentLoader
def self.can_load?(ref)
- path = Pathname.new(ref)
+ path = Pathname(ref)
path.extname == ".rb" && path.expand_path.exist?
end
attr_reader :token, :path
def initialize(path)
- path = Pathname.new(path).expand_path
+ path = Pathname(path).expand_path
@token = path.basename(".rb").to_s
@path = path
end
def load
- raise CaskUnavailableError.new(@token, "'#{@path}' does not exist.") unless @path.exist?
- raise CaskUnavailableError.new(@token, "'#{@path}' is not readable.") unless @path.readable?
- raise CaskUnavailableError.new(@token, "'#{@path}' is not a file.") unless @path.file?
+ raise CaskUnavailableError.new(token, "'#{path}' does not exist.") unless path.exist?
+ raise CaskUnavailableError.new(token, "'#{path}' is not readable.") unless path.readable?
+ raise CaskUnavailableError.new(token, "'#{path}' is not a file.") unless path.file?
- @content = IO.read(@path)
+ @content = IO.read(path)
super
end
@@ -44,11 +46,11 @@ module Hbc
private
def cask(header_token, &block)
- if @token != header_token
- raise CaskTokenMismatchError.new(@token, header_token)
+ if token != header_token
+ raise CaskTokenMismatchError.new(token, header_token)
end
- Cask.new(header_token, sourcefile_path: @path, &block)
+ Cask.new(header_token, sourcefile_path: path, &block)
end
end
@@ -65,14 +67,13 @@ module Hbc
end
def load
- Hbc.cache.mkpath
- FileUtils.rm_f @path
+ path.dirname.mkpath
begin
- ohai "Downloading #{@url}."
- curl @url, "-o", @path
+ ohai "Downloading #{url}."
+ curl url, "-o", path
rescue ErrorDuringExecution
- raise CaskUnavailableError.new(@token, "Failed to download #{Formatter.url(@url)}.")
+ raise CaskUnavailableError.new(token, "Failed to download #{Formatter.url(url)}.")
end
super
@@ -84,15 +85,17 @@ module Hbc
ref.to_s.match?(HOMEBREW_TAP_CASK_REGEX)
end
+ attr_reader :tap
+
def initialize(tapped_name)
- user, repo, token = tapped_name.split("/", 3).map(&:downcase)
+ user, repo, token = tapped_name.split("/", 3)
@tap = Tap.fetch(user, repo)
super @tap.cask_dir/"#{token}.rb"
end
def load
- @tap.install unless @tap.installed?
+ tap.install unless tap.installed?
super
end
@@ -104,12 +107,12 @@ module Hbc
end
def initialize(ref)
- @token = File.basename(ref, ".rb")
- super CaskLoader.default_path(@token)
+ token = File.basename(ref, ".rb")
+ super CaskLoader.default_path(token)
end
def load
- raise CaskUnavailableError.new(@token, "No Cask with this name exists.")
+ raise CaskUnavailableError.new(token, "No Cask with this name exists.")
end
end
diff --git a/Library/Homebrew/cask/lib/hbc/checkable.rb b/Library/Homebrew/cask/lib/hbc/checkable.rb
index 03f052629..604dd3f89 100644
--- a/Library/Homebrew/cask/lib/hbc/checkable.rb
+++ b/Library/Homebrew/cask/lib/hbc/checkable.rb
@@ -1,29 +1,27 @@
module Hbc
module Checkable
def errors
- Array(@errors)
+ @errors ||= []
end
def warnings
- Array(@warnings)
+ @warnings ||= []
end
def add_error(message)
- @errors ||= []
- @errors << message
+ errors << message
end
def add_warning(message)
- @warnings ||= []
- @warnings << message
+ warnings << message
end
def errors?
- Array(@errors).any?
+ errors.any?
end
def warnings?
- Array(@warnings).any?
+ warnings.any?
end
def result
diff --git a/Library/Homebrew/cask/lib/hbc/container/base.rb b/Library/Homebrew/cask/lib/hbc/container/base.rb
index 1f1c9ad9b..52eb5aab1 100644
--- a/Library/Homebrew/cask/lib/hbc/container/base.rb
+++ b/Library/Homebrew/cask/lib/hbc/container/base.rb
@@ -1,11 +1,16 @@
module Hbc
class Container
class Base
- def initialize(cask, path, command, nested: false)
+ def initialize(cask, path, command, nested: false, verbose: false)
@cask = cask
@path = path
@command = command
@nested = nested
+ @verbose = verbose
+ end
+
+ def verbose?
+ @verbose
end
def extract_nested_inside(dir)
@@ -32,7 +37,7 @@ module Hbc
return false unless container
ohai "Extracting nested container #{source.basename}"
- container.new(@cask, source, @command, nested: true).extract
+ container.new(@cask, source, @command, nested: true, verbose: verbose?).extract
true
end
diff --git a/Library/Homebrew/cask/lib/hbc/container/dmg.rb b/Library/Homebrew/cask/lib/hbc/container/dmg.rb
index 113c6fb11..1d172a4b7 100644
--- a/Library/Homebrew/cask/lib/hbc/container/dmg.rb
+++ b/Library/Homebrew/cask/lib/hbc/container/dmg.rb
@@ -13,61 +13,76 @@ module Hbc
print_stderr: false).stdout.empty?
end
- attr_reader :mounts
- def initialize(*args)
- super(*args)
- @mounts = []
- end
-
def extract
- mount!
- assert_mounts_found
- extract_mounts
- ensure
- eject!
+ mount do |mounts|
+ begin
+ raise CaskError, "No mounts found in '#{@path}'; perhaps it is a bad DMG?" if mounts.empty?
+ mounts.each(&method(:extract_mount))
+ ensure
+ mounts.each(&method(:eject))
+ end
+ end
end
- def mount!
- plist = @command.run!("/usr/bin/hdiutil",
- # realpath is a failsafe against unusual filenames
- args: %w[mount -plist -nobrowse -readonly -noidme -mountrandom /tmp] + [Pathname.new(@path).realpath],
- input: "y\n")
- .plist
- @mounts = mounts_from_plist(plist)
- end
+ def mount
+ # realpath is a failsafe against unusual filenames
+ path = Pathname.new(@path).realpath
- def eject!
- @mounts.each do |mount|
- # realpath is a failsafe against unusual filenames
- mountpath = Pathname.new(mount).realpath
- next unless mountpath.exist?
+ Dir.mktmpdir do |unpack_dir|
+ cdr_path = Pathname.new(unpack_dir).join("#{path.basename(".dmg")}.cdr")
- begin
- tries ||= 3
- if tries > 1
- @command.run("/usr/sbin/diskutil",
- args: ["eject", mountpath],
- print_stderr: false)
- else
- @command.run("/usr/sbin/diskutil",
- args: ["unmount", "force", mountpath],
- print_stderr: false)
+ without_eula = @command.run("/usr/bin/hdiutil",
+ args: ["attach", "-plist", "-nobrowse", "-readonly", "-noidme", "-mountrandom", unpack_dir, path],
+ input: "qn\n",
+ print_stderr: false)
+
+ # If mounting without agreeing to EULA succeeded, there is none.
+ plist = if without_eula.success?
+ without_eula.plist
+ else
+ @command.run!("/usr/bin/hdiutil", args: ["convert", "-quiet", "-format", "UDTO", "-o", cdr_path, path])
+
+ with_eula = @command.run!("/usr/bin/hdiutil",
+ args: ["attach", "-plist", "-nobrowse", "-readonly", "-noidme", "-mountrandom", unpack_dir, cdr_path])
+
+ if verbose? && !(eula_text = without_eula.stdout).empty?
+ ohai "Software License Agreement for '#{path}':"
+ puts eula_text
end
- raise CaskError, "Failed to eject #{mountpath}" if mountpath.exist?
- rescue CaskError => e
- raise e if (tries -= 1).zero?
- sleep 1
- retry
+
+ with_eula.plist
end
+
+ yield mounts_from_plist(plist)
end
end
- private
-
- def extract_mounts
- @mounts.each(&method(:extract_mount))
+ def eject(mount)
+ # realpath is a failsafe against unusual filenames
+ mountpath = Pathname.new(mount).realpath
+ return unless mountpath.exist?
+
+ begin
+ tries ||= 3
+ if tries > 1
+ @command.run("/usr/sbin/diskutil",
+ args: ["eject", mountpath],
+ print_stderr: false)
+ else
+ @command.run("/usr/sbin/diskutil",
+ args: ["unmount", "force", mountpath],
+ print_stderr: false)
+ end
+ raise CaskError, "Failed to eject #{mountpath}" if mountpath.exist?
+ rescue CaskError => e
+ raise e if (tries -= 1).zero?
+ sleep 1
+ retry
+ end
end
+ private
+
def extract_mount(mount)
Tempfile.open(["", ".bom"]) do |bomfile|
bomfile.close
@@ -124,10 +139,6 @@ module Hbc
return [] unless plist.respond_to?(:fetch)
plist.fetch("system-entities", []).map { |e| e["mount-point"] }.compact
end
-
- def assert_mounts_found
- raise CaskError, "No mounts found in '#{@path}'; perhaps it is a bad DMG?" if @mounts.empty?
- end
end
end
end
diff --git a/Library/Homebrew/cask/lib/hbc/download_strategy.rb b/Library/Homebrew/cask/lib/hbc/download_strategy.rb
index 5b32b4840..28ae704ee 100644
--- a/Library/Homebrew/cask/lib/hbc/download_strategy.rb
+++ b/Library/Homebrew/cask/lib/hbc/download_strategy.rb
@@ -100,7 +100,7 @@ module Hbc
end
def _fetch
- odebug "Calling curl with args #{cask_curl_args.utf8_inspect}"
+ odebug "Calling curl with args #{cask_curl_args}"
curl(*cask_curl_args)
end
diff --git a/Library/Homebrew/cask/lib/hbc/dsl.rb b/Library/Homebrew/cask/lib/hbc/dsl.rb
index 92245e8fb..112ceb943 100644
--- a/Library/Homebrew/cask/lib/hbc/dsl.rb
+++ b/Library/Homebrew/cask/lib/hbc/dsl.rb
@@ -211,10 +211,10 @@ module Hbc
# depends_on uses a load method so that multiple stanzas can be merged
def depends_on(*args)
- return @depends_on if args.empty?
@depends_on ||= DSL::DependsOn.new
+ return @depends_on if args.empty?
begin
- @depends_on.load(*args) unless args.empty?
+ @depends_on.load(*args)
rescue RuntimeError => e
raise CaskInvalidError.new(token, e)
end
diff --git a/Library/Homebrew/cask/lib/hbc/dsl/depends_on.rb b/Library/Homebrew/cask/lib/hbc/dsl/depends_on.rb
index a8c1a1b73..bdef4239a 100644
--- a/Library/Homebrew/cask/lib/hbc/dsl/depends_on.rb
+++ b/Library/Homebrew/cask/lib/hbc/dsl/depends_on.rb
@@ -24,6 +24,8 @@ module Hbc
def initialize
@pairs ||= {}
+ @cask ||= []
+ @formula ||= []
end
def load(pairs = {})
@@ -53,12 +55,10 @@ module Hbc
end
def formula=(*args)
- @formula ||= []
@formula.concat(args)
end
def cask=(*args)
- @cask ||= []
@cask.concat(args)
end
diff --git a/Library/Homebrew/cask/lib/hbc/exceptions.rb b/Library/Homebrew/cask/lib/hbc/exceptions.rb
index d9e1b07db..1a246be65 100644
--- a/Library/Homebrew/cask/lib/hbc/exceptions.rb
+++ b/Library/Homebrew/cask/lib/hbc/exceptions.rb
@@ -77,9 +77,15 @@ module Hbc
end
end
- class CaskCyclicCaskDependencyError < AbstractCaskErrorWithToken
+ class CaskCyclicDependencyError < AbstractCaskErrorWithToken
def to_s
- "Cask '#{token}' includes cyclic dependencies on other Casks and could not be installed."
+ "Cask '#{token}' includes cyclic dependencies on other Casks" << (reason.empty? ? "." : ": #{reason}")
+ end
+ end
+
+ class CaskSelfReferencingDependencyError < CaskCyclicDependencyError
+ def to_s
+ "Cask '#{token}' depends on itself."
end
end
@@ -91,7 +97,7 @@ module Hbc
class CaskInvalidError < AbstractCaskErrorWithToken
def to_s
- "Cask '#{token}' definition is invalid" << (reason.empty? ? ".": ": #{reason}")
+ "Cask '#{token}' definition is invalid" << (reason.empty? ? "." : ": #{reason}")
end
end
diff --git a/Library/Homebrew/cask/lib/hbc/installer.rb b/Library/Homebrew/cask/lib/hbc/installer.rb
index aa6d600f7..53210ed4b 100644
--- a/Library/Homebrew/cask/lib/hbc/installer.rb
+++ b/Library/Homebrew/cask/lib/hbc/installer.rb
@@ -1,11 +1,14 @@
require "rubygems"
+require "formula_installer"
+
require "hbc/cask_dependencies"
require "hbc/staged"
require "hbc/verify"
module Hbc
class Installer
+ extend Predicable
# TODO: it is unwise for Hbc::Staged to be a module, when we are
# dealing with both staged and unstaged Casks here. This should
# either be a class which is only sometimes instantiated, or there
@@ -27,21 +30,7 @@ module Hbc
@reinstall = false
end
- def skip_cask_deps?
- @skip_cask_deps
- end
-
- def force?
- @force
- end
-
- def binaries?
- @binaries
- end
-
- def verbose?
- @verbose
- end
+ attr_predicate :binaries?, :force?, :skip_cask_deps?, :require_sha?, :verbose?
def self.print_caveats(cask)
odebug "Printing caveats"
@@ -75,7 +64,7 @@ module Hbc
odebug "Hbc::Installer#fetch"
satisfy_dependencies
- verify_has_sha if @require_sha && !force?
+ verify_has_sha if require_sha? && !force?
download
verify
end
@@ -164,7 +153,7 @@ module Hbc
end
odebug "Using container class #{container} for #{@downloaded_path}"
- container.new(@cask, @downloaded_path, @command).extract
+ container.new(@cask, @downloaded_path, @command, verbose: verbose?).extract
end
def install_artifacts
@@ -210,7 +199,6 @@ module Hbc
x11_dependencies
formula_dependencies
cask_dependencies unless skip_cask_deps?
- puts "complete"
end
def macos_dependencies
@@ -247,36 +235,50 @@ module Hbc
end
def formula_dependencies
- return unless @cask.depends_on.formula && !@cask.depends_on.formula.empty?
- ohai "Installing Formula dependencies from Homebrew"
- @cask.depends_on.formula.each do |dep_name|
- print "#{dep_name} ... "
- installed = @command.run(HOMEBREW_BREW_FILE,
- args: ["list", "--versions", dep_name],
- print_stderr: false).stdout.include?(dep_name)
- if installed
- puts "already installed"
- else
- @command.run!(HOMEBREW_BREW_FILE,
- args: ["install", dep_name])
- puts "done"
+ formulae = @cask.depends_on.formula.map { |f| Formula[f] }
+ return if formulae.empty?
+
+ if formulae.all?(&:any_version_installed?)
+ puts "All Formula dependencies satisfied."
+ return
+ end
+
+ not_installed = formulae.reject(&:any_version_installed?)
+
+ ohai "Installing Formula dependencies: #{not_installed.map(&:to_s).join(", ")}"
+ not_installed.each do |formula|
+ begin
+ old_argv = ARGV.dup
+ ARGV.replace([])
+ FormulaInstaller.new(formula).tap do |fi|
+ fi.installed_as_dependency = true
+ fi.installed_on_request = false
+ fi.show_header = true
+ fi.verbose = verbose?
+ fi.prelude
+ fi.install
+ fi.finish
+ end
+ ensure
+ ARGV.replace(old_argv)
end
end
end
def cask_dependencies
- return unless @cask.depends_on.cask && !@cask.depends_on.cask.empty?
- ohai "Installing Cask dependencies: #{@cask.depends_on.cask.join(", ")}"
- deps = CaskDependencies.new(@cask)
- deps.sorted.each do |dep_token|
- puts "#{dep_token} ..."
- dep = CaskLoader.load(dep_token)
- if dep.installed?
- puts "already installed"
- else
- Installer.new(dep, binaries: binaries?, verbose: verbose?, skip_cask_deps: true, force: false).install
- puts "done"
- end
+ return if @cask.depends_on.cask.empty?
+ casks = CaskDependencies.new(@cask)
+
+ if casks.all?(&:installed?)
+ puts "All Cask dependencies satisfied."
+ return
+ end
+
+ not_installed = casks.reject(&:installed?)
+
+ ohai "Installing Cask dependencies: #{not_installed.map(&:to_s).join(", ")}"
+ not_installed.each do |cask|
+ Installer.new(cask, binaries: binaries?, verbose: verbose?, skip_cask_deps: true, force: false).install
end
end
diff --git a/Library/Homebrew/cask/lib/hbc/system_command.rb b/Library/Homebrew/cask/lib/hbc/system_command.rb
index 6414a9e80..901617b71 100644
--- a/Library/Homebrew/cask/lib/hbc/system_command.rb
+++ b/Library/Homebrew/cask/lib/hbc/system_command.rb
@@ -20,7 +20,7 @@ module Hbc
def run!
@processed_output = { stdout: "", stderr: "" }
- odebug "Executing: #{expanded_command.utf8_inspect}"
+ odebug "Executing: #{expanded_command}"
each_output_line do |type, line|
case type
@@ -62,7 +62,7 @@ module Hbc
def assert_success
return if processed_status && processed_status.success?
- raise CaskCommandFailedError.new(command.utf8_inspect, processed_output[:stdout], processed_output[:stderr], processed_status)
+ raise CaskCommandFailedError.new(command, processed_output[:stdout], processed_output[:stderr], processed_status)
end
def expanded_command
@@ -162,7 +162,7 @@ module Hbc
raise CaskError, <<-EOS
Empty result parsing plist output from command.
command was:
- #{command.utf8_inspect}
+ #{command}
output we attempted to parse:
#{output}
EOS
diff --git a/Library/Homebrew/cask/lib/hbc/url.rb b/Library/Homebrew/cask/lib/hbc/url.rb
index 07b41fb80..15da2ced2 100644
--- a/Library/Homebrew/cask/lib/hbc/url.rb
+++ b/Library/Homebrew/cask/lib/hbc/url.rb
@@ -1,5 +1,3 @@
-require "forwardable"
-
module Hbc
class URL
FAKE_USER_AGENT = "Mozilla/5.0 (Macintosh; Intel Mac OS X 10) https://caskroom.github.io".freeze
diff --git a/Library/Homebrew/cask/lib/hbc/url_checker.rb b/Library/Homebrew/cask/lib/hbc/url_checker.rb
index 60a15ca2f..7076b13c5 100644
--- a/Library/Homebrew/cask/lib/hbc/url_checker.rb
+++ b/Library/Homebrew/cask/lib/hbc/url_checker.rb
@@ -38,7 +38,7 @@ module Hbc
def _check_response_status
ok = OK_RESPONSES[cask.url.scheme]
return if ok.include?(@response_status)
- add_error "unexpected http response, expecting #{ok.map(&:utf8_inspect).join(" or ")}, got #{@response_status.utf8_inspect}"
+ add_error "unexpected http response, expecting #{ok.map(&:to_s).join(" or ")}, got #{@response_status}"
end
def _get_data_from_request
diff --git a/Library/Homebrew/cask/lib/hbc/utils.rb b/Library/Homebrew/cask/lib/hbc/utils.rb
index 59e85aaeb..22f826e74 100644
--- a/Library/Homebrew/cask/lib/hbc/utils.rb
+++ b/Library/Homebrew/cask/lib/hbc/utils.rb
@@ -4,24 +4,15 @@ require "stringio"
BUG_REPORTS_URL = "https://github.com/caskroom/homebrew-cask#reporting-bugs".freeze
-# monkeypatch Object - not a great idea
-class Object
- def utf8_inspect
- return inspect unless defined?(Encoding)
- return map(&:utf8_inspect) if respond_to?(:map)
- inspect.force_encoding("UTF-8").sub(/\A"(.*)"\Z/, '\1')
- end
-end
-
class Buffer < StringIO
+ extend Predicable
+
+ attr_predicate :tty?
+
def initialize(tty = false)
super()
@tty = tty
end
-
- def tty?
- @tty
- end
end
# global methods
diff --git a/Library/Homebrew/caveats.rb b/Library/Homebrew/caveats.rb
index ee09063fd..2d0ceeb48 100644
--- a/Library/Homebrew/caveats.rb
+++ b/Library/Homebrew/caveats.rb
@@ -1,4 +1,6 @@
class Caveats
+ extend Forwardable
+
attr_reader :f
def initialize(f)
@@ -25,9 +27,7 @@ class Caveats
caveats.compact.join("\n")
end
- def empty?
- caveats.empty?
- end
+ delegate [:empty?, :to_s] => :caveats
private
diff --git a/Library/Homebrew/checksum.rb b/Library/Homebrew/checksum.rb
index 1b095ea32..506885fce 100644
--- a/Library/Homebrew/checksum.rb
+++ b/Library/Homebrew/checksum.rb
@@ -1,6 +1,7 @@
class Checksum
+ extend Forwardable
+
attr_reader :hash_type, :hexdigest
- alias to_s hexdigest
TYPES = [:sha256].freeze
@@ -9,9 +10,7 @@ class Checksum
@hexdigest = hexdigest
end
- def empty?
- hexdigest.empty?
- end
+ delegate [:empty?, :to_s] => :@hexdigest
def ==(other)
hash_type == other.hash_type && hexdigest == other.hexdigest
diff --git a/Library/Homebrew/cmd/info.rb b/Library/Homebrew/cmd/info.rb
index 98200a0b4..731156f95 100644
--- a/Library/Homebrew/cmd/info.rb
+++ b/Library/Homebrew/cmd/info.rb
@@ -169,8 +169,8 @@ module Homebrew
Homebrew.dump_options_for_formula f
end
- c = Caveats.new(f)
- ohai "Caveats", c.caveats unless c.empty?
+ caveats = Caveats.new(f)
+ ohai "Caveats", caveats.to_s unless caveats.empty?
end
def decorate_dependencies(dependencies)
diff --git a/Library/Homebrew/cmd/style.rb b/Library/Homebrew/cmd/style.rb
index c6201e371..51937c3e5 100644
--- a/Library/Homebrew/cmd/style.rb
+++ b/Library/Homebrew/cmd/style.rb
@@ -94,7 +94,11 @@ module Homebrew
RuboCop::Cop::Cop.registry.departments.include?(cop.to_sym)
end
- args << "--only" << cops_to_include.join(",") unless cops_to_include.empty?
+ if cops_to_include.empty?
+ odie "RuboCops #{options[:only_cops].join(",")} were not found"
+ end
+
+ args << "--only" << cops_to_include.join(",")
end
if files.nil?
diff --git a/Library/Homebrew/cmd/update-report.rb b/Library/Homebrew/cmd/update-report.rb
index aa1fd244d..374bbbd73 100644
--- a/Library/Homebrew/cmd/update-report.rb
+++ b/Library/Homebrew/cmd/update-report.rb
@@ -547,6 +547,8 @@ class Reporter
end
class ReporterHub
+ extend Forwardable
+
attr_reader :reporters
def initialize
@@ -564,9 +566,7 @@ class ReporterHub
@hash.update(report) { |_key, oldval, newval| oldval.concat(newval) }
end
- def empty?
- @hash.empty?
- end
+ delegate :empty? => :@hash
def dump
# Key Legend: Added (A), Copied (C), Deleted (D), Modified (M), Renamed (R)
diff --git a/Library/Homebrew/constants.rb b/Library/Homebrew/constants.rb
index 4ccf18624..23be70bcc 100644
--- a/Library/Homebrew/constants.rb
+++ b/Library/Homebrew/constants.rb
@@ -1,3 +1,3 @@
# RuboCop version used for `brew style` and `brew cask style`
HOMEBREW_RUBOCOP_VERSION = "0.49.1".freeze
-HOMEBREW_RUBOCOP_CASK_VERSION = "~> 0.13.0".freeze # has to be updated when RuboCop version changes
+HOMEBREW_RUBOCOP_CASK_VERSION = "~> 0.13.1".freeze # has to be updated when RuboCop version changes
diff --git a/Library/Homebrew/debrew.rb b/Library/Homebrew/debrew.rb
index 7ff2c0360..c2662c9ee 100644
--- a/Library/Homebrew/debrew.rb
+++ b/Library/Homebrew/debrew.rb
@@ -74,18 +74,13 @@ module Debrew
end
end
- class << self
- alias original_raise raise
- end
-
@active = false
@debugged_exceptions = Set.new
- def self.active?
- @active
- end
-
class << self
+ extend Predicable
+ alias original_raise raise
+ attr_predicate :active?
attr_reader :debugged_exceptions
end
diff --git a/Library/Homebrew/dependencies.rb b/Library/Homebrew/dependencies.rb
index 951db078d..0ed0502d8 100644
--- a/Library/Homebrew/dependencies.rb
+++ b/Library/Homebrew/dependencies.rb
@@ -1,28 +1,11 @@
-class Dependencies
- include Enumerable
+require "delegate"
- def initialize
- @deps = []
+class Dependencies < DelegateClass(Array)
+ def initialize(*args)
+ super(args)
end
- def each(*args, &block)
- @deps.each(*args, &block)
- end
-
- def <<(o)
- @deps << o
- self
- end
-
- def empty?
- @deps.empty?
- end
-
- def *(arg)
- @deps * arg
- end
-
- alias to_ary to_a
+ alias eql? ==
def optional
select(&:optional?)
@@ -44,40 +27,28 @@ class Dependencies
build + required + recommended
end
- attr_reader :deps
- protected :deps
-
- def ==(other)
- deps == other.deps
- end
- alias eql? ==
-
def inspect
- "#<#{self.class.name}: #{to_a.inspect}>"
+ "#<#{self.class.name}: #{to_a}>"
end
end
-class Requirements
- include Enumerable
-
- def initialize
- @reqs = Set.new
- end
-
- def each(*args, &block)
- @reqs.each(*args, &block)
+class Requirements < DelegateClass(Set)
+ def initialize(*args)
+ super(Set.new(args))
end
def <<(other)
if other.is_a?(Comparable)
- @reqs.grep(other.class) do |req|
+ grep(other.class) do |req|
return self if req > other
- @reqs.delete(req)
+ delete(req)
end
end
- @reqs << other
+ super
self
end
- alias to_ary to_a
+ def inspect
+ "#<#{self.class.name}: {#{to_a.join(", ")}}>"
+ end
end
diff --git a/Library/Homebrew/dependency.rb b/Library/Homebrew/dependency.rb
index 4a452440a..d7d5ec59c 100644
--- a/Library/Homebrew/dependency.rb
+++ b/Library/Homebrew/dependency.rb
@@ -2,6 +2,7 @@ require "dependable"
# A dependency on another Homebrew formula.
class Dependency
+ extend Forwardable
include Dependable
attr_reader :name, :tags, :env_proc, :option_names
@@ -34,9 +35,7 @@ class Dependency
formula
end
- def installed?
- to_formula.installed?
- end
+ delegate installed?: :to_formula
def satisfied?(inherited_options)
installed? && missing_options(inherited_options).empty?
diff --git a/Library/Homebrew/dev-cmd/audit.rb b/Library/Homebrew/dev-cmd/audit.rb
index 1c7476c4b..ff6b17b45 100644
--- a/Library/Homebrew/dev-cmd/audit.rb
+++ b/Library/Homebrew/dev-cmd/audit.rb
@@ -75,16 +75,18 @@ module Homebrew
only_cops = ARGV.value("only-cops").to_s.split(",")
except_cops = ARGV.value("except-cops").to_s.split(",")
+
if !only_cops.empty? && !except_cops.empty?
odie "--only-cops and --except-cops cannot be used simultaneously!"
- elsif (!only_cops.empty? || !except_cops.empty?) && strict
- odie "--only-cops/--except-cops and --strict cannot be used simultaneously"
+ elsif (!only_cops.empty? || !except_cops.empty?) && (strict || ARGV.value("only"))
+ odie "--only-cops/--except-cops and --strict/--only cannot be used simultaneously"
end
options = { fix: ARGV.flag?("--fix"), realpath: true }
if !only_cops.empty?
options[:only_cops] = only_cops
+ ARGV.push("--only=style")
elsif !except_cops.empty?
options[:except_cops] = except_cops
elsif !strict
@@ -307,7 +309,7 @@ class FormulaAuditor
unversioned_name = unversioned_formula.basename(".rb")
problem "#{formula} is versioned but no #{unversioned_name} formula exists"
end
- elsif ARGV.build_stable? &&
+ elsif ARGV.build_stable? && formula.stable? &&
!(versioned_formulae = Dir[formula.path.to_s.gsub(/\.rb$/, "@*.rb")]).empty?
versioned_aliases = formula.aliases.grep(/.@\d/)
_, last_alias_version =
@@ -819,6 +821,13 @@ class FormulaAuditor
def patch_problems(patch)
case patch.url
+ when %r{https?://github\.com/.+/.+/(?:commit|pull)/[a-fA-F0-9]*.(?:patch|diff)}
+ unless patch.url =~ /\?full_index=\w+$/
+ problem <<-EOS.undent
+ GitHub patches should use the full_index parameter:
+ #{patch.url}?full_index=1
+ EOS
+ end
when /raw\.github\.com/, %r{gist\.github\.com/raw}, %r{gist\.github\.com/.+/raw},
%r{gist\.githubusercontent\.com/.+/raw}
unless patch.url =~ /[a-fA-F0-9]{40}/
@@ -827,7 +836,7 @@ class FormulaAuditor
when %r{https?://patch-diff\.githubusercontent\.com/raw/(.+)/(.+)/pull/(.+)\.(?:diff|patch)}
problem <<-EOS.undent
use GitHub pull request URLs:
- https://github.com/#{Regexp.last_match(1)}/#{Regexp.last_match(2)}/pull/#{Regexp.last_match(3)}.patch
+ https://github.com/#{Regexp.last_match(1)}/#{Regexp.last_match(2)}/pull/#{Regexp.last_match(3)}.patch?full_index=1
Rather than patch-diff:
#{patch.url}
EOS
diff --git a/Library/Homebrew/dev-cmd/bump-formula-pr.rb b/Library/Homebrew/dev-cmd/bump-formula-pr.rb
index 586eec47c..1c56749a3 100644
--- a/Library/Homebrew/dev-cmd/bump-formula-pr.rb
+++ b/Library/Homebrew/dev-cmd/bump-formula-pr.rb
@@ -286,7 +286,11 @@ module Homebrew
formula.path.parent.cd do
branch = "#{formula.name}-#{new_formula_version}"
+ git_dir = Utils.popen_read("git rev-parse --git-dir").chomp
+ shallow = !git_dir.empty? && File.exist?("#{git_dir}/shallow")
+
if ARGV.dry_run?
+ ohai "git fetch --unshallow origin" if shallow
ohai "git checkout --no-track -b #{branch} origin/master"
ohai "git commit --no-edit --verbose --message='#{formula.name} #{new_formula_version}#{devel_message}' -- #{formula.path}"
ohai "hub fork --no-remote"
@@ -296,6 +300,7 @@ module Homebrew
ohai "hub pull-request --browse -m '#{formula.name} #{new_formula_version}#{devel_message}'"
ohai "git checkout -"
else
+ safe_system "git", "fetch", "--unshallow", "origin" if shallow
safe_system "git", "checkout", "--no-track", "-b", branch, "origin/master"
safe_system "git", "commit", "--no-edit", "--verbose",
"--message=#{formula.name} #{new_formula_version}#{devel_message}",
diff --git a/Library/Homebrew/download_strategy.rb b/Library/Homebrew/download_strategy.rb
index 78f6c1e28..717334714 100644
--- a/Library/Homebrew/download_strategy.rb
+++ b/Library/Homebrew/download_strategy.rb
@@ -3,6 +3,7 @@ require "rexml/document"
require "time"
class AbstractDownloadStrategy
+ extend Forwardable
include FileUtils
attr_reader :meta, :name, :version, :resource
@@ -181,9 +182,7 @@ class VCSDownloadStrategy < AbstractDownloadStrategy
@clone
end
- def head?
- version.head?
- end
+ delegate head?: :version
# Return last commit's unique identifier for the repository.
# Return most recent modified timestamp unless overridden.
diff --git a/Library/Homebrew/extend/os/linux/hardware/cpu.rb b/Library/Homebrew/extend/os/linux/hardware/cpu.rb
index 7c945b237..177db6139 100644
--- a/Library/Homebrew/extend/os/linux/hardware/cpu.rb
+++ b/Library/Homebrew/extend/os/linux/hardware/cpu.rb
@@ -84,9 +84,14 @@ module Hardware
@features ||= flags[1..-1].map(&:intern)
end
- %w[aes altivec avx avx2 lm sse3 ssse3 sse4 sse4_2].each do |flag|
+ %w[aes altivec avx avx2 lm ssse3 sse4 sse4_2].each do |flag|
define_method(flag + "?") { flags.include? flag }
end
+
+ def sse3?
+ flags.include?("pni") || flags.include?("sse3")
+ end
+
alias is_64_bit? lm?
def bits
diff --git a/Library/Homebrew/extend/predicable.rb b/Library/Homebrew/extend/predicable.rb
new file mode 100644
index 000000000..d02fbb89b
--- /dev/null
+++ b/Library/Homebrew/extend/predicable.rb
@@ -0,0 +1,9 @@
+module Predicable
+ def attr_predicate(*attrs)
+ attrs.each do |attr|
+ define_method attr do
+ instance_variable_get("@#{attr.to_s.sub(/\?$/, "")}") == true
+ end
+ end
+ end
+end
diff --git a/Library/Homebrew/formula.rb b/Library/Homebrew/formula.rb
index 66993a348..0d000496b 100644
--- a/Library/Homebrew/formula.rb
+++ b/Library/Homebrew/formula.rb
@@ -45,6 +45,7 @@ class Formula
include Utils::Inreplace
include Utils::Shell
extend Enumerable
+ extend Forwardable
# @!method inreplace(paths, before = nil, after = nil)
# Actually implemented in {Utils::Inreplace.inreplace}.
@@ -314,37 +315,14 @@ class Formula
active_spec == head
end
- # @private
- def bottle_unneeded?
- active_spec.bottle_unneeded?
- end
-
- # @private
- def bottle_disabled?
- active_spec.bottle_disabled?
- end
-
- # @private
- def bottle_disable_reason
- active_spec.bottle_disable_reason
- end
-
- # Does the currently active {SoftwareSpec} have any bottle?
- # @private
- def bottle_defined?
- active_spec.bottle_defined?
- end
-
- # Does the currently active {SoftwareSpec} have an installable bottle?
- # @private
- def bottled?
- active_spec.bottled?
- end
-
- # @private
- def bottle_specification
- active_spec.bottle_specification
- end
+ delegate [
+ :bottle_unneeded?,
+ :bottle_disabled?,
+ :bottle_disable_reason,
+ :bottle_defined?,
+ :bottled?,
+ :bottle_specification,
+ ] => :active_spec
# The Bottle object for the currently active {SoftwareSpec}.
# @private
@@ -353,24 +331,21 @@ class Formula
end
# The description of the software.
+ # @method desc
# @see .desc
- def desc
- self.class.desc
- end
+ delegate desc: :"self.class"
# The homepage for the software.
+ # @method homepage
# @see .homepage
- def homepage
- self.class.homepage
- end
+ delegate homepage: :"self.class"
# The version for the currently active {SoftwareSpec}.
# The version is autodetected from the URL and/or tag so only needs to be
# declared if it cannot be autodetected correctly.
+ # @method version
# @see .version
- def version
- active_spec.version
- end
+ delegate version: :active_spec
def update_head_version
return unless head?
@@ -394,9 +369,8 @@ class Formula
# Additional downloads can be defined as {#resource}s.
# {Resource#stage} will create a temporary directory and yield to a block.
# <pre>resource("additional_files").stage { bin.install "my/extra/tool" }</pre>
- def resource(name)
- active_spec.resource(name)
- end
+ # @method resource
+ delegate resource: :active_spec
# An old name for the formula
def oldname
@@ -416,68 +390,39 @@ class Formula
end
# The {Resource}s for the currently active {SoftwareSpec}.
- def resources
- active_spec.resources.values
- end
+ # @method resources
+ def_delegator :"active_spec.resources", :values, :resources
# The {Dependency}s for the currently active {SoftwareSpec}.
- # @private
- def deps
- active_spec.deps
- end
+ delegate deps: :active_spec
# The {Requirement}s for the currently active {SoftwareSpec}.
- # @private
- def requirements
- active_spec.requirements
- end
+ delegate requirements: :active_spec
# The cached download for the currently active {SoftwareSpec}.
- # @private
- def cached_download
- active_spec.cached_download
- end
+ delegate cached_download: :active_spec
# Deletes the download for the currently active {SoftwareSpec}.
- # @private
- def clear_cache
- active_spec.clear_cache
- end
+ delegate clear_cache: :active_spec
# The list of patches for the currently active {SoftwareSpec}.
- # @private
- def patchlist
- active_spec.patches
- end
+ def_delegator :active_spec, :patches, :patchlist
# The options for the currently active {SoftwareSpec}.
- # @private
- def options
- active_spec.options
- end
+ delegate options: :active_spec
# The deprecated options for the currently active {SoftwareSpec}.
- # @private
- def deprecated_options
- active_spec.deprecated_options
- end
+ delegate deprecated_options: :active_spec
# The deprecated option flags for the currently active {SoftwareSpec}.
- # @private
- def deprecated_flags
- active_spec.deprecated_flags
- end
+ delegate deprecated_flags: :active_spec
# If a named option is defined for the currently active {SoftwareSpec}.
- def option_defined?(name)
- active_spec.option_defined?(name)
- end
+ # @method option_defined?
+ delegate option_defined?: :active_spec
# All the {.fails_with} for the currently active {SoftwareSpec}.
- # @private
- def compiler_failures
- active_spec.compiler_failures
- end
+ delegate compiler_failures: :active_spec
# If this {Formula} is installed.
# This is actually just a check for if the {#installed_prefix} directory
diff --git a/Library/Homebrew/formula_installer.rb b/Library/Homebrew/formula_installer.rb
index a365c967a..27786e77e 100644
--- a/Library/Homebrew/formula_installer.rb
+++ b/Library/Homebrew/formula_installer.rb
@@ -17,6 +17,7 @@ require "development_tools"
class FormulaInstaller
include FormulaCellarChecks
+ extend Predicable
def self.mode_attr_accessor(*names)
attr_accessor(*names)
@@ -559,11 +560,11 @@ class FormulaInstaller
audit_installed if ARGV.homebrew_developer? && !formula.keg_only?
- c = Caveats.new(formula)
+ caveats = Caveats.new(formula)
- return if c.empty?
+ return if caveats.empty?
@show_summary_heading = true
- ohai "Caveats", c.caveats
+ ohai "Caveats", caveats.to_s
end
def finish
@@ -879,9 +880,7 @@ class FormulaInstaller
private
- def hold_locks?
- @hold_locks || false
- end
+ attr_predicate :hold_locks?
def lock
return unless (@@locked ||= []).empty?
diff --git a/Library/Homebrew/formula_support.rb b/Library/Homebrew/formula_support.rb
index 4d963a55e..a4534291a 100644
--- a/Library/Homebrew/formula_support.rb
+++ b/Library/Homebrew/formula_support.rb
@@ -81,7 +81,7 @@ class BottleDisableReason
end
def to_s
- if @type == :unneeded
+ if unneeded?
"This formula doesn't require compiling."
else
@reason
diff --git a/Library/Homebrew/global.rb b/Library/Homebrew/global.rb
index f36b01874..9f79781b4 100644
--- a/Library/Homebrew/global.rb
+++ b/Library/Homebrew/global.rb
@@ -1,4 +1,6 @@
+require "forwardable"
require "extend/module"
+require "extend/predicable"
require "extend/fileutils"
require "extend/pathname"
require "extend/git_repository"
diff --git a/Library/Homebrew/language/node.rb b/Library/Homebrew/language/node.rb
index 01d41041b..eaadc54fc 100644
--- a/Library/Homebrew/language/node.rb
+++ b/Library/Homebrew/language/node.rb
@@ -1,7 +1,7 @@
module Language
module Node
def self.npm_cache_config
- "cache=#{HOMEBREW_CACHE}/npm_cache\n"
+ "cache=#{HOMEBREW_CACHE}/npm_cache"
end
def self.pack_for_installation
@@ -10,19 +10,18 @@ module Language
# fed to `npm install` only symlinks are created linking back to that
# directory, consequently breaking that assumption. We require a tarball
# because npm install creates a "real" installation when fed a tarball.
- output = Utils.popen_read("npm pack").chomp
- raise "npm failed to pack #{Dir.pwd}" unless $CHILD_STATUS.exitstatus.zero?
- output
+ pack_cmd = "npm pack --ignore-scripts"
+ output = Utils.popen_read(pack_cmd)
+ if !$CHILD_STATUS.exitstatus.zero? || output.lines.empty?
+ raise "npm failed to pack #{Dir.pwd}"
+ end
+ output.lines.last.chomp
end
def self.setup_npm_environment
- npmrc = Pathname.new("#{ENV["HOME"]}/.npmrc")
- # only run setup_npm_environment once per formula
- return if npmrc.exist?
- # explicitly set npm's cache path to HOMEBREW_CACHE/npm_cache to fix
- # issues caused by overriding $HOME (long build times, high disk usage)
- # https://github.com/Homebrew/brew/pull/37#issuecomment-208840366
- npmrc.write npm_cache_config
+ # guard that this is only run once
+ return if @env_set
+ @env_set = true
# explicitly use our npm and node-gyp executables instead of the user
# managed ones in HOMEBREW_PREFIX/lib/node_modules which might be broken
begin
@@ -42,8 +41,10 @@ module Language
# npm install args for global style module format installed into libexec
%W[
- --verbose
+ -ddd
--global
+ --build-from-source
+ --#{npm_cache_config}
--prefix=#{libexec}
#{Dir.pwd}/#{pack}
]
@@ -52,7 +53,11 @@ module Language
def self.local_npm_install_args
setup_npm_environment
# npm install args for local style module format
- ["--verbose"]
+ %W[
+ -ddd
+ --build-from-source
+ --#{npm_cache_config}
+ ]
end
end
end
diff --git a/Library/Homebrew/missing_formula.rb b/Library/Homebrew/missing_formula.rb
index 75498b128..57450ea84 100644
--- a/Library/Homebrew/missing_formula.rb
+++ b/Library/Homebrew/missing_formula.rb
@@ -109,6 +109,10 @@ module Homebrew
message = <<-EOS.undent
It was migrated from #{old_tap} to #{new_tap}.
+ EOS
+ break if new_tap_name == CoreTap.instance.name
+
+ message += <<-EOS.undent
You can access it again by running:
brew tap #{new_tap_name}
EOS
diff --git a/Library/Homebrew/os/mac/pkgconfig/10.13/libcurl.pc b/Library/Homebrew/os/mac/pkgconfig/10.13/libcurl.pc
index 91c69df6e..ff7a29ee2 100644
--- a/Library/Homebrew/os/mac/pkgconfig/10.13/libcurl.pc
+++ b/Library/Homebrew/os/mac/pkgconfig/10.13/libcurl.pc
@@ -28,12 +28,12 @@ exec_prefix=${prefix}
libdir=${exec_prefix}/lib
includedir=${prefix}/include
supported_protocols="DICT FILE FTP FTPS GOPHER HTTP HTTPS IMAP IMAPS LDAP LDAPS POP3 POP3S RTSP SMB SMBS SMTP SMTPS TELNET TFTP"
-supported_features="AsynchDNS IPv6 Largefile GSS-API Kerberos SPNEGO NTLM NTLM_WB SSL libz UnixSockets"
+supported_features="AsynchDNS IPv6 Largefile GSS-API Kerberos SPNEGO NTLM NTLM_WB SSL libz HTTP2 UnixSockets HTTPS-proxy"
Name: libcurl
URL: https://curl.haxx.se/
Description: Library to transfer files with ftp, http, etc.
-Version: 7.51.0
+Version: 7.54.0
Libs: -L${libdir} -lcurl
Libs.private: -lldap -lz
Cflags: -I${includedir}
diff --git a/Library/Homebrew/os/mac/xcode.rb b/Library/Homebrew/os/mac/xcode.rb
index d957792af..1d70c3981 100644
--- a/Library/Homebrew/os/mac/xcode.rb
+++ b/Library/Homebrew/os/mac/xcode.rb
@@ -216,7 +216,7 @@ module OS
# on the older supported platform for that Xcode release, i.e there's no
# CLT package for 10.11 that contains the Clang version from Xcode 8.
case MacOS.version
- when "10.13" then "900.0.22.8"
+ when "10.13" then "900.0.26"
when "10.12" then "802.0.42"
when "10.11" then "800.0.42.1"
when "10.10" then "700.1.81"
@@ -229,6 +229,7 @@ module OS
def minimum_version
case MacOS.version
+ when "10.13" then "9.0.0"
when "10.12" then "8.0.0"
else "1.0.0"
end
diff --git a/Library/Homebrew/resource.rb b/Library/Homebrew/resource.rb
index c0e9dbada..1e55b69c5 100644
--- a/Library/Homebrew/resource.rb
+++ b/Library/Homebrew/resource.rb
@@ -1,7 +1,6 @@
require "download_strategy"
require "checksum"
require "version"
-require "forwardable"
# Resource is the fundamental representation of an external resource. The
# primary formula download, along with other declared resources, are instances
diff --git a/Library/Homebrew/rubocops.rb b/Library/Homebrew/rubocops.rb
index 4710654fa..e27f91867 100644
--- a/Library/Homebrew/rubocops.rb
+++ b/Library/Homebrew/rubocops.rb
@@ -6,3 +6,4 @@ require_relative "./rubocops/homepage_cop"
require_relative "./rubocops/text_cop"
require_relative "./rubocops/caveats_cop"
require_relative "./rubocops/checksum_cop"
+require_relative "./rubocops/legacy_patches_cop"
diff --git a/Library/Homebrew/software_spec.rb b/Library/Homebrew/software_spec.rb
index eaae724a4..0d2b48acc 100644
--- a/Library/Homebrew/software_spec.rb
+++ b/Library/Homebrew/software_spec.rb
@@ -1,4 +1,3 @@
-require "forwardable"
require "resource"
require "checksum"
require "version"
@@ -162,8 +161,17 @@ class SoftwareSpec
end
def recursive_dependencies
- recursive_dependencies = deps
- deps.map(&:to_formula).compact.uniq.each do |f|
+ deps_f = []
+ recursive_dependencies = deps.map do |dep|
+ begin
+ deps_f << dep.to_formula
+ dep
+ rescue TapFormulaUnavailableError
+ # Don't complain about missing cross-tap dependencies
+ next
+ end
+ end.compact.uniq
+ deps_f.compact.each do |f|
f.recursive_dependencies.each do |dep|
recursive_dependencies << dep unless recursive_dependencies.include?(dep)
end
diff --git a/Library/Homebrew/test/cask/artifact/uninstall_zap_shared_examples.rb b/Library/Homebrew/test/cask/artifact/uninstall_zap_shared_examples.rb
index 6c2fd1a05..b84c1fd00 100644
--- a/Library/Homebrew/test/cask/artifact/uninstall_zap_shared_examples.rb
+++ b/Library/Homebrew/test/cask/artifact/uninstall_zap_shared_examples.rb
@@ -176,6 +176,14 @@ shared_examples "#uninstall_phase or #zap_phase" do
let(:fake_system_command) { Hbc::NeverSudoSystemCommand }
let(:cask) { Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/with-#{artifact_name}-#{directive}.rb") }
+ before(:each) do
+ allow_any_instance_of(Hbc::Artifact::UninstallBase).to receive(:trash_paths)
+ .and_wrap_original do |method, *args|
+ result = method.call(*args)
+ FileUtils.rm_rf result.stdout.split("\0")
+ end
+ end
+
it "is supported" do
paths.each do |path|
expect(path).to exist
diff --git a/Library/Homebrew/test/cask/cli/style_spec.rb b/Library/Homebrew/test/cask/cli/style_spec.rb
index 640eca5f4..15507f410 100644
--- a/Library/Homebrew/test/cask/cli/style_spec.rb
+++ b/Library/Homebrew/test/cask/cli/style_spec.rb
@@ -57,18 +57,16 @@ describe Hbc::CLI::Style, :cask do
end
end
- context "version" do
- it "matches `HOMEBREW_RUBOCOP_VERSION`", :needs_network do
- stdout, status = Open3.capture2("gem", "dependency", "rubocop-cask", "--version", HOMEBREW_RUBOCOP_CASK_VERSION, "--pipe", "--remote")
+ specify "`rubocop-cask` supports `HOMEBREW_RUBOCOP_VERSION`", :needs_network do
+ stdout, status = Open3.capture2("gem", "dependency", "rubocop-cask", "--version", HOMEBREW_RUBOCOP_CASK_VERSION, "--pipe", "--remote")
- expect(status).to be_a_success
+ expect(status).to be_a_success
- requirement = Gem::Requirement.new(stdout.scan(/rubocop --version '(.*)'/).flatten.first)
- version = Gem::Version.new(HOMEBREW_RUBOCOP_VERSION)
+ requirement = Gem::Requirement.new(stdout.scan(/rubocop --version '(.*)'/).flatten.first)
+ version = Gem::Version.new(HOMEBREW_RUBOCOP_VERSION)
- expect(requirement).not_to be_none
- expect(requirement).to be_satisfied_by(version)
- end
+ expect(requirement).not_to be_none
+ expect(requirement).to be_satisfied_by(version)
end
end
diff --git a/Library/Homebrew/test/cask/container/dmg_spec.rb b/Library/Homebrew/test/cask/container/dmg_spec.rb
index a94362aba..4f3f57071 100644
--- a/Library/Homebrew/test/cask/container/dmg_spec.rb
+++ b/Library/Homebrew/test/cask/container/dmg_spec.rb
@@ -9,11 +9,12 @@ describe Hbc::Container::Dmg, :cask do
Hbc::SystemCommand,
)
- begin
- dmg.mount!
- expect(dmg.mounts).not_to include nil
- ensure
- dmg.eject!
+ dmg.mount do |mounts|
+ begin
+ expect(mounts).not_to include nil
+ ensure
+ mounts.each(&dmg.public_method(:eject))
+ end
end
end
end
diff --git a/Library/Homebrew/test/cask/depends_on_spec.rb b/Library/Homebrew/test/cask/depends_on_spec.rb
index 0299c243a..4b78820ce 100644
--- a/Library/Homebrew/test/cask/depends_on_spec.rb
+++ b/Library/Homebrew/test/cask/depends_on_spec.rb
@@ -12,7 +12,7 @@ describe "Satisfy Dependencies and Requirements", :cask do
describe "depends_on cask" do
context "when depends_on cask is cyclic" do
let(:cask) { Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/with-depends-on-cask-cyclic.rb") }
- it { is_expected.to raise_error(Hbc::CaskCyclicCaskDependencyError) }
+ it { is_expected.to raise_error(Hbc::CaskCyclicDependencyError) }
end
context do
diff --git a/Library/Homebrew/test/language/node_spec.rb b/Library/Homebrew/test/language/node_spec.rb
index b2114bc4f..5ddbde944 100644
--- a/Library/Homebrew/test/language/node_spec.rb
+++ b/Library/Homebrew/test/language/node_spec.rb
@@ -2,45 +2,56 @@ require "language/node"
describe Language::Node do
describe "#setup_npm_environment" do
- it "does nothing when npmrc exists" do
- expect(subject.setup_npm_environment).to be_nil
- end
-
- it "calls prepend_path when node formula exists and npmrc does not exist" do
+ it "calls prepend_path when node formula exists only during the first call" do
node = formula "node" do
url "node-test"
end
stub_formula_loader(node)
- allow_any_instance_of(Pathname).to receive(:exist?).and_return(false)
expect(ENV).to receive(:prepend_path)
- subject.setup_npm_environment
+ subject.instance_variable_set(:@env_set, false)
+ expect(subject.setup_npm_environment).to be_nil
+
+ expect(subject.instance_variable_get(:@env_set)).to eq(true)
+ expect(ENV).not_to receive(:prepend_path)
+ expect(subject.setup_npm_environment).to be_nil
end
- it "does not call prepend_path when node formula does not exist but npmrc exists" do
- allow_any_instance_of(Pathname).to receive(:exist?).and_return(false)
+ it "does not call prepend_path when node formula does not exist" do
expect(subject.setup_npm_environment).to be_nil
end
end
describe "#std_npm_install_args" do
npm_install_arg = "libexec"
+ npm_pack_cmd = "npm pack --ignore-scripts"
it "raises error with non zero exitstatus" do
+ allow(Utils).to receive(:popen_read).with(npm_pack_cmd).and_return("error msg")
+ allow_any_instance_of(Process::Status).to receive(:exitstatus).and_return(42)
+ allow_any_instance_of(nil::NilClass).to receive(:exitstatus).and_return(42)
+ expect { subject.std_npm_install_args(npm_install_arg) }.to \
+ raise_error("npm failed to pack #{Dir.pwd}")
+ end
+
+ it "raises error with empty npm pack output" do
+ allow(Utils).to receive(:popen_read).with(npm_pack_cmd).and_return("")
+ allow_any_instance_of(Process::Status).to receive(:exitstatus).and_return(0)
+ allow_any_instance_of(nil::NilClass).to receive(:exitstatus).and_return(0)
expect { subject.std_npm_install_args(npm_install_arg) }.to \
raise_error("npm failed to pack #{Dir.pwd}")
end
it "does not raise error with a zero exitstatus" do
- allow(Utils).to receive(:popen_read).with("npm pack").and_return("pack")
+ allow(Utils).to receive(:popen_read).with(npm_pack_cmd).and_return("pack.tgz")
allow_any_instance_of(Process::Status).to receive(:exitstatus).and_return(0)
allow_any_instance_of(nil::NilClass).to receive(:exitstatus).and_return(0)
resp = subject.std_npm_install_args(npm_install_arg)
- expect(resp).to include("--prefix=#{npm_install_arg}", "#{Dir.pwd}/pack")
+ expect(resp).to include("--prefix=#{npm_install_arg}", "#{Dir.pwd}/pack.tgz")
end
end
specify "#local_npm_install_args" do
resp = subject.local_npm_install_args
- expect(resp).to include("--verbose")
+ expect(resp).to include("-ddd", "--build-from-source", "--cache=#{HOMEBREW_CACHE}/npm_cache")
end
end
diff --git a/Library/Homebrew/test/spec_helper.rb b/Library/Homebrew/test/spec_helper.rb
index 03b14720b..75540caad 100644
--- a/Library/Homebrew/test/spec_helper.rb
+++ b/Library/Homebrew/test/spec_helper.rb
@@ -68,12 +68,18 @@ RSpec.configure do |config|
end
config.around(:each) do |example|
+ def find_files
+ Find.find(TEST_TMPDIR)
+ .reject { |f| File.basename(f) == ".DS_Store" }
+ .map { |f| f.sub(TEST_TMPDIR, "") }
+ end
+
begin
TEST_DIRECTORIES.each(&:mkpath)
@__homebrew_failed = Homebrew.failed?
- @__files_before_test = Find.find(TEST_TMPDIR).map { |f| f.sub(TEST_TMPDIR, "") }
+ @__files_before_test = find_files
@__argv = ARGV.dup
@__env = ENV.to_hash # dup doesn't work on ENV
@@ -106,7 +112,7 @@ RSpec.configure do |config|
CoreTap.instance.path/"formula_renames.json",
]
- files_after_test = Find.find(TEST_TMPDIR).map { |f| f.sub(TEST_TMPDIR, "") }
+ files_after_test = find_files
diff = Set.new(@__files_before_test) ^ Set.new(files_after_test)
expect(diff).to be_empty, <<-EOS.undent
diff --git a/Library/Homebrew/test/utils/trash_spec.rb b/Library/Homebrew/test/utils/trash_spec.rb
deleted file mode 100644
index 9f2f7df15..000000000
--- a/Library/Homebrew/test/utils/trash_spec.rb
+++ /dev/null
@@ -1,32 +0,0 @@
-require "open3"
-
-describe "trash", :needs_macos do
- let(:executable) { HOMEBREW_LIBRARY_PATH/"utils/trash.swift" }
- let(:dir) { mktmpdir }
- let(:file) { dir/"new_file" }
-
- it "moves existing files to the trash" do
- FileUtils.touch file
-
- expect(file).to exist
-
- out, err, status = Open3.capture3(executable, file)
-
- expect(out).to match %r{moved #{file} to .*/\.Trash/\.*}
- expect(err).to be_empty
- expect(status).to be_a_success
-
- expect(file).not_to exist
-
- trashed_path = out.sub(/^moved #{Regexp.escape(file.to_s)} to (.*)\n$/, '\1')
- FileUtils.rm_f trashed_path
- end
-
- it "fails when files don't exist" do
- out, err, status = Open3.capture3(executable, file)
-
- expect(out).to be_empty
- expect(err).to eq "could not move #{file} to trash\n"
- expect(status).to be_a_failure
- end
-end
diff --git a/Library/Homebrew/test/version_spec.rb b/Library/Homebrew/test/version_spec.rb
index 6c8be7677..deb91ed89 100644
--- a/Library/Homebrew/test/version_spec.rb
+++ b/Library/Homebrew/test/version_spec.rb
@@ -453,11 +453,6 @@ describe Version do
.to be_detected_from("https://example.com/dada-v2017-04-17.tar.gz")
end
- specify "dash version style" do
- expect(Version.create("3.4"))
- .to be_detected_from("http://www.antlr.org/download/antlr-3.4-complete.jar")
- end
-
specify "jenkins version style" do
expect(Version.create("1.486"))
.to be_detected_from("http://mirrors.jenkins-ci.org/war/1.486/jenkins.war")
@@ -465,6 +460,27 @@ describe Version do
.to be_detected_from("https://github.com/hechoendrupal/DrupalConsole/releases/download/0.10.11/drupal.phar")
end
+ specify "char prefixed, url-only version style" do
+ expect(Version.create("1.9.293"))
+ .to be_detected_from("https://github.com/clojure/clojurescript/releases/download/r1.9.293/cljs.jar")
+ expect(Version.create("0.6.1"))
+ .to be_detected_from("https://github.com/fibjs/fibjs/releases/download/v0.6.1/fullsrc.zip")
+ expect(Version.create("1.9"))
+ .to be_detected_from("https://wwwlehre.dhbw-stuttgart.de/~sschulz/WORK/E_DOWNLOAD/V_1.9/E.tgz")
+ end
+
+ specify "w.x.y.z url-only version style" do
+ expect(Version.create("2.3.2.0"))
+ .to be_detected_from("https://github.com/JustArchi/ArchiSteamFarm/releases/download/2.3.2.0/ASF.zip")
+ expect(Version.create("1.7.5.2"))
+ .to be_detected_from("https://people.gnome.org/~newren/eg/download/1.7.5.2/eg")
+ end
+
+ specify "dash version style" do
+ expect(Version.create("3.4"))
+ .to be_detected_from("http://www.antlr.org/download/antlr-3.4-complete.jar")
+ end
+
specify "apache version style" do
expect(Version.create("1.2.0-rc2"))
.to be_detected_from("http://www.apache.org/dyn/closer.cgi?path=/cassandra/1.2.0/apache-cassandra-1.2.0-rc2-bin.tar.gz")
diff --git a/Library/Homebrew/utils/trash.swift b/Library/Homebrew/utils/trash.swift
deleted file mode 100755
index f591c3806..000000000
--- a/Library/Homebrew/utils/trash.swift
+++ /dev/null
@@ -1,43 +0,0 @@
-#!/usr/bin/swift
-
-import Cocoa
-
-DispatchQueue.main.async {
- let arguments = CommandLine.arguments.dropFirst().filter { !$0.isEmpty }
- let URLs = arguments.map { URL(fileURLWithPath: $0) }
-
- #if swift(>=4.0)
- let workspace = NSWorkspace.shared
- #else
- let workspace = NSWorkspace.shared()
- #endif
-
- workspace.recycle(URLs) { (dict, error) in
- dict.forEach {
- #if swift(>=4.0)
- let originalPath = $0.0.path
- let trashPath = $0.1.path
- #else
- let originalPath = $0.path
- let trashPath = $1.path
- #endif
-
- print("moved \(originalPath) to \(trashPath)")
- }
-
- if error == nil {
- exit(0)
- }
-
- let trashedURLs = dict.keys
- let untrashedURLs = URLs.filter { !trashedURLs.contains($0) }
-
- untrashedURLs.forEach {
- fputs("could not move \($0.path) to trash\n", stderr)
- }
-
- exit(1)
- }
-}
-
-RunLoop.main.run()
diff --git a/Library/Homebrew/version.rb b/Library/Homebrew/version.rb
index 8a86126eb..ddeaa6fee 100644
--- a/Library/Homebrew/version.rb
+++ b/Library/Homebrew/version.rb
@@ -428,8 +428,13 @@ class Version
# e.g. http://mirrors.jenkins-ci.org/war/1.486/jenkins.war
# e.g. https://github.com/foo/bar/releases/download/0.10.11/bar.phar
- m = %r{/(\d\.\d+(\.\d+)?)}.match(spec_s)
- return m.captures.first unless m.nil?
+ # e.g. https://github.com/clojure/clojurescript/releases/download/r1.9.293/cljs.jar
+ # e.g. https://github.com/fibjs/fibjs/releases/download/v0.6.1/fullsrc.zip
+ # e.g. https://wwwlehre.dhbw-stuttgart.de/~sschulz/WORK/E_DOWNLOAD/V_1.9/E.tgz
+ # e.g. https://github.com/JustArchi/ArchiSteamFarm/releases/download/2.3.2.0/ASF.zip
+ # e.g. https://people.gnome.org/~newren/eg/download/1.7.5.2/eg
+ m = %r{/([rvV]_?)?(\d\.\d+(\.\d+){,2})}.match(spec_s)
+ return m.captures[1] unless m.nil?
# e.g. http://www.ijg.org/files/jpegsrc.v8d.tar.gz
m = /\.v(\d+[a-z]?)/.match(stem)
diff --git a/docs/Installation.md b/docs/Installation.md
index b301eab6a..e36ed3efa 100644
--- a/docs/Installation.md
+++ b/docs/Installation.md
@@ -44,7 +44,7 @@ Uninstallation is documented in the [FAQ](FAQ.md).
<a name="1"><sup>1</sup></a> Not all formulae have CPU or OS requirements, but
you can assume you will have trouble if you don’t conform. Also, you can find
PowerPC and Tiger branches from other users in the fork network. See
-[Interesting Taps & Forks](Interesting-Taps-&-Forks.md).
+[Interesting Taps and Forks](Interesting-Taps-and-Forks.md).
<a name="2"><sup>2</sup></a> 10.10 or higher is recommended. 10.5–10.9 are
supported on a best-effort basis. For 10.4 and 10.5, see
diff --git a/docs/Interesting-Taps-&-Forks.md b/docs/Interesting-Taps-and-Forks.md
index 6b70fadec..6b70fadec 100644
--- a/docs/Interesting-Taps-&-Forks.md
+++ b/docs/Interesting-Taps-and-Forks.md
diff --git a/docs/Node-for-Formula-Authors.md b/docs/Node-for-Formula-Authors.md
index b74036753..a3d0624f2 100644
--- a/docs/Node-for-Formula-Authors.md
+++ b/docs/Node-for-Formula-Authors.md
@@ -30,7 +30,7 @@ Node modules which are compatible with the latest Node version should declare a
depends_on "node"
```
-If your formula requires being executed with an older Node version you must vendor this older Node version as done in the [`kibana` formula](https://github.com/Homebrew/homebrew-core/blob/c6202f91a129e2f994d904f299a308cc6fbd58e5/Formula/kibana.rb).
+If your formula requires being executed with an older Node version you should use one of the versioned node formulae (e.g. `node@6`).
### Special requirements for native addons
@@ -47,8 +47,8 @@ Also note that such a formula would only be compatible with the same Node major
Node modules should be installed to `libexec`. This prevents the Node modules from contaminating the global `node_modules`, which is important so that npm doesn't try to manage Homebrew-installed Node modules.
In the following we distinguish between two types of Node modules using formulae:
-* formulae for standard Node modules compatible with npm's global module format which should use [`std_npm_install_args`](#installing-global-style-modules-with-std_npm_install_args-to-libexec) (like [`azure-cli`](https://github.com/Homebrew/homebrew-core/blob/d93fe9ba3bcc9071b699c8da4e7d733518d3337e/Formula/azure-cli.rb) or [`autocode`](https://github.com/Homebrew/homebrew-core/blob/1a670a6269e1e07f86683c2d164977c9bd8a3fb6/Formula/autocode.rb)) and
-* formulae where the `npm install` step is only one of multiple not exclusively Node related install steps (not compatible with npm's global module format) which have to use [`local_npm_install_args`](#installing-module-dependencies-locally-with-local_npm_install_args) (like [`elixirscript`](https://github.com/Homebrew/homebrew-core/blob/ec1e40d37e81af63122a354f0101c377f6a4e66d/Formula/elixirscript.rb) or [`kibana`](https://github.com/Homebrew/homebrew-core/blob/c6202f91a129e2f994d904f299a308cc6fbd58e5/Formula/kibana.rb))
+* formulae for standard Node modules compatible with npm's global module format which should use [`std_npm_install_args`](#installing-global-style-modules-with-std_npm_install_args-to-libexec) (like [`azure-cli`](https://github.com/Homebrew/homebrew-core/blob/0f3b27d252b8112c744e0460d871cfe1def6b993/Formula/azure-cli.rb) or [`webpack`](https://github.com/Homebrew/homebrew-core/blob/6282879973d569962e63da7c81ac4623e1a8336b/Formula/webpack.rb)) and
+* formulae where the `npm install` call is not the only required install step (e.g. need to compile non-JavaScript sources too) have to use [`local_npm_install_args`](#installing-module-dependencies-locally-with-local_npm_install_args) (like [`elixirscript`](https://github.com/Homebrew/homebrew-core/blob/4bb491b7b246830aed57b97348a17e9401374978/Formula/elixirscript.rb)
Both methods have in common that they are setting the correct environment for using npm inside Homebrew and are returning the arguments for invoking `npm install` for their specific use cases. This includes fixing an important edge case with the npm cache (caused by Homebrew's redirection of `HOME` during the build and test process) by using our own custom `npm_cache` inside `HOMEBREW_CACHE`, which would otherwise result in very long build times and high disk space usage.
@@ -72,6 +72,8 @@ This will install your Node module in npm's global module style with a custom pr
bin.install_symlink Dir["#{libexec}/bin/*"]
```
+**Note:** Because of a required workaround for `npm@5` calling `npm pack` we currently don't support installing modules (from non-npm registry tarballs), which require a prepublish step (e.g. for transpiling sources). See [Homebrew/brew#2820](https://github.com/Homebrew/brew/pull/2820) for more information.
+
### Installing module dependencies locally with `local_npm_install_args`
In your formula's `install` method, do any installation steps which need to be done before the `npm install` step and then `cd` to the top level of the included Node module. Then, use `system` with `Language::Node.local_npm_install_args` to invoke `npm install` like:
diff --git a/docs/_config.yml b/docs/_config.yml
index 2bdba509e..210d0b0d4 100644
--- a/docs/_config.yml
+++ b/docs/_config.yml
@@ -1,6 +1,17 @@
include: [.well-known]
exclude: [bin, vendor, CNAME, Gemfile, Gemfile.lock]
+# Same as GitHub Pages
+# https://help.github.com/articles/using-jekyll-with-pages#troubleshooting
+# Disable despite enabled on GitHub Pages for supported plugins to work.
+# safe: true
+kramdown:
+ input: GFM
+ hard_wrap: false
+lsi: false
+highlighter: rouge
+
gems:
- jekyll-feed
+ - jekyll-sitemap
- jekyll-seo-tag
diff --git a/docs/_layouts/base.html b/docs/_layouts/base.html
index 324b42c6f..ee631bda5 100644
--- a/docs/_layouts/base.html
+++ b/docs/_layouts/base.html
@@ -12,19 +12,8 @@
{% seo title=false %}
{% feed_meta %}
<meta name="viewport" content="width=device-width">
- <link rel="shortcut icon" href="/img/favicon.ico">
- <link rel="icon" sizes="16x16" href="/img/favicon-16x16.png" >
- <link rel="icon" sizes="32x32" href="/img/favicon-32x32.png">
- <link rel="icon" sizes="96x96" href="/img/favicon-96x96.png">
- <link rel="icon" sizes="192x192" href="/img/favicon-192x192.png">
- <link rel="apple-touch-icon-precomposed" sizes="57x57" href="/img/apple-touch-icon-57x57-precomposed.png">
- <link rel="apple-touch-icon-precomposed" sizes="72x72" href="/img/apple-touch-icon-72x72-precomposed.png">
- <link rel="apple-touch-icon-precomposed" sizes="76x76" href="/img/apple-touch-icon-76x76-precomposed.png">
- <link rel="apple-touch-icon-precomposed" sizes="114x114" href="/img/apple-touch-icon-114x114-precomposed.png">
- <link rel="apple-touch-icon-precomposed" sizes="120x120" href="/img/apple-touch-icon-120x120-precomposed.png">
- <link rel="apple-touch-icon-precomposed" sizes="144x144" href="/img/apple-touch-icon-144x144-precomposed.png">
- <link rel="apple-touch-icon-precomposed" sizes="152x152" href="/img/apple-touch-icon-152x152-precomposed.png">
- <link rel="apple-touch-icon-precomposed" sizes="180x180" href="/img/apple-touch-icon-180x180-precomposed.png">
+ <link rel="icon" type="image/x-icon" href="/img/favicon.ico">
+ <link rel="apple-touch-icon"href="/img/apple-touch-icon.png">
<link rel="stylesheet" href="/css/screen.css" type="text/css" media="screen">
<link rel="stylesheet" href="/css/pygments.css" type="text/css" media="screen">
<script>
diff --git a/docs/favicon.ico b/docs/favicon.ico
deleted file mode 120000
index 2082fb7fc..000000000
--- a/docs/favicon.ico
+++ /dev/null
@@ -1 +0,0 @@
-img/favicon.ico \ No newline at end of file
diff --git a/docs/img/apple-touch-icon-114x114-precomposed.png b/docs/img/apple-touch-icon-114x114-precomposed.png
deleted file mode 100644
index 88dde6feb..000000000
--- a/docs/img/apple-touch-icon-114x114-precomposed.png
+++ /dev/null
Binary files differ
diff --git a/docs/img/apple-touch-icon-120x120-precomposed.png b/docs/img/apple-touch-icon-120x120-precomposed.png
deleted file mode 100644
index 6ff8dede5..000000000
--- a/docs/img/apple-touch-icon-120x120-precomposed.png
+++ /dev/null
Binary files differ
diff --git a/docs/img/apple-touch-icon-144x144-precomposed.png b/docs/img/apple-touch-icon-144x144-precomposed.png
deleted file mode 100644
index 9f76fb088..000000000
--- a/docs/img/apple-touch-icon-144x144-precomposed.png
+++ /dev/null
Binary files differ
diff --git a/docs/img/apple-touch-icon-152x152-precomposed.png b/docs/img/apple-touch-icon-152x152-precomposed.png
deleted file mode 100644
index 914c40b69..000000000
--- a/docs/img/apple-touch-icon-152x152-precomposed.png
+++ /dev/null
Binary files differ
diff --git a/docs/img/apple-touch-icon-57x57-precomposed.png b/docs/img/apple-touch-icon-57x57-precomposed.png
deleted file mode 100644
index c1f0fef2a..000000000
--- a/docs/img/apple-touch-icon-57x57-precomposed.png
+++ /dev/null
Binary files differ
diff --git a/docs/img/apple-touch-icon-72x72-precomposed.png b/docs/img/apple-touch-icon-72x72-precomposed.png
deleted file mode 100644
index bf667da22..000000000
--- a/docs/img/apple-touch-icon-72x72-precomposed.png
+++ /dev/null
Binary files differ
diff --git a/docs/img/apple-touch-icon-76x76-precomposed.png b/docs/img/apple-touch-icon-76x76-precomposed.png
deleted file mode 100644
index e683a489a..000000000
--- a/docs/img/apple-touch-icon-76x76-precomposed.png
+++ /dev/null
Binary files differ
diff --git a/docs/img/apple-touch-icon-180x180-precomposed.png b/docs/img/apple-touch-icon.png
index 849e941d3..849e941d3 100644
--- a/docs/img/apple-touch-icon-180x180-precomposed.png
+++ b/docs/img/apple-touch-icon.png
Binary files differ
diff --git a/docs/img/favicon-16x16.png b/docs/img/favicon-16x16.png
deleted file mode 100644
index 95bca9b8c..000000000
--- a/docs/img/favicon-16x16.png
+++ /dev/null
Binary files differ
diff --git a/docs/img/favicon-192x192.png b/docs/img/favicon-192x192.png
deleted file mode 100644
index 1ac8eeecc..000000000
--- a/docs/img/favicon-192x192.png
+++ /dev/null
Binary files differ
diff --git a/docs/img/favicon-32x32.png b/docs/img/favicon-32x32.png
deleted file mode 100644
index 724f3f07c..000000000
--- a/docs/img/favicon-32x32.png
+++ /dev/null
Binary files differ
diff --git a/docs/img/favicon-96x96.png b/docs/img/favicon-96x96.png
deleted file mode 100644
index 2e3337c13..000000000
--- a/docs/img/favicon-96x96.png
+++ /dev/null
Binary files differ
diff --git a/docs/robots.txt b/docs/robots.txt
new file mode 100644
index 000000000..4937a300e
--- /dev/null
+++ b/docs/robots.txt
@@ -0,0 +1,4 @@
+---
+---
+User-agent: *
+Sitemap: {{ site.url }}/sitemap.xml