-
-
Notifications
You must be signed in to change notification settings - Fork 9.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: allow font install on linux #18874
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -266,3 +266,5 @@ def self.app_management_permissions_granted?(app:, command:) | |
end | ||
end | ||
end | ||
|
||
require "extend/os/cask/quarantine" |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# typed: strict | ||
# frozen_string_literal: true | ||
|
||
require "extend/os/mac/cask/artifact/moved" if OS.mac? | ||
require "extend/os/linux/cask/artifact/moved" if OS.linux? | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not something to take on in this PR, but I wonder if we should have a single require file for all of an OS's extensions, rather than introduce three more require files here. 🤔 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think this approach is maybe a bit nicer for now. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sounds good. I also realized that the requires need to come after the generic versions, due to sorbet limitations, so that would be a tricky dance to pull off anyway. |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# typed: strict | ||
# frozen_string_literal: true | ||
|
||
require "extend/os/linux/cask/config" if OS.linux? |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# typed: strict | ||
# frozen_string_literal: true | ||
|
||
require "extend/os/linux/cask/quarantine" if OS.linux? |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# typed: strict | ||
# frozen_string_literal: true | ||
|
||
module OS | ||
module Linux | ||
module Cask | ||
module Artifact | ||
module Moved | ||
extend T::Helpers | ||
|
||
requires_ancestor { ::Cask::Artifact::Moved } | ||
|
||
sig { params(target: Pathname).returns(T::Boolean) } | ||
def undeletable?(target) | ||
!target.parent.writable? | ||
end | ||
end | ||
end | ||
end | ||
end | ||
end | ||
|
||
Cask::Artifact::Moved.prepend(OS::Linux::Cask::Config) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
# typed: strict | ||
# frozen_string_literal: true | ||
|
||
require "os/linux" | ||
|
||
module OS | ||
module Linux | ||
module Cask | ||
module Config | ||
module ClassMethods | ||
DEFAULT_DIRS = T.let({ | ||
vst_plugindir: "~/.vst", | ||
vst3_plugindir: "~/.vst3", | ||
fontdir: "#{ENV.fetch("XDG_DATA_HOME", "~/.local/share")}/fonts", | ||
appdir: "~/.config/apps", | ||
}.freeze, T::Hash[Symbol, String]) | ||
|
||
sig { returns(T::Hash[Symbol, String]) } | ||
def defaults | ||
{ | ||
languages: LazyObject.new { Linux.languages }, | ||
}.merge(DEFAULT_DIRS).freeze | ||
end | ||
end | ||
end | ||
end | ||
end | ||
end | ||
|
||
Cask::Config.singleton_class.prepend(OS::Linux::Cask::Config::ClassMethods) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
# typed: strict | ||
# frozen_string_literal: true | ||
|
||
module OS | ||
module Linux | ||
module Cask | ||
module Quarantine | ||
extend T::Helpers | ||
|
||
requires_ancestor { ::Cask::Quarantine } | ||
|
||
sig { returns(Symbol) } | ||
def self.check_quarantine_support = :linux | ||
|
||
sig { returns(T::Boolean) } | ||
def self.available? = false | ||
end | ||
end | ||
end | ||
end | ||
|
||
Cask::Quarantine.prepend(OS::Linux::Cask::Quarantine) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
# typed: strict | ||
# frozen_string_literal: true | ||
|
||
require "cask/macos" | ||
|
||
module OS | ||
module Mac | ||
module Cask | ||
module Artifact | ||
module Moved | ||
extend T::Helpers | ||
|
||
requires_ancestor { ::Cask::Artifact::Moved } | ||
|
||
sig { params(target: Pathname).returns(T::Boolean) } | ||
def undeletable?(target) | ||
MacOS.undeletable?(target) | ||
end | ||
end | ||
end | ||
end | ||
end | ||
end | ||
|
||
Cask::Artifact::Moved.prepend(OS::Mac::Cask::Artifact::Moved) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
would be good if this or any of the other lines missing test coverage could have some added
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, this was actually part of my attempt to fix the
DEFAULTS
because the whole definition of methods based on hash keys made my head spin.If we want to keep the hash thing, I think that would work now as well. So I can remove these methods again if you prefer.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't mind either way.