-
-
Notifications
You must be signed in to change notification settings - Fork 9.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #18874 from Homebrew/feat/cask/font_install
feat: allow font install on linux
- Loading branch information
Showing
16 changed files
with
202 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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? |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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? |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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? |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
# frozen_string_literal: true | ||
|
||
require "locale" | ||
require "os/linux" | ||
|
||
RSpec.describe OS::Linux do | ||
describe "::languages", :needs_linux do | ||
it "returns a list of all languages" do | ||
expect(described_class.languages).not_to be_empty | ||
end | ||
end | ||
|
||
describe "::language", :needs_linux do | ||
it "returns the first item from #languages" do | ||
expect(described_class.language).to eq(described_class.languages.first) | ||
end | ||
end | ||
|
||
describe "::'os_version'", :needs_linux do | ||
it "returns the OS version" do | ||
expect(described_class.os_version).not_to be_empty | ||
end | ||
end | ||
|
||
describe "::'wsl?'" do | ||
it "returns the WSL state" do | ||
expect(described_class.wsl?).to be(false) | ||
end | ||
end | ||
|
||
describe "::'wsl_version'", :needs_linux do | ||
it "returns the WSL version" do | ||
expect(described_class.wsl_version).to match(Version::NULL) | ||
end | ||
end | ||
end |