Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Library/Homebrew/cask/artifact.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
# frozen_string_literal: true

require "cask/artifact/app"
require "cask/artifact/appimage"
require "cask/artifact/artifact" # generic 'artifact' stanza
require "cask/artifact/audio_unit_plugin"
require "cask/artifact/binary"
Expand Down
15 changes: 15 additions & 0 deletions Library/Homebrew/cask/artifact/appimage.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# typed: strict
# frozen_string_literal: true

require "cask/artifact/symlinked"

module Cask
module Artifact
class AppImage < Symlinked
sig { params(target: T.any(String, Pathname)).returns(Pathname) }
def resolve_target(target)
config.appimagedir/target
end
end
end
end
2 changes: 2 additions & 0 deletions Library/Homebrew/cask/config.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ class Config
DEFAULT_DIRS = T.let(
{
appdir: "/Applications",
appimagedir: "~/Applications",
keyboard_layoutdir: "/Library/Keyboard Layouts",
colorpickerdir: "~/Library/ColorPickers",
prefpanedir: "~/Library/PreferencePanes",
Expand Down Expand Up @@ -47,6 +48,7 @@ def self.from_args(args)
args = T.unsafe(args)
new(explicit: {
appdir: args.appdir,
appimagedir: args.appimagedir,
keyboard_layoutdir: args.keyboard_layoutdir,
colorpickerdir: args.colorpickerdir,
prefpanedir: args.prefpanedir,
Expand Down
1 change: 1 addition & 0 deletions Library/Homebrew/cask/dsl.rb
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ class DSL
ORDINARY_ARTIFACT_CLASSES = [
Artifact::Installer,
Artifact::App,
Artifact::AppImage,
Artifact::Artifact,
Artifact::AudioUnitPlugin,
Artifact::Binary,
Expand Down
4 changes: 4 additions & 0 deletions Library/Homebrew/cli/parser.rb
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,10 @@ def self.global_cask_options
description: "Target location for Applications " \
"(default: `#{Cask::Config::DEFAULT_DIRS[:appdir]}`).",
}],
[:flag, "--appimagedir=", {
description: "Target location for AppImages " \
"(default: `#{Cask::Config::DEFAULT_DIRS[:appimagedir]}`).",
}],
[:flag, "--keyboard-layoutdir=", {
description: "Target location for Keyboard Layouts " \
"(default: `#{Cask::Config::DEFAULT_DIRS[:keyboard_layoutdir]}`).",
Expand Down
1 change: 1 addition & 0 deletions Library/Homebrew/extend/os/cask/installer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@
# frozen_string_literal: true

require "extend/os/linux/cask/installer" if OS.linux?
require "extend/os/mac/cask/installer" if OS.mac?
29 changes: 29 additions & 0 deletions Library/Homebrew/extend/os/mac/cask/installer.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# typed: strict
# frozen_string_literal: true

module OS
module Mac
module Cask
module Installer
extend T::Helpers

requires_ancestor { ::Cask::Installer }

MAC_INVALID_ARTIFACTS = [
::Cask::Artifact::AppImage,
].freeze

sig { void }
def check_stanza_os_requirements
return unless artifacts.any? do |artifact|
MAC_INVALID_ARTIFACTS.include?(artifact.class)
end

raise ::Cask::CaskError, "Linux is required for this software."
end
end
end
end
end

Cask::Installer.prepend(OS::Mac::Cask::Installer)
Loading