Merge branch 'master' into api-language-support
This commit is contained in:
commit
9d6713d023
@ -41,7 +41,7 @@ Metrics/PerceivedComplexity:
|
|||||||
Metrics/MethodLength:
|
Metrics/MethodLength:
|
||||||
Max: 232
|
Max: 232
|
||||||
Metrics/ModuleLength:
|
Metrics/ModuleLength:
|
||||||
Max: 463
|
Max: 466
|
||||||
Exclude:
|
Exclude:
|
||||||
# TODO: extract more of the bottling logic
|
# TODO: extract more of the bottling logic
|
||||||
- "dev-cmd/bottle.rb"
|
- "dev-cmd/bottle.rb"
|
||||||
|
|||||||
@ -198,7 +198,7 @@ GEM
|
|||||||
thor (>= 1.2.0)
|
thor (>= 1.2.0)
|
||||||
yard-sorbet
|
yard-sorbet
|
||||||
thor (1.2.1)
|
thor (1.2.1)
|
||||||
tzinfo (2.0.5)
|
tzinfo (2.0.6)
|
||||||
concurrent-ruby (~> 1.0)
|
concurrent-ruby (~> 1.0)
|
||||||
unf (0.1.4)
|
unf (0.1.4)
|
||||||
unf_ext
|
unf_ext
|
||||||
@ -209,10 +209,9 @@ GEM
|
|||||||
parser (>= 3.1.0)
|
parser (>= 3.1.0)
|
||||||
uri_template (0.7.0)
|
uri_template (0.7.0)
|
||||||
warning (1.3.0)
|
warning (1.3.0)
|
||||||
webrick (1.7.0)
|
webrick (1.8.1)
|
||||||
webrobots (0.1.2)
|
webrobots (0.1.2)
|
||||||
yard (0.9.28)
|
yard (0.9.26)
|
||||||
webrick (~> 1.7.0)
|
|
||||||
yard-sorbet (0.6.1)
|
yard-sorbet (0.6.1)
|
||||||
sorbet-runtime (>= 0.5)
|
sorbet-runtime (>= 0.5)
|
||||||
yard (>= 0.9)
|
yard (>= 0.9)
|
||||||
|
|||||||
@ -3,7 +3,6 @@
|
|||||||
|
|
||||||
require "api/analytics"
|
require "api/analytics"
|
||||||
require "api/cask"
|
require "api/cask"
|
||||||
require "api/cask-source"
|
|
||||||
require "api/formula"
|
require "api/formula"
|
||||||
require "api/versions"
|
require "api/versions"
|
||||||
require "extend/cachable"
|
require "extend/cachable"
|
||||||
@ -23,23 +22,20 @@ module Homebrew
|
|||||||
HOMEBREW_CACHE_API = (HOMEBREW_CACHE/"api").freeze
|
HOMEBREW_CACHE_API = (HOMEBREW_CACHE/"api").freeze
|
||||||
MAX_RETRIES = 3
|
MAX_RETRIES = 3
|
||||||
|
|
||||||
sig { params(endpoint: String, json: T::Boolean).returns(T.any(String, Hash)) }
|
sig { params(endpoint: String).returns(Hash) }
|
||||||
def fetch(endpoint, json: true)
|
def fetch(endpoint)
|
||||||
return cache[endpoint] if cache.present? && cache.key?(endpoint)
|
return cache[endpoint] if cache.present? && cache.key?(endpoint)
|
||||||
|
|
||||||
api_url = "#{API_DOMAIN}/#{endpoint}"
|
api_url = "#{API_DOMAIN}/#{endpoint}"
|
||||||
output = Utils::Curl.curl_output("--fail", api_url, max_time: 5)
|
output = Utils::Curl.curl_output("--fail", api_url, max_time: 5)
|
||||||
raise ArgumentError, "No file found at #{Tty.underline}#{api_url}#{Tty.reset}" unless output.success?
|
raise ArgumentError, "No file found at #{Tty.underline}#{api_url}#{Tty.reset}" unless output.success?
|
||||||
|
|
||||||
cache[endpoint] = if json
|
cache[endpoint] = JSON.parse(output.stdout)
|
||||||
JSON.parse(output.stdout)
|
|
||||||
else
|
|
||||||
output.stdout
|
|
||||||
end
|
|
||||||
rescue JSON::ParserError
|
rescue JSON::ParserError
|
||||||
raise ArgumentError, "Invalid JSON file: #{Tty.underline}#{api_url}#{Tty.reset}"
|
raise ArgumentError, "Invalid JSON file: #{Tty.underline}#{api_url}#{Tty.reset}"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
sig { params(endpoint: String, target: Pathname).returns(Hash) }
|
||||||
def fetch_json_api_file(endpoint, target:)
|
def fetch_json_api_file(endpoint, target:)
|
||||||
retry_count = 0
|
retry_count = 0
|
||||||
|
|
||||||
@ -58,5 +54,19 @@ module Homebrew
|
|||||||
retry
|
retry
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
sig { params(filepath: String, repo: String, git_head: T.nilable(String)).returns(String) }
|
||||||
|
def fetch_file_source(filepath, repo:, git_head: nil)
|
||||||
|
git_head ||= "master"
|
||||||
|
endpoint = "#{git_head}/#{filepath}"
|
||||||
|
return cache[endpoint] if cache.present? && cache.key?(endpoint)
|
||||||
|
|
||||||
|
raw_url = "https://raw.githubusercontent.com/#{repo}/#{endpoint}"
|
||||||
|
puts "Fetching #{raw_url}..."
|
||||||
|
output = Utils::Curl.curl_output("--fail", raw_url, max_time: 5)
|
||||||
|
raise ArgumentError, "No file found at #{Tty.underline}#{raw_url}#{Tty.reset}" unless output.success?
|
||||||
|
|
||||||
|
cache[endpoint] = output.stdout
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@ -1,29 +0,0 @@
|
|||||||
# typed: false
|
|
||||||
# frozen_string_literal: true
|
|
||||||
|
|
||||||
module Homebrew
|
|
||||||
module API
|
|
||||||
# Helper functions for using the cask source API.
|
|
||||||
#
|
|
||||||
# @api private
|
|
||||||
module CaskSource
|
|
||||||
class << self
|
|
||||||
extend T::Sig
|
|
||||||
|
|
||||||
sig { params(token: String).returns(Hash) }
|
|
||||||
def fetch(token)
|
|
||||||
token = token.sub(%r{^homebrew/cask/}, "")
|
|
||||||
Homebrew::API.fetch "cask-source/#{token}.rb", json: false
|
|
||||||
end
|
|
||||||
|
|
||||||
sig { params(token: String).returns(T::Boolean) }
|
|
||||||
def available?(token)
|
|
||||||
fetch token
|
|
||||||
true
|
|
||||||
rescue ArgumentError
|
|
||||||
false
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
@ -10,9 +10,14 @@ module Homebrew
|
|||||||
class << self
|
class << self
|
||||||
extend T::Sig
|
extend T::Sig
|
||||||
|
|
||||||
sig { params(name: String).returns(Hash) }
|
sig { params(token: String).returns(Hash) }
|
||||||
def fetch(name)
|
def fetch(token)
|
||||||
Homebrew::API.fetch "cask/#{name}.json"
|
Homebrew::API.fetch "cask/#{token}.json"
|
||||||
|
end
|
||||||
|
|
||||||
|
sig { params(token: String, git_head: T.nilable(String)).returns(String) }
|
||||||
|
def fetch_source(token, git_head: nil)
|
||||||
|
Homebrew::API.fetch_file_source "Casks/#{token}.rb", repo: "Homebrew/homebrew-cask", git_head: git_head
|
||||||
end
|
end
|
||||||
|
|
||||||
sig { returns(Hash) }
|
sig { returns(Hash) }
|
||||||
|
|||||||
@ -199,7 +199,7 @@ rescue MethodDeprecatedError => e
|
|||||||
exit 1
|
exit 1
|
||||||
rescue Exception => e # rubocop:disable Lint/RescueException
|
rescue Exception => e # rubocop:disable Lint/RescueException
|
||||||
onoe e
|
onoe e
|
||||||
if internal_cmd && defined?(OS::ISSUES_URL)
|
if internal_cmd && !OS.unsupported_configuration?
|
||||||
if Homebrew::EnvConfig.no_auto_update?
|
if Homebrew::EnvConfig.no_auto_update?
|
||||||
$stderr.puts "#{Tty.bold}Do not report this issue until you've run `brew update` and tried again.#{Tty.reset}"
|
$stderr.puts "#{Tty.bold}Do not report this issue until you've run `brew update` and tried again.#{Tty.reset}"
|
||||||
else
|
else
|
||||||
|
|||||||
@ -689,6 +689,8 @@ done
|
|||||||
HOMEBREW_ARG_COUNT="$#"
|
HOMEBREW_ARG_COUNT="$#"
|
||||||
HOMEBREW_COMMAND="$1"
|
HOMEBREW_COMMAND="$1"
|
||||||
shift
|
shift
|
||||||
|
# If you are going to change anything in below case statement,
|
||||||
|
# be sure to also update HOMEBREW_INTERNAL_COMMAND_ALIASES hash in commands.rb
|
||||||
case "${HOMEBREW_COMMAND}" in
|
case "${HOMEBREW_COMMAND}" in
|
||||||
ls) HOMEBREW_COMMAND="list" ;;
|
ls) HOMEBREW_COMMAND="list" ;;
|
||||||
homepage) HOMEBREW_COMMAND="home" ;;
|
homepage) HOMEBREW_COMMAND="home" ;;
|
||||||
@ -705,6 +707,8 @@ case "${HOMEBREW_COMMAND}" in
|
|||||||
environment) HOMEBREW_COMMAND="--env" ;;
|
environment) HOMEBREW_COMMAND="--env" ;;
|
||||||
--config) HOMEBREW_COMMAND="config" ;;
|
--config) HOMEBREW_COMMAND="config" ;;
|
||||||
-v) HOMEBREW_COMMAND="--version" ;;
|
-v) HOMEBREW_COMMAND="--version" ;;
|
||||||
|
lc) HOMEBREW_COMMAND="livecheck" ;;
|
||||||
|
tc) HOMEBREW_COMMAND="typecheck" ;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
# Set HOMEBREW_DEV_CMD_RUN for users who have run a development command.
|
# Set HOMEBREW_DEV_CMD_RUN for users who have run a development command.
|
||||||
@ -767,13 +771,21 @@ To turn developer mode off, run $(bold "brew developer off")
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
# Test HOMEBREW_INSTALL_FROM_API on HOMEBREW_DEV_CMD_RUN and HOMEBREW_DEVELOPER
|
# Test HOMEBREW_INSTALL_FROM_API on HOMEBREW_DEV_CMD_RUN and HOMEBREW_DEVELOPER
|
||||||
# folks who haven't run a HOMEBREW_DEVELOPER_COMMAND.
|
# folks who haven't run a HOMEBREW_DEVELOPER_COMMAND if they are in a default
|
||||||
|
# prefix and on a supported macOS version.
|
||||||
if [[ -z "${HOMEBREW_NO_INSTALL_FROM_API}" &&
|
if [[ -z "${HOMEBREW_NO_INSTALL_FROM_API}" &&
|
||||||
-z "${HOMEBREW_INSTALL_FROM_API}" &&
|
-z "${HOMEBREW_INSTALL_FROM_API}" &&
|
||||||
-z "${HOMEBREW_DEVELOPER_COMMAND}" ]] &&
|
-z "${HOMEBREW_DEVELOPER_COMMAND}" ]] &&
|
||||||
|
[[ -z "${HOMEBREW_MACOS_VERSION_NUMERIC}" ||
|
||||||
|
"${HOMEBREW_MACOS_VERSION_NUMERIC}" -ge "110000" ]] &&
|
||||||
|
[[ "${HOMEBREW_PREFIX}" == "/usr/local" ||
|
||||||
|
"${HOMEBREW_PREFIX}" == "/opt/homebrew" ||
|
||||||
|
"${HOMEBREW_PREFIX}" == "/home/linuxbrew/.linuxbrew" ]] &&
|
||||||
[[ -n "${HOMEBREW_DEV_CMD_RUN}" || -n "${HOMEBREW_DEVELOPER}" ]]
|
[[ -n "${HOMEBREW_DEV_CMD_RUN}" || -n "${HOMEBREW_DEVELOPER}" ]]
|
||||||
then
|
then
|
||||||
export HOMEBREW_INSTALL_FROM_API=1
|
export HOMEBREW_INSTALL_FROM_API=1
|
||||||
|
else
|
||||||
|
unset HOMEBREW_INSTALL_FROM_API
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ -f "${HOMEBREW_LIBRARY}/Homebrew/cmd/${HOMEBREW_COMMAND}.sh" ]]
|
if [[ -f "${HOMEBREW_LIBRARY}/Homebrew/cmd/${HOMEBREW_COMMAND}.sh" ]]
|
||||||
|
|||||||
@ -246,6 +246,8 @@ module Cask
|
|||||||
"conflicts_with" => conflicts_with,
|
"conflicts_with" => conflicts_with,
|
||||||
"container" => container&.pairs,
|
"container" => container&.pairs,
|
||||||
"auto_updates" => auto_updates,
|
"auto_updates" => auto_updates,
|
||||||
|
"tap_git_head" => tap&.git_head,
|
||||||
|
"languages" => languages,
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@ -215,7 +215,7 @@ module Cask
|
|||||||
# Use the cask-source API if there are any `*flight` blocks or the cask has multiple languages
|
# Use the cask-source API if there are any `*flight` blocks or the cask has multiple languages
|
||||||
if json_cask[:artifacts].any? { |artifact| FLIGHT_STANZAS.include?(artifact.keys.first) } ||
|
if json_cask[:artifacts].any? { |artifact| FLIGHT_STANZAS.include?(artifact.keys.first) } ||
|
||||||
json_cask[:languages].any?
|
json_cask[:languages].any?
|
||||||
cask_source = Homebrew::API::CaskSource.fetch(token)
|
cask_source = Homebrew::API::Cask.fetch_source(token, git_head: json_cask[:tap_git_head])
|
||||||
return FromContentLoader.new(cask_source).load(config: config)
|
return FromContentLoader.new(cask_source).load(config: config)
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -223,7 +223,9 @@ module Cask
|
|||||||
json_cask[:artifacts] = json_cask[:artifacts].map(&method(:from_h_hash_gsubs))
|
json_cask[:artifacts] = json_cask[:artifacts].map(&method(:from_h_hash_gsubs))
|
||||||
json_cask[:caveats] = from_h_string_gsubs(json_cask[:caveats])
|
json_cask[:caveats] = from_h_string_gsubs(json_cask[:caveats])
|
||||||
|
|
||||||
Cask.new(token, source: cask_source, config: config) do
|
tap = Tap.fetch(json_cask[:tap]) if json_cask[:tap].to_s.include?("/")
|
||||||
|
|
||||||
|
Cask.new(token, tap: tap, source: cask_source, config: config) do
|
||||||
version json_cask[:version]
|
version json_cask[:version]
|
||||||
|
|
||||||
if json_cask[:sha256] == "no_check"
|
if json_cask[:sha256] == "no_check"
|
||||||
@ -371,7 +373,7 @@ module Cask
|
|||||||
return loader_class.new(ref)
|
return loader_class.new(ref)
|
||||||
end
|
end
|
||||||
|
|
||||||
if Homebrew::EnvConfig.install_from_api? && !need_path && Homebrew::API::CaskSource.available?(ref)
|
if Homebrew::EnvConfig.install_from_api? && !need_path && Homebrew::API::Cask.all_casks.key?(ref)
|
||||||
return FromAPILoader.new(ref)
|
return FromAPILoader.new(ref)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@ -298,9 +298,10 @@ module Homebrew
|
|||||||
def parse(argv = ARGV.freeze, ignore_invalid_options: false)
|
def parse(argv = ARGV.freeze, ignore_invalid_options: false)
|
||||||
raise "Arguments were already parsed!" if @args_parsed
|
raise "Arguments were already parsed!" if @args_parsed
|
||||||
|
|
||||||
# If we accept formula options, parse once allowing invalid options
|
# If we accept formula options, but the command isn't scoped only
|
||||||
# so we can get the remaining list containing formula names.
|
# to casks, parse once allowing invalid options so we can get the
|
||||||
if @formula_options
|
# remaining list containing formula names.
|
||||||
|
if @formula_options && !only_casks?(argv)
|
||||||
remaining, non_options = parse_remaining(argv, ignore_invalid_options: true)
|
remaining, non_options = parse_remaining(argv, ignore_invalid_options: true)
|
||||||
|
|
||||||
argv = [*remaining, "--", *non_options]
|
argv = [*remaining, "--", *non_options]
|
||||||
@ -639,6 +640,10 @@ module Homebrew
|
|||||||
end
|
end
|
||||||
end.compact.uniq(&:name)
|
end.compact.uniq(&:name)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def only_casks?(argv)
|
||||||
|
argv.include?("--casks") || argv.include?("--cask")
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
class OptionConstraintError < UsageError
|
class OptionConstraintError < UsageError
|
||||||
|
|||||||
@ -9,6 +9,7 @@ require "description_cache_store"
|
|||||||
require "cli/parser"
|
require "cli/parser"
|
||||||
require "settings"
|
require "settings"
|
||||||
require "linuxbrew-core-migration"
|
require "linuxbrew-core-migration"
|
||||||
|
require "extend/os/cmd/update-report"
|
||||||
|
|
||||||
module Homebrew
|
module Homebrew
|
||||||
extend T::Sig
|
extend T::Sig
|
||||||
@ -293,31 +294,7 @@ module Homebrew
|
|||||||
end
|
end
|
||||||
|
|
||||||
def migrate_gcc_dependents_if_needed
|
def migrate_gcc_dependents_if_needed
|
||||||
# TODO: Refactor and move to extend/os
|
# do nothing
|
||||||
return if OS.mac? # rubocop:disable Homebrew/MoveToExtendOS
|
|
||||||
return if Settings.read("gcc-rpaths.fixed") == "true"
|
|
||||||
|
|
||||||
Formula.installed.each do |formula|
|
|
||||||
next unless formula.tap&.core_tap?
|
|
||||||
|
|
||||||
recursive_runtime_dependencies = Dependency.expand(
|
|
||||||
formula,
|
|
||||||
cache_key: "update-report",
|
|
||||||
) do |_, dependency|
|
|
||||||
Dependency.prune if dependency.build? || dependency.test?
|
|
||||||
end
|
|
||||||
next unless recursive_runtime_dependencies.map(&:name).include? "gcc"
|
|
||||||
|
|
||||||
keg = formula.installed_kegs.last
|
|
||||||
tab = Tab.for_keg(keg)
|
|
||||||
# Force reinstallation upon `brew upgrade` to fix the bottle RPATH.
|
|
||||||
tab.source["versions"]["version_scheme"] = -1
|
|
||||||
tab.write
|
|
||||||
rescue TapFormulaUnavailableError
|
|
||||||
nil
|
|
||||||
end
|
|
||||||
|
|
||||||
Settings.write "gcc-rpaths.fixed", true
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@ -11,6 +11,8 @@ module Commands
|
|||||||
|
|
||||||
HOMEBREW_CMD_PATH = (HOMEBREW_LIBRARY_PATH/"cmd").freeze
|
HOMEBREW_CMD_PATH = (HOMEBREW_LIBRARY_PATH/"cmd").freeze
|
||||||
HOMEBREW_DEV_CMD_PATH = (HOMEBREW_LIBRARY_PATH/"dev-cmd").freeze
|
HOMEBREW_DEV_CMD_PATH = (HOMEBREW_LIBRARY_PATH/"dev-cmd").freeze
|
||||||
|
# If you are going to change anything in below hash,
|
||||||
|
# be sure to also update appropriate case statement in brew.sh
|
||||||
HOMEBREW_INTERNAL_COMMAND_ALIASES = {
|
HOMEBREW_INTERNAL_COMMAND_ALIASES = {
|
||||||
"ls" => "list",
|
"ls" => "list",
|
||||||
"homepage" => "home",
|
"homepage" => "home",
|
||||||
|
|||||||
@ -28,11 +28,10 @@ module Homebrew
|
|||||||
public_members = GitHub.public_member_usernames("Homebrew")
|
public_members = GitHub.public_member_usernames("Homebrew")
|
||||||
|
|
||||||
members = {
|
members = {
|
||||||
plc: GitHub.members_by_team("Homebrew", "plc"),
|
plc: GitHub.members_by_team("Homebrew", "plc"),
|
||||||
tsc: GitHub.members_by_team("Homebrew", "tsc"),
|
tsc: GitHub.members_by_team("Homebrew", "tsc"),
|
||||||
|
maintainers: GitHub.members_by_team("Homebrew", "maintainers"),
|
||||||
}
|
}
|
||||||
members[:other] = GitHub.members_by_team("Homebrew", "maintainers")
|
|
||||||
.except(*members.values.map(&:keys).flatten.uniq)
|
|
||||||
|
|
||||||
sentences = {}
|
sentences = {}
|
||||||
members.each do |group, hash|
|
members.each do |group, hash|
|
||||||
@ -48,8 +47,8 @@ module Homebrew
|
|||||||
"\\1 is #{sentences[:plc]}.")
|
"\\1 is #{sentences[:plc]}.")
|
||||||
content.gsub!(/(Homebrew's \[Technical Steering Committee.*) is .*\./,
|
content.gsub!(/(Homebrew's \[Technical Steering Committee.*) is .*\./,
|
||||||
"\\1 is #{sentences[:tsc]}.")
|
"\\1 is #{sentences[:tsc]}.")
|
||||||
content.gsub!(/(Homebrew's other current maintainers are).*\./,
|
content.gsub!(/(Homebrew's maintainers are).*\./,
|
||||||
"\\1 #{sentences[:other]}.")
|
"\\1 #{sentences[:maintainers]}.")
|
||||||
|
|
||||||
File.write(readme, content)
|
File.write(readme, content)
|
||||||
|
|
||||||
|
|||||||
@ -226,7 +226,9 @@ module Homebrew
|
|||||||
},
|
},
|
||||||
HOMEBREW_INSTALL_FROM_API: {
|
HOMEBREW_INSTALL_FROM_API: {
|
||||||
description: "If set, install formulae and casks in homebrew/core and homebrew/cask taps using Homebrew's " \
|
description: "If set, install formulae and casks in homebrew/core and homebrew/cask taps using Homebrew's " \
|
||||||
"API instead of needing (large, slow) local checkouts of these repositories.",
|
"API instead of needing (large, slow) local checkouts of these repositories. Note, this will " \
|
||||||
|
"only take effect in supported configurations (i.e. using the default Homebrew prefix and, " \
|
||||||
|
"if on macOS, on a supported version).",
|
||||||
boolean: true,
|
boolean: true,
|
||||||
},
|
},
|
||||||
HOMEBREW_LIVECHECK_WATCHLIST: {
|
HOMEBREW_LIVECHECK_WATCHLIST: {
|
||||||
@ -285,8 +287,7 @@ module Homebrew
|
|||||||
boolean: true,
|
boolean: true,
|
||||||
},
|
},
|
||||||
HOMEBREW_NO_EMOJI: {
|
HOMEBREW_NO_EMOJI: {
|
||||||
description: "If set, do not print `HOMEBREW_INSTALL_BADGE` on a successful build." \
|
description: "If set, do not print `HOMEBREW_INSTALL_BADGE` on a successful build.",
|
||||||
"\n\n *Note:* Will only try to print emoji on OS X Lion or newer.",
|
|
||||||
boolean: true,
|
boolean: true,
|
||||||
},
|
},
|
||||||
HOMEBREW_NO_ENV_HINTS: {
|
HOMEBREW_NO_ENV_HINTS: {
|
||||||
@ -485,6 +486,9 @@ module Homebrew
|
|||||||
|
|
||||||
sig { returns(T::Boolean) }
|
sig { returns(T::Boolean) }
|
||||||
def install_from_api?
|
def install_from_api?
|
||||||
|
return false if OS.unsupported_configuration?
|
||||||
|
return false unless Homebrew.default_prefix?
|
||||||
|
|
||||||
ENV["HOMEBREW_NO_INSTALL_FROM_API"].blank? && ENV["HOMEBREW_INSTALL_FROM_API"].present?
|
ENV["HOMEBREW_NO_INSTALL_FROM_API"].blank? && ENV["HOMEBREW_INSTALL_FROM_API"].present?
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@ -524,7 +524,7 @@ class BuildError < RuntimeError
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
if formula.tap && defined?(OS::ISSUES_URL)
|
if formula.tap && !OS.unsupported_configuration?
|
||||||
if formula.tap.official?
|
if formula.tap.official?
|
||||||
puts Formatter.error(Formatter.url(OS::ISSUES_URL), label: "READ THIS")
|
puts Formatter.error(Formatter.url(OS::ISSUES_URL), label: "READ THIS")
|
||||||
elsif (issues_url = formula.tap.issues_url)
|
elsif (issues_url = formula.tap.issues_url)
|
||||||
|
|||||||
4
Library/Homebrew/extend/os/cmd/update-report.rb
Normal file
4
Library/Homebrew/extend/os/cmd/update-report.rb
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
# typed: strict
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
|
require "extend/os/linux/cmd/update-report" if OS.linux?
|
||||||
34
Library/Homebrew/extend/os/linux/cmd/update-report.rb
Normal file
34
Library/Homebrew/extend/os/linux/cmd/update-report.rb
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
# typed: false
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
|
module Homebrew
|
||||||
|
extend T::Sig
|
||||||
|
|
||||||
|
module_function
|
||||||
|
|
||||||
|
def migrate_gcc_dependents_if_needed
|
||||||
|
return if Settings.read("gcc-rpaths.fixed") == "true"
|
||||||
|
|
||||||
|
Formula.installed.each do |formula|
|
||||||
|
next unless formula.tap&.core_tap?
|
||||||
|
|
||||||
|
recursive_runtime_dependencies = Dependency.expand(
|
||||||
|
formula,
|
||||||
|
cache_key: "update-report",
|
||||||
|
) do |_, dependency|
|
||||||
|
Dependency.prune if dependency.build? || dependency.test?
|
||||||
|
end
|
||||||
|
next unless recursive_runtime_dependencies.map(&:name).include? "gcc"
|
||||||
|
|
||||||
|
keg = formula.installed_kegs.last
|
||||||
|
tab = Tab.for_keg(keg)
|
||||||
|
# Force reinstallation upon `brew upgrade` to fix the bottle RPATH.
|
||||||
|
tab.source["versions"]["version_scheme"] = -1
|
||||||
|
tab.write
|
||||||
|
rescue TapFormulaUnavailableError
|
||||||
|
nil
|
||||||
|
end
|
||||||
|
|
||||||
|
Settings.write "gcc-rpaths.fixed", true
|
||||||
|
end
|
||||||
|
end
|
||||||
@ -1,4 +0,0 @@
|
|||||||
# typed: strict
|
|
||||||
# frozen_string_literal: true
|
|
||||||
|
|
||||||
require "active_support/core_ext/object/blank"
|
|
||||||
@ -2126,6 +2126,7 @@ class Formula
|
|||||||
"disabled" => disabled?,
|
"disabled" => disabled?,
|
||||||
"disable_date" => disable_date,
|
"disable_date" => disable_date,
|
||||||
"disable_reason" => disable_reason,
|
"disable_reason" => disable_reason,
|
||||||
|
"tap_git_head" => tap&.git_head,
|
||||||
}
|
}
|
||||||
|
|
||||||
if stable
|
if stable
|
||||||
|
|||||||
@ -129,8 +129,6 @@ end.compact.freeze
|
|||||||
|
|
||||||
require "set"
|
require "set"
|
||||||
|
|
||||||
require "extend/string"
|
|
||||||
|
|
||||||
require "system_command"
|
require "system_command"
|
||||||
require "exceptions"
|
require "exceptions"
|
||||||
require "utils"
|
require "utils"
|
||||||
|
|||||||
@ -48,7 +48,7 @@ module Homebrew
|
|||||||
readme.read[/(Homebrew's \[Technical Steering Committee.*\.)/, 1]
|
readme.read[/(Homebrew's \[Technical Steering Committee.*\.)/, 1]
|
||||||
.gsub(/\[([^\]]+)\]\([^)]+\)/, '\1')
|
.gsub(/\[([^\]]+)\]\([^)]+\)/, '\1')
|
||||||
variables[:maintainers] =
|
variables[:maintainers] =
|
||||||
readme.read[/(Homebrew's other current maintainers .*\.)/, 1]
|
readme.read[/(Homebrew's maintainers .*\.)/, 1]
|
||||||
.gsub(/\[([^\]]+)\]\([^)]+\)/, '\1')
|
.gsub(/\[([^\]]+)\]\([^)]+\)/, '\1')
|
||||||
variables[:alumni] =
|
variables[:alumni] =
|
||||||
readme.read[/(Former maintainers .*\.)/, 1]
|
readme.read[/(Former maintainers .*\.)/, 1]
|
||||||
|
|||||||
@ -59,8 +59,8 @@ module OS
|
|||||||
if !OS::Mac.version.prerelease? &&
|
if !OS::Mac.version.prerelease? &&
|
||||||
!OS::Mac.version.outdated_release? &&
|
!OS::Mac.version.outdated_release? &&
|
||||||
ARGV.none? { |v| v.start_with?("--cc=") } &&
|
ARGV.none? { |v| v.start_with?("--cc=") } &&
|
||||||
(HOMEBREW_PREFIX == HOMEBREW_DEFAULT_PREFIX ||
|
(HOMEBREW_PREFIX.to_s == HOMEBREW_DEFAULT_PREFIX ||
|
||||||
(HOMEBREW_PREFIX == HOMEBREW_MACOS_ARM_DEFAULT_PREFIX && Hardware::CPU.arm?))
|
(HOMEBREW_PREFIX.to_s == HOMEBREW_MACOS_ARM_DEFAULT_PREFIX && Hardware::CPU.arm?))
|
||||||
ISSUES_URL = "https://docs.brew.sh/Troubleshooting"
|
ISSUES_URL = "https://docs.brew.sh/Troubleshooting"
|
||||||
end
|
end
|
||||||
PATH_OPEN = "/usr/bin/open"
|
PATH_OPEN = "/usr/bin/open"
|
||||||
@ -69,4 +69,9 @@ module OS
|
|||||||
ISSUES_URL = "https://docs.brew.sh/Troubleshooting"
|
ISSUES_URL = "https://docs.brew.sh/Troubleshooting"
|
||||||
PATH_OPEN = "xdg-open"
|
PATH_OPEN = "xdg-open"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
sig { returns(T::Boolean) }
|
||||||
|
def self.unsupported_configuration?
|
||||||
|
!defined?(OS::ISSUES_URL)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@ -1,12 +0,0 @@
|
|||||||
# typed: strict
|
|
||||||
# frozen_string_literal: true
|
|
||||||
|
|
||||||
# Utility method extensions for String.
|
|
||||||
class String
|
|
||||||
extend T::Sig
|
|
||||||
|
|
||||||
sig { returns(String) }
|
|
||||||
def undent
|
|
||||||
gsub(/^.{#{(slice(/^ +/) || '').length}}/, "")
|
|
||||||
end
|
|
||||||
end
|
|
||||||
@ -2,7 +2,6 @@
|
|||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
require "rubocops/extend/formula"
|
require "rubocops/extend/formula"
|
||||||
require "extend/string"
|
|
||||||
|
|
||||||
module RuboCop
|
module RuboCop
|
||||||
module Cop
|
module Cop
|
||||||
|
|||||||
@ -1,7 +1,6 @@
|
|||||||
# typed: false
|
# typed: false
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
require "extend/string"
|
|
||||||
require "rubocops/shared/helper_functions"
|
require "rubocops/shared/helper_functions"
|
||||||
|
|
||||||
module RuboCop
|
module RuboCop
|
||||||
|
|||||||
@ -3,7 +3,6 @@
|
|||||||
|
|
||||||
require "rubocops/extend/formula"
|
require "rubocops/extend/formula"
|
||||||
require "rubocops/shared/desc_helper"
|
require "rubocops/shared/desc_helper"
|
||||||
require "extend/string"
|
|
||||||
|
|
||||||
module RuboCop
|
module RuboCop
|
||||||
module Cop
|
module Cop
|
||||||
|
|||||||
@ -2,7 +2,6 @@
|
|||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
require "rubocops/extend/formula"
|
require "rubocops/extend/formula"
|
||||||
require "extend/string"
|
|
||||||
|
|
||||||
module RuboCop
|
module RuboCop
|
||||||
module Cop
|
module Cop
|
||||||
|
|||||||
@ -8,7 +8,6 @@ require_relative "cask/constants/stanza"
|
|||||||
require_relative "cask/ast/stanza"
|
require_relative "cask/ast/stanza"
|
||||||
require_relative "cask/ast/cask_header"
|
require_relative "cask/ast/cask_header"
|
||||||
require_relative "cask/ast/cask_block"
|
require_relative "cask/ast/cask_block"
|
||||||
require_relative "cask/extend/string"
|
|
||||||
require_relative "cask/extend/node"
|
require_relative "cask/extend/node"
|
||||||
require_relative "cask/mixin/cask_help"
|
require_relative "cask/mixin/cask_help"
|
||||||
require_relative "cask/mixin/on_homepage_stanza"
|
require_relative "cask/mixin/on_homepage_stanza"
|
||||||
|
|||||||
@ -579,6 +579,12 @@ end
|
|||||||
|
|
||||||
class TZInfo::PeriodNotFound < ::StandardError; end
|
class TZInfo::PeriodNotFound < ::StandardError; end
|
||||||
|
|
||||||
|
module TZInfo::RubyCoreSupport
|
||||||
|
class << self
|
||||||
|
def untaint(o); end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
class TZInfo::StringDeduper
|
class TZInfo::StringDeduper
|
||||||
def initialize; end
|
def initialize; end
|
||||||
|
|
||||||
@ -265,6 +265,7 @@ class WEBrick::HTTPRequest
|
|||||||
private
|
private
|
||||||
|
|
||||||
def _read_data(io, method, *arg); end
|
def _read_data(io, method, *arg); end
|
||||||
|
def parse_host_request_line(host); end
|
||||||
def parse_query; end
|
def parse_query; end
|
||||||
def parse_uri(str, scheme = T.unsafe(nil)); end
|
def parse_uri(str, scheme = T.unsafe(nil)); end
|
||||||
def read_body(socket, block); end
|
def read_body(socket, block); end
|
||||||
@ -284,7 +285,6 @@ class WEBrick::HTTPResponse
|
|||||||
|
|
||||||
def [](field); end
|
def [](field); end
|
||||||
def []=(field, value); end
|
def []=(field, value); end
|
||||||
def _rack_setup_header; end
|
|
||||||
def body; end
|
def body; end
|
||||||
def body=(_arg0); end
|
def body=(_arg0); end
|
||||||
def chunked=(val); end
|
def chunked=(val); end
|
||||||
@ -319,9 +319,13 @@ class WEBrick::HTTPResponse
|
|||||||
def sent_size; end
|
def sent_size; end
|
||||||
def set_error(ex, backtrace = T.unsafe(nil)); end
|
def set_error(ex, backtrace = T.unsafe(nil)); end
|
||||||
def set_redirect(status, url); end
|
def set_redirect(status, url); end
|
||||||
|
def setup_header; end
|
||||||
def status; end
|
def status; end
|
||||||
def status=(status); end
|
def status=(status); end
|
||||||
def status_line; end
|
def status_line; end
|
||||||
|
def upgrade; end
|
||||||
|
def upgrade!(protocol); end
|
||||||
|
def upgrade=(_arg0); end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
@ -450,6 +454,15 @@ class WEBrick::HTTPServlet::FileHandler < ::WEBrick::HTTPServlet::AbstractServle
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
class WEBrick::HTTPServlet::ProcHandler < ::WEBrick::HTTPServlet::AbstractServlet
|
||||||
|
def initialize(proc); end
|
||||||
|
|
||||||
|
def do_GET(request, response); end
|
||||||
|
def do_POST(request, response); end
|
||||||
|
def do_PUT(request, response); end
|
||||||
|
def get_instance(server, *options); end
|
||||||
|
end
|
||||||
|
|
||||||
module WEBrick::HTTPStatus
|
module WEBrick::HTTPStatus
|
||||||
private
|
private
|
||||||
|
|
||||||
@ -149,13 +149,16 @@ class Rack::Request
|
|||||||
def xhr?; end
|
def xhr?; end
|
||||||
|
|
||||||
class << self
|
class << self
|
||||||
|
def forwarded_priority; end
|
||||||
|
def forwarded_priority=(_arg0); end
|
||||||
def ip_filter; end
|
def ip_filter; end
|
||||||
def ip_filter=(_arg0); end
|
def ip_filter=(_arg0); end
|
||||||
|
def x_forwarded_proto_priority; end
|
||||||
|
def x_forwarded_proto_priority=(_arg0); end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
Rack::Request::ALLOWED_SCHEMES = T.let(T.unsafe(nil), Array)
|
Rack::Request::ALLOWED_SCHEMES = T.let(T.unsafe(nil), Array)
|
||||||
Rack::Request::SCHEME_WHITELIST = T.let(T.unsafe(nil), Array)
|
|
||||||
|
|
||||||
class String
|
class String
|
||||||
include ::Comparable
|
include ::Comparable
|
||||||
@ -202,8 +205,6 @@ module YARD
|
|||||||
def ruby18?; end
|
def ruby18?; end
|
||||||
def ruby19?; end
|
def ruby19?; end
|
||||||
def ruby2?; end
|
def ruby2?; end
|
||||||
def ruby31?; end
|
|
||||||
def ruby3?; end
|
|
||||||
def windows?; end
|
def windows?; end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -1419,12 +1420,7 @@ class YARD::Handlers::Ruby::MixinHandler < ::YARD::Handlers::Ruby::Base
|
|||||||
def recipient(mixin); end
|
def recipient(mixin); end
|
||||||
end
|
end
|
||||||
|
|
||||||
class YARD::Handlers::Ruby::ModuleFunctionHandler < ::YARD::Handlers::Ruby::Base
|
class YARD::Handlers::Ruby::ModuleFunctionHandler < ::YARD::Handlers::Ruby::Base; end
|
||||||
include ::YARD::Handlers::Ruby::DecoratorHandlerMethods
|
|
||||||
|
|
||||||
def make_module_function(instance_method, namespace); end
|
|
||||||
end
|
|
||||||
|
|
||||||
class YARD::Handlers::Ruby::ModuleHandler < ::YARD::Handlers::Ruby::Base; end
|
class YARD::Handlers::Ruby::ModuleHandler < ::YARD::Handlers::Ruby::Base; end
|
||||||
|
|
||||||
class YARD::Handlers::Ruby::PrivateClassMethodHandler < ::YARD::Handlers::Ruby::Base
|
class YARD::Handlers::Ruby::PrivateClassMethodHandler < ::YARD::Handlers::Ruby::Base
|
||||||
@ -2409,7 +2405,6 @@ class YARD::Parser::Ruby::ModuleNode < ::YARD::Parser::Ruby::KeywordNode
|
|||||||
end
|
end
|
||||||
|
|
||||||
class YARD::Parser::Ruby::ParameterNode < ::YARD::Parser::Ruby::AstNode
|
class YARD::Parser::Ruby::ParameterNode < ::YARD::Parser::Ruby::AstNode
|
||||||
def args_forward; end
|
|
||||||
def block_param; end
|
def block_param; end
|
||||||
def double_splat_param; end
|
def double_splat_param; end
|
||||||
def named_params; end
|
def named_params; end
|
||||||
@ -3335,7 +3330,6 @@ class YARD::Tags::Directive
|
|||||||
|
|
||||||
protected
|
protected
|
||||||
|
|
||||||
def inside_directive?; end
|
|
||||||
def parser; end
|
def parser; end
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -4390,10 +4390,6 @@ module Homebrew::API::Cask
|
|||||||
extend ::T::Private::Methods::SingletonMethodHooks
|
extend ::T::Private::Methods::SingletonMethodHooks
|
||||||
end
|
end
|
||||||
|
|
||||||
module Homebrew::API::CaskSource
|
|
||||||
extend ::T::Private::Methods::SingletonMethodHooks
|
|
||||||
end
|
|
||||||
|
|
||||||
module Homebrew::API::Formula
|
module Homebrew::API::Formula
|
||||||
extend ::T::Private::Methods::SingletonMethodHooks
|
extend ::T::Private::Methods::SingletonMethodHooks
|
||||||
end
|
end
|
||||||
|
|||||||
@ -141,11 +141,15 @@ module SystemConfig
|
|||||||
|
|
||||||
def core_tap_config(f = $stdout)
|
def core_tap_config(f = $stdout)
|
||||||
if CoreTap.instance.installed?
|
if CoreTap.instance.installed?
|
||||||
f.puts "Core tap ORIGIN: #{core_tap_origin}"
|
f.puts "Core tap origin: #{core_tap_origin}"
|
||||||
f.puts "Core tap HEAD: #{core_tap_head}"
|
f.puts "Core tap HEAD: #{core_tap_head}"
|
||||||
f.puts "Core tap last commit: #{core_tap_last_commit}"
|
f.puts "Core tap last commit: #{core_tap_last_commit}"
|
||||||
f.puts "Core tap branch: #{core_tap_branch}"
|
f.puts "Core tap branch: #{core_tap_branch}"
|
||||||
else
|
end
|
||||||
|
|
||||||
|
if (formula_json = Homebrew::API::HOMEBREW_CACHE_API/"formula.json") && formula_json.exist?
|
||||||
|
f.puts "Core tap JSON: #{formula_json.mtime.to_s(:short)}"
|
||||||
|
elsif !CoreTap.instance.installed?
|
||||||
f.puts "Core tap: N/A"
|
f.puts "Core tap: N/A"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@ -178,7 +178,7 @@ class Tap
|
|||||||
def git_head
|
def git_head
|
||||||
raise TapUnavailableError, name unless installed?
|
raise TapUnavailableError, name unless installed?
|
||||||
|
|
||||||
path.git_head
|
@git_head ||= path.git_head
|
||||||
end
|
end
|
||||||
|
|
||||||
# Time since last git commit for this {Tap}.
|
# Time since last git commit for this {Tap}.
|
||||||
|
|||||||
@ -41,4 +41,14 @@ describe Homebrew::API::Cask do
|
|||||||
expect(casks_output).to eq casks_hash
|
expect(casks_output).to eq casks_hash
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
describe "::fetch_source" do
|
||||||
|
it "fetches the source of a cask (defaulting to master when no `git_head` is passed)" do
|
||||||
|
curl_output = OpenStruct.new(stdout: "foo", success?: true)
|
||||||
|
expect(Utils::Curl).to receive(:curl_output)
|
||||||
|
.with("--fail", "https://raw.githubusercontent.com/Homebrew/homebrew-cask/master/Casks/foo.rb", max_time: 5)
|
||||||
|
.and_return(curl_output)
|
||||||
|
described_class.fetch_source("foo", git_head: nil)
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@ -21,12 +21,6 @@ describe Homebrew::API do
|
|||||||
end
|
end
|
||||||
|
|
||||||
describe "::fetch" do
|
describe "::fetch" do
|
||||||
it "fetches a text file" do
|
|
||||||
mock_curl_output stdout: text
|
|
||||||
fetched_text = described_class.fetch("foo.txt", json: false)
|
|
||||||
expect(fetched_text).to eq text
|
|
||||||
end
|
|
||||||
|
|
||||||
it "fetches a JSON file" do
|
it "fetches a JSON file" do
|
||||||
mock_curl_output stdout: json
|
mock_curl_output stdout: json
|
||||||
fetched_json = described_class.fetch("foo.json")
|
fetched_json = described_class.fetch("foo.json")
|
||||||
@ -70,4 +64,19 @@ describe Homebrew::API do
|
|||||||
}.to raise_error(SystemExit)
|
}.to raise_error(SystemExit)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
describe "::fetch_file_source" do
|
||||||
|
it "fetches a file" do
|
||||||
|
mock_curl_output stdout: json
|
||||||
|
fetched_json = described_class.fetch_file_source("foo.json", repo: "Homebrew/homebrew-core", git_head: "master")
|
||||||
|
expect(fetched_json).to eq json
|
||||||
|
end
|
||||||
|
|
||||||
|
it "raises an error if the file does not exist" do
|
||||||
|
mock_curl_output success: false
|
||||||
|
expect {
|
||||||
|
described_class.fetch_file_source("bar.txt", repo: "Homebrew/homebrew-core", git_head: "master")
|
||||||
|
}.to raise_error(ArgumentError, /No file found/)
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@ -84,7 +84,10 @@ describe Cask::Cmd::List, :cask do
|
|||||||
end
|
end
|
||||||
|
|
||||||
describe "lists json" do
|
describe "lists json" do
|
||||||
let(:casks) { ["local-caffeine", "local-transmission", "multiple-versions", "third-party/tap/third-party-cask"] }
|
let(:casks) {
|
||||||
|
["local-caffeine", "local-transmission", "multiple-versions", "with-languages",
|
||||||
|
"third-party/tap/third-party-cask"]
|
||||||
|
}
|
||||||
let(:expected_output) {
|
let(:expected_output) {
|
||||||
<<~EOS
|
<<~EOS
|
||||||
[
|
[
|
||||||
@ -124,7 +127,11 @@ describe Cask::Cmd::List, :cask do
|
|||||||
},
|
},
|
||||||
"conflicts_with": null,
|
"conflicts_with": null,
|
||||||
"container": null,
|
"container": null,
|
||||||
"auto_updates": null
|
"auto_updates": null,
|
||||||
|
"tap_git_head": null,
|
||||||
|
"languages": [
|
||||||
|
|
||||||
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"token": "local-transmission",
|
"token": "local-transmission",
|
||||||
@ -155,7 +162,11 @@ describe Cask::Cmd::List, :cask do
|
|||||||
},
|
},
|
||||||
"conflicts_with": null,
|
"conflicts_with": null,
|
||||||
"container": null,
|
"container": null,
|
||||||
"auto_updates": null
|
"auto_updates": null,
|
||||||
|
"tap_git_head": null,
|
||||||
|
"languages": [
|
||||||
|
|
||||||
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"token": "multiple-versions",
|
"token": "multiple-versions",
|
||||||
@ -189,7 +200,11 @@ describe Cask::Cmd::List, :cask do
|
|||||||
},
|
},
|
||||||
"conflicts_with": null,
|
"conflicts_with": null,
|
||||||
"container": null,
|
"container": null,
|
||||||
"auto_updates": null
|
"auto_updates": null,
|
||||||
|
"tap_git_head": null,
|
||||||
|
"languages": [
|
||||||
|
|
||||||
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"token": "third-party-cask",
|
"token": "third-party-cask",
|
||||||
@ -220,7 +235,47 @@ describe Cask::Cmd::List, :cask do
|
|||||||
},
|
},
|
||||||
"conflicts_with": null,
|
"conflicts_with": null,
|
||||||
"container": null,
|
"container": null,
|
||||||
"auto_updates": null
|
"auto_updates": null,
|
||||||
|
"tap_git_head": null,
|
||||||
|
"languages": [
|
||||||
|
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"token": "with-languages",
|
||||||
|
"full_token": "with-languages",
|
||||||
|
"tap": "homebrew/cask",
|
||||||
|
"name": [
|
||||||
|
|
||||||
|
],
|
||||||
|
"desc": null,
|
||||||
|
"homepage": "https://brew.sh/",
|
||||||
|
"url": "file://#{TEST_FIXTURE_DIR}/cask/caffeine.zip",
|
||||||
|
"appcast": null,
|
||||||
|
"version": "1.2.3",
|
||||||
|
"versions": {
|
||||||
|
},
|
||||||
|
"installed": "1.2.3",
|
||||||
|
"outdated": false,
|
||||||
|
"sha256": "xyz789",
|
||||||
|
"artifacts": [
|
||||||
|
{
|
||||||
|
"app": [
|
||||||
|
"Caffeine.app"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"caveats": null,
|
||||||
|
"depends_on": {
|
||||||
|
},
|
||||||
|
"conflicts_with": null,
|
||||||
|
"container": null,
|
||||||
|
"auto_updates": null,
|
||||||
|
"tap_git_head": null,
|
||||||
|
"languages": [
|
||||||
|
"zh",
|
||||||
|
"en-US"
|
||||||
|
]
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
EOS
|
EOS
|
||||||
@ -257,7 +312,7 @@ describe Cask::Cmd::List, :cask do
|
|||||||
it "of given Casks" do
|
it "of given Casks" do
|
||||||
expect {
|
expect {
|
||||||
described_class.run("--json", "local-caffeine", "local-transmission", "multiple-versions",
|
described_class.run("--json", "local-caffeine", "local-transmission", "multiple-versions",
|
||||||
"third-party/tap/third-party-cask")
|
"third-party/tap/third-party-cask", "with-languages")
|
||||||
}.to output(expected_output).to_stdout
|
}.to output(expected_output).to_stdout
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@ -11,7 +11,7 @@ describe RuboCop::Cop::Cask::HomepageUrlTrailingSlash do
|
|||||||
|
|
||||||
context "when the homepage URL ends with a slash" do
|
context "when the homepage URL ends with a slash" do
|
||||||
let(:source) do
|
let(:source) do
|
||||||
<<-CASK.undent
|
<<~CASK
|
||||||
cask 'foo' do
|
cask 'foo' do
|
||||||
homepage 'https://foo.brew.sh/'
|
homepage 'https://foo.brew.sh/'
|
||||||
end
|
end
|
||||||
@ -23,7 +23,7 @@ describe RuboCop::Cop::Cask::HomepageUrlTrailingSlash do
|
|||||||
|
|
||||||
context "when the homepage URL does not end with a slash but has a path" do
|
context "when the homepage URL does not end with a slash but has a path" do
|
||||||
let(:source) do
|
let(:source) do
|
||||||
<<-CASK.undent
|
<<~CASK
|
||||||
cask 'foo' do
|
cask 'foo' do
|
||||||
homepage 'https://foo.brew.sh/path'
|
homepage 'https://foo.brew.sh/path'
|
||||||
end
|
end
|
||||||
@ -35,14 +35,14 @@ describe RuboCop::Cop::Cask::HomepageUrlTrailingSlash do
|
|||||||
|
|
||||||
context "when the homepage URL does not end with a slash and has no path" do
|
context "when the homepage URL does not end with a slash and has no path" do
|
||||||
let(:source) do
|
let(:source) do
|
||||||
<<-CASK.undent
|
<<~CASK
|
||||||
cask 'foo' do
|
cask 'foo' do
|
||||||
homepage 'https://foo.brew.sh'
|
homepage 'https://foo.brew.sh'
|
||||||
end
|
end
|
||||||
CASK
|
CASK
|
||||||
end
|
end
|
||||||
let(:correct_source) do
|
let(:correct_source) do
|
||||||
<<-CASK.undent
|
<<~CASK
|
||||||
cask 'foo' do
|
cask 'foo' do
|
||||||
homepage 'https://foo.brew.sh/'
|
homepage 'https://foo.brew.sh/'
|
||||||
end
|
end
|
||||||
|
|||||||
@ -12,7 +12,7 @@ describe RuboCop::Cop::Cask::OnSystemConditionals do
|
|||||||
context "when auditing `postflight` stanzas" do
|
context "when auditing `postflight` stanzas" do
|
||||||
context "when there are no on_system blocks" do
|
context "when there are no on_system blocks" do
|
||||||
let(:source) do
|
let(:source) do
|
||||||
<<-CASK.undent
|
<<~CASK
|
||||||
cask 'foo' do
|
cask 'foo' do
|
||||||
postflight do
|
postflight do
|
||||||
foobar
|
foobar
|
||||||
@ -26,7 +26,7 @@ describe RuboCop::Cop::Cask::OnSystemConditionals do
|
|||||||
|
|
||||||
context "when there is an `on_intel` block" do
|
context "when there is an `on_intel` block" do
|
||||||
let(:source) do
|
let(:source) do
|
||||||
<<-CASK.undent
|
<<~CASK
|
||||||
cask 'foo' do
|
cask 'foo' do
|
||||||
postflight do
|
postflight do
|
||||||
on_intel do
|
on_intel do
|
||||||
@ -37,7 +37,7 @@ describe RuboCop::Cop::Cask::OnSystemConditionals do
|
|||||||
CASK
|
CASK
|
||||||
end
|
end
|
||||||
let(:correct_source) do
|
let(:correct_source) do
|
||||||
<<-CASK.undent
|
<<~CASK
|
||||||
cask 'foo' do
|
cask 'foo' do
|
||||||
postflight do
|
postflight do
|
||||||
if Hardware::CPU.intel?
|
if Hardware::CPU.intel?
|
||||||
@ -64,7 +64,7 @@ describe RuboCop::Cop::Cask::OnSystemConditionals do
|
|||||||
|
|
||||||
context "when there is an `on_monterey` block" do
|
context "when there is an `on_monterey` block" do
|
||||||
let(:source) do
|
let(:source) do
|
||||||
<<-CASK.undent
|
<<~CASK
|
||||||
cask 'foo' do
|
cask 'foo' do
|
||||||
postflight do
|
postflight do
|
||||||
on_monterey do
|
on_monterey do
|
||||||
@ -75,7 +75,7 @@ describe RuboCop::Cop::Cask::OnSystemConditionals do
|
|||||||
CASK
|
CASK
|
||||||
end
|
end
|
||||||
let(:correct_source) do
|
let(:correct_source) do
|
||||||
<<-CASK.undent
|
<<~CASK
|
||||||
cask 'foo' do
|
cask 'foo' do
|
||||||
postflight do
|
postflight do
|
||||||
if MacOS.version == :monterey
|
if MacOS.version == :monterey
|
||||||
@ -102,7 +102,7 @@ describe RuboCop::Cop::Cask::OnSystemConditionals do
|
|||||||
|
|
||||||
context "when there is an `on_monterey :or_older` block" do
|
context "when there is an `on_monterey :or_older` block" do
|
||||||
let(:source) do
|
let(:source) do
|
||||||
<<-CASK.undent
|
<<~CASK
|
||||||
cask 'foo' do
|
cask 'foo' do
|
||||||
postflight do
|
postflight do
|
||||||
on_monterey :or_older do
|
on_monterey :or_older do
|
||||||
@ -113,7 +113,7 @@ describe RuboCop::Cop::Cask::OnSystemConditionals do
|
|||||||
CASK
|
CASK
|
||||||
end
|
end
|
||||||
let(:correct_source) do
|
let(:correct_source) do
|
||||||
<<-CASK.undent
|
<<~CASK
|
||||||
cask 'foo' do
|
cask 'foo' do
|
||||||
postflight do
|
postflight do
|
||||||
if MacOS.version <= :monterey
|
if MacOS.version <= :monterey
|
||||||
@ -143,7 +143,7 @@ describe RuboCop::Cop::Cask::OnSystemConditionals do
|
|||||||
context "when auditing `sha256` stanzas inside on_arch blocks" do
|
context "when auditing `sha256` stanzas inside on_arch blocks" do
|
||||||
context "when there are no on_arch blocks" do
|
context "when there are no on_arch blocks" do
|
||||||
let(:source) do
|
let(:source) do
|
||||||
<<-CASK.undent
|
<<~CASK
|
||||||
cask 'foo' do
|
cask 'foo' do
|
||||||
sha256 "67cdb8a02803ef37fdbf7e0be205863172e41a561ca446cd84f0d7ab35a99d94"
|
sha256 "67cdb8a02803ef37fdbf7e0be205863172e41a561ca446cd84f0d7ab35a99d94"
|
||||||
end
|
end
|
||||||
@ -155,7 +155,7 @@ describe RuboCop::Cop::Cask::OnSystemConditionals do
|
|||||||
|
|
||||||
context "when the proper `sha256` stanza is used" do
|
context "when the proper `sha256` stanza is used" do
|
||||||
let(:source) do
|
let(:source) do
|
||||||
<<-CASK.undent
|
<<~CASK
|
||||||
cask 'foo' do
|
cask 'foo' do
|
||||||
sha256 arm: "67cdb8a02803ef37fdbf7e0be205863172e41a561ca446cd84f0d7ab35a99d94",
|
sha256 arm: "67cdb8a02803ef37fdbf7e0be205863172e41a561ca446cd84f0d7ab35a99d94",
|
||||||
intel: "8c62a2b791cf5f0da6066a0a4b6e85f62949cd60975da062df44adf887f4370b"
|
intel: "8c62a2b791cf5f0da6066a0a4b6e85f62949cd60975da062df44adf887f4370b"
|
||||||
@ -168,7 +168,7 @@ describe RuboCop::Cop::Cask::OnSystemConditionals do
|
|||||||
|
|
||||||
context "when the `sha256` stanza needs to be removed from the on_arch blocks" do
|
context "when the `sha256` stanza needs to be removed from the on_arch blocks" do
|
||||||
let(:source) do
|
let(:source) do
|
||||||
<<-CASK.undent
|
<<~CASK
|
||||||
cask 'foo' do
|
cask 'foo' do
|
||||||
on_intel do
|
on_intel do
|
||||||
sha256 "67cdb8a02803ef37fdbf7e0be205863172e41a561ca446cd84f0d7ab35a99d94"
|
sha256 "67cdb8a02803ef37fdbf7e0be205863172e41a561ca446cd84f0d7ab35a99d94"
|
||||||
@ -180,7 +180,7 @@ describe RuboCop::Cop::Cask::OnSystemConditionals do
|
|||||||
CASK
|
CASK
|
||||||
end
|
end
|
||||||
let(:correct_source) do
|
let(:correct_source) do
|
||||||
<<-CASK.undent
|
<<~CASK
|
||||||
cask 'foo' do
|
cask 'foo' do
|
||||||
#{" "}
|
#{" "}
|
||||||
sha256 arm: "8c62a2b791cf5f0da6066a0a4b6e85f62949cd60975da062df44adf887f4370b", intel: "67cdb8a02803ef37fdbf7e0be205863172e41a561ca446cd84f0d7ab35a99d94"
|
sha256 arm: "8c62a2b791cf5f0da6066a0a4b6e85f62949cd60975da062df44adf887f4370b", intel: "67cdb8a02803ef37fdbf7e0be205863172e41a561ca446cd84f0d7ab35a99d94"
|
||||||
@ -188,7 +188,7 @@ describe RuboCop::Cop::Cask::OnSystemConditionals do
|
|||||||
CASK
|
CASK
|
||||||
end
|
end
|
||||||
let(:offense_source) do
|
let(:offense_source) do
|
||||||
<<-CASK.undent
|
<<~CASK
|
||||||
on_arm do
|
on_arm do
|
||||||
sha256 "8c62a2b791cf5f0da6066a0a4b6e85f62949cd60975da062df44adf887f4370b"
|
sha256 "8c62a2b791cf5f0da6066a0a4b6e85f62949cd60975da062df44adf887f4370b"
|
||||||
end
|
end
|
||||||
@ -213,7 +213,7 @@ describe RuboCop::Cop::Cask::OnSystemConditionals do
|
|||||||
|
|
||||||
context "when there is only one on_arch block" do
|
context "when there is only one on_arch block" do
|
||||||
let(:source) do
|
let(:source) do
|
||||||
<<-CASK.undent
|
<<~CASK
|
||||||
cask 'foo' do
|
cask 'foo' do
|
||||||
on_intel do
|
on_intel do
|
||||||
sha256 "67cdb8a02803ef37fdbf7e0be205863172e41a561ca446cd84f0d7ab35a99d94"
|
sha256 "67cdb8a02803ef37fdbf7e0be205863172e41a561ca446cd84f0d7ab35a99d94"
|
||||||
@ -227,7 +227,7 @@ describe RuboCop::Cop::Cask::OnSystemConditionals do
|
|||||||
|
|
||||||
context "when there is also a `version` stanza inside the on_arch blocks" do
|
context "when there is also a `version` stanza inside the on_arch blocks" do
|
||||||
let(:source) do
|
let(:source) do
|
||||||
<<-CASK.undent
|
<<~CASK
|
||||||
cask 'foo' do
|
cask 'foo' do
|
||||||
on_intel do
|
on_intel do
|
||||||
version "1.0.0"
|
version "1.0.0"
|
||||||
@ -246,7 +246,7 @@ describe RuboCop::Cop::Cask::OnSystemConditionals do
|
|||||||
|
|
||||||
context "when there is also a `version` stanza inside only a single on_arch block" do
|
context "when there is also a `version` stanza inside only a single on_arch block" do
|
||||||
let(:source) do
|
let(:source) do
|
||||||
<<-CASK.undent
|
<<~CASK
|
||||||
cask 'foo' do
|
cask 'foo' do
|
||||||
on_intel do
|
on_intel do
|
||||||
version "2.0.0"
|
version "2.0.0"
|
||||||
@ -266,7 +266,7 @@ describe RuboCop::Cop::Cask::OnSystemConditionals do
|
|||||||
context "when auditing loose `Hardware::CPU` method calls" do
|
context "when auditing loose `Hardware::CPU` method calls" do
|
||||||
context "when there is a `Hardware::CPU.arm?` reference" do
|
context "when there is a `Hardware::CPU.arm?` reference" do
|
||||||
let(:source) do
|
let(:source) do
|
||||||
<<-CASK.undent
|
<<~CASK
|
||||||
cask 'foo' do
|
cask 'foo' do
|
||||||
if Hardware::CPU.arm? && other_condition
|
if Hardware::CPU.arm? && other_condition
|
||||||
sha256 "67cdb8a02803ef37fdbf7e0be205863172e41a561ca446cd84f0d7ab35a99d94"
|
sha256 "67cdb8a02803ef37fdbf7e0be205863172e41a561ca446cd84f0d7ab35a99d94"
|
||||||
@ -291,7 +291,7 @@ describe RuboCop::Cop::Cask::OnSystemConditionals do
|
|||||||
|
|
||||||
context "when there is a `Hardware::CPU.intel?` reference" do
|
context "when there is a `Hardware::CPU.intel?` reference" do
|
||||||
let(:source) do
|
let(:source) do
|
||||||
<<-CASK.undent
|
<<~CASK
|
||||||
cask 'foo' do
|
cask 'foo' do
|
||||||
if Hardware::CPU.intel? && other_condition
|
if Hardware::CPU.intel? && other_condition
|
||||||
sha256 "67cdb8a02803ef37fdbf7e0be205863172e41a561ca446cd84f0d7ab35a99d94"
|
sha256 "67cdb8a02803ef37fdbf7e0be205863172e41a561ca446cd84f0d7ab35a99d94"
|
||||||
@ -316,7 +316,7 @@ describe RuboCop::Cop::Cask::OnSystemConditionals do
|
|||||||
|
|
||||||
context "when there is a `Hardware::CPU.arch` reference" do
|
context "when there is a `Hardware::CPU.arch` reference" do
|
||||||
let(:source) do
|
let(:source) do
|
||||||
<<-CASK.undent
|
<<~CASK
|
||||||
cask 'foo' do
|
cask 'foo' do
|
||||||
version "1.2.3"
|
version "1.2.3"
|
||||||
sha256 "67cdb8a02803ef37fdbf7e0be205863172e41a561ca446cd84f0d7ab35a99d94"
|
sha256 "67cdb8a02803ef37fdbf7e0be205863172e41a561ca446cd84f0d7ab35a99d94"
|
||||||
@ -342,7 +342,7 @@ describe RuboCop::Cop::Cask::OnSystemConditionals do
|
|||||||
context "when auditing loose `MacOS.version` method calls" do
|
context "when auditing loose `MacOS.version` method calls" do
|
||||||
context "when there is a `MacOS.version ==` reference" do
|
context "when there is a `MacOS.version ==` reference" do
|
||||||
let(:source) do
|
let(:source) do
|
||||||
<<-CASK.undent
|
<<~CASK
|
||||||
cask 'foo' do
|
cask 'foo' do
|
||||||
if MacOS.version == :catalina
|
if MacOS.version == :catalina
|
||||||
version "1.0.0"
|
version "1.0.0"
|
||||||
@ -367,7 +367,7 @@ describe RuboCop::Cop::Cask::OnSystemConditionals do
|
|||||||
|
|
||||||
context "when there is a `MacOS.version <=` reference" do
|
context "when there is a `MacOS.version <=` reference" do
|
||||||
let(:source) do
|
let(:source) do
|
||||||
<<-CASK.undent
|
<<~CASK
|
||||||
cask 'foo' do
|
cask 'foo' do
|
||||||
if MacOS.version <= :catalina
|
if MacOS.version <= :catalina
|
||||||
version "1.0.0"
|
version "1.0.0"
|
||||||
@ -392,7 +392,7 @@ describe RuboCop::Cop::Cask::OnSystemConditionals do
|
|||||||
|
|
||||||
context "when there is a `MacOS.version >=` reference" do
|
context "when there is a `MacOS.version >=` reference" do
|
||||||
let(:source) do
|
let(:source) do
|
||||||
<<-CASK.undent
|
<<~CASK
|
||||||
cask 'foo' do
|
cask 'foo' do
|
||||||
if MacOS.version >= :catalina
|
if MacOS.version >= :catalina
|
||||||
version "1.0.0"
|
version "1.0.0"
|
||||||
@ -417,7 +417,7 @@ describe RuboCop::Cop::Cask::OnSystemConditionals do
|
|||||||
|
|
||||||
context "when there is a `MacOS.version` reference" do
|
context "when there is a `MacOS.version` reference" do
|
||||||
let(:source) do
|
let(:source) do
|
||||||
<<-CASK.undent
|
<<~CASK
|
||||||
cask 'foo' do
|
cask 'foo' do
|
||||||
version "1.2.3"
|
version "1.2.3"
|
||||||
sha256 "67cdb8a02803ef37fdbf7e0be205863172e41a561ca446cd84f0d7ab35a99d94"
|
sha256 "67cdb8a02803ef37fdbf7e0be205863172e41a561ca446cd84f0d7ab35a99d94"
|
||||||
|
|||||||
@ -18,7 +18,7 @@ describe RuboCop::Cop::Cask::StanzaGrouping do
|
|||||||
|
|
||||||
context "when there is only one stanza" do
|
context "when there is only one stanza" do
|
||||||
let(:source) do
|
let(:source) do
|
||||||
<<-CASK.undent
|
<<~CASK
|
||||||
cask 'foo' do
|
cask 'foo' do
|
||||||
version :latest
|
version :latest
|
||||||
end
|
end
|
||||||
@ -30,7 +30,7 @@ describe RuboCop::Cop::Cask::StanzaGrouping do
|
|||||||
|
|
||||||
context "when no stanzas are incorrectly grouped" do
|
context "when no stanzas are incorrectly grouped" do
|
||||||
let(:source) do
|
let(:source) do
|
||||||
<<-CASK.undent
|
<<~CASK
|
||||||
cask 'foo' do
|
cask 'foo' do
|
||||||
version :latest
|
version :latest
|
||||||
sha256 :no_check
|
sha256 :no_check
|
||||||
@ -43,7 +43,7 @@ describe RuboCop::Cop::Cask::StanzaGrouping do
|
|||||||
|
|
||||||
context "when no stanzas or variable assignments are incorrectly grouped" do
|
context "when no stanzas or variable assignments are incorrectly grouped" do
|
||||||
let(:source) do
|
let(:source) do
|
||||||
<<-CASK.undent
|
<<~CASK
|
||||||
cask 'foo' do
|
cask 'foo' do
|
||||||
arch arm: "arm64", intel: "x86_64"
|
arch arm: "arm64", intel: "x86_64"
|
||||||
folder = on_arch_conditional arm: "darwin-arm64", intel: "darwin"
|
folder = on_arch_conditional arm: "darwin-arm64", intel: "darwin"
|
||||||
@ -59,7 +59,7 @@ describe RuboCop::Cop::Cask::StanzaGrouping do
|
|||||||
|
|
||||||
context "when one stanza is incorrectly grouped" do
|
context "when one stanza is incorrectly grouped" do
|
||||||
let(:source) do
|
let(:source) do
|
||||||
<<-CASK.undent
|
<<~CASK
|
||||||
cask 'foo' do
|
cask 'foo' do
|
||||||
version :latest
|
version :latest
|
||||||
|
|
||||||
@ -68,7 +68,7 @@ describe RuboCop::Cop::Cask::StanzaGrouping do
|
|||||||
CASK
|
CASK
|
||||||
end
|
end
|
||||||
let(:correct_source) do
|
let(:correct_source) do
|
||||||
<<-CASK.undent
|
<<~CASK
|
||||||
cask 'foo' do
|
cask 'foo' do
|
||||||
version :latest
|
version :latest
|
||||||
sha256 :no_check
|
sha256 :no_check
|
||||||
@ -92,7 +92,7 @@ describe RuboCop::Cop::Cask::StanzaGrouping do
|
|||||||
|
|
||||||
context "when the arch stanza is incorrectly grouped" do
|
context "when the arch stanza is incorrectly grouped" do
|
||||||
let(:source) do
|
let(:source) do
|
||||||
<<-CASK.undent
|
<<~CASK
|
||||||
cask 'foo' do
|
cask 'foo' do
|
||||||
arch arm: "arm64", intel: "x86_64"
|
arch arm: "arm64", intel: "x86_64"
|
||||||
version :latest
|
version :latest
|
||||||
@ -101,7 +101,7 @@ describe RuboCop::Cop::Cask::StanzaGrouping do
|
|||||||
CASK
|
CASK
|
||||||
end
|
end
|
||||||
let(:correct_source) do
|
let(:correct_source) do
|
||||||
<<-CASK.undent
|
<<~CASK
|
||||||
cask 'foo' do
|
cask 'foo' do
|
||||||
arch arm: "arm64", intel: "x86_64"
|
arch arm: "arm64", intel: "x86_64"
|
||||||
|
|
||||||
@ -127,7 +127,7 @@ describe RuboCop::Cop::Cask::StanzaGrouping do
|
|||||||
|
|
||||||
context "when one variable assignment is incorrectly grouped" do
|
context "when one variable assignment is incorrectly grouped" do
|
||||||
let(:source) do
|
let(:source) do
|
||||||
<<-CASK.undent
|
<<~CASK
|
||||||
cask 'foo' do
|
cask 'foo' do
|
||||||
arch arm: "arm64", intel: "x86_64"
|
arch arm: "arm64", intel: "x86_64"
|
||||||
folder = on_arch_conditional arm: "darwin-arm64", intel: "darwin"
|
folder = on_arch_conditional arm: "darwin-arm64", intel: "darwin"
|
||||||
@ -137,7 +137,7 @@ describe RuboCop::Cop::Cask::StanzaGrouping do
|
|||||||
CASK
|
CASK
|
||||||
end
|
end
|
||||||
let(:correct_source) do
|
let(:correct_source) do
|
||||||
<<-CASK.undent
|
<<~CASK
|
||||||
cask 'foo' do
|
cask 'foo' do
|
||||||
arch arm: "arm64", intel: "x86_64"
|
arch arm: "arm64", intel: "x86_64"
|
||||||
folder = on_arch_conditional arm: "darwin-arm64", intel: "darwin"
|
folder = on_arch_conditional arm: "darwin-arm64", intel: "darwin"
|
||||||
@ -164,7 +164,7 @@ describe RuboCop::Cop::Cask::StanzaGrouping do
|
|||||||
|
|
||||||
context "when many stanzas are incorrectly grouped" do
|
context "when many stanzas are incorrectly grouped" do
|
||||||
let(:source) do
|
let(:source) do
|
||||||
<<-CASK.undent
|
<<~CASK
|
||||||
cask 'foo' do
|
cask 'foo' do
|
||||||
version :latest
|
version :latest
|
||||||
sha256 :no_check
|
sha256 :no_check
|
||||||
@ -181,7 +181,7 @@ describe RuboCop::Cop::Cask::StanzaGrouping do
|
|||||||
CASK
|
CASK
|
||||||
end
|
end
|
||||||
let(:correct_source) do
|
let(:correct_source) do
|
||||||
<<-CASK.undent
|
<<~CASK
|
||||||
cask 'foo' do
|
cask 'foo' do
|
||||||
version :latest
|
version :latest
|
||||||
sha256 :no_check
|
sha256 :no_check
|
||||||
@ -232,7 +232,7 @@ describe RuboCop::Cop::Cask::StanzaGrouping do
|
|||||||
|
|
||||||
context "when many stanzas and variable assignments are incorrectly grouped" do
|
context "when many stanzas and variable assignments are incorrectly grouped" do
|
||||||
let(:source) do
|
let(:source) do
|
||||||
<<-CASK.undent
|
<<~CASK
|
||||||
cask 'foo' do
|
cask 'foo' do
|
||||||
arch arm: "arm64", intel: "x86_64"
|
arch arm: "arm64", intel: "x86_64"
|
||||||
folder = on_arch_conditional arm: "darwin-arm64", intel: "darwin"
|
folder = on_arch_conditional arm: "darwin-arm64", intel: "darwin"
|
||||||
@ -253,7 +253,7 @@ describe RuboCop::Cop::Cask::StanzaGrouping do
|
|||||||
CASK
|
CASK
|
||||||
end
|
end
|
||||||
let(:correct_source) do
|
let(:correct_source) do
|
||||||
<<-CASK.undent
|
<<~CASK
|
||||||
cask 'foo' do
|
cask 'foo' do
|
||||||
arch arm: "arm64", intel: "x86_64"
|
arch arm: "arm64", intel: "x86_64"
|
||||||
folder = on_arch_conditional arm: "darwin-arm64", intel: "darwin"
|
folder = on_arch_conditional arm: "darwin-arm64", intel: "darwin"
|
||||||
@ -320,7 +320,7 @@ describe RuboCop::Cop::Cask::StanzaGrouping do
|
|||||||
|
|
||||||
context "when caveats stanza is incorrectly grouped" do
|
context "when caveats stanza is incorrectly grouped" do
|
||||||
let(:source) do
|
let(:source) do
|
||||||
format(<<-CASK.undent, caveats: caveats.strip)
|
format(<<~CASK, caveats: caveats.strip)
|
||||||
cask 'foo' do
|
cask 'foo' do
|
||||||
version :latest
|
version :latest
|
||||||
sha256 :no_check
|
sha256 :no_check
|
||||||
@ -332,7 +332,7 @@ describe RuboCop::Cop::Cask::StanzaGrouping do
|
|||||||
CASK
|
CASK
|
||||||
end
|
end
|
||||||
let(:correct_source) do
|
let(:correct_source) do
|
||||||
format(<<-CASK.undent, caveats: caveats.strip)
|
format(<<~CASK, caveats: caveats.strip)
|
||||||
cask 'foo' do
|
cask 'foo' do
|
||||||
version :latest
|
version :latest
|
||||||
sha256 :no_check
|
sha256 :no_check
|
||||||
@ -355,8 +355,8 @@ describe RuboCop::Cop::Cask::StanzaGrouping do
|
|||||||
|
|
||||||
context "when caveats is a heredoc" do
|
context "when caveats is a heredoc" do
|
||||||
let(:caveats) do
|
let(:caveats) do
|
||||||
<<-CAVEATS.undent
|
<<~CAVEATS
|
||||||
caveats <<-EOS.undent
|
caveats <<~EOS
|
||||||
This is a multiline caveat.
|
This is a multiline caveat.
|
||||||
|
|
||||||
Let's hope it doesn't cause any problems!
|
Let's hope it doesn't cause any problems!
|
||||||
@ -369,7 +369,7 @@ describe RuboCop::Cop::Cask::StanzaGrouping do
|
|||||||
|
|
||||||
context "when caveats is a block" do
|
context "when caveats is a block" do
|
||||||
let(:caveats) do
|
let(:caveats) do
|
||||||
<<-CAVEATS.undent
|
<<~CAVEATS
|
||||||
caveats do
|
caveats do
|
||||||
puts 'This is a multiline caveat.'
|
puts 'This is a multiline caveat.'
|
||||||
|
|
||||||
@ -384,7 +384,7 @@ describe RuboCop::Cop::Cask::StanzaGrouping do
|
|||||||
|
|
||||||
context "when the postflight stanza is incorrectly grouped" do
|
context "when the postflight stanza is incorrectly grouped" do
|
||||||
let(:source) do
|
let(:source) do
|
||||||
<<-CASK.undent
|
<<~CASK
|
||||||
cask 'foo' do
|
cask 'foo' do
|
||||||
version :latest
|
version :latest
|
||||||
sha256 :no_check
|
sha256 :no_check
|
||||||
@ -398,7 +398,7 @@ describe RuboCop::Cop::Cask::StanzaGrouping do
|
|||||||
CASK
|
CASK
|
||||||
end
|
end
|
||||||
let(:correct_source) do
|
let(:correct_source) do
|
||||||
<<-CASK.undent
|
<<~CASK
|
||||||
cask 'foo' do
|
cask 'foo' do
|
||||||
version :latest
|
version :latest
|
||||||
sha256 :no_check
|
sha256 :no_check
|
||||||
@ -420,7 +420,7 @@ describe RuboCop::Cop::Cask::StanzaGrouping do
|
|||||||
|
|
||||||
context "when a stanza has a comment" do
|
context "when a stanza has a comment" do
|
||||||
let(:source) do
|
let(:source) do
|
||||||
<<-CASK.undent
|
<<~CASK
|
||||||
cask 'foo' do
|
cask 'foo' do
|
||||||
version :latest
|
version :latest
|
||||||
sha256 :no_check
|
sha256 :no_check
|
||||||
@ -437,7 +437,7 @@ describe RuboCop::Cop::Cask::StanzaGrouping do
|
|||||||
CASK
|
CASK
|
||||||
end
|
end
|
||||||
let(:correct_source) do
|
let(:correct_source) do
|
||||||
<<-CASK.undent
|
<<~CASK
|
||||||
cask 'foo' do
|
cask 'foo' do
|
||||||
version :latest
|
version :latest
|
||||||
sha256 :no_check
|
sha256 :no_check
|
||||||
@ -462,7 +462,7 @@ describe RuboCop::Cop::Cask::StanzaGrouping do
|
|||||||
|
|
||||||
context "when a stanza has a comment and there is a variable assignment" do
|
context "when a stanza has a comment and there is a variable assignment" do
|
||||||
let(:source) do
|
let(:source) do
|
||||||
<<-CASK.undent
|
<<~CASK
|
||||||
cask 'foo' do
|
cask 'foo' do
|
||||||
arch arm: "arm64", intel: "x86_64"
|
arch arm: "arm64", intel: "x86_64"
|
||||||
folder = on_arch_conditional arm: "darwin-arm64", intel: "darwin"
|
folder = on_arch_conditional arm: "darwin-arm64", intel: "darwin"
|
||||||
@ -481,7 +481,7 @@ describe RuboCop::Cop::Cask::StanzaGrouping do
|
|||||||
CASK
|
CASK
|
||||||
end
|
end
|
||||||
let(:correct_source) do
|
let(:correct_source) do
|
||||||
<<-CASK.undent
|
<<~CASK
|
||||||
cask 'foo' do
|
cask 'foo' do
|
||||||
arch arm: "arm64", intel: "x86_64"
|
arch arm: "arm64", intel: "x86_64"
|
||||||
folder = on_arch_conditional arm: "darwin-arm64", intel: "darwin"
|
folder = on_arch_conditional arm: "darwin-arm64", intel: "darwin"
|
||||||
@ -509,7 +509,7 @@ describe RuboCop::Cop::Cask::StanzaGrouping do
|
|||||||
# TODO: detect incorrectly grouped stanzas in nested expressions
|
# TODO: detect incorrectly grouped stanzas in nested expressions
|
||||||
context "when stanzas are nested in a conditional expression" do
|
context "when stanzas are nested in a conditional expression" do
|
||||||
let(:source) do
|
let(:source) do
|
||||||
<<-CASK.undent
|
<<~CASK
|
||||||
cask 'foo' do
|
cask 'foo' do
|
||||||
if true
|
if true
|
||||||
version :latest
|
version :latest
|
||||||
|
|||||||
@ -11,7 +11,7 @@ describe RuboCop::Cop::Cask::StanzaOrder do
|
|||||||
|
|
||||||
context "when there is only one stanza" do
|
context "when there is only one stanza" do
|
||||||
let(:source) do
|
let(:source) do
|
||||||
<<-CASK.undent
|
<<~CASK
|
||||||
cask 'foo' do
|
cask 'foo' do
|
||||||
version :latest
|
version :latest
|
||||||
end
|
end
|
||||||
@ -23,7 +23,7 @@ describe RuboCop::Cop::Cask::StanzaOrder do
|
|||||||
|
|
||||||
context "when no stanzas are out of order" do
|
context "when no stanzas are out of order" do
|
||||||
let(:source) do
|
let(:source) do
|
||||||
<<-CASK.undent
|
<<~CASK
|
||||||
cask 'foo' do
|
cask 'foo' do
|
||||||
arch arm: "arm", intel: "x86_64"
|
arch arm: "arm", intel: "x86_64"
|
||||||
folder = on_arch_conditional arm: "darwin-arm64", intel: "darwin"
|
folder = on_arch_conditional arm: "darwin-arm64", intel: "darwin"
|
||||||
@ -39,7 +39,7 @@ describe RuboCop::Cop::Cask::StanzaOrder do
|
|||||||
|
|
||||||
context "when one pair of stanzas is out of order" do
|
context "when one pair of stanzas is out of order" do
|
||||||
let(:source) do
|
let(:source) do
|
||||||
<<-CASK.undent
|
<<~CASK
|
||||||
cask 'foo' do
|
cask 'foo' do
|
||||||
sha256 :no_check
|
sha256 :no_check
|
||||||
version :latest
|
version :latest
|
||||||
@ -47,7 +47,7 @@ describe RuboCop::Cop::Cask::StanzaOrder do
|
|||||||
CASK
|
CASK
|
||||||
end
|
end
|
||||||
let(:correct_source) do
|
let(:correct_source) do
|
||||||
<<-CASK.undent
|
<<~CASK
|
||||||
cask 'foo' do
|
cask 'foo' do
|
||||||
version :latest
|
version :latest
|
||||||
sha256 :no_check
|
sha256 :no_check
|
||||||
@ -77,7 +77,7 @@ describe RuboCop::Cop::Cask::StanzaOrder do
|
|||||||
|
|
||||||
context "when the arch stanza is out of order" do
|
context "when the arch stanza is out of order" do
|
||||||
let(:source) do
|
let(:source) do
|
||||||
<<-CASK.undent
|
<<~CASK
|
||||||
cask 'foo' do
|
cask 'foo' do
|
||||||
version :latest
|
version :latest
|
||||||
sha256 :no_check
|
sha256 :no_check
|
||||||
@ -86,7 +86,7 @@ describe RuboCop::Cop::Cask::StanzaOrder do
|
|||||||
CASK
|
CASK
|
||||||
end
|
end
|
||||||
let(:correct_source) do
|
let(:correct_source) do
|
||||||
<<-CASK.undent
|
<<~CASK
|
||||||
cask 'foo' do
|
cask 'foo' do
|
||||||
arch arm: "arm", intel: "x86_64"
|
arch arm: "arm", intel: "x86_64"
|
||||||
version :latest
|
version :latest
|
||||||
@ -123,7 +123,7 @@ describe RuboCop::Cop::Cask::StanzaOrder do
|
|||||||
|
|
||||||
context "when an arch variable assignment is out of order" do
|
context "when an arch variable assignment is out of order" do
|
||||||
let(:source) do
|
let(:source) do
|
||||||
<<-CASK.undent
|
<<~CASK
|
||||||
cask 'foo' do
|
cask 'foo' do
|
||||||
arch arm: "arm", intel: "x86_64"
|
arch arm: "arm", intel: "x86_64"
|
||||||
sha256 :no_check
|
sha256 :no_check
|
||||||
@ -133,7 +133,7 @@ describe RuboCop::Cop::Cask::StanzaOrder do
|
|||||||
CASK
|
CASK
|
||||||
end
|
end
|
||||||
let(:correct_source) do
|
let(:correct_source) do
|
||||||
<<-CASK.undent
|
<<~CASK
|
||||||
cask 'foo' do
|
cask 'foo' do
|
||||||
arch arm: "arm", intel: "x86_64"
|
arch arm: "arm", intel: "x86_64"
|
||||||
folder = on_arch_conditional arm: "darwin-arm64", intel: "darwin"
|
folder = on_arch_conditional arm: "darwin-arm64", intel: "darwin"
|
||||||
@ -165,7 +165,7 @@ describe RuboCop::Cop::Cask::StanzaOrder do
|
|||||||
|
|
||||||
context "when an arch variable assignment is above the arch stanza" do
|
context "when an arch variable assignment is above the arch stanza" do
|
||||||
let(:source) do
|
let(:source) do
|
||||||
<<-CASK.undent
|
<<~CASK
|
||||||
cask 'foo' do
|
cask 'foo' do
|
||||||
folder = on_arch_conditional arm: "darwin-arm64", intel: "darwin"
|
folder = on_arch_conditional arm: "darwin-arm64", intel: "darwin"
|
||||||
arch arm: "arm", intel: "x86_64"
|
arch arm: "arm", intel: "x86_64"
|
||||||
@ -175,7 +175,7 @@ describe RuboCop::Cop::Cask::StanzaOrder do
|
|||||||
CASK
|
CASK
|
||||||
end
|
end
|
||||||
let(:correct_source) do
|
let(:correct_source) do
|
||||||
<<-CASK.undent
|
<<~CASK
|
||||||
cask 'foo' do
|
cask 'foo' do
|
||||||
arch arm: "arm", intel: "x86_64"
|
arch arm: "arm", intel: "x86_64"
|
||||||
folder = on_arch_conditional arm: "darwin-arm64", intel: "darwin"
|
folder = on_arch_conditional arm: "darwin-arm64", intel: "darwin"
|
||||||
@ -207,7 +207,7 @@ describe RuboCop::Cop::Cask::StanzaOrder do
|
|||||||
|
|
||||||
context "when many stanzas are out of order" do
|
context "when many stanzas are out of order" do
|
||||||
let(:source) do
|
let(:source) do
|
||||||
<<-CASK.undent
|
<<~CASK
|
||||||
cask 'foo' do
|
cask 'foo' do
|
||||||
url 'https://foo.brew.sh/foo.zip'
|
url 'https://foo.brew.sh/foo.zip'
|
||||||
uninstall :quit => 'com.example.foo',
|
uninstall :quit => 'com.example.foo',
|
||||||
@ -219,7 +219,7 @@ describe RuboCop::Cop::Cask::StanzaOrder do
|
|||||||
CASK
|
CASK
|
||||||
end
|
end
|
||||||
let(:correct_source) do
|
let(:correct_source) do
|
||||||
<<-CASK.undent
|
<<~CASK
|
||||||
cask 'foo' do
|
cask 'foo' do
|
||||||
version :latest
|
version :latest
|
||||||
sha256 :no_check
|
sha256 :no_check
|
||||||
@ -266,7 +266,7 @@ describe RuboCop::Cop::Cask::StanzaOrder do
|
|||||||
|
|
||||||
context "when a stanza appears multiple times" do
|
context "when a stanza appears multiple times" do
|
||||||
let(:source) do
|
let(:source) do
|
||||||
<<-CASK.undent
|
<<~CASK
|
||||||
cask 'foo' do
|
cask 'foo' do
|
||||||
name 'Foo'
|
name 'Foo'
|
||||||
url 'https://foo.brew.sh/foo.zip'
|
url 'https://foo.brew.sh/foo.zip'
|
||||||
@ -279,7 +279,7 @@ describe RuboCop::Cop::Cask::StanzaOrder do
|
|||||||
CASK
|
CASK
|
||||||
end
|
end
|
||||||
let(:correct_source) do
|
let(:correct_source) do
|
||||||
<<-CASK.undent
|
<<~CASK
|
||||||
cask 'foo' do
|
cask 'foo' do
|
||||||
version :latest
|
version :latest
|
||||||
sha256 :no_check
|
sha256 :no_check
|
||||||
@ -299,7 +299,7 @@ describe RuboCop::Cop::Cask::StanzaOrder do
|
|||||||
|
|
||||||
context "when a stanza has a comment" do
|
context "when a stanza has a comment" do
|
||||||
let(:source) do
|
let(:source) do
|
||||||
<<-CASK.undent
|
<<~CASK
|
||||||
cask 'foo' do
|
cask 'foo' do
|
||||||
version :latest
|
version :latest
|
||||||
# comment with an empty line between
|
# comment with an empty line between
|
||||||
@ -313,7 +313,7 @@ describe RuboCop::Cop::Cask::StanzaOrder do
|
|||||||
CASK
|
CASK
|
||||||
end
|
end
|
||||||
let(:correct_source) do
|
let(:correct_source) do
|
||||||
<<-CASK.undent
|
<<~CASK
|
||||||
cask 'foo' do
|
cask 'foo' do
|
||||||
version :latest
|
version :latest
|
||||||
sha256 :no_check # comment on same line
|
sha256 :no_check # comment on same line
|
||||||
@ -332,7 +332,7 @@ describe RuboCop::Cop::Cask::StanzaOrder do
|
|||||||
|
|
||||||
context "when a variable assignment is out of order with a comment" do
|
context "when a variable assignment is out of order with a comment" do
|
||||||
let(:source) do
|
let(:source) do
|
||||||
<<-CASK.undent
|
<<~CASK
|
||||||
cask 'foo' do
|
cask 'foo' do
|
||||||
version :latest
|
version :latest
|
||||||
sha256 :no_check
|
sha256 :no_check
|
||||||
@ -347,7 +347,7 @@ describe RuboCop::Cop::Cask::StanzaOrder do
|
|||||||
CASK
|
CASK
|
||||||
end
|
end
|
||||||
let(:correct_source) do
|
let(:correct_source) do
|
||||||
<<-CASK.undent
|
<<~CASK
|
||||||
cask 'foo' do
|
cask 'foo' do
|
||||||
folder = on_arch_conditional arm: "darwin-arm64", intel: "darwin" # comment on same line
|
folder = on_arch_conditional arm: "darwin-arm64", intel: "darwin" # comment on same line
|
||||||
version :latest
|
version :latest
|
||||||
@ -367,7 +367,7 @@ describe RuboCop::Cop::Cask::StanzaOrder do
|
|||||||
|
|
||||||
context "when the caveats stanza is out of order" do
|
context "when the caveats stanza is out of order" do
|
||||||
let(:source) do
|
let(:source) do
|
||||||
format(<<-CASK.undent, caveats: caveats.strip)
|
format(<<~CASK, caveats: caveats.strip)
|
||||||
cask 'foo' do
|
cask 'foo' do
|
||||||
name 'Foo'
|
name 'Foo'
|
||||||
url 'https://foo.brew.sh/foo.zip'
|
url 'https://foo.brew.sh/foo.zip'
|
||||||
@ -379,7 +379,7 @@ describe RuboCop::Cop::Cask::StanzaOrder do
|
|||||||
CASK
|
CASK
|
||||||
end
|
end
|
||||||
let(:correct_source) do
|
let(:correct_source) do
|
||||||
format(<<-CASK.undent, caveats: caveats.strip)
|
format(<<~CASK, caveats: caveats.strip)
|
||||||
cask 'foo' do
|
cask 'foo' do
|
||||||
version :latest
|
version :latest
|
||||||
sha256 :no_check
|
sha256 :no_check
|
||||||
@ -399,8 +399,8 @@ describe RuboCop::Cop::Cask::StanzaOrder do
|
|||||||
|
|
||||||
context "when caveats is a heredoc" do
|
context "when caveats is a heredoc" do
|
||||||
let(:caveats) do
|
let(:caveats) do
|
||||||
<<-CAVEATS.undent
|
<<~CAVEATS
|
||||||
caveats <<-EOS.undent
|
caveats <<~EOS
|
||||||
This is a multiline caveat.
|
This is a multiline caveat.
|
||||||
|
|
||||||
Let's hope it doesn't cause any problems!
|
Let's hope it doesn't cause any problems!
|
||||||
@ -413,7 +413,7 @@ describe RuboCop::Cop::Cask::StanzaOrder do
|
|||||||
|
|
||||||
context "when caveats is a block" do
|
context "when caveats is a block" do
|
||||||
let(:caveats) do
|
let(:caveats) do
|
||||||
<<-CAVEATS.undent
|
<<~CAVEATS
|
||||||
caveats do
|
caveats do
|
||||||
puts 'This is a multiline caveat.'
|
puts 'This is a multiline caveat.'
|
||||||
|
|
||||||
@ -428,7 +428,7 @@ describe RuboCop::Cop::Cask::StanzaOrder do
|
|||||||
|
|
||||||
context "when the postflight stanza is out of order" do
|
context "when the postflight stanza is out of order" do
|
||||||
let(:source) do
|
let(:source) do
|
||||||
<<-CASK.undent
|
<<~CASK
|
||||||
cask 'foo' do
|
cask 'foo' do
|
||||||
name 'Foo'
|
name 'Foo'
|
||||||
url 'https://foo.brew.sh/foo.zip'
|
url 'https://foo.brew.sh/foo.zip'
|
||||||
@ -442,7 +442,7 @@ describe RuboCop::Cop::Cask::StanzaOrder do
|
|||||||
CASK
|
CASK
|
||||||
end
|
end
|
||||||
let(:correct_source) do
|
let(:correct_source) do
|
||||||
<<-CASK.undent
|
<<~CASK
|
||||||
cask 'foo' do
|
cask 'foo' do
|
||||||
version :latest
|
version :latest
|
||||||
sha256 :no_check
|
sha256 :no_check
|
||||||
@ -462,7 +462,7 @@ describe RuboCop::Cop::Cask::StanzaOrder do
|
|||||||
# TODO: detect out-of-order stanzas in nested expressions
|
# TODO: detect out-of-order stanzas in nested expressions
|
||||||
context "when stanzas are nested in a conditional expression" do
|
context "when stanzas are nested in a conditional expression" do
|
||||||
let(:source) do
|
let(:source) do
|
||||||
<<-CASK.undent
|
<<~CASK
|
||||||
cask 'foo' do
|
cask 'foo' do
|
||||||
if true
|
if true
|
||||||
sha256 :no_check
|
sha256 :no_check
|
||||||
|
|||||||
@ -11,7 +11,7 @@ describe RuboCop::Cop::Cask::UrlLegacyCommaSeparators do
|
|||||||
|
|
||||||
context "when url version interpolation does not include version.before_comma or version.after_comma" do
|
context "when url version interpolation does not include version.before_comma or version.after_comma" do
|
||||||
let(:source) do
|
let(:source) do
|
||||||
<<-CASK.undent
|
<<~CASK
|
||||||
cask 'foo' do
|
cask 'foo' do
|
||||||
version '1.1'
|
version '1.1'
|
||||||
url 'https://foo.brew.sh/foo-\#{version}.dmg'
|
url 'https://foo.brew.sh/foo-\#{version}.dmg'
|
||||||
@ -24,7 +24,7 @@ describe RuboCop::Cop::Cask::UrlLegacyCommaSeparators do
|
|||||||
|
|
||||||
context "when the url uses csv" do
|
context "when the url uses csv" do
|
||||||
let(:source) do
|
let(:source) do
|
||||||
<<-CASK.undent
|
<<~CASK
|
||||||
cask 'foo' do
|
cask 'foo' do
|
||||||
version '1.1,111'
|
version '1.1,111'
|
||||||
url 'https://foo.brew.sh/foo-\#{version.csv.first}.dmg'
|
url 'https://foo.brew.sh/foo-\#{version.csv.first}.dmg'
|
||||||
@ -37,7 +37,7 @@ describe RuboCop::Cop::Cask::UrlLegacyCommaSeparators do
|
|||||||
|
|
||||||
context "when the url uses version.before_comma" do
|
context "when the url uses version.before_comma" do
|
||||||
let(:source) do
|
let(:source) do
|
||||||
<<-CASK.undent
|
<<~CASK
|
||||||
cask 'foo' do
|
cask 'foo' do
|
||||||
version '1.1,111'
|
version '1.1,111'
|
||||||
url 'https://foo.brew.sh/foo-\#{version.before_comma}.dmg'
|
url 'https://foo.brew.sh/foo-\#{version.before_comma}.dmg'
|
||||||
@ -45,7 +45,7 @@ describe RuboCop::Cop::Cask::UrlLegacyCommaSeparators do
|
|||||||
CASK
|
CASK
|
||||||
end
|
end
|
||||||
let(:correct_source) do
|
let(:correct_source) do
|
||||||
<<-CASK.undent
|
<<~CASK
|
||||||
cask 'foo' do
|
cask 'foo' do
|
||||||
version '1.1,111'
|
version '1.1,111'
|
||||||
url 'https://foo.brew.sh/foo-\#{version.csv.first}.dmg'
|
url 'https://foo.brew.sh/foo-\#{version.csv.first}.dmg'
|
||||||
@ -70,7 +70,7 @@ describe RuboCop::Cop::Cask::UrlLegacyCommaSeparators do
|
|||||||
|
|
||||||
context "when the url uses version.after_comma" do
|
context "when the url uses version.after_comma" do
|
||||||
let(:source) do
|
let(:source) do
|
||||||
<<-CASK.undent
|
<<~CASK
|
||||||
cask 'foo' do
|
cask 'foo' do
|
||||||
version '1.1,111'
|
version '1.1,111'
|
||||||
url 'https://foo.brew.sh/foo-\#{version.after_comma}.dmg'
|
url 'https://foo.brew.sh/foo-\#{version.after_comma}.dmg'
|
||||||
@ -78,7 +78,7 @@ describe RuboCop::Cop::Cask::UrlLegacyCommaSeparators do
|
|||||||
CASK
|
CASK
|
||||||
end
|
end
|
||||||
let(:correct_source) do
|
let(:correct_source) do
|
||||||
<<-CASK.undent
|
<<~CASK
|
||||||
cask 'foo' do
|
cask 'foo' do
|
||||||
version '1.1,111'
|
version '1.1,111'
|
||||||
url 'https://foo.brew.sh/foo-\#{version.csv.second}.dmg'
|
url 'https://foo.brew.sh/foo-\#{version.csv.second}.dmg'
|
||||||
|
|||||||
@ -11,7 +11,7 @@ describe RuboCop::Cop::Cask::Variables do
|
|||||||
|
|
||||||
context "when there are no variables" do
|
context "when there are no variables" do
|
||||||
let(:source) do
|
let(:source) do
|
||||||
<<-CASK.undent
|
<<~CASK
|
||||||
cask "foo" do
|
cask "foo" do
|
||||||
version :latest
|
version :latest
|
||||||
end
|
end
|
||||||
@ -23,7 +23,7 @@ describe RuboCop::Cop::Cask::Variables do
|
|||||||
|
|
||||||
context "when there is an arch stanza" do
|
context "when there is an arch stanza" do
|
||||||
let(:source) do
|
let(:source) do
|
||||||
<<-CASK.undent
|
<<~CASK
|
||||||
cask "foo" do
|
cask "foo" do
|
||||||
arch arm: "darwin-arm64", intel: "darwin"
|
arch arm: "darwin-arm64", intel: "darwin"
|
||||||
end
|
end
|
||||||
@ -35,7 +35,7 @@ describe RuboCop::Cop::Cask::Variables do
|
|||||||
|
|
||||||
context "when there is a non-arch variable that uses the arch conditional" do
|
context "when there is a non-arch variable that uses the arch conditional" do
|
||||||
let(:source) do
|
let(:source) do
|
||||||
<<-CASK.undent
|
<<~CASK
|
||||||
cask "foo" do
|
cask "foo" do
|
||||||
folder = on_arch_conditional arm: "darwin-arm64", intel: "darwin"
|
folder = on_arch_conditional arm: "darwin-arm64", intel: "darwin"
|
||||||
end
|
end
|
||||||
@ -47,14 +47,14 @@ describe RuboCop::Cop::Cask::Variables do
|
|||||||
|
|
||||||
context "when there is an arch variable" do
|
context "when there is an arch variable" do
|
||||||
let(:source) do
|
let(:source) do
|
||||||
<<-CASK.undent
|
<<~CASK
|
||||||
cask 'foo' do
|
cask 'foo' do
|
||||||
arch = Hardware::CPU.intel? ? "darwin" : "darwin-arm64"
|
arch = Hardware::CPU.intel? ? "darwin" : "darwin-arm64"
|
||||||
end
|
end
|
||||||
CASK
|
CASK
|
||||||
end
|
end
|
||||||
let(:correct_source) do
|
let(:correct_source) do
|
||||||
<<-CASK.undent
|
<<~CASK
|
||||||
cask 'foo' do
|
cask 'foo' do
|
||||||
arch arm: "darwin-arm64", intel: "darwin"
|
arch arm: "darwin-arm64", intel: "darwin"
|
||||||
end
|
end
|
||||||
@ -78,14 +78,14 @@ describe RuboCop::Cop::Cask::Variables do
|
|||||||
|
|
||||||
context "when there is an arch variable that doesn't use strings" do
|
context "when there is an arch variable that doesn't use strings" do
|
||||||
let(:source) do
|
let(:source) do
|
||||||
<<-CASK.undent
|
<<~CASK
|
||||||
cask 'foo' do
|
cask 'foo' do
|
||||||
arch = Hardware::CPU.intel? ? :darwin : :darwin_arm64
|
arch = Hardware::CPU.intel? ? :darwin : :darwin_arm64
|
||||||
end
|
end
|
||||||
CASK
|
CASK
|
||||||
end
|
end
|
||||||
let(:correct_source) do
|
let(:correct_source) do
|
||||||
<<-CASK.undent
|
<<~CASK
|
||||||
cask 'foo' do
|
cask 'foo' do
|
||||||
arch arm: :darwin_arm64, intel: :darwin
|
arch arm: :darwin_arm64, intel: :darwin
|
||||||
end
|
end
|
||||||
@ -109,14 +109,14 @@ describe RuboCop::Cop::Cask::Variables do
|
|||||||
|
|
||||||
context "when there is an arch with an empty string" do
|
context "when there is an arch with an empty string" do
|
||||||
let(:source) do
|
let(:source) do
|
||||||
<<-CASK.undent
|
<<~CASK
|
||||||
cask 'foo' do
|
cask 'foo' do
|
||||||
arch = Hardware::CPU.intel? ? "" : "arm64"
|
arch = Hardware::CPU.intel? ? "" : "arm64"
|
||||||
end
|
end
|
||||||
CASK
|
CASK
|
||||||
end
|
end
|
||||||
let(:correct_source) do
|
let(:correct_source) do
|
||||||
<<-CASK.undent
|
<<~CASK
|
||||||
cask 'foo' do
|
cask 'foo' do
|
||||||
arch arm: "arm64"
|
arch arm: "arm64"
|
||||||
end
|
end
|
||||||
@ -140,14 +140,14 @@ describe RuboCop::Cop::Cask::Variables do
|
|||||||
|
|
||||||
context "when there is a non-arch variable" do
|
context "when there is a non-arch variable" do
|
||||||
let(:source) do
|
let(:source) do
|
||||||
<<-CASK.undent
|
<<~CASK
|
||||||
cask 'foo' do
|
cask 'foo' do
|
||||||
folder = Hardware::CPU.intel? ? "darwin" : "darwin-arm64"
|
folder = Hardware::CPU.intel? ? "darwin" : "darwin-arm64"
|
||||||
end
|
end
|
||||||
CASK
|
CASK
|
||||||
end
|
end
|
||||||
let(:correct_source) do
|
let(:correct_source) do
|
||||||
<<-CASK.undent
|
<<~CASK
|
||||||
cask 'foo' do
|
cask 'foo' do
|
||||||
folder = on_arch_conditional arm: "darwin-arm64", intel: "darwin"
|
folder = on_arch_conditional arm: "darwin-arm64", intel: "darwin"
|
||||||
end
|
end
|
||||||
@ -171,14 +171,14 @@ describe RuboCop::Cop::Cask::Variables do
|
|||||||
|
|
||||||
context "when there is a non-arch variable with an empty string" do
|
context "when there is a non-arch variable with an empty string" do
|
||||||
let(:source) do
|
let(:source) do
|
||||||
<<-CASK.undent
|
<<~CASK
|
||||||
cask 'foo' do
|
cask 'foo' do
|
||||||
folder = Hardware::CPU.intel? ? "amd64" : ""
|
folder = Hardware::CPU.intel? ? "amd64" : ""
|
||||||
end
|
end
|
||||||
CASK
|
CASK
|
||||||
end
|
end
|
||||||
let(:correct_source) do
|
let(:correct_source) do
|
||||||
<<-CASK.undent
|
<<~CASK
|
||||||
cask 'foo' do
|
cask 'foo' do
|
||||||
folder = on_arch_conditional intel: "amd64"
|
folder = on_arch_conditional intel: "amd64"
|
||||||
end
|
end
|
||||||
@ -202,7 +202,7 @@ describe RuboCop::Cop::Cask::Variables do
|
|||||||
|
|
||||||
context "when there is an arch and a non-arch variable" do
|
context "when there is an arch and a non-arch variable" do
|
||||||
let(:source) do
|
let(:source) do
|
||||||
<<-CASK.undent
|
<<~CASK
|
||||||
cask 'foo' do
|
cask 'foo' do
|
||||||
arch = Hardware::CPU.arm? ? "darwin-arm64" : "darwin"
|
arch = Hardware::CPU.arm? ? "darwin-arm64" : "darwin"
|
||||||
folder = Hardware::CPU.arm? ? "darwin-arm64" : "darwin"
|
folder = Hardware::CPU.arm? ? "darwin-arm64" : "darwin"
|
||||||
@ -210,7 +210,7 @@ describe RuboCop::Cop::Cask::Variables do
|
|||||||
CASK
|
CASK
|
||||||
end
|
end
|
||||||
let(:correct_source) do
|
let(:correct_source) do
|
||||||
<<-CASK.undent
|
<<~CASK
|
||||||
cask 'foo' do
|
cask 'foo' do
|
||||||
arch arm: "darwin-arm64", intel: "darwin"
|
arch arm: "darwin-arm64", intel: "darwin"
|
||||||
folder = on_arch_conditional arm: "darwin-arm64", intel: "darwin"
|
folder = on_arch_conditional arm: "darwin-arm64", intel: "darwin"
|
||||||
@ -242,7 +242,7 @@ describe RuboCop::Cop::Cask::Variables do
|
|||||||
|
|
||||||
context "when there are two non-arch variables" do
|
context "when there are two non-arch variables" do
|
||||||
let(:source) do
|
let(:source) do
|
||||||
<<-CASK.undent
|
<<~CASK
|
||||||
cask 'foo' do
|
cask 'foo' do
|
||||||
folder = Hardware::CPU.arm? ? "darwin-arm64" : "darwin"
|
folder = Hardware::CPU.arm? ? "darwin-arm64" : "darwin"
|
||||||
platform = Hardware::CPU.intel? ? "darwin": "darwin-arm64"
|
platform = Hardware::CPU.intel? ? "darwin": "darwin-arm64"
|
||||||
@ -250,7 +250,7 @@ describe RuboCop::Cop::Cask::Variables do
|
|||||||
CASK
|
CASK
|
||||||
end
|
end
|
||||||
let(:correct_source) do
|
let(:correct_source) do
|
||||||
<<-CASK.undent
|
<<~CASK
|
||||||
cask 'foo' do
|
cask 'foo' do
|
||||||
folder = on_arch_conditional arm: "darwin-arm64", intel: "darwin"
|
folder = on_arch_conditional arm: "darwin-arm64", intel: "darwin"
|
||||||
platform = on_arch_conditional arm: "darwin-arm64", intel: "darwin"
|
platform = on_arch_conditional arm: "darwin-arm64", intel: "darwin"
|
||||||
|
|||||||
@ -26,7 +26,7 @@ end
|
|||||||
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/concurrent-ruby-1.2.0/lib/concurrent-ruby")
|
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/concurrent-ruby-1.2.0/lib/concurrent-ruby")
|
||||||
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/i18n-1.12.0/lib")
|
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/i18n-1.12.0/lib")
|
||||||
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/minitest-5.17.0/lib")
|
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/minitest-5.17.0/lib")
|
||||||
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/tzinfo-2.0.5/lib")
|
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/tzinfo-2.0.6/lib")
|
||||||
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/zeitwerk-2.6.6/lib")
|
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/zeitwerk-2.6.6/lib")
|
||||||
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/activesupport-6.1.7.2/lib")
|
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/activesupport-6.1.7.2/lib")
|
||||||
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/public_suffix-5.0.1/lib")
|
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/public_suffix-5.0.1/lib")
|
||||||
@ -69,7 +69,7 @@ $:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version
|
|||||||
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/racc-1.6.2/lib")
|
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/racc-1.6.2/lib")
|
||||||
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/nokogiri-1.13.10-x86_64-darwin/lib")
|
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/nokogiri-1.13.10-x86_64-darwin/lib")
|
||||||
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/rubyntlm-0.6.3/lib")
|
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/rubyntlm-0.6.3/lib")
|
||||||
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/webrick-1.7.0/lib")
|
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/webrick-1.8.1/lib")
|
||||||
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/webrobots-0.1.2/lib")
|
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/webrobots-0.1.2/lib")
|
||||||
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/mechanize-2.8.5/lib")
|
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/mechanize-2.8.5/lib")
|
||||||
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/method_source-1.0.0/lib")
|
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/method_source-1.0.0/lib")
|
||||||
@ -119,7 +119,7 @@ $:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version
|
|||||||
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/sorbet-static-and-runtime-0.5.10461/lib")
|
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/sorbet-static-and-runtime-0.5.10461/lib")
|
||||||
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/thor-1.2.1/lib")
|
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/thor-1.2.1/lib")
|
||||||
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/spoom-1.1.11/lib")
|
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/spoom-1.1.11/lib")
|
||||||
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/yard-0.9.28/lib")
|
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/yard-0.9.26/lib")
|
||||||
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/yard-sorbet-0.6.1/lib")
|
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/yard-sorbet-0.6.1/lib")
|
||||||
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/tapioca-0.7.3/lib")
|
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/tapioca-0.7.3/lib")
|
||||||
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/warning-1.3.0/lib")
|
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/warning-1.3.0/lib")
|
||||||
|
|||||||
@ -1,18 +0,0 @@
|
|||||||
# encoding: UTF-8
|
|
||||||
# frozen_string_literal: true
|
|
||||||
|
|
||||||
module TZInfo
|
|
||||||
# Object#untaint is deprecated in Ruby >= 2.7 and will be removed in 3.2.
|
|
||||||
# UntaintExt adds a refinement to make Object#untaint a no-op and avoid the
|
|
||||||
# warning.
|
|
||||||
#
|
|
||||||
# @private
|
|
||||||
module UntaintExt # :nodoc:
|
|
||||||
refine Object do
|
|
||||||
def untaint
|
|
||||||
self
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
private_constant :UntaintExt
|
|
||||||
end
|
|
||||||
@ -17,12 +17,8 @@ module TZInfo
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
# Object#untaint is a deprecated no-op in Ruby >= 2.7 and will be removed in
|
|
||||||
# 3.2. Add a refinement to either silence the warning, or supply the method if
|
require_relative 'tzinfo/ruby_core_support'
|
||||||
# needed.
|
|
||||||
if !Object.new.respond_to?(:untaint) || RUBY_VERSION =~ /\A(\d+)\.(\d+)(?:\.|\z)/ && ($1 == '2' && $2.to_i >= 7 || $1.to_i >= 3)
|
|
||||||
require_relative 'tzinfo/untaint_ext'
|
|
||||||
end
|
|
||||||
|
|
||||||
require_relative 'tzinfo/version'
|
require_relative 'tzinfo/version'
|
||||||
|
|
||||||
@ -4,10 +4,6 @@
|
|||||||
require 'strscan'
|
require 'strscan'
|
||||||
|
|
||||||
module TZInfo
|
module TZInfo
|
||||||
# Use send as a workaround for erroneous 'wrong number of arguments' errors
|
|
||||||
# with JRuby 9.0.5.0 when calling methods with Java implementations. See #114.
|
|
||||||
send(:using, UntaintExt) if TZInfo.const_defined?(:UntaintExt)
|
|
||||||
|
|
||||||
module DataSources
|
module DataSources
|
||||||
# An {InvalidPosixTimeZone} exception is raised if an invalid POSIX-style
|
# An {InvalidPosixTimeZone} exception is raised if an invalid POSIX-style
|
||||||
# time zone string is encountered.
|
# time zone string is encountered.
|
||||||
@ -43,12 +39,12 @@ module TZInfo
|
|||||||
|
|
||||||
s = StringScanner.new(tz_string)
|
s = StringScanner.new(tz_string)
|
||||||
check_scan(s, /([^-+,\d<][^-+,\d]*) | <([^>]+)>/x)
|
check_scan(s, /([^-+,\d<][^-+,\d]*) | <([^>]+)>/x)
|
||||||
std_abbrev = @string_deduper.dedupe((s[1] || s[2]).untaint)
|
std_abbrev = @string_deduper.dedupe(RubyCoreSupport.untaint(s[1] || s[2]))
|
||||||
check_scan(s, /([-+]?\d+)(?::(\d+)(?::(\d+))?)?/)
|
check_scan(s, /([-+]?\d+)(?::(\d+)(?::(\d+))?)?/)
|
||||||
std_offset = get_offset_from_hms(s[1], s[2], s[3])
|
std_offset = get_offset_from_hms(s[1], s[2], s[3])
|
||||||
|
|
||||||
if s.scan(/([^-+,\d<][^-+,\d]*) | <([^>]+)>/x)
|
if s.scan(/([^-+,\d<][^-+,\d]*) | <([^>]+)>/x)
|
||||||
dst_abbrev = @string_deduper.dedupe((s[1] || s[2]).untaint)
|
dst_abbrev = @string_deduper.dedupe(RubyCoreSupport.untaint(s[1] || s[2]))
|
||||||
|
|
||||||
if s.scan(/([-+]?\d+)(?::(\d+)(?::(\d+))?)?/)
|
if s.scan(/([-+]?\d+)(?::(\d+)(?::(\d+))?)?/)
|
||||||
dst_offset = get_offset_from_hms(s[1], s[2], s[3])
|
dst_offset = get_offset_from_hms(s[1], s[2], s[3])
|
||||||
@ -2,10 +2,6 @@
|
|||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
module TZInfo
|
module TZInfo
|
||||||
# Use send as a workaround for erroneous 'wrong number of arguments' errors
|
|
||||||
# with JRuby 9.0.5.0 when calling methods with Java implementations. See #114.
|
|
||||||
send(:using, UntaintExt) if TZInfo.const_defined?(:UntaintExt)
|
|
||||||
|
|
||||||
module DataSources
|
module DataSources
|
||||||
# A {TZInfoDataNotFound} exception is raised if the tzinfo-data gem could
|
# A {TZInfoDataNotFound} exception is raised if the tzinfo-data gem could
|
||||||
# not be found (i.e. `require 'tzinfo/data'` failed) when selecting the Ruby
|
# not be found (i.e. `require 'tzinfo/data'` failed) when selecting the Ruby
|
||||||
@ -52,7 +48,7 @@ module TZInfo
|
|||||||
data_file = File.join('', 'tzinfo', 'data.rb')
|
data_file = File.join('', 'tzinfo', 'data.rb')
|
||||||
path = $".reverse_each.detect {|p| p.end_with?(data_file) }
|
path = $".reverse_each.detect {|p| p.end_with?(data_file) }
|
||||||
if path
|
if path
|
||||||
@base_path = File.join(File.dirname(path), 'data').untaint
|
@base_path = RubyCoreSupport.untaint(File.join(File.dirname(path), 'data'))
|
||||||
else
|
else
|
||||||
@base_path = 'tzinfo/data'
|
@base_path = 'tzinfo/data'
|
||||||
end
|
end
|
||||||
@ -2,10 +2,6 @@
|
|||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
module TZInfo
|
module TZInfo
|
||||||
# Use send as a workaround for erroneous 'wrong number of arguments' errors
|
|
||||||
# with JRuby 9.0.5.0 when calling methods with Java implementations. See #114.
|
|
||||||
send(:using, UntaintExt) if TZInfo.const_defined?(:UntaintExt)
|
|
||||||
|
|
||||||
module DataSources
|
module DataSources
|
||||||
# An {InvalidZoneinfoDirectory} exception is raised if {ZoneinfoDataSource}
|
# An {InvalidZoneinfoDirectory} exception is raised if {ZoneinfoDataSource}
|
||||||
# is initialized with a specific zoneinfo path that is not a valid zoneinfo
|
# is initialized with a specific zoneinfo path that is not a valid zoneinfo
|
||||||
@ -444,7 +440,7 @@ module TZInfo
|
|||||||
end
|
end
|
||||||
|
|
||||||
unless entry =~ /\./ || exclude.include?(entry)
|
unless entry =~ /\./ || exclude.include?(entry)
|
||||||
entry.untaint
|
RubyCoreSupport.untaint(entry)
|
||||||
path = dir + [entry]
|
path = dir + [entry]
|
||||||
full_path = File.join(@zoneinfo_dir, *path)
|
full_path = File.join(@zoneinfo_dir, *path)
|
||||||
|
|
||||||
@ -2,10 +2,6 @@
|
|||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
module TZInfo
|
module TZInfo
|
||||||
# Use send as a workaround for erroneous 'wrong number of arguments' errors
|
|
||||||
# with JRuby 9.0.5.0 when calling methods with Java implementations. See #114.
|
|
||||||
send(:using, UntaintExt) if TZInfo.const_defined?(:UntaintExt)
|
|
||||||
|
|
||||||
module DataSources
|
module DataSources
|
||||||
# An {InvalidZoneinfoFile} exception is raised if an attempt is made to load
|
# An {InvalidZoneinfoFile} exception is raised if an attempt is made to load
|
||||||
# an invalid zoneinfo file.
|
# an invalid zoneinfo file.
|
||||||
@ -448,7 +444,7 @@ module TZInfo
|
|||||||
abbrev_end = abbrev.index("\0", abbrev_start)
|
abbrev_end = abbrev.index("\0", abbrev_start)
|
||||||
raise InvalidZoneinfoFile, "Missing abbreviation null terminator in file '#{file.path}'." unless abbrev_end
|
raise InvalidZoneinfoFile, "Missing abbreviation null terminator in file '#{file.path}'." unless abbrev_end
|
||||||
|
|
||||||
abbr = @string_deduper.dedupe(abbrev[abbrev_start...abbrev_end].force_encoding(Encoding::UTF_8).untaint)
|
abbr = @string_deduper.dedupe(RubyCoreSupport.untaint(abbrev[abbrev_start...abbrev_end].force_encoding(Encoding::UTF_8)))
|
||||||
|
|
||||||
TimezoneOffset.new(base_utc_offset, std_offset, abbr)
|
TimezoneOffset.new(base_utc_offset, std_offset, abbr)
|
||||||
end
|
end
|
||||||
38
Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/tzinfo-2.0.6/lib/tzinfo/ruby_core_support.rb
vendored
Normal file
38
Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/tzinfo-2.0.6/lib/tzinfo/ruby_core_support.rb
vendored
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
module TZInfo
|
||||||
|
|
||||||
|
# Methods to support different versions of Ruby.
|
||||||
|
#
|
||||||
|
# @private
|
||||||
|
module RubyCoreSupport #:nodoc:
|
||||||
|
class << self
|
||||||
|
# Object#untaint is deprecated and becomes a no-op in Ruby >= 2.7. It has
|
||||||
|
# been removed from Ruby 3.2.
|
||||||
|
if !Object.new.respond_to?(:untaint) || RUBY_VERSION =~ /\A(\d+)\.(\d+)(?:\.|\z)/ && ($1 == '2' && $2.to_i >= 7 || $1.to_i >= 3)
|
||||||
|
# :nocov_functional_untaint:
|
||||||
|
|
||||||
|
# Returns the supplied `Object`
|
||||||
|
#
|
||||||
|
# @param o [Object] the `Object` to untaint.
|
||||||
|
# @return [Object] `o`.
|
||||||
|
def untaint(o)
|
||||||
|
o
|
||||||
|
end
|
||||||
|
|
||||||
|
# :nocov_functional_untaint:
|
||||||
|
else
|
||||||
|
# :nocov_no_functional_untaint:
|
||||||
|
|
||||||
|
# Untaints and returns the supplied `Object`.
|
||||||
|
#
|
||||||
|
# @param o [Object] the `Object` to untaint.
|
||||||
|
# @return [Object] `o`.
|
||||||
|
def untaint(o)
|
||||||
|
o.untaint
|
||||||
|
end
|
||||||
|
|
||||||
|
# :nocov_no_functional_untaint:
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
private_constant :RubyCoreSupport
|
||||||
|
end
|
||||||
@ -3,5 +3,5 @@
|
|||||||
|
|
||||||
module TZInfo
|
module TZInfo
|
||||||
# The TZInfo version number.
|
# The TZInfo version number.
|
||||||
VERSION = '2.0.5'
|
VERSION = '2.0.6'
|
||||||
end
|
end
|
||||||
@ -1,4 +1,4 @@
|
|||||||
# frozen_string_literal: false
|
# frozen_string_literal: true
|
||||||
#--
|
#--
|
||||||
# accesslog.rb -- Access log handling utilities
|
# accesslog.rb -- Access log handling utilities
|
||||||
#
|
#
|
||||||
@ -1,4 +1,4 @@
|
|||||||
# frozen_string_literal: false
|
# frozen_string_literal: true
|
||||||
#
|
#
|
||||||
# cgi.rb -- Yet another CGI library
|
# cgi.rb -- Yet another CGI library
|
||||||
#
|
#
|
||||||
@ -1,4 +1,4 @@
|
|||||||
# frozen_string_literal: false
|
# frozen_string_literal: true
|
||||||
#
|
#
|
||||||
# compat.rb -- cross platform compatibility
|
# compat.rb -- cross platform compatibility
|
||||||
#
|
#
|
||||||
@ -1,4 +1,4 @@
|
|||||||
# frozen_string_literal: false
|
# frozen_string_literal: true
|
||||||
#
|
#
|
||||||
# config.rb -- Default configurations.
|
# config.rb -- Default configurations.
|
||||||
#
|
#
|
||||||
@ -1,4 +1,4 @@
|
|||||||
# frozen_string_literal: false
|
# frozen_string_literal: true
|
||||||
#
|
#
|
||||||
# cookie.rb -- Cookie class
|
# cookie.rb -- Cookie class
|
||||||
#
|
#
|
||||||
@ -92,7 +92,7 @@ module WEBrick
|
|||||||
# The cookie string suitable for use in an HTTP header
|
# The cookie string suitable for use in an HTTP header
|
||||||
|
|
||||||
def to_s
|
def to_s
|
||||||
ret = ""
|
ret = +""
|
||||||
ret << @name << "=" << @value
|
ret << @name << "=" << @value
|
||||||
ret << "; " << "Version=" << @version.to_s if @version > 0
|
ret << "; " << "Version=" << @version.to_s if @version > 0
|
||||||
ret << "; " << "Domain=" << @domain if @domain
|
ret << "; " << "Domain=" << @domain if @domain
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user