Namespace some top-level constants
This commit is contained in:
parent
563c2b1d3a
commit
9e3e1e1847
@ -3,12 +3,12 @@
|
|||||||
|
|
||||||
require "cask/artifact/abstract_uninstall"
|
require "cask/artifact/abstract_uninstall"
|
||||||
|
|
||||||
UPGRADE_REINSTALL_SKIP_DIRECTIVES = [:quit, :signal].freeze
|
|
||||||
|
|
||||||
module Cask
|
module Cask
|
||||||
module Artifact
|
module Artifact
|
||||||
# Artifact corresponding to the `uninstall` stanza.
|
# Artifact corresponding to the `uninstall` stanza.
|
||||||
class Uninstall < AbstractUninstall
|
class Uninstall < AbstractUninstall
|
||||||
|
UPGRADE_REINSTALL_SKIP_DIRECTIVES = [:quit, :signal].freeze
|
||||||
|
|
||||||
def uninstall_phase(upgrade: false, reinstall: false, **options)
|
def uninstall_phase(upgrade: false, reinstall: false, **options)
|
||||||
filtered_directives = ORDERED_DIRECTIVES.filter do |directive_sym|
|
filtered_directives = ORDERED_DIRECTIVES.filter do |directive_sym|
|
||||||
next false if directive_sym == :rmdir
|
next false if directive_sym == :rmdir
|
||||||
|
|||||||
@ -4,11 +4,11 @@
|
|||||||
require "utils/user"
|
require "utils/user"
|
||||||
require "open3"
|
require "open3"
|
||||||
|
|
||||||
BUG_REPORTS_URL = "https://github.com/Homebrew/homebrew-cask#reporting-bugs"
|
|
||||||
|
|
||||||
module Cask
|
module Cask
|
||||||
# Helper functions for various cask operations.
|
# Helper functions for various cask operations.
|
||||||
module Utils
|
module Utils
|
||||||
|
BUG_REPORTS_URL = "https://github.com/Homebrew/homebrew-cask#reporting-bugs"
|
||||||
|
|
||||||
def self.gain_permissions_mkpath(path, command: SystemCommand)
|
def self.gain_permissions_mkpath(path, command: SystemCommand)
|
||||||
dir = path.ascend.find(&:directory?)
|
dir = path.ascend.find(&:directory?)
|
||||||
return if path == dir
|
return if path == dir
|
||||||
|
|||||||
@ -2,6 +2,7 @@
|
|||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
require "utils/curl"
|
require "utils/curl"
|
||||||
|
require "utils/gzip"
|
||||||
require "json"
|
require "json"
|
||||||
require "zlib"
|
require "zlib"
|
||||||
require "extend/hash/keys"
|
require "extend/hash/keys"
|
||||||
@ -26,9 +27,6 @@ class GitHubPackages
|
|||||||
VALID_OCI_TAG_REGEX = /^[a-zA-Z0-9_][a-zA-Z0-9._-]{0,127}$/
|
VALID_OCI_TAG_REGEX = /^[a-zA-Z0-9_][a-zA-Z0-9._-]{0,127}$/
|
||||||
INVALID_OCI_TAG_CHARS_REGEX = /[^a-zA-Z0-9._-]/
|
INVALID_OCI_TAG_CHARS_REGEX = /[^a-zA-Z0-9._-]/
|
||||||
|
|
||||||
GZIP_BUFFER_SIZE = 64 * 1024
|
|
||||||
private_constant :GZIP_BUFFER_SIZE
|
|
||||||
|
|
||||||
# Translate Homebrew tab.arch to OCI platform.architecture
|
# Translate Homebrew tab.arch to OCI platform.architecture
|
||||||
TAB_ARCH_TO_PLATFORM_ARCHITECTURE = {
|
TAB_ARCH_TO_PLATFORM_ARCHITECTURE = {
|
||||||
"arm64" => "arm64",
|
"arm64" => "arm64",
|
||||||
@ -382,7 +380,7 @@ class GitHubPackages
|
|||||||
|
|
||||||
tar_sha256 = Digest::SHA256.new
|
tar_sha256 = Digest::SHA256.new
|
||||||
Zlib::GzipReader.open(local_file) do |gz|
|
Zlib::GzipReader.open(local_file) do |gz|
|
||||||
while (data = gz.read(GZIP_BUFFER_SIZE))
|
while (data = gz.read(Utils::Gzip::GZIP_BUFFER_SIZE))
|
||||||
tar_sha256 << data
|
tar_sha256 << data
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@ -4,9 +4,6 @@
|
|||||||
require "cli/parser"
|
require "cli/parser"
|
||||||
require "erb"
|
require "erb"
|
||||||
|
|
||||||
SOURCE_PATH = (HOMEBREW_LIBRARY_PATH/"manpages").freeze
|
|
||||||
TARGET_MAN_PATH = (HOMEBREW_REPOSITORY/"manpages").freeze
|
|
||||||
TARGET_DOC_PATH = (HOMEBREW_REPOSITORY/"docs").freeze
|
|
||||||
module Homebrew
|
module Homebrew
|
||||||
# Helper functions for generating homebrew manual.
|
# Helper functions for generating homebrew manual.
|
||||||
module Manpages
|
module Manpages
|
||||||
@ -25,6 +22,10 @@ module Homebrew
|
|||||||
keyword_init: true,
|
keyword_init: true,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
SOURCE_PATH = (HOMEBREW_LIBRARY_PATH/"manpages").freeze
|
||||||
|
TARGET_MAN_PATH = (HOMEBREW_REPOSITORY/"manpages").freeze
|
||||||
|
TARGET_DOC_PATH = (HOMEBREW_REPOSITORY/"docs").freeze
|
||||||
|
|
||||||
def self.regenerate_man_pages(quiet:)
|
def self.regenerate_man_pages(quiet:)
|
||||||
require "kramdown"
|
require "kramdown"
|
||||||
require "manpages/parser/ronn"
|
require "manpages/parser/ronn"
|
||||||
|
|||||||
@ -1,13 +1,13 @@
|
|||||||
# typed: strict
|
# typed: strict
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
# Apple's gzip also uses zlib so use the same buffer size here.
|
|
||||||
# https://github.com/apple-oss-distributions/file_cmds/blob/file_cmds-400/gzip/gzip.c#L147
|
|
||||||
GZIP_BUFFER_SIZE = T.let(64 * 1024, Integer)
|
|
||||||
|
|
||||||
module Utils
|
module Utils
|
||||||
# Helper functions for creating gzip files.
|
# Helper functions for creating gzip files.
|
||||||
module Gzip
|
module Gzip
|
||||||
|
# Apple's gzip also uses zlib so use the same buffer size here.
|
||||||
|
# https://github.com/apple-oss-distributions/file_cmds/blob/file_cmds-400/gzip/gzip.c#L147
|
||||||
|
GZIP_BUFFER_SIZE = T.let(64 * 1024, Integer)
|
||||||
|
|
||||||
sig {
|
sig {
|
||||||
params(
|
params(
|
||||||
path: T.any(String, Pathname),
|
path: T.any(String, Pathname),
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user