From ca61dfdd812f0ca24b6b5ed80fea846c88894568 Mon Sep 17 00:00:00 2001 From: Jonathan Dahan Date: Tue, 28 Jan 2014 10:17:50 -0500 Subject: [PATCH] Add support for screensaver artifact --- CONTRIBUTING.md | 1 + FAQ.md | 1 + USAGE.md | 3 +++ lib/cask.rb | 1 + lib/cask/artifact.rb | 2 ++ lib/cask/artifact/screensaver.rb | 3 +++ lib/cask/cli.rb | 4 ++++ lib/cask/dsl.rb | 3 ++- lib/cask/locations.rb | 8 ++++++++ 9 files changed, 25 insertions(+), 1 deletion(-) create mode 100644 lib/cask/artifact/screensaver.rb diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 944f036235..f3ec824d56 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -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) diff --git a/FAQ.md b/FAQ.md index 4617163fd6..6945d3476f 100644 --- a/FAQ.md +++ b/FAQ.md @@ -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: diff --git a/USAGE.md b/USAGE.md index ca9d839ede..e0ba4846fd 100644 --- a/USAGE.md +++ b/USAGE.md @@ -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`: diff --git a/lib/cask.rb b/lib/cask.rb index e755f8a954..6ff819a405 100644 --- a/lib/cask.rb +++ b/lib/cask.rb @@ -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) diff --git a/lib/cask/artifact.rb b/lib/cask/artifact.rb index 89e27fdb35..d5aad2b83c 100644 --- a/lib/cask/artifact.rb +++ b/lib/cask/artifact.rb @@ -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 diff --git a/lib/cask/artifact/screensaver.rb b/lib/cask/artifact/screensaver.rb new file mode 100644 index 0000000000..7c1a0784d8 --- /dev/null +++ b/lib/cask/artifact/screensaver.rb @@ -0,0 +1,3 @@ +class Cask::Artifact::ScreenSaver < Cask::Artifact::Symlinked + +end \ No newline at end of file diff --git a/lib/cask/cli.rb b/lib/cask/cli.rb index 65885ec7da..db488f0935 100644 --- a/lib/cask/cli.rb +++ b/lib/cask/cli.rb @@ -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 diff --git a/lib/cask/dsl.rb b/lib/cask/dsl.rb index 62f2afc61e..14d6d63b81 100644 --- a/lib/cask/dsl.rb +++ b/lib/cask/dsl.rb @@ -65,7 +65,8 @@ module Cask::DSL :colorpicker, :binary, :caskroom_only, - :input_method + :input_method, + :screen_saver ] ARTIFACT_TYPES.each do |type| diff --git a/lib/cask/locations.rb b/lib/cask/locations.rb index 11d86a915c..ea29af3ddc 100644 --- a/lib/cask/locations.rb +++ b/lib/cask/locations.rb @@ -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