itamae-plugin-resource-cask 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/itamae-plugin-resource-cask.gemspec +1 -1
- data/lib/itamae/plugin/resource/cask.rb +5 -5
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 001dd5d35bd9cd923aa7de96be736c96775531a7
|
4
|
+
data.tar.gz: a64b4e37838a19c975571e435236033cac68bfd6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a85ea6ab04eca5b15fef4c17a2ded3e89fa55b5f320167a63462c23484a3560452ce6858db1e0c59af1a9b19eb49b6a3f20b008addbaaeb2b4772788636cb844
|
7
|
+
data.tar.gz: dc88b59c1d56d9a34fd005702388b281eec3d0f377bd1cc92bd7af52a4b66aa448303aae842e34d98abb4d4940eec02befa7fdd0139061dc8614ff27ee96e655
|
@@ -4,7 +4,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
4
4
|
|
5
5
|
Gem::Specification.new do |spec|
|
6
6
|
spec.name = "itamae-plugin-resource-cask"
|
7
|
-
spec.version = "0.1.
|
7
|
+
spec.version = "0.1.1"
|
8
8
|
spec.authors = ["Takashi Kokubun"]
|
9
9
|
spec.email = ["takashikkbn@gmail.com"]
|
10
10
|
spec.summary = %q{Itamae resource plugin to manage homebrew cask packages.}
|
@@ -4,7 +4,7 @@ module Itamae
|
|
4
4
|
module Plugin
|
5
5
|
module Resource
|
6
6
|
class Cask < Itamae::Resource::Base
|
7
|
-
|
7
|
+
BREW_CASK = '/usr/local/bin/brew-cask'
|
8
8
|
|
9
9
|
define_attribute :action, default: :install
|
10
10
|
define_attribute :target, type: String, default_name: true
|
@@ -14,24 +14,24 @@ module Itamae
|
|
14
14
|
super
|
15
15
|
ensure_brew_cask_availability
|
16
16
|
|
17
|
-
result = run_command("#{
|
17
|
+
result = run_command("#{BREW_CASK} list | grep '#{attributes.target}$'", error: false)
|
18
18
|
current.exist = result.exit_status == 0
|
19
19
|
end
|
20
20
|
|
21
21
|
def action_install(options)
|
22
22
|
unless current.exist
|
23
|
-
run_command([
|
23
|
+
run_command([BREW_CASK, "install", attributes.target])
|
24
24
|
end
|
25
25
|
end
|
26
26
|
|
27
27
|
def action_alfred(options)
|
28
|
-
run_command([
|
28
|
+
run_command([BREW_CASK, "alfred", attributes.target])
|
29
29
|
end
|
30
30
|
|
31
31
|
private
|
32
32
|
|
33
33
|
def ensure_brew_cask_availability
|
34
|
-
if run_command("#{
|
34
|
+
if run_command("#{BREW_CASK} > /dev/null", error: false).exit_status != 0
|
35
35
|
raise "`brew cask` command is not available. Please install brew cask."
|
36
36
|
end
|
37
37
|
end
|