itamae-plugin-resource-cask 0.2.2 → 0.2.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 +5 -5
- data/CHANGELOG.md +30 -0
- data/README.md +1 -1
- data/itamae-plugin-resource-cask.gemspec +1 -1
- data/lib/itamae/plugin/resource/cask.rb +1 -8
- data/mrblib/itamae/plugin/resource/cask.rb +13 -0
- data/mrblib/itamae/plugin/resource_executor/cask.rb +42 -0
- metadata +6 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: ed564cf5af93a48f55aee856344f7d1a8b42b6347fd56aca8ced2d3879a02999
|
4
|
+
data.tar.gz: c2d120cdcc317558b6d2d39686a3753b9fe93a07c70d53dee6fd632d540ef9de
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e7ad81760910d31d03f7a9b9acac26abcef47c9e515900108996b79497ca5ccfbd15ba2a077708e9bc1b243554a0fc48691af290763c8f2a65784b790441232f
|
7
|
+
data.tar.gz: f172f3ad4c62b52091e219634d7d161cc2582713b462f197e198312c234e4561aadaa4ca67f38c55e5032533f6b1dc7321754e47420aa7187c6612e4a44e9d98
|
data/CHANGELOG.md
ADDED
@@ -0,0 +1,30 @@
|
|
1
|
+
# Change Log
|
2
|
+
|
3
|
+
## [v0.2.2](https://github.com/k0kubun/itamae-plugin-resource-cask/tree/v0.2.2) (2015-12-14)
|
4
|
+
[Full Changelog](https://github.com/k0kubun/itamae-plugin-resource-cask/compare/v0.2.1...v0.2.2)
|
5
|
+
|
6
|
+
**Merged pull requests:**
|
7
|
+
|
8
|
+
- Pass options attributes to install and alfred sub-commands. [\#3](https://github.com/k0kubun/itamae-plugin-resource-cask/pull/3) ([ryotarai](https://github.com/ryotarai))
|
9
|
+
|
10
|
+
## [v0.2.1](https://github.com/k0kubun/itamae-plugin-resource-cask/tree/v0.2.1) (2015-12-14)
|
11
|
+
[Full Changelog](https://github.com/k0kubun/itamae-plugin-resource-cask/compare/v0.2.0...v0.2.1)
|
12
|
+
|
13
|
+
**Merged pull requests:**
|
14
|
+
|
15
|
+
- brew-cask is no longer available since caskroom/homebrew-cask\#15381. [\#2](https://github.com/k0kubun/itamae-plugin-resource-cask/pull/2) ([ryotarai](https://github.com/ryotarai))
|
16
|
+
|
17
|
+
## [v0.2.0](https://github.com/k0kubun/itamae-plugin-resource-cask/tree/v0.2.0) (2015-12-06)
|
18
|
+
[Full Changelog](https://github.com/k0kubun/itamae-plugin-resource-cask/compare/v0.1.1...v0.2.0)
|
19
|
+
|
20
|
+
**Merged pull requests:**
|
21
|
+
|
22
|
+
- Support custom brew prefix [\#1](https://github.com/k0kubun/itamae-plugin-resource-cask/pull/1) ([k0kubun](https://github.com/k0kubun))
|
23
|
+
|
24
|
+
## [v0.1.1](https://github.com/k0kubun/itamae-plugin-resource-cask/tree/v0.1.1) (2015-09-25)
|
25
|
+
[Full Changelog](https://github.com/k0kubun/itamae-plugin-resource-cask/compare/v0.1.0...v0.1.1)
|
26
|
+
|
27
|
+
## [v0.1.0](https://github.com/k0kubun/itamae-plugin-resource-cask/tree/v0.1.0) (2015-09-25)
|
28
|
+
|
29
|
+
|
30
|
+
\* *This Change Log was automatically generated by [github_changelog_generator](https://github.com/skywinder/Github-Changelog-Generator)*
|
data/README.md
CHANGED
@@ -34,7 +34,7 @@ end
|
|
34
34
|
|
35
35
|
## Contributing
|
36
36
|
|
37
|
-
1. Fork it ( https://github.com/
|
37
|
+
1. Fork it ( https://github.com/k0kubun/itamae-plugin-resource-cask/fork )
|
38
38
|
2. Create your feature branch (`git checkout -b my-new-feature`)
|
39
39
|
3. Commit your changes (`git commit -am 'Add some feature'`)
|
40
40
|
4. Push to the branch (`git push origin my-new-feature`)
|
@@ -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.2.
|
7
|
+
spec.version = "0.2.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.}
|
@@ -10,7 +10,6 @@ module Itamae
|
|
10
10
|
|
11
11
|
def set_current_attributes
|
12
12
|
super
|
13
|
-
ensure_brew_cask_availability
|
14
13
|
|
15
14
|
result = run_command("#{brew_cask_list} | grep '#{attributes.target}$'", error: false)
|
16
15
|
current.exist = result.exit_status == 0
|
@@ -30,13 +29,7 @@ module Itamae
|
|
30
29
|
|
31
30
|
# Optimized `brew cask list`
|
32
31
|
def brew_cask_list
|
33
|
-
"ls -1 /
|
34
|
-
end
|
35
|
-
|
36
|
-
def ensure_brew_cask_availability
|
37
|
-
if run_command("test -d $(brew --prefix)/Library/Taps/caskroom/homebrew-cask", error: false).exit_status != 0
|
38
|
-
raise "`brew cask` command is not available. Please install brew cask."
|
39
|
-
end
|
32
|
+
"ls -1 $(brew --prefix)/Caskroom"
|
40
33
|
end
|
41
34
|
end
|
42
35
|
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
module ::MItamae
|
2
|
+
module Plugin
|
3
|
+
module Resource
|
4
|
+
class Cask < ::MItamae::Resource::Base
|
5
|
+
define_attribute :action, default: :install
|
6
|
+
define_attribute :target, type: String, default_name: true
|
7
|
+
define_attribute :options, type: [String, Array], default: "--appdir=/Applications"
|
8
|
+
|
9
|
+
self.available_actions = [:install, :alfred]
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
@@ -0,0 +1,42 @@
|
|
1
|
+
module ::MItamae
|
2
|
+
module Plugin
|
3
|
+
module ResourceExecutor
|
4
|
+
class Cask < ::MItamae::ResourceExecutor::Base
|
5
|
+
def apply
|
6
|
+
|
7
|
+
if !current.exist && desired.exist
|
8
|
+
run_command(["brew", "cask", "install", *Array(desired.options), desired.target])
|
9
|
+
end
|
10
|
+
|
11
|
+
if desired.alfred_linked
|
12
|
+
run_command(["brew", "cask", "alfred", *Array(desired.options), desired.target])
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
private
|
17
|
+
|
18
|
+
def set_current_attributes(current, action)
|
19
|
+
case action
|
20
|
+
when :install
|
21
|
+
result = run_command("#{brew_cask_list} | grep '#{attributes.target}$'", error: false)
|
22
|
+
current.exist = (result.exit_status == 0)
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
def set_desired_attributes(desired, action)
|
27
|
+
case action
|
28
|
+
when :install
|
29
|
+
desired.exist = true
|
30
|
+
when :alfred
|
31
|
+
desired.alfred_linked = true
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
# Optimized `brew cask list`
|
36
|
+
def brew_cask_list
|
37
|
+
"ls -1 $(brew --prefix)/Caskroom"
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: itamae-plugin-resource-cask
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Takashi Kokubun
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2018-06-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -60,12 +60,15 @@ extensions: []
|
|
60
60
|
extra_rdoc_files: []
|
61
61
|
files:
|
62
62
|
- ".gitignore"
|
63
|
+
- CHANGELOG.md
|
63
64
|
- Gemfile
|
64
65
|
- LICENSE.txt
|
65
66
|
- README.md
|
66
67
|
- Rakefile
|
67
68
|
- itamae-plugin-resource-cask.gemspec
|
68
69
|
- lib/itamae/plugin/resource/cask.rb
|
70
|
+
- mrblib/itamae/plugin/resource/cask.rb
|
71
|
+
- mrblib/itamae/plugin/resource_executor/cask.rb
|
69
72
|
homepage: https://github.com/k0kubun/itamae-plugin-resource-cask
|
70
73
|
licenses:
|
71
74
|
- MIT
|
@@ -86,9 +89,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
86
89
|
version: '0'
|
87
90
|
requirements: []
|
88
91
|
rubyforge_project:
|
89
|
-
rubygems_version: 2.
|
92
|
+
rubygems_version: 2.7.6
|
90
93
|
signing_key:
|
91
94
|
specification_version: 4
|
92
95
|
summary: Itamae resource plugin to manage homebrew cask packages.
|
93
96
|
test_files: []
|
94
|
-
has_rdoc:
|