itamae-plugin-resource-cask 0.0.2 → 0.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +6 -0
- data/itamae-plugin-resource-cask.gemspec +1 -1
- data/lib/itamae/plugin/resource/cask.rb +9 -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: 0409d495c508979ab7501dfdb89b47c438f3c6a0
|
4
|
+
data.tar.gz: 480464d936a3ca59fa951c32526380c5e60e7708
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7e66f83a139b323078f86c7758bf5c10d4d1b3ddde4fef86a66020000575b72ec84052ac72550ad765089d57258adc5fc198ee13f57fb0ca4b2d321c77a099fd
|
7
|
+
data.tar.gz: 937a19292643e41d23de4c4b8203b7b1bfeb00d5d5c57b685aaea2a0f1646aaeedd7bfc234ac8c041ec1a61ba715ef9885dd091cc441096c5fb25af93f1b106e
|
data/README.md
CHANGED
@@ -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.0.
|
7
|
+
spec.version = "0.0.3"
|
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,23 +4,27 @@ module Itamae
|
|
4
4
|
module Plugin
|
5
5
|
module Resource
|
6
6
|
class Cask < Itamae::Resource::Base
|
7
|
-
define_attribute :action, default: :
|
8
|
-
define_attribute :
|
7
|
+
define_attribute :action, default: :install
|
8
|
+
define_attribute :target, type: String, default_name: true
|
9
9
|
|
10
10
|
def set_current_attributes
|
11
11
|
super
|
12
12
|
ensure_brew_cask_availability
|
13
13
|
|
14
|
-
result = run_command("brew cask list | grep '#{attributes.
|
14
|
+
result = run_command("brew cask list | grep '#{attributes.target}$'", error: false)
|
15
15
|
current.exist = result.exit_status == 0
|
16
16
|
end
|
17
17
|
|
18
|
-
def
|
18
|
+
def action_install(options)
|
19
19
|
unless current.exist
|
20
|
-
run_command(["brew", "cask", "install", attributes.
|
20
|
+
run_command(["brew", "cask", "install", attributes.target])
|
21
21
|
end
|
22
22
|
end
|
23
23
|
|
24
|
+
def action_alfred(options)
|
25
|
+
run_command(["brew", "cask", "alfred", attributes.target])
|
26
|
+
end
|
27
|
+
|
24
28
|
private
|
25
29
|
|
26
30
|
def ensure_brew_cask_availability
|