Add support for screensaver artifact

This commit is contained in:
Jonathan Dahan 2014-01-28 10:17:50 -05:00
parent a45c118807
commit ca61dfdd81
9 changed files with 25 additions and 1 deletions

View File

@ -97,6 +97,7 @@ Additional fields you might need for special use-cases:
| `service` | relative path to a service that should be linked into the `~/Library/Services` folder on installation
| `binary` | relative path to a binary that should be linked into the `~/usr/local/bin` folder on installation
| `input_method` | relative path to a input method that should be linked into the `~/Library/Input Methods` folder on installation
| `screensaver` | relative path to a screensaver that should be linked into the `~/Library/Screen Savers` folder on installation
| `nested_container` | relative path to an inner container that must be extracted before moving on with the installation; this allows us to support dmg inside tar, zip inside dmg, etc.
| `depends_on_formula` | a list of Homebrew Formulae upon which this Cask depends
| `caveats` | a string or Ruby block providing the user with Cask-specific information at install time (see __Caveats Details__ for more information)

1
FAQ.md
View File

@ -17,6 +17,7 @@ Casks currently have five required fields:
* __qlplugin__: (required for `.qlgenerator`) indicates which file(s) should be linked into the QuickLook folder on installation
* __font__ : (required for fonts) indicates which file(s) should be linked into the Fonts folder on installation
* __input_method__: (required for input method) indicates which file(s) should be linked into the Input Methods folder on installation
* __screensaver__: (required for `.saver`) indicates which file(s) should be linked into the Screen Saver folder on installation
and six optional fields:

View File

@ -169,6 +169,9 @@ Default is `~/Library/Fonts`
Default is `/usr/local/bin`
* `--input_methoddir=/my/path` changes the path for Input Methods symlinks.
Default is `~/Library/Input Methods`
* `--screensaverdir=/my/path` changes the path for Screen Saver symlinks.
Default is `~/Library/Screen Savers`
To make these settings persistent, you might want to add the following line to your `.bash_profile` or `.zshenv`:

View File

@ -54,6 +54,7 @@ class Cask
end
appdir.mkpath unless appdir.exist?
qlplugindir.mkpath unless qlplugindir.exist?
screen_saverdir.mkpath unless screen_saverdir.exist?
end
def self.load(query)

View File

@ -17,6 +17,7 @@ require 'cask/artifact/widget'
require 'cask/artifact/service'
require 'cask/artifact/caskroom_only'
require 'cask/artifact/input_method'
require 'cask/artifact/screensaver'
module Cask::Artifact
@ -39,6 +40,7 @@ module Cask::Artifact
Cask::Artifact::Block,
Cask::Artifact::Binary,
Cask::Artifact::InputMethod,
Cask::Artifact::ScreenSaver,
]
end

View File

@ -0,0 +1,3 @@
class Cask::Artifact::ScreenSaver < Cask::Artifact::Symlinked
end

View File

@ -108,6 +108,10 @@ class Cask::CLI
opts.on("--input_methoddir=MANDATORY") do |v|
Cask.input_methoddir = Pathname(v).expand_path
end
opts.on("--screen_saverdir=MANDATORY") do |v|
Cask.screen_saverdir = Pathname(v).expand_path
end
opts.on("--no-binaries") do |v|
Cask.no_binaries = true
end

View File

@ -65,7 +65,8 @@ module Cask::DSL
:colorpicker,
:binary,
:caskroom_only,
:input_method
:input_method,
:screen_saver
]
ARTIFACT_TYPES.each do |type|

View File

@ -88,6 +88,14 @@ module Cask::Locations
@input_methoddir = _input_methoddir
end
def screen_saverdir
@screen_saverdir ||= Pathname.new('~/Library/Screen Savers').expand_path
end
def screen_saverdir=(_screen_saverdir)
@screen_saverdir = _screen_saverdir
end
def default_tap
@default_tap ||= 'phinze-cask'
end