Skip to content

Commit

Permalink
Merge pull request #2 from ryotarai/brew-cask-cmd
Browse files Browse the repository at this point in the history
brew-cask is no longer available since Homebrew/homebrew-cask#15381.
  • Loading branch information
k0kubun committed Dec 14, 2015
2 parents 84e1c5b + 1f5d470 commit 5330cd2
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions lib/itamae/plugin/resource/cask.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@ module Itamae
module Plugin
module Resource
class Cask < Itamae::Resource::Base
BREW_CASK = 'brew-cask'

define_attribute :action, default: :install
define_attribute :target, type: String, default_name: true
define_attribute :options, type: String, default: "--appdir=/Applications"
Expand All @@ -20,12 +18,12 @@ def set_current_attributes

def action_install(options)
unless current.exist
run_command([BREW_CASK, "install", attributes.target])
run_command(["brew", "cask", "install", attributes.target])
end
end

def action_alfred(options)
run_command([BREW_CASK, "alfred", attributes.target])
run_command(["brew", "cask", "alfred", attributes.target])
end

private
Expand All @@ -36,7 +34,7 @@ def brew_cask_list
end

def ensure_brew_cask_availability
if run_command("which -s #{BREW_CASK}", error: false).exit_status != 0
if run_command("test -d $(brew --prefix)/Library/Taps/caskroom/homebrew-cask", error: false).exit_status != 0
raise "`brew cask` command is not available. Please install brew cask."
end
end
Expand Down

0 comments on commit 5330cd2

Please sign in to comment.