mirror of
https://github.com/Homebrew/brew.git
synced 2026-08-12 22:29:27 +04:00
Merge pull request #23447 from AlternateRT/fix-appimage-cask-dsl
Fix AppImage's stanza name in cask DSL
This commit is contained in:
@@ -5,6 +5,7 @@ require "cask/artifact/symlinked"
|
||||
|
||||
module Cask
|
||||
module Artifact
|
||||
# Artifact corresponding to the `app_image` stanza.
|
||||
class AppImage < Symlinked
|
||||
sig { override.params(target: T.any(String, Pathname), base_dir: T.nilable(Pathname)).returns(Pathname) }
|
||||
def resolve_target(target, base_dir: nil)
|
||||
|
||||
@@ -6,6 +6,7 @@ require "install_steps"
|
||||
|
||||
module Cask
|
||||
module Artifact
|
||||
# Abstract superclass for install steps artifacts.
|
||||
class AbstractInstallSteps < AbstractArtifact
|
||||
abstract!
|
||||
|
||||
@@ -34,6 +35,7 @@ module Cask
|
||||
end
|
||||
end
|
||||
|
||||
# Artifact corresponding to the `preflight_steps` stanza.
|
||||
class PreflightSteps < AbstractInstallSteps
|
||||
sig { params(command: T.class_of(SystemCommand), _options: T.anything).void }
|
||||
def install_phase(command: SystemCommand, **_options)
|
||||
@@ -46,6 +48,7 @@ module Cask
|
||||
end
|
||||
end
|
||||
|
||||
# Artifact corresponding to the `postflight_steps` stanza.
|
||||
class PostflightSteps < AbstractInstallSteps
|
||||
sig { params(command: T.class_of(SystemCommand), _options: T.anything).void }
|
||||
def install_phase(command: SystemCommand, **_options)
|
||||
@@ -58,6 +61,7 @@ module Cask
|
||||
end
|
||||
end
|
||||
|
||||
# Artifact corresponding to the `uninstall_preflight_steps` stanza.
|
||||
class UninstallPreflightSteps < AbstractInstallSteps
|
||||
sig { params(command: T.class_of(SystemCommand), _options: T.anything).void }
|
||||
def uninstall_phase(command: SystemCommand, **_options)
|
||||
@@ -65,6 +69,7 @@ module Cask
|
||||
end
|
||||
end
|
||||
|
||||
# Artifact corresponding to the `uninstall_postflight_steps` stanza.
|
||||
class UninstallPostflightSteps < AbstractInstallSteps
|
||||
sig { params(command: T.class_of(SystemCommand), _options: T.anything).void }
|
||||
def uninstall_phase(command: SystemCommand, **_options)
|
||||
|
||||
@@ -5,6 +5,7 @@ require "cask/artifact/symlinked"
|
||||
|
||||
module Cask
|
||||
module Artifact
|
||||
# Superclass for all artifacts that are installed as shell completions.
|
||||
class ShellCompletion < Symlinked
|
||||
sig { override.overridable.params(_: T.any(String, Pathname), base_dir: T.nilable(Pathname)).returns(Pathname) }
|
||||
def resolve_target(_, base_dir: nil)
|
||||
|
||||
@@ -42,7 +42,7 @@ module RuboCop
|
||||
[
|
||||
:suite,
|
||||
:app,
|
||||
:appimage,
|
||||
:app_image,
|
||||
:pkg,
|
||||
:generated_script,
|
||||
:installer,
|
||||
|
||||
@@ -16,7 +16,7 @@ RSpec.describe RuboCop::Cop::Cask::StanzaOrder, :config do
|
||||
:on_macos,
|
||||
:on_linux,
|
||||
:on_system_conditional,
|
||||
:appimage,
|
||||
:app_image,
|
||||
:generated_script,
|
||||
:command_wrapper,
|
||||
:generate_completions_from_executable,
|
||||
@@ -86,11 +86,11 @@ RSpec.describe RuboCop::Cop::Cask::StanzaOrder, :config do
|
||||
CASK
|
||||
end
|
||||
|
||||
it "orders `appimage` after `app`" do
|
||||
it "orders `app_image` after `app`" do
|
||||
expect_offense <<~CASK
|
||||
cask 'foo' do
|
||||
appimage 'Foo.AppImage'
|
||||
^^^^^^^^^^^^^^^^^^^^^^^ `appimage` stanza out of order
|
||||
app_image 'Foo.AppImage'
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^ `app_image` stanza out of order
|
||||
app 'Foo.app'
|
||||
^^^^^^^^^^^^^ `app` stanza out of order
|
||||
end
|
||||
@@ -99,7 +99,7 @@ RSpec.describe RuboCop::Cop::Cask::StanzaOrder, :config do
|
||||
expect_correction <<~CASK
|
||||
cask 'foo' do
|
||||
app 'Foo.app'
|
||||
appimage 'Foo.AppImage'
|
||||
app_image 'Foo.AppImage'
|
||||
end
|
||||
CASK
|
||||
end
|
||||
|
||||
@@ -74,7 +74,7 @@ Having a common order for stanzas makes casks easier to update and parse. Below
|
||||
|
||||
suite
|
||||
app
|
||||
appimage
|
||||
app_image
|
||||
pkg
|
||||
generated_script
|
||||
installer
|
||||
@@ -145,13 +145,13 @@ This skips automated homepage availability audits for one year. Do not use a fut
|
||||
|
||||
Each cask must declare one or more [artifacts](/rubydoc/Cask/Artifact.html) (i.e. something to install).
|
||||
Not every artifact type is supported on every operating system and a cask does not need to support both macOS and Linux.
|
||||
The `appimage` stanza is Linux-only, macOS integration stanzas such as `app` and `pkg` are macOS-only and portable stanzas such as `binary` can be used on either operating system.
|
||||
The `app_image` stanza is Linux-only, macOS integration stanzas such as `app` and `pkg` are macOS-only and portable stanzas such as `binary` can be used on either operating system.
|
||||
|
||||
| name | multiple occurrences allowed? | value |
|
||||
| -------------------------------------------------------------------------------------- | :---------------------------: | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| [`suite`](#stanza-suite) | yes | Relative path to a containing directory that should be moved into the `/Applications` folder on installation. |
|
||||
| [`app`](#stanza-app) | yes | Relative path to an `.app` that should be moved into the `/Applications` folder on installation. |
|
||||
| `appimage` | yes | Relative path to an AppImage that should be linked into the configured AppImage directory on installation. |
|
||||
| `app_image` | yes | Relative path to an AppImage that should be linked into the configured AppImage directory on installation. |
|
||||
| [`pkg`](#stanza-pkg) | yes | Relative path to a `.pkg` file containing the distribution. |
|
||||
| [`generated_script`](#stanza-generated_script) | yes | Generates a script for another artifact or install step to use. |
|
||||
| [`installer`](#stanza-installer) | yes | Describes an executable which must be run to complete the installation. |
|
||||
|
||||
Reference in New Issue
Block a user